Land for jackc@codeaurora.com:
Land for jackc@codeaurora.com:

This is a fix for when multiple ethernet services exist (etho0, dummy0, etc). 
The code loops through all available services, and if it is of TYPE_ETHERNET, 
will assign it as the default service to use. If there are multiple 
services of TYPE_ETHERNET, later services in the array will overwrite 
earlier ones. If the last service is something without a real 
connection (such as dummy0), you will not be able to access the internet. 
Also, earlier services are never deleted and will be leaked. 

This change will stop reassigning services once a service is created 
and has a working connection. It will also delete previous connections 
to fix the memory leak. 

This fix was originally implemented http://codereview.chromium.org/3027015/ 
but was removed in http://codereview.chromium.org/4169001/ 

BUG=chromium-os:9766
TEST=Manual. Check to make sure connecting/disconnecting ethernet works as normal.
Review URL: http://codereview.chromium.org/5289007

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@67779 0039d316-1c4b-4281-b951-d872f2087c98

ChromiumWebApps/chromium,patrickm/chromium.src,keishi/chromium,ondra-novak/chromium.src,PeterWangIntel/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,hgl888/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,dednal/chromium.src,robclark/chromium,keishi/chromium,krieger-od/nwjs_chromium.src,junmin-zhu/chromium-rivertrail,dednal/chromium.src,patrickm/chromium.src,PeterWangIntel/chromium-crosswalk,jaruba/chromium.src,hgl888/chromium-crosswalk,chuan9/chromium-crosswalk,littlstar/chromium.src,Chilledheart/chromium,junmin-zhu/chromium-rivertrail,axinging/chromium-crosswalk,timopulkkinen/BubbleFish,pozdnyakov/chromium-crosswalk,hujiajie/pa-chromium,ChromiumWebApps/chromium,ondra-novak/chromium.src,nacl-webkit/chrome_deps,Pluto-tv/chromium-crosswalk,dednal/chromium.src,bright-sparks/chromium-spacewalk,keishi/chromium,anirudhSK/chromium,axinging/chromium-crosswalk,ltilve/chromium,Jonekee/chromium.src,Pluto-tv/chromium-crosswalk,hgl888/chromium-crosswalk-efl,ltilve/chromium,dednal/chromium.src,timopulkkinen/BubbleFish,axinging/chromium-crosswalk,littlstar/chromium.src,markYoungH/chromium.src,ltilve/chromium,Jonekee/chromium.src,littlstar/chromium.src,ChromiumWebApps/chromium,hgl888/chromium-crosswalk,junmin-zhu/chromium-rivertrail,anirudhSK/chromium,crosswalk-project/chromium-crosswalk-efl,Chilledheart/chromium,timopulkkinen/BubbleFish,zcbenz/cefode-chromium,markYoungH/chromium.src,fujunwei/chromium-crosswalk,hgl888/chromium-crosswalk-efl,dushu1203/chromium.src,axinging/chromium-crosswalk,patrickm/chromium.src,bright-sparks/chromium-spacewalk,pozdnyakov/chromium-crosswalk,pozdnyakov/chromium-crosswalk,markYoungH/chromium.src,Fireblend/chromium-crosswalk,timopulkkinen/BubbleFish,chuan9/chromium-crosswalk,nacl-webkit/chrome_deps,crosswalk-project/chromium-crosswalk-efl,ChromiumWebApps/chromium,zcbenz/cefode-chromium,hujiajie/pa-chromium,TheTypoMaster/chromium-crosswalk,Just-D/chromium-1,dednal/chromium.src,ltilve/chromium,hujiajie/pa-chromium,M4sse/chromium.src,Fireblend/chromium-crosswalk,dednal/chromium.src,Just-D/chromium-1,hgl888/chromium-crosswalk-efl,fujunwei/chromium-crosswalk,M4sse/chromium.src,dushu1203/chromium.src,hujiajie/pa-chromium,Jonekee/chromium.src,Chilledheart/chromium,pozdnyakov/chromium-crosswalk,dushu1203/chromium.src,dushu1203/chromium.src,Just-D/chromium-1,keishi/chromium,pozdnyakov/chromium-crosswalk,krieger-od/nwjs_chromium.src,PeterWangIntel/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,krieger-od/nwjs_chromium.src,pozdnyakov/chromium-crosswalk,patrickm/chromium.src,ChromiumWebApps/chromium,krieger-od/nwjs_chromium.src,littlstar/chromium.src,Chilledheart/chromium,anirudhSK/chromium,dednal/chromium.src,dushu1203/chromium.src,Chilledheart/chromium,dednal/chromium.src,M4sse/chromium.src,mogoweb/chromium-crosswalk,fujunwei/chromium-crosswalk,keishi/chromium,ondra-novak/chromium.src,keishi/chromium,mogoweb/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk-efl,littlstar/chromium.src,krieger-od/nwjs_chromium.src,rogerwang/chromium,junmin-zhu/chromium-rivertrail,Jonekee/chromium.src,jaruba/chromium.src,pozdnyakov/chromium-crosswalk,bright-sparks/chromium-spacewalk,hgl888/chromium-crosswalk,anirudhSK/chromium,zcbenz/cefode-chromium,Just-D/chromium-1,Pluto-tv/chromium-crosswalk,anirudhSK/chromium,pozdnyakov/chromium-crosswalk,chuan9/chromium-crosswalk,littlstar/chromium.src,zcbenz/cefode-chromium,ondra-novak/chromium.src,robclark/chromium,TheTypoMaster/chromium-crosswalk,ChromiumWebApps/chromium,chuan9/chromium-crosswalk,nacl-webkit/chrome_deps,Fireblend/chromium-crosswalk,M4sse/chromium.src,bright-sparks/chromium-spacewalk,crosswalk-project/chromium-crosswalk-efl,jaruba/chromium.src,Fireblend/chromium-crosswalk,dushu1203/chromium.src,chuan9/chromium-crosswalk,mogoweb/chromium-crosswalk,bright-sparks/chromium-spacewalk,Just-D/chromium-1,Fireblend/chromium-crosswalk,hgl888/chromium-crosswalk-efl,rogerwang/chromium,bright-sparks/chromium-spacewalk,chuan9/chromium-crosswalk,dushu1203/chromium.src,dednal/chromium.src,ChromiumWebApps/chromium,markYoungH/chromium.src,Chilledheart/chromium,zcbenz/cefode-chromium,crosswalk-project/chromium-crosswalk-efl,hgl888/chromium-crosswalk-efl,mogoweb/chromium-crosswalk,anirudhSK/chromium,rogerwang/chromium,TheTypoMaster/chromium-crosswalk,hgl888/chromium-crosswalk,hujiajie/pa-chromium,robclark/chromium,mogoweb/chromium-crosswalk,timopulkkinen/BubbleFish,Jonekee/chromium.src,rogerwang/chromium,littlstar/chromium.src,junmin-zhu/chromium-rivertrail,anirudhSK/chromium,Jonekee/chromium.src,junmin-zhu/chromium-rivertrail,krieger-od/nwjs_chromium.src,ltilve/chromium,Fireblend/chromium-crosswalk,Pluto-tv/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,mohamed--abdel-maksoud/chromium.src,M4sse/chromium.src,hgl888/chromium-crosswalk-efl,axinging/chromium-crosswalk,fujunwei/chromium-crosswalk,Pluto-tv/chromium-crosswalk,littlstar/chromium.src,axinging/chromium-crosswalk,ChromiumWebApps/chromium,Jonekee/chromium.src,hgl888/chromium-crosswalk,zcbenz/cefode-chromium,mogoweb/chromium-crosswalk,fujunwei/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,nacl-webkit/chrome_deps,nacl-webkit/chrome_deps,TheTypoMaster/chromium-crosswalk,hgl888/chromium-crosswalk,jaruba/chromium.src,ondra-novak/chromium.src,jaruba/chromium.src,Chilledheart/chromium,ondra-novak/chromium.src,krieger-od/nwjs_chromium.src,jaruba/chromium.src,nacl-webkit/chrome_deps,Fireblend/chromium-crosswalk,pozdnyakov/chromium-crosswalk,junmin-zhu/chromium-rivertrail,Jonekee/chromium.src,fujunwei/chromium-crosswalk,patrickm/chromium.src,crosswalk-project/chromium-crosswalk-efl,TheTypoMaster/chromium-crosswalk,axinging/chromium-crosswalk,ChromiumWebApps/chromium,robclark/chromium,zcbenz/cefode-chromium,dednal/chromium.src,M4sse/chromium.src,timopulkkinen/BubbleFish,fujunwei/chromium-crosswalk,Fireblend/chromium-crosswalk,patrickm/chromium.src,jaruba/chromium.src,fujunwei/chromium-crosswalk,keishi/chromium,patrickm/chromium.src,markYoungH/chromium.src,hujiajie/pa-chromium,junmin-zhu/chromium-rivertrail,M4sse/chromium.src,Pluto-tv/chromium-crosswalk,chuan9/chromium-crosswalk,nacl-webkit/chrome_deps,Just-D/chromium-1,nacl-webkit/chrome_deps,bright-sparks/chromium-spacewalk,ltilve/chromium,mogoweb/chromium-crosswalk,mogoweb/chromium-crosswalk,Just-D/chromium-1,anirudhSK/chromium,Jonekee/chromium.src,anirudhSK/chromium,dushu1203/chromium.src,PeterWangIntel/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,rogerwang/chromium,M4sse/chromium.src,markYoungH/chromium.src,ondra-novak/chromium.src,crosswalk-project/chromium-crosswalk-efl,M4sse/chromium.src,hujiajie/pa-chromium,krieger-od/nwjs_chromium.src,ltilve/chromium,rogerwang/chromium,nacl-webkit/chrome_deps,M4sse/chromium.src,anirudhSK/chromium,Pluto-tv/chromium-crosswalk,rogerwang/chromium,mohamed--abdel-maksoud/chromium.src,PeterWangIntel/chromium-crosswalk,ltilve/chromium,timopulkkinen/BubbleFish,robclark/chromium,jaruba/chromium.src,hgl888/chromium-crosswalk-efl,axinging/chromium-crosswalk,dushu1203/chromium.src,Pluto-tv/chromium-crosswalk,bright-sparks/chromium-spacewalk,ondra-novak/chromium.src,dednal/chromium.src,PeterWangIntel/chromium-crosswalk,hgl888/chromium-crosswalk-efl,TheTypoMaster/chromium-crosswalk,axinging/chromium-crosswalk,mogoweb/chromium-crosswalk,dushu1203/chromium.src,keishi/chromium,junmin-zhu/chromium-rivertrail,robclark/chromium,keishi/chromium,krieger-od/nwjs_chromium.src,patrickm/chromium.src,bright-sparks/chromium-spacewalk,hujiajie/pa-chromium,fujunwei/chromium-crosswalk,nacl-webkit/chrome_deps,axinging/chromium-crosswalk,hgl888/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,timopulkkinen/BubbleFish,timopulkkinen/BubbleFish,rogerwang/chromium,jaruba/chromium.src,zcbenz/cefode-chromium,TheTypoMaster/chromium-crosswalk,anirudhSK/chromium,crosswalk-project/chromium-crosswalk-efl,chuan9/chromium-crosswalk,ChromiumWebApps/chromium,krieger-od/nwjs_chromium.src,markYoungH/chromium.src,timopulkkinen/BubbleFish,rogerwang/chromium,timopulkkinen/BubbleFish,robclark/chromium,mohamed--abdel-maksoud/chromium.src,Just-D/chromium-1,Just-D/chromium-1,patrickm/chromium.src,markYoungH/chromium.src,mohamed--abdel-maksoud/chromium.src,keishi/chromium,pozdnyakov/chromium-crosswalk,zcbenz/cefode-chromium,nacl-webkit/chrome_deps,axinging/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,Jonekee/chromium.src,markYoungH/chromium.src,robclark/chromium,krieger-od/nwjs_chromium.src,ChromiumWebApps/chromium,M4sse/chromium.src,Chilledheart/chromium,hujiajie/pa-chromium,ltilve/chromium,mohamed--abdel-maksoud/chromium.src,markYoungH/chromium.src,PeterWangIntel/chromium-crosswalk,hgl888/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,markYoungH/chromium.src,robclark/chromium,hgl888/chromium-crosswalk-efl,hujiajie/pa-chromium,jaruba/chromium.src,rogerwang/chromium,keishi/chromium,Chilledheart/chromium,Jonekee/chromium.src,junmin-zhu/chromium-rivertrail,chuan9/chromium-crosswalk,Fireblend/chromium-crosswalk,mogoweb/chromium-crosswalk,ondra-novak/chromium.src,Pluto-tv/chromium-crosswalk,anirudhSK/chromium,jaruba/chromium.src,pozdnyakov/chromium-crosswalk,zcbenz/cefode-chromium,robclark/chromium,dushu1203/chromium.src,ChromiumWebApps/chromium,zcbenz/cefode-chromium,junmin-zhu/chromium-rivertrail,hujiajie/pa-chromium