+z2Wc @sLddkZddkZddkZddklZddklZddklZl Z l Z l Z l Z l Z lZlZlZlZddklZddklZlZlZlZlZlZlZdefdYZd efd YZd eifd YZd eifdYZdefdYZ dZ!dS(iN(t NC_functions(tRoute( t_tgetRoottSYSCONFDEVICEDIRtlogtETHERNETtSYSCONFNETWORKtgeneric_run_dialogt generic_runt getDebugLeveltunlink(t ConfShellVar(t Gdtstructtgdtstruct_propertiestGdtstrtGdtlisttGdtbooltGdtinttgdtlist_propertiest StaticRoutescBseZdZeeRS(sContains Routes(t__name__t __module__t__doc__RR(((s7/usr/share/system-config-network/netconfpkg/NCDevice.pyR!st Device_basecBs8eZededfdedfdedfdedfdedfdedfdedfdedfd edfd edfd edfd edfd edfdedfdedfdedfdedfdedfdedfdedfdedfdedfdedfgdZdZRS(tDeviceIdsTest doc stringt NMControlledtDevicetAliastTypetSubTypetOnBoottOnParentt AllowUsert BootPrototIPtNetmasktGatewaytIPv6InittHostnametDomaintAutoDNStHardwareAddresstMtutSlaveRttestt PrimaryDNSt SecondaryDNScCstt|id|_d|_d|_d|_d|_d|_ d|_ d|_ d|_ d|_ d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_dS(N(tsuperRt__init__tNoneRRRRRRRR R!R"R#R$tPrefixR%R&R'R(R)R*R+R,RR.R/(tself((s7/usr/share/system-config-network/netconfpkg/NCDevice.pyR1Bs2                       cCs!|ipt|_n|iS(N(R(R4((s7/usr/share/system-config-network/netconfpkg/NCDevice.pytcreateStaticRoutes]s ( RRRRRRRR1R5(((s7/usr/share/system-config-network/netconfpkg/NCDevice.pyR%s4                       t ConfDevicecBseZddZdZRS(cCs|djott}nt}|d||_ti|itipt}d|_ n ti |i}|d|_ t i i ||i|o<|i |id|i|id|i ndS(Nsifcfg-iis8# Please read /usr/share/doc/initscripts-*/sysconfig.txts,# for the documentation of these parameters.(R2RRtFalsetfilenametostaccesstR_OKtTruetoldmodetstatR R1trewindt insertlinetnextline(R4tnametmdirtnewtstatus((s7/usr/share/system-config-network/netconfpkg/NCDevice.pyR1es        cCsH|i|itidd|id@|iftii|dS(Nis chmod %#o %si(tchmodR=RR8R twrite(R4((s7/usr/share/system-config-network/netconfpkg/NCDevice.pyRG|s$N(RRR2R1RG(((s7/usr/share/system-config-network/netconfpkg/NCDevice.pyR6ds t ConfRoutecBseZdZRS(cCs3tii|ttd||iddS(Nsroute-i(R R1RRRF(R4RB((s7/usr/share/system-config-network/netconfpkg/NCDevice.pyR1s (RRR1(((s7/usr/share/system-config-network/netconfpkg/NCDevice.pyRHsRcBs;eZeZd6ZdZdZh dd6dd6dd6dd 6d d 6d d 6dd6dd6dd6dd6dd6Zhdd6Z hdd6dd6dd6d d!6d"d#6d$d%6d&d'6Z d(Z d)Z d*Z d+Zd,Zd-Zd.Zd/Zd0Zd6d1Zd6d2Zd3Zd4Zd5ZRS(7iRtDEVICERtIPADDRR#tNETMASKR$tGATEWAYR%t DHCP_HOSTNAMER'tDNS1R.tDNS2R/tDOMAINR(t BOOTPROTOR"tTYPERtHWADDRR*tMTUR+tONBOOTRtONPARENTR t NM_CONTROLLEDRtUSERCTLR!tPEERDNSR)tSLAVER,tIPV6INITR&cCs tt|id|_dS(N(R0RR1R2toldname(R4((s7/usr/share/system-config-network/netconfpkg/NCDevice.pyR1scCsdS(N(R2(R4((s7/usr/share/system-config-network/netconfpkg/NCDevice.pyt getDialogscCsdS(N(R2(R4((s7/usr/share/system-config-network/netconfpkg/NCDevice.pyt getWizardscCs tdS(N(R7(R4tdevice((s7/usr/share/system-config-network/netconfpkg/NCDevice.pytisTypescCstid|otStS(Ns^[a-z|A-Z|0-9\_:]+$(tretsearchR<R7(R4tvalue((s7/usr/share/system-config-network/netconfpkg/NCDevice.pyt testDeviceIdscCsH|i}|idjo+|idjo|dt|i}n|S(Ntt:(RRR2tstr(R4tdevname((s7/usr/share/system-config-network/netconfpkg/NCDevice.pytgetDeviceAliass  cCstid|i}t}d}yJxC|iD]5}|ot|}Pn|djo t}q2q2WWntj onX|S(Ns!/sbin/ip link show %s 2>/dev/nullitmtu(tcommandst getoutputRR7tsplittintR<t ValueError(R4touttnexttvaltk((s7/usr/share/system-config-network/netconfpkg/NCDevice.pyt getRealMtus     c"Cst|}||_|idpw|id}|djoNddkl}x;|D],}|i|| jo|i|Pq[q[Wn||_n||_xW|i i D]F}|i |}|i|o#||ot ||||qqWx]|i i D]L}|i |}|i|o)t ||ot ||||qqWx|ii D]}|i|}|i|o9||djot ||tqt ||tqo|d!jot ||tqot ||tqoW|ip |`n|ip.ytitt}|ido|id  p|d |ijo|d} | o|ioytid t|id t|id } tid t| d t|id } | | jot| |_nWqqXqnWqLtj o} tit| qLXnyQ|iid}|djo.t|i|d |_|i| |_nWnYt j o!tit!d|in.t"j o!tit!d|inX|ip |`#n|i$djo$|io d|_$qAd|_$n|i& p&|i&djp|i&t!djojddk'l(} | i)}xK|D]*}|i*|ijo|i&|_&PqqWti+|i|_&n|ido+|ddjo t|_,qt|_,n|ido|d|_-n"|ido|d|_-n|i-ot|i-}g}xt.ddD]x}d}|djodn|}x)t.d|D]}|d d|>}qW|i/t|t0d|d}qWdi1||_nttt2|id}t3i4i5|o&ti6|tt2d|int7|}x|i D]}|i8doyt|d}Wn qnXt9}|i:|i;i/||dt||_<|id t|o|d t||_n|idt|o|dt||_qiqqW|i=|i>dS("NRIRfi(t getDeviceListtyesRWRYRLt GATEWAYDEVsipcalc --network t s 2>/dev/nullis/%s, Device not specified or alias not a number!tnonetdhcpRetUnknown(tNCHardwareListt RESOLV_MODStnotPREFIXtPREFIX0iiiit.s.routesroute-tADDRESSRK(RWRY(?R6R\thas_keytfindtnetconfpkg.NCDeviceListRuRtapplyRt_Device__keydicttkeystsetattrt_Device__intkeydicttlent_Device__boolkeydictR<R7R,R%R RRR$RkRlRgR#tEnvironmentErrorRtgeneric_error_dialogRnRt TypeErrorRRoR R"R2Rt netconfpkgR|tgetHardwareListtNamet getDeviceTypeR)R3trangetappendtmaxtjoinRR9tpathtisfiletrenameRHt startswithRR5RtAddresstcommitt setunmodified(R4RBtconftaliasposRutdevtselfkeytconfkeytcfgtgwtnetworkRptmsgR|thwlistthwtprefixt maskbytestitbtshifttmfiletrconftkeytptroute((s7/usr/share/system-config-network/netconfpkg/NCDevice.pytloads          !      !         1           # c Cstid|i|ioe|i|ijoRxOdddgD]:}titt||itt||iqDWnt |i}|i |i djo$|i o d|_ qd|_ n|i o|i i|_ n|i djo d|_ n|i djod|_d|_ d|_nxU|iiD]D}|i|}t||ot||||/dev/nulli tNETWORKsipcalc --network iiRRKRLis.routeR}(%R9tumaskRR\RRRRRR6tfsfR"R2R#tlowerR%R$RRthasattrtgetattrRRgRR<R7RRRRkRlRRRHRRGR ( R4RRRRt broadcastRRRRRR((s7/usr/share/system-config-network/netconfpkg/NCDevice.pytsaves  !           &   $   $! $!             cCsd}||idg}yWt||dddtddtd |id td |id |\}}Wntj o}d }nX||fS(Ns /sbin/ifuptuptcatchfdiittitlesNetwork device activating...tlabels,Activating network device %s, please wait...terrlabels#Cannot activate network device %s! tdialogi(ii(RRRt RuntimeError(R4RtcommandtparamtretR((s7/usr/share/system-config-network/netconfpkg/NCDevice.pytactivates       cCsd}||idg}yWt||dddtddtd |id td |id |\}}Wntj o}d }nX||fS(Ns /sbin/ifdowntdownRiiRsNetwork device deactivating...Rs.Deactivating network device %s, please wait...Rs%Cannot deactivate network device %s! Ri(ii(RRRR(R4RRRRR((s7/usr/share/system-config-network/netconfpkg/NCDevice.pyt deactivate(s       c Csd}d}tii| o*tdjotid}d}ny%t|||gdd \}}Wntj o}d }nX||fS( Ns/usr/bin/system-config-networkReis/system-config-network-guis-dRiii(ii(R9RRR tgetcwdR R(R4RtargsRR((s7/usr/share/system-config-network/netconfpkg/NCDevice.pyt configure<s$   cCsdS(N((R4((s7/usr/share/system-config-network/netconfpkg/NCDevice.pytmonitorLscCs|iS(N(R(R4((s7/usr/share/system-config-network/netconfpkg/NCDevice.pyt getHWDeviceOsN(RRRRR2RtPrioritytkeyidRRRR1R]R^R`RdRiRtRRRRRRR(((s7/usr/share/system-config-network/netconfpkg/NCDevice.pyRsP              s Harald Hoyer ("RkR9RaRRtnetconfpkg.NCRouteRtnetconfpkg.NC_functionsRRRRRRRR R R tnetconfpkg.confR tnetconfpkg.gdtR RRRRRRRRR6RHRt __author__(((s7/usr/share/system-config-network/netconfpkg/NCDevice.pyts   F4?#