+
    ˜qgjm©  ã                   óâ  € ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHtHtH	t	H
t
Ht ^ RIHtHt ^ RIHt ]P"                  ! ]4      tRtRt. RrOt. RsOt]P0                  ! R4      3R ltR	 tRtR
 ltRuR ltRvR ltR tR tR t R t!R t"R t#R t$R t%]PL                  ! RR7      R R l4       t']PL                  ! RR7      R R l4       t(R R lt)RvR lt*R t+R t,RvR R  llt-RvR! lt.RvR" lt/R# t0R$ t1R% t2R& t3R' t4 ! R( R)]54      t6R* t7R+ R, lt8R- R. lt9R/ R0 lt:R1 R2 lt;R3 R4 lt<R5 R6 lt=R7 R8 lt>R9 R: lt?RvR; R< llt@R= tARwR> ltBRxR? ltCRyR@ ltDRA tERB tFRC RD ltGRE RF ltHRG RH ltIRI RJ ltJRK RL ltKRM RN ltLRzRO RP lltMRQ RR ltNRS tORT RU ltPRV RW ltQRX RY ltRRZ R[ ltSR\ R] ltTR^ R_ ltUR` Ra ltVRb Rc ltWRd Re ltXRf Rg ltYRh Ri ltZRj Rk lt[Rl Rm lt\Rn Ro lt] ! Rp Rq]^4      t_R# ){é    N)ÚCallableÚDictÚListÚOptionalÚTuple)ÚsubpÚutil)ÚIproute2z/sys/class/net/Úeth0z([0-9]+)c                ó¶   € \         P                  ! W4       Uu. uF4  pVP                  4       '       d   \        V4      MVP	                  4       NK6  	  up# u upi )a0  Sorting for Humans: natural sort order. Can be use as the key to sort
functions.
This will sort ['eth0', 'ens3', 'ens10', 'ens12', 'ens8', 'ens0'] as
['ens0', 'ens3', 'ens8', 'ens10', 'ens12', 'eth0'] instead of the simple
python way which will produce ['ens0', 'ens10', 'ens12', 'ens3', 'ens8',
'eth0'].)ÚreÚsplitÚisdigitÚintÚlower)ÚsÚ_nsreÚtexts   && Ú8/usr/lib/python3/dist-packages/cloudinit/net/__init__.pyÚnatural_sort_keyr   +   sK   € ô —H’H˜UÔ&óá&ˆDð —\‘\—^’^ŒˆDŒ	¨¯©«Ò5Ù&ñð ùò s
   ™A´Ac                 ó   € \         # )z3Simple function to return the global SYS_CLASS_NET.)ÚSYS_CLASS_NET© ó    r   Úget_sys_class_pathr   8   s   € äÐr   c                 ó@   € \        4       V ,           R ,           V,           # )Ú/)r   ©ÚdevnameÚpaths   &&r   Úsys_dev_pathr!   =   s   € ÜÓ 'Õ)¨CÕ/°$Õ6Ð6r   c                 ó  € \        W4      p \        P                  ! V4      pTP                  4       pTf   T#  Y',          #   \        \        3 dq   p\        TR R4      p	T	\        P                  \        P                  39   d   Te   T! T4      u Rp?# T	\        P                  39   d   Te   T! T4      u Rp?# h Rp?ii ; i  \         d/   pTe   T! T4      u Rp?# \        P                  RTT4       h Rp?ii ; i)ÚerrnoNz5Found unexpected (not translatable) value '%s' in '%s)r!   r	   Úload_text_fileÚOSErrorÚIOErrorÚgetattrr#   ÚENOENTÚENOTDIRÚEINVALÚstripÚKeyErrorÚLOGÚdebug)
r   r    Ú	translateÚ	on_enoentÚon_keyerrorÚ	on_einvalÚdev_pathÚcontentsÚeÚe_errnos
   &&&&&&    r   Úread_sys_netr7   A   sð   € ô ˜GÓ*€Hð
Ü×&Ò& xÓ0ˆð �~‰~Ó€HØÒØˆðØÕ"Ð"øô ”WÐô Ü˜!˜W dÓ+ˆØ”u—|‘|¤U§]¡]Ð3Ô3ØÒ$Ù  “|Õ#Ø”u—|‘|�oÔ%ØÒ$Ù  “|Õ#Øûðûô ô 	ØÒ"Ù˜q“>Õ!ä�I‰IØGØØôð
 ûð	úsR   �A ºC ÁCÁ=B>ÂCÂ!B>Â7CÂ=B>Â>CÃC?ÃC:ÃC?Ã"C:Ã:C?c           	      ó*   € R  p\        V VVVVVR7      # )c                 ó   € R # ©Fr   )r5   s   &r   Úon_excp_falseÚ(read_sys_net_safe.<locals>.on_excp_falseg   s   € Ùr   )r1   r0   r2   r/   )r7   )ÚifaceÚfieldr/   r;   s   &&& r   Úread_sys_net_safer?   f   s(   € òô ØØØ!ØØØôð r   c                 ód   € \        W4      pVR J d   R#  \        V4      #   \         d     R# i ; i)FN)r?   r   Ú
ValueError)r=   r>   Úvals   && r   Úread_sys_net_intrC   t   s6   € Ü
˜EÓ
)€CØ
ˆeƒ|ÙðÜ�3‹xˆøÜô Úðús   •
   /®/c                 ó.   € R RRRRR/p\        V RVR7      # )ÚupTÚunknownÚdownFÚ	operstate)r/   ©r?   )r   r/   s   & r   Úis_uprJ   ~   s%   € ð �t˜Y¨¨f°eÐ<€IÜ˜W k¸YÔGÐGr   c                 óT   € \         P                  P                  \        V R 4      4      # )Úbridge©Úosr    Úexistsr!   ©r   s   &r   Ú	is_bridgerQ   †   s   € Ü�7‰7�>‰>œ, w°Ó9Ó:Ð:r   c                 óT   € \         P                  P                  \        V R 4      4      # )ÚbondingrM   rP   s   &r   Úis_bondrT   Š   s   € Ü�7‰7�>‰>œ, w°	Ó:Ó;Ð;r   c                ón   € \        V RR7      p\        P                  P                  V4      '       d   V# R# )z8Return the master path for devname, or None if no masterÚmaster©r    N)r!   rN   r    rO   r   s   & r   Ú
get_masterrX   Ž   s)   € ä˜ hÔ/€DÜ	‡w�w‡~�~�d×ÒØˆÙr   c                ó0  € \        V 4      pVf   R# \        P                  P                  VR4      p\        P                  P                  VR4      p\        P                  P	                  V4      ;'       g     \        P                  P	                  V4      # )z@Return a bool indicating if devname's master is a bridge or bondFrS   rL   )rX   rN   r    ÚjoinrO   )r   Úmaster_pathÚbonding_pathÚbridge_paths   &   r   Úmaster_is_bridge_or_bondr^   –   se   € ä˜WÓ%€KØÒÙÜ—7‘7—<‘< ¨YÓ7€LÜ—'‘'—,‘,˜{¨HÓ5€KÜ�7‰7�>‰>˜,Ó'×FÐF¬2¯7©7¯>©>¸+Ó+FÐFr   c                ó|   € \        V 4      pVf   R# \        V RR7      p\        P                  P	                  V4      # )z;Return a bool indicating if devname's master is openvswitchFzupper_ovs-systemrW   )rX   r!   rN   r    rO   )r   r[   Úovs_paths   &  r   Úmaster_is_openvswitchra       s5   € ä˜WÓ%€KØÒÙÜ˜GÐ*<Ô=€HÜ�7‰7�>‰>˜(Ó#Ð#r   c                 ó    € \        V R 4      R8H  # )ÚtypeÚ32rI   rP   s   &r   Úis_ib_interfacere   ©   s   € Ü˜W fÓ-°Ñ5Ð5r   )Úmaxsizec                ó$   € V ^8„  d   QhR\         /# ©é   Úreturn©Úbool)Úformats   "r   Ú__annotate__rn   ®   s   € ÷ ñ ¤$ñ r   c                 ó~   € \        \        P                  ! R4      4      p V '       g   \        P	                  R4       V # )zDReturn a bool indicating if Open vSwitch is installed in the system.ú	ovs-vsctlz<ovs-vsctl not in PATH; not detecting Open vSwitch interfaces)rl   r   Úwhichr-   r.   )Úrets    r   Úopenvswitch_is_installedrs   ­   s0   € ô Œt�zŠz˜+Ó&Ó
'€CßÜ�	‰	ØJô	
ð €Jr   c                ó$   € V ^8„  d   QhR\         /# rh   )Úlist)rm   s   "r   rn   rn   ¹   s   € ÷  ñ  ¤Tñ  r   c                 óò   €  \         P                   ! \        4      w  rV P                  4       #   \         P                   d4   pRTP                  9   d   \
        P                  R4       . u Rp?# h Rp?ii ; i)zÂReturn a list of the names of OVS internal interfaces on the system.

These will all be strings, and are used to exclude OVS-specific interface
from cloud-init's network configuration handling.
zdatabase connection failedzJOpen vSwitch is not yet up; no interfaces will be detected as OVS-internalN)r   Ú!OVS_INTERNAL_INTERFACE_LOOKUP_CMDÚ
splitlinesÚProcessExecutionErrorÚstderrr-   Úinfo)ÚoutÚ_errÚexcs      r   Úget_ovs_internal_interfacesr   ¸   sf   € ð Ü—I’IÔ?Ó@‰	ˆð �~‰~ÓÐøô ×%Ñ%ô Ø'¨3¯:©:Ô5Ü�H‰Hð ôð �IØûðús!   ‚. ®A6Á'A1Á*A6Á0A1Á1A6c                ó0   € V ^8„  d   QhR\         R\        /# )ri   r   rj   ©Ústrrl   )rm   s   "r   rn   rn   Í   s   € ÷ ñ ¬sð ´tñ r   c                óz   € \        4       '       g   R# \        4       pW9   d   \        P                  RV 4       R# R# )zxReturns True if this is an OVS internal interface.

If OVS is not installed or not yet running, this will return False.
FzDetected %s as an OVS interfaceT)rs   r   r-   r.   )r   Úovs_bridgess   & r   Ú!is_openvswitch_internal_interfacer…   Í   s3   € ô
 $×%Ò%ÙÜ-Ó/€KØÔÜ�	‰	Ð3°WÔ=ÙÙr   c                ól   € Vf   \        V 4      p\        W4      '       g   \        W4      '       d   R# R# )z¢netfailover driver uses 3 nics, master, primary and standby.
this returns True if the device is either the primary or standby
as these devices are to be ignored.
TF)Údevice_driverÚis_netfail_primaryÚis_netfail_standby©r   Údrivers   &&r   Úis_netfailoverrŒ   Û   s6   € ð
 ‚~Ü˜wÓ'ˆÜ˜'×*Ò*Ô.@Ø÷/ò /ñ Ùr   c                óH   € Rp \        V R4      pV#   \         d     T# i ; i)zDReturns a str from reading /sys/class/net/<devname>/device/features.Ú zdevice/features)r7   Ú	Exception©r   Úfeaturess   & r   Úget_dev_featuresr’   é   s9   € à€HðÜ Ð):Ó;ˆð €Oøô ô ØØ€Oðús   „ ’! !c                ód   € \        V 4      pV'       d   \        V4      ^@8  d   R# V^>,          R8H  # )z¼Return True if VIRTIO_NET_F_STANDBY bit (62) is set.

https://github.com/torvalds/linux/blob/         089cf7f6ecb266b6a4164919a2e69bd2f938374a/         include/uapi/linux/virtio_net.h#L60
FÚ1)r’   Úlenr�   s   & r   Úhas_netfail_standby_featurer–   ó   s.   € ô   Ó(€Hß”s˜8“} rÔ)ÙØ�B�<˜3ÑÐr   c                ó$   € V ^8„  d   QhR\         /# rh   rk   )rm   s   "r   rn   rn      s   € ÷ ñ ¬tñ r   c                óz   € \        V 4      e   R# Vf   \        V 4      pVR8w  d   R# \        V 4      '       g   R# R# )zÞA device is a "netfail master" device if:

- The device does NOT have the 'master' sysfs attribute
- The device driver is 'virtio_net'
- The device has the standby feature bit set

Return True if all of the above is True.
FÚ
virtio_netT©rX   r‡   r–   rŠ   s   &&r   Úis_netfail_masterr›      s=   € ô �'ÓÒ&Ùà‚~Ü˜wÓ'ˆà�ÔÙä& w×/Ò/Ùár   c                óh  € \        V RR7      p\        P                  P                  V4      '       g   R# Vf   \	        V 4      pVR8X  d   R# \        P                  P                  \        P                  P                  V4      4      p\	        V4      pVR8w  d   R# \        V4      pV'       g   R# R# )a  A device is a "netfail primary" device if:

- the device has a 'master' sysfs file
- the device driver is not 'virtio_net'
- the 'master' sysfs file points to device with virtio_net driver
- the 'master' device has the 'standby' feature bit set

Return True if all of the above is True.
rV   rW   Fr™   T)r!   rN   r    rO   r‡   ÚbasenameÚrealpathr–   )r   r‹   Úmaster_sysfs_pathÚmaster_devnameÚmaster_driverÚmaster_has_standbys   &&    r   rˆ   rˆ     s�   € ô % W°8Ô<ÐÜ�7‰7�>‰>Ð+×,Ò,Ùà‚~Ü˜wÓ'ˆà�ÔÙä—W‘W×%Ñ%¤b§g¡g×&6Ñ&6Ð7HÓ&IÓJ€NÜ! .Ó1€MØ˜Ô$Ùä4°^ÓDÐßÙár   c                óz   € \        V 4      f   R# Vf   \        V 4      pVR8w  d   R# \        V 4      '       g   R# R# )zÓA device is a "netfail standby" device if:

- The device has a 'master' sysfs attribute
- The device driver is 'virtio_net'
- The device has the standby feature bit set

Return True if all of the above is True.
Fr™   Trš   rŠ   s   &&r   r‰   r‰   9  s=   € ô �'ÓÒ"Ùà‚~Ü˜wÓ'ˆà�ÔÙä& w×/Ò/Ùár   c                ó@   € \        V R4      pV'       d
   VR9   d   R# R# )a”  
/* interface name assignment types (sysfs name_assign_type attribute) */
#define NET_NAME_UNKNOWN      0  /* unknown origin (not exposed to user) */
#define NET_NAME_ENUM         1  /* enumerated by kernel */
#define NET_NAME_PREDICTABLE  2  /* predictably named by the kernel */
#define NET_NAME_USER         3  /* provided by user-space */
#define NET_NAME_RENAMED      4  /* renamed by user-space */
Úname_assign_typeTF)Ú3Ú4rI   )r   r¥   s   & r   Ú
is_renamedr¨   Q  s#   € ô )¨Ð2DÓEÐßÐ,°
Ô:ÙÙr   c                 óR   € \        \        V R 4      4      pRVP                  4       9   # )ÚueventzDEVTYPE=vlan)r‚   r?   rx   )r   rª   s   & r   Úis_vlanr«   `  s(   € ÜÔ" 7¨HÓ5Ó6€FØ˜V×.Ñ.Ó0Ñ0Ð0r   c                óÒ   € Rp\        V R4      p\        P                  P                  V4      '       d4   \        P                  P	                  \        P
                  ! V4      4      pV# )z8Return the device driver for net device named 'devname'.Nzdevice/driver)r!   rN   r    Úislinkr�   Úreadlink)r   r‹   Údriver_paths   &  r   r‡   r‡   e  sH   € à€FÜ˜w¨Ó8€Kä	‡w�w‡~�~�k×"Ò"Ü—‘×!Ñ!¤"§+¢+¨kÓ":Ó;ˆà€Mr   c                ó.   € \        V R4      pVRJ d   R# V# )z;Return the device id string for net device named 'devname'.zdevice/deviceFNrI   )r   Údev_ids   & r   Údevice_devidr²   p  s   € ä˜w¨Ó8€FØ�ƒÙà€Mr   c                  óh  € \         P                  ! 4       '       g   \         P                  ! 4       '       d"   \        \	        4       P                  4       4      #  \        P                  ! \        4       4      p V #   \         d.   pTP                  \        P                  8X  d	   . p  R p?T # h R p?ii ; i©N)r	   Ú
is_FreeBSDÚis_DragonFlyBSDru   Úget_interfaces_by_macÚvaluesrN   Úlistdirr   r%   r#   r(   )Údevsr5   s     r   Úget_devicelistr»   y  s†   € Ü‡‚×ÒœD×0Ò0×2Ò2ÜÔ)Ó+×2Ñ2Ó4Ó5Ð5ðÜ�zŠzÔ,Ó.Ó/ˆð €Køô ô Ø�7‰7”e—l‘lÔ"ØŒDð €Kð ûð	ús   ÁA9 Á9B1Â!B,Â+B,Â,B1c                   ó   € ] tR tRtRtRtR# )ÚParserErrori‡  z6Raised when a parser has issue parsing a file/content.r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r   r   r   r½   r½   ‡  s   † Ý@r   r½   c                 ój   € V '       d   \        V \        4      '       g   R # V P                  R4      R8H  # )FÚconfigÚdisabled)Ú
isinstanceÚdictÚget)Úcfgs   &r   Úis_disabled_cfgrË   ‹  s(   € ß”j ¤d×+Ò+ÙØ�7‰7�8Ó 
Ñ*Ð*r   c                ó:   € V ^8„  d   QhR\         \        ,          /# rh   ©r   r‚   )rm   s   "r   rn   rn   ‘  s   € ÷ 
.ñ 
.œT¤#�Yñ 
.r   c                 ó  € \         P                  ! 4       '       g   \         P                  ! 4       '       d   \        4       # \         P                  ! 4       '       g   \         P
                  ! 4       '       d   \        4       # \        4       # )ziGet the list of network interfaces viable for networking.

@return List of interfaces, sorted naturally.
)r	   rµ   r¶   Úfind_candidate_nics_on_freebsdÚ	is_NetBSDÚ
is_OpenBSDÚ(find_candidate_nics_on_netbsd_or_openbsdÚfind_candidate_nics_on_linuxr   r   r   Úfind_candidate_nicsrÔ   ‘  sS   € ô
 ‡‚×ÒœD×0Ò0×2Ò2Ü-Ó/Ð/Ü	�Š×	Ò	œTŸ_š_×.Ò.Ü7Ó9Ð9ä+Ó-Ð-r   c                ó:   € V ^8„  d   QhR\         \        ,          /# rh   ©r   r‚   )rm   s   "r   rn   rn   ž  s   € ÷ ,ñ ,œ8¤C�=ñ ,r   c                 ó  € \         P                  ! 4       '       g   \         P                  ! 4       '       d   \        4       # \         P                  ! 4       '       g   \         P
                  ! 4       '       d   \        4       # \        4       # )z.Get the name of the 'fallback' network device.)r	   rµ   r¶   Úfind_fallback_nic_on_freebsdrÐ   rÑ   Ú&find_fallback_nic_on_netbsd_or_openbsdÚfind_fallback_nic_on_linuxr   r   r   Úfind_fallback_nicrÛ   ž  sQ   € ä‡‚×ÒœD×0Ò0×2Ò2Ü+Ó-Ð-Ü	�Š×	Ò	œTŸ_š_×.Ò.Ü5Ó7Ð7ä)Ó+Ð+r   c                ó:   € V ^8„  d   QhR\         \        ,          /# rh   rÍ   )rm   s   "r   rn   rn   ¨  s   € ÷ Jñ J´$´sµ)ñ Jr   c                 óP   € \        \        4       P                  4       \        R7      # )zeGet the names of the candidate network devices on NetBSD/OpenBSD.

@return list of sorted interfaces
©Úkey)Úsortedr·   r¸   r   r   r   r   rÒ   rÒ   ¨  s   € ô
 Ô'Ó)×0Ñ0Ó2Ô8HÔIÐIr   c                ó:   € V ^8„  d   QhR\         \        ,          /# rh   rÖ   )rm   s   "r   rn   rn   °  s   € ÷ 	ñ 	´¼µñ 	r   c                 ó<   € \        4       p V '       d
   V ^ ,          # R# )z^Get the 'fallback' network device name on NetBSD/OpenBSD.

@return default interface, or None
N)rÒ   ©Únamess    r   rÙ   rÙ   °  s   € ô
 5Ó6€EßØ�Q�xˆár   c                ó:   € V ^8„  d   QhR\         \        ,          /# rh   rÍ   )rm   s   "r   rn   rn   ¼  s   € ÷ Jñ J¬¬S­	ñ Jr   c                 ó¸   € \         P                   ! . RO4      w  rV P                  4       pV'       d   V# \        \        4       P	                  4       \
        R7      # )z_Get the names of the candidate network devices on FreeBSD.

@return List of sorted interfaces.
rÞ   )Úifconfigz-lz-uÚether)r   r   rà   r·   r¸   r   )ÚstdoutÚ_stderrr¸   s      r   rÏ   rÏ   ¼  sE   € ô
 —i’iÒ AÓB�O€FØ�\‰\‹^€FßØˆô Ô'Ó)×0Ñ0Ó2Ô8HÔIÐIr   c                ó:   € V ^8„  d   QhR\         \        ,          /# rh   rÖ   )rm   s   "r   rn   rn   Ë  s   € ÷ 	ñ 	¤h¬s¥mñ 	r   c                 ó<   € \        4       p V '       d
   V ^ ,          # R# )zWGet the 'fallback' network device name on FreeBSD.

@return List of sorted interfaces.
N)rÏ   rã   s    r   rØ   rØ   Ë  s   € ô
 +Ó,€EßØ�Q�xˆár   c                ó:   € V ^8„  d   QhR\         \        ,          /# rh   rÍ   )rm   s   "r   rn   rn   ×  s   € ÷ Oñ O¤d¬3¥iñ Or   c            	     óÄ  € R\         P                  ! 4       9   d   \        P                  R4       Mr\	        4        U u. uF!  p V R8w  g   K  \        V 4      '       d   K  V NK#  	  pp \        V4      '       d-   \        P                  RV4        \         P                  ! 4        . p. p\        RRRRRRR	7       Fà  w  p  pVR8X  d   K  VP!                  R
4      '       d   \        P                  RV4       K@  \#        VR4      pV'       d   VP%                  V4       Kg  \        P                  RV4       \#        VR4      pV'       d   VP%                  V4       K¤  \'        VR4      p	V	R9   d   VP%                  V4       KÊ  \        P                  RV4       Kâ  	  . p
W43 FR  p\)        V\*        R7      p\,        V9   d,   VP/                  \,        4       VP1                  ^ \,        4       W«,          p
KT  	  V
# u up i   \        P                   dM   p\        P                  RTP                  TP                  TP                  TP                  4        Rp?EL·Rp?ii ; i)z]Get the names of the candidate network devices on Linux.

@return List of sorted interfaces.
znet.ifnames=0z9Stable ifnames disabled by net.ifnames=0 in /proc/cmdlineÚloz4Found unstable nic names: %s; calling udevadm settlezAudevadm failed to settle: cmd=%r stderr=%r stdout=%r exit_code=%sNFT)Úfilter_openvswitch_internalÚ2filter_slave_if_master_not_bridge_bond_openvswitchÚfilter_vlanÚfilter_without_own_macÚfilter_zero_macÚlog_filtered_reasonsÚvethzIgnoring veth interface: %sÚcarrierzInterface has no carrier: %sÚdormantrH   zInterface ignored: %srÞ   )rø   rG   ÚlowerlayerdownrF   )r	   Úget_cmdliner-   r.   r»   r¨   r•   Úudevadm_settler   ry   ÚwarningÚcmdrz   ré   Ú	exit_codeÚget_interfacesÚ
startswithrC   Úappendr?   rà   r   ÚDEFAULT_PRIMARY_INTERFACEÚremoveÚinsert)ÚdeviceÚunstableÚerrorÚ	connectedÚpossibly_connectedÚ	interfaceÚ_r÷   rø   rH   Úsorted_interfacesÚ
interfacess               r   rÓ   rÓ   ×  s$  € ð
 œ$×*Ò*Ó,Ô,Ü�	‰	ÐMÕNô )Ô*ó
á*�Ø˜‰~ô ä&0°×&8÷ ˆFÙ*ð 	ð 
ô
 ˆx�=Š=Ü�I‰IØFØôð
Ü×#Ò#Ô%ð €IØÐÜ,Ø$)Ø;@ØØ$ØØ!÷Ñˆ	�1�a˜ð ˜ÔÙØ×Ñ ×'Ò'Ü�I‰IÐ3°YÔ?ÙÜ" 9¨iÓ8ˆßØ×Ñ˜YÔ'ÙÜ�	‰	Ð0°)Ô<ô # 9¨iÓ8ˆßØ×%Ñ% iÔ0ÙÜ% i°Ó=ˆ	ØÐHÔHØ×%Ñ% iÔ0Ùä�	‰	Ð)¨9Ö5ñ=ðJ ÐØ Ó5ˆ
Ü˜JÔ,<Ô=ˆ
Ü$¨
Ô2Ø×ÑÔ7Ô8Ø×Ñ˜aÔ!:Ô;ØÕ'Òñ 6ð ÐùòO
øô ×-Ñ-ô Ü—‘ð>à—I‘IØ—L‘LØ—L‘LØ—O‘O÷ò ûðús*   ½	G9ÁG9ÁG9ÂG> Ç>IÈAIÉIc                ó:   € V ^8„  d   QhR\         \        ,          /# rh   rÖ   )rm   s   "r   rn   rn   )  s   € ÷ 	ñ 	¤H¬S¥Mñ 	r   c                 ó<   € \        4       p V '       d
   V ^ ,          # R# )zUGet the 'fallback' network device name on Linux.

@return List of sorted interfaces.
N)rÓ   rã   s    r   rÚ   rÚ   )  s   € ô
 )Ó*€EßØ�Q�xˆár   c                ó:   € V ^8„  d   QhR\         \        ,          /# rh   )r   rÈ   )rm   s   "r   rn   rn   5  s   € ÷ ñ ´H¼TµNñ r   c                óò   € \        4       pV'       g   R# \        V4      '       d   RV/pMR\        VR4      P                  4       /pV '       d   \	        V4      pV'       d   W2R&   RRRRR	VR
V/pRW/R^/pV# )zBGenerate network cfg v2 for dhcp on the NIC most likely connected.NÚnameÚ
macaddressÚaddressr‹   Údhcp4TÚdhcp6úset-nameÚmatchÚ	ethernetsÚversion)rÛ   r›   r?   r   r‡   )Úconfig_driverÚtarget_namer  r‹   rÊ   Únconfs   &     r   Úgenerate_fallback_configr  5  s”   € ô $Ó%€Kßáô ˜×%Ò%Ø˜Ð%‰ð Ô+¨K¸ÓC×IÑIÓKð
ˆ÷ Ü˜{Ó+ˆßØ$�(‰Oà�Ø�Ø�KØ�ð	€Cð ˜;Ð,¨i¸Ð;€EØ€Lr   c                 ó�   € R  pR pV P                  R4      pV^8X  d	   V! V 4      # V^8X  d	   V! V 4      # \        RV,          4      h)c                 óº  € . pV P                  R / 4       FÂ  pVP                  R4      R8w  d   K  VP                  R4      pV'       g   K6  VP                  R4      pVP                  R/ 4      P                  R4      pVP                  R/ 4      P                  R4      pV'       g   \        V4      pV'       g   \        V4      pVP                  W4WV.4       KÄ  	  V# )rÅ   rc   ÚphysicalÚmac_addressr  Úparamsr‹   Ú	device_id)rÉ   r‡   r²   r  )ÚnetcfgÚphysdevsÚentÚmacr  r‹   r$  s   &      r   Ú
_version_1Ú$extract_physdevs.<locals>._version_1S  s¸   € ØˆØ—:‘:˜h¨Ö+ˆCØ�w‰w�v‹ *Ô,ÙØ—'‘'˜-Ó(ˆCßÙØ—7‘7˜6“?ˆDØ—W‘W˜X rÓ*×.Ñ.¨xÓ8ˆFØŸ™ ¨"Ó-×1Ñ1°+Ó>ˆIßÜ& tÓ,�ßÜ(¨Ó.�	Ø�O‰O˜S¨Ð:Ö;ñ ,ð ˆr   c                 óÚ  € . pV P                  R / 4      P                  4        FÄ  pVP                  R4      pV'       g   K  VP                  R/ 4      P                  R4      pV'       g   KI  VP                  R/ 4      P                  R4      pVP                  R/ 4      P                  R4      pV'       g   \        V4      pV'       g   \        V4      pVP	                  WCWV.4       KÆ  	  V# )r  r  r  r  r‹   r$  )rÉ   r¸   r‡   r²   r  )r%  r&  r'  r  r(  r‹   r$  s   &      r   Ú
_version_2Ú$extract_physdevs.<locals>._version_2e  sÂ   € ØˆØ—:‘:˜k¨2Ó.×5Ñ5Ö7ˆCà—7‘7˜:Ó&ˆDßÙà—'‘'˜' 2Ó&×*Ñ*¨<Ó8ˆCßÙØ—W‘W˜W bÓ)×-Ñ-¨hÓ7ˆFØŸ™ ¨Ó,×0Ñ0°Ó=ˆIßÜ& tÓ,�ßÜ(¨Ó.�	Ø�O‰O˜S¨Ð:Ö;ñ 8ð  ˆr   r  z"Unknown network config version: %s)rÉ   ÚRuntimeError)r%  r)  r,  r  s   &   r   Úextract_physdevsr/  R  sQ   € òò$ð( �j‰j˜Ó#€GØ�!„|Ù˜&Ó!Ð!Ø	�AŒÙ˜&Ó!Ð!ä
Ð;¸gÕEÓ
FÐFr   c                óV   € \        V R4      pVf   V'       d   \        R4      hR# VR9   # )a‚  return True if the provided interface has its own address.

Based on addr_assign_type in /sys.  Return true for any interface
that does not have a 'stolen' address. Examples of such devices
are bonds or vlans that inherit their mac from another device.
Possible values are:
  0: permanent address    2: stolen from another device
1: randomly generated   3: set using dev_set_mac_addressÚaddr_assign_typez%s had no addr_assign_type.T)r   é   é   )rC   rA   )ÚifnameÚstrictÚassign_types   && r   Úinterface_has_own_macr7  ‚  s6   € ô # 6Ð+=Ó>€KØÒ÷ ÜÐ:Ó;Ð;ÙØ˜)Ñ#Ð#r   c                ó  € / p\        4        F-  w  r#rERRRVRVRVP                  4       RVR\        V4      /W&   K/  	  V '       d¼   \        P                  ! R4      p\
        P
                  ! . ROR	R
7      w  rx\
        P
                  ! . ROR	R
7      w  r˜\        4       p
Wy3 F#  pV
P                  VP                  V4      4       K%  	  VP                  4        F%  pVR,          RJ ;'       g    VR,          V
9  VR&   K'  	  V# )a°  Collect information necessary for rename_interfaces.

returns a dictionary by mac address like:
   {name:
     {
      'downable': None or boolean indicating that the
                  device has only automatically assigned ip addrs.
      'device_id': Device id value (if it has one)
      'driver': Device driver (if it has one)
      'mac': mac address (in lower case)
      'name': name
      'up': boolean: is_up(name)
     }}
ÚdownableNr$  r‹   r(  r  rE   z[0-9]+:\s+(\w+)[@:]T)ÚcaptureF)Úipz-6ÚaddrÚshowÚ	permanentÚscopeÚglobal)r;  z-4r<  r=  )
rÿ   r   rJ   r   Úcompiler   ÚsetÚupdateÚfindallr¸   )Úcheck_downableÚcur_infor  r(  r‹   r$  ÚnmatchÚipv6r}   Úipv4Únics_with_addressesÚ	bytes_outÚds   &            r   Ú_get_current_rename_inforM  –  s÷   € ð €HÜ(6Ö(8Ñ$ˆ�6à˜Ø˜Ø�fØ�3—9‘9“;Ø�DØ”%˜“+ð
ˆ‹ñ )9÷ Ü—’Ð2Ó3ˆÜ—Y’YÚHØô
‰
ˆô —Y’YÒ;ÀTÔJ‰
ˆä!›eÐØ›ˆIØ×&Ñ& v§~¡~°iÓ'@ÖAñ &ð —‘Ö"ˆAà�$•˜5Ð ×HÐH A f¥IÐ5HÑ$Hð ˆj‹Mñ #ð
 €Or   c                 óF  aa€ \        V 4      '       g   \        P                  R 4       R# Vf   \        4       p/ oVP	                  4        FO  w  rEVP                  4       pVP                  R4      '       d   VR,          P                  4       VR&   WFR&   VSV&   KQ  	  \        P                  RS4       R p. p. p	. p
V! S4      pRpRpR oVV3R lpV  EF  w  ppppV'       d   VP                  4       p. pV! VVV4      pV'       g%   V'       d   V	P                  R	V: R
V: R24       KY  VP                  R4      pVV8X  d   Ks  V'       g%   V'       d   V	P                  R	V: R
V: R24       KŸ  VR,          '       dh   RpVR,          '       g&   V'       d   V	P                  VVVV3,          4       Kä  RVR&   VP                  RVVV334       V
P                  RVVV334       VV9   dÏ   VV,          pVR,          '       dN   RpVR,          '       g'   V'       d   V	P                  VVVV3,          4       EKk  VP                  RVVV334       RpVe   VV9   d   V^,          pWÍ,          pK  VP                  RVVVV334       VVR&   V! S4      pVR,          '       d   V
P                  RVVV334       VP                  RVVVR,          V334       VVR&   V! S4      pVV,          pEK!  	  R\        P                  R\        P                  R\        P                  /pV'       gI   V
'       gA   \        V	4      '       d   \        P                  RV V	4       MV\        P                  RV 4       M?\        P                  RWV
,           4       WŠ,            F  w  pppp VV,          ! V!   K  	  \        V	4      '       d   \        RP!                  V	4      4      hR#   \         d0   pT	P                  RT: T: RT: RT: RT: 2	4        Rp?K|  Rp?ii ; i)zno interfaces to renameNr(  r  zDetected interfaces %sc                 óB   € \        R  V P                  4        4       4      # )c              3   ó6   "  € T F  qR ,          V3x € K  	  R# 5i)r  Nr   )Ú.0Údatas   & r   Ú	<genexpr>Ú<_rename_interfaces.<locals>.update_byname.<locals>.<genexpr>Ú  s   é € ÐD±^¨T˜&•\ 4Õ(³^ùs   ‚)rÈ   r¸   )Úbymacs   &r   Úupdate_bynameÚ)_rename_interfaces.<locals>.update_bynameÙ  s   € ÜÑD°U·\±\´^ÓDÓDÐDr   z
cirename%dc                ó&  € V'       dE   V'       d=   V'       d5   V R,          V8H  ;'       d!    V R,          V8H  ;'       d    V R,          V8H  # V'       d)   V'       d!   V R,          V8H  ;'       d    V R,          V8H  # V'       d   V R,          V8H  # R# )zmatch if set and in datar(  r‹   r$  Fr   )rR  r(  r‹   r$  s   &&&&r   Úentry_matchÚ'_rename_interfaces.<locals>.entry_matchã  sƒ   € ç—6Ÿià�U•˜sÑ"÷ 3ð 3Ø˜•N fÑ,÷3ð 3à˜Õ%¨Ñ2ð÷
 —VØ˜•; #Ñ%×BÐB¨$¨x­.¸FÑ*BÐBßØ˜•; #Ñ%Ð%ár   c           	      ó  <€ SP                  4        Uu. uF  pS! W0W4      '       g   K  VNK  	  pp\        V4      '       d8   \        V4      ^8”  d   RV: RV : RV: RV: R2	p\        V4      hV^ ,          # R# u upi )r2  z2Failed to match a single device. Matched devices "z" with search values "(mac:z driver:z device_id:z)"N)r¸   r•   rA   )r(  r‹   r$  rR  r  ÚmsgrF  rY  s   &&&   €€r   Ú
find_entryÚ&_rename_interfaces.<locals>.find_entryò  s€   ø€ ð !Ÿ™Ô)ó
á)�Ù˜4 f×8÷ ˆDÙ)ð 	ð 
ô
 ˆu�:Š:Ü�5‹z˜A�~ó ›c£6«9ð6ð ô
 ! “oÐ%Ø˜•8ˆOáùò
s
   ”A<ªA<z$[nic not present] Cannot rename mac=z to z, not available.rE   z*[busy] Error renaming mac=%s from %s to %sr9  FrG   z2[busy-target] Error renaming mac=%s from %s to %s.Úrenamez1Unable to rename interfaces: %s due to errors: %sz$no work necessary for renaming of %szRenamed %s with ops %sz[unknown] Error performing z for z, z: Ú
éÿÿÿÿ)r•   r-   r.   rM  ÚitemsÚcopyrÉ   r   r  r
   Úlink_renameÚ	link_downÚlink_uprü   r�   r.  rZ   )ÚrenamesÚstrict_presentÚstrict_busyÚcurrent_infor  rR  ÚcurrV  ÚopsÚerrorsÚupsÚ
cur_bynameÚtmpname_fmtÚtmpir]  r(  Únew_namer‹   r$  Úcur_opsÚcur_namer\  ÚtargetÚtmp_nameÚopmapÚopr#  r5   rF  rY  s   &&&&                        @@r   Ú_rename_interfacesry  Ä  sÄ  ù€ ô ˆw�<Š<Ü�	‰	Ð+Ô,ÙàÒÜ/Ó1ˆà€HØ"×(Ñ(Ö*‰
ˆØ�i‰i‹kˆØ�7‰7�5�>Š>Ø˜U�×)Ñ)Ó+ˆC�‰JØˆF‰Øˆ�‹ñ +ô ‡I�IÐ&¨Ô1òEð €CØ€FØ
€CÙ˜xÓ(€JØ€KØ€Dòöô$ -4Ñ(ˆˆX�v˜yßØ—)‘)“+ˆCØˆÙ˜˜f iÓ0ˆßßØ—’ã*-«xð9ôñ à—7‘7˜6“?ˆØ�xÔáçßØ—’ã*-«xð9ôñ àˆt�9Œ9Ø>ˆCØ�z—?”?ßØ—M‘M #¨¨h¸Ð(AÕ"AÔBÙØˆC�‰IØ�N‰N˜F C¨°H°;Ð?Ô@Ø�J‰J˜˜c 8¨h¨[Ð9Ô:à�zÔ!Ø Õ)ˆFØ�d�|Œ|ØJ�Ø˜j×)Ô)ß"ØŸ™ c¨S°(¸HÐ,EÕ&EÔFÚà—N‘N F¨C°¸H¸;Ð#GÔHà&*ˆHØÒ" h°*Ô&<Ø˜•	�Ø&Õ-’à�N‰N˜H c¨8°hÀÐ5IÐJÔKØ%ˆF�6‰NÙ& xÓ0ˆJØ�d�|Œ|Ø—
‘
˜D # x°(°Ð=Ô>à�‰˜ # x°#°fµ+¸xÐ1HÐIÔJØˆˆF‰Ù" 8Ó,ˆ
Øˆw�‹ñ{ -4ð@ 	”(×&Ñ&Ø”×"Ñ"ØŒh×Ñð"€E÷ Ÿ#Üˆv�;Š;Ü�K‰KØCØØõô �I‰IÐ<¸gÕFä�	‰	Ð*¨G¸3µYÔ?à),¯¨Ñ%ˆB��X˜vðØ�b–	˜6Ô"ñ *3ô ˆ6‡{‚{Ü˜4Ÿ9™9 VÓ,Ó-Ð-ñ øô ô Ø—’â›6£3«²!ð5÷ò ûðús   Î(O&Ï&P Ï1$PÐP c                ó~   € Rp\         P                  P                  \        V R4      4      '       d   Rp\	        W4      # )z6Returns the string value of an interface's MAC Addressr  Úbonding_slavezbonding_slave/perm_hwaddr)rN   r    Úisdirr!   r?   )r4  r    s   & r   Úget_interface_macr}  b  s3   € à€DÜ	‡w�w‡}�}”\ &¨/Ó:×;Ò;ð +ˆÜ˜VÓ*Ð*r   c                óˆ   € \        V R4      R8X  d1   \        V 4      pV'       d   V'       d   V^$R VR,          ,           pV# R# )z±Returns the string value of an Infiniband interface's hardware
address. If ethernet_format is True, an Ethernet MAC-style 6 byte
representation of the address will be returned.
rc   rd   :é3   NNNiòÿÿÿ)r?   r}  )r4  Úethernet_formatr(  s   && r   Úget_ib_interface_hwaddrr�  l  s@   € ô ˜ Ó(¨DÔ0Ü Ó'ˆß—?à�b˜�+  C¥Õ(ˆCØˆ
ñ 1r   c                ó$   € V ^8„  d   QhR\         /# rh   ©rÈ   )rm   s   "r   rn   rn   z  s   € ÷ 0ñ 0œtñ 0r   c                  ó*  € \         P                  ! 4       '       g   \         P                  ! 4       '       d   \        4       # \         P                  ! 4       '       d   \        4       # \         P                  ! 4       '       d   \        4       # \        4       # r´   )	r	   rµ   r¶   Ú get_interfaces_by_mac_on_freebsdrÐ   Úget_interfaces_by_mac_on_netbsdrÑ   Ú get_interfaces_by_mac_on_openbsdÚget_interfaces_by_mac_on_linuxr   r   r   r·   r·   z  s[   € Ü‡‚×ÒœD×0Ò0×2Ò2Ü/Ó1Ð1Ü	�Š×	Ò	Ü.Ó0Ð0Ü	�Š×	Ò	Ü/Ó1Ð1ä-Ó/Ð/r   c                óF   € V ^8„  d   QhR\         R\        \         ,          /# )ri   r(  rj   )r‚   r   )rm   s   "r   rn   rn   …  s   € ÷ ñ ¤cð ¬h´s­mñ r   c                 ó–   € \        4       P                  4        F,  w  rV P                  4       VP                  4       8X  g   K*  Vu # 	  R # r´   )r·   rb  r   )r(  Úinterface_macÚinterface_names   &  r   Úfind_interface_name_from_macr�  …  s>   € Ü)>Ó)@×)FÑ)FÖ)HÑ%ˆØ�9‰9‹;˜-×-Ñ-Ó/Ö/Ø!Ò!ñ *Iñ r   c                ó$   € V ^8„  d   QhR\         /# rh   rƒ  )rm   s   "r   rn   rn   Œ  s   € ÷ ñ ¬$ñ r   c                  ó”   € \         P                   ! . RO4      w  rR pR pV! V! V 4      4       UUu/ uF  w  rEWEbK	  	  pppV# u uppi )rç   c              3   ó¨   "  € R pV P                  R4       F2  pVP                  R4      '       d   W,          pK$  V'       d   Vx € TpK4  	  Vx € R# 5i)rŽ   r`  Ú	N)r   r   )r|   Ú
curr_blockÚlines   &  r   ÚflattenÚ1get_interfaces_by_mac_on_freebsd.<locals>.flatten�  sI   é € Øˆ
Ø—I‘I˜d–OˆDØ�‰˜t×$Ò$ØÕ"’
çØ$Ò$Ø!’
ñ $ð Ôùs   ‚?AÁAc              3   óª   "  € V  FH  p\         P                  ! R V4      pV'       g   K$  VP                  R4      VP                  R4      3x € KJ  	  R# 5i)z2^(?P<ifname>\S*): .*ether\s(?P<mac>[\da-f:]{17}).*r(  r4  N)r   ÚsearchÚgroup)Ú	flat_listÚblockÚms   &  r   Úfind_macÚ2get_interfaces_by_mac_on_freebsd.<locals>.find_macœ  sE   é € ÛˆEÜ—	’	ØEÀuóˆA÷ ‰qØ—w‘w˜u“~ q§w¡w¨xÓ'8Ð9Ô9ó ùs
   ‚"A©*A)rç   ú-arè   )r   )r|   r  r”  rœ  r(  r4  Úresultss          r   r…  r…  Œ  sM   € Ü�yŠyÒ4Ó5�H€Sò	ò:ñ /7±w¸s³|Ô.DÔEÑ.D™{˜sˆsŠ{Ñ.D€GÑEØ€Nùó Fs   ²Ac                ó$   € V ^8„  d   QhR\         /# rh   rƒ  )rm   s   "r   rn   rn   ¨  s   € ÷ ñ ¬ñ r   c                  ó$  € / p R p\         P                   ! RR.4      w  r#\        P                  ! RRV4      P                  4       pV FE  p\        P                  ! W4      pV'       g   K#  VP                  4       pVR,          WR,          &   KG  	  V # )zE(?P<ifname>\w+).*address:\s(?P<mac>([\da-f]{2}[:-]){5}([\da-f]{2})).*rç   rž  ú\n\s+Ú r4  r(  ©r   r   Úsubrx   r  Ú	groupdict©rr   Úre_field_matchr|   r  Úif_linesr“  r›  Úfieldss           r   r†  r†  ¨  óƒ   € Ø
€Cð	6ð ô �yŠy˜* dÐ+Ó,�H€SÜ�vŠv�h  SÓ)×4Ñ4Ó6€HÛˆÜ�HŠH�^Ó*ˆß‰1Ø—[‘[“]ˆFØ!'¨Õ!1ˆC�u•Óñ	 ð
 €Jr   c                ó$   € V ^8„  d   QhR\         /# rh   rƒ  )rm   s   "r   rn   rn   ¸  s   € ÷ ñ ¬$ñ r   c                  ó$  € / p R p\         P                   ! RR.4      w  r#\        P                  ! RRV4      P                  4       pV FE  p\        P                  ! W4      pV'       g   K#  VP                  4       pVR,          WR,          &   KG  	  V # )zC(?P<ifname>\w+).*lladdr\s(?P<mac>([\da-f]{2}[:-]){5}([\da-f]{2})).*rç   rž  r¢  r£  r4  r(  r¤  r§  s           r   r‡  r‡  ¸  r«  r   c                ó$   € V ^8„  d   QhR\         /# rh   rƒ  )rm   s   "r   rn   rn   È  s   € ÷ Dñ D¬ñ Dr   c                 óT  € / p \        4        F—  w  rr4W 9   dH   VR9   d!   \        P                  RVW,          V4       K3  RV: RW,          : RV: R2p\        V4      hWV&   \	        VR4      pV'       g   Km  W`9  d   WV&   Ky  \        P                  RVW,          V4       K™  	  V # )	ziBuild a dictionary of tuples {mac: name}.

Bridges and any devices that have a 'stolen' mac are excluded.z>Ignoring duplicate macs from '%s' and '%s' due to driver '%s'.úduplicate mac found! both 'ú' and 'ú' have mac 'z'.Tz^Ethernet and InfiniBand interfaces have the same address both '%s' and '%s' have address '%s'.)Ú	fsl_enetcÚ
mscc_felixÚqmi_wwan)rÿ   r-   r.   r.  r�  rü   )rr   r  r(  r‹   Ú_devidr\  Úib_macs          r   rˆ  rˆ  È  sÃ   € ð €Cä%3Ö%5Ñ!ˆ�6ØŒ:ð Ð@Ô@Ü—	‘	ð#àØ•HØôñ ð Aó Ø—�ÛðˆCô
 ˜sÓ#Ð#àˆC‰ô
 )¨¨tÓ4ˆß‰6ð* Ô Ø"�F“ä—‘ð=àØ•KØöño &6ð| €Jr   c                óx   € V ^8„  d   QhR\         R\         R\         R\         R\         R\         R\         R\        /# )	ri   Úfilter_hyperv_vf_with_syntheticrð   rñ   rò   ró   rô   rõ   rj   )rl   ru   )rm   s   "r   rn   rn     sX   € ÷ :ñ :Ü%)ð:ä!%ð:ô 9=ð:ô ð	:ô
 !ð:ô ð:ô ð:ô 
ñ:r   c           	     óV  € V'       d   \         P                  MR p. p\        4       p	RP                  R
4      p
V	 EFV  p\	        V4      '       d   V! RV4       K   V'       d   \        V4      '       d   K;  \        V4      '       d   V! RV4       KW  V'       d   \        V4      '       g   V! RV4       K{  V'       d2   \        V4      e%   \        V4      '       g   \        V4      '       g   K´  \        V4      '       d   V! RV4       KÐ  \        V4      pV'       g   V! RV4       Kî  V'       d   VR	8w  d   WÊR\        V4       8X  d   EK  V'       d   \        V4      '       d   EK.  \        V4      pVP!                  W¼V\#        V4      34       EKY  	  V '       d   \%        Wx4       V# )z~Return list of interface tuples (name, mac, driver, device_id)

Bridges and any devices that have a 'stolen' mac are excluded.c                  ó   € R # r´   r   )Úargss   *r   Ú<lambda>Ú get_interfaces.<locals>.<lambda>  s   € É4r   Ú:zIgnoring bridge interface: %szIgnoring bond interface: %sz)Ignoring interface with inherited MAC: %sNzIgnoring failover interface: %sz"Ignoring interface without mac: %srï   )Ú00rÀ  rÀ  rÀ  rÀ  rÀ  rÀ  rÀ  rÀ  rÀ  rÀ  rÀ  rÀ  rÀ  rÀ  rÀ  )r-   r.   r»   rZ   rQ   r«   rT   r7  rX   r^   ra   rŒ   r}  r•   r…   r‡   r  r²   Ú)filter_hyperv_vf_with_synthetic_interface)r¹  rð   rñ   rò   ró   rô   rõ   Úfiltered_loggerrr   rº   Úzero_macr  r(  r‹   s   &&&&&&&       r   rÿ   rÿ     sT  € ÷ $8”c—i’iÑ=O€OØ
€CÜÓ€Dà�x‰x˜Ó%€HÜˆÜ�T�?Š?ÙÐ;¸TÔBÙßœ7 4Ÿ=š=ÙÜ�4�=Š=ÙÐ9¸4Ô@Ùß!Ô*?À×*EÒ*EÙÐGÈÔNÙç>Ü˜4Ó Ò,Ü,¨T×2Ò2Ü)¨$×/Ò/áÜ˜$×ÒÙÐ=¸tÔDÙÜ Ó%ˆçÙÐ@À$ÔGÙç˜t tœ|°À
Ä#ÀcÃ(Ð7KÔ0KÚß&Ô+LØ÷,
ò ,
ò Ü˜tÓ$ˆØ�
‰
�D˜v¤|°DÓ'9Ð:×;ñG ÷L 'Ü1°/ÔGà€Jr   c          	      óŽ   € V ^8„  d   QhR\         R,          R\        \        \        \        \        \        3,          ,          RR/# )ri   rÂ  Nr  rj   ).N)r   r   r   r‚   )rm   s   "r   rn   rn   L  s>   € ÷ '%ñ '%Ü˜iÕ(ð'%ä”Uœ3¤¤S¬#Ð-Õ.Õ/ð'%ð 
ñ'%r   c                ó<  € V Uu/ uF#  q"^,          R8X  g   K  V^,          V^ ,          bK%  	  ppV Uu. uF%  pV^,          V9   g   K  V^,          R8w  g   K#  VNK'  	  ppV F+  pVw  rgr‰V ! RVVW7,          V4       VP                  V4       K-  	  R# u upi u upi )ai  Filter Hyper-V SR-IOV/VFs when used with synthetic hv_netvsc.

Hyper-V's netvsc driver may register an SR-IOV/VF interface with a mac
that matches the synthetic (hv_netvsc) interface.  This VF will be
enslaved to the synthetic interface, but cloud-init may be racing this
process.  The [perhaps-yet-to-be-enslaved] VF should never be directly
configured, so we filter interfaces that duplicate any hv_netvsc mac
address, as this the most reliable indicator that it is meant to be
subordinate to the synthetic interface.

VF drivers will be mlx4_core, mlx5_core, or mana.  However, given that
this list of drivers has changed over time and mana's dependency on
hv_netvsc is expected to be removed in the future, we no longer rely
on these names. Note that this will not affect mlx4/5 instances outside
of Hyper-V, as it only affects environments where hv_netvsc is present.
Ú	hv_netvsczdIgnoring %r VF interface with driver %r due to synthetic hv_netvsc interface %r with mac address %r.N)r  )
rÂ  r  ÚiÚhv_netvsc_mac_to_nameÚinterfaces_to_remover
  r  r(  r‹   r  s
   &&        r   rÁ  rÁ  L  sÆ   € ñ* 'óÙ&�q¨A­$°+Ñ*=Œ
ˆˆ!�ˆa��dŠ
™Jð ð ñ
 óáˆAØˆQ�4Ð(Ñ(ô 	
à-.¨q­T°[Ñ-@÷ 	
ˆÙð ð ó *ˆ	Ø(Ñˆ�6ÙðDàØØ!Õ&Øô	
ð 	×Ñ˜)Ö$ó *ùòùòs   …B™B´BÁ	BÁBc            
     ó²   € / p \        4        FF  w  p  p\        VR4      pV'       g   K  W09   d   \        RV: RW,          : RV: R24      hW0V&   KH  	  V # )zPBuild a dictionary mapping Infiniband interface names to their hardware
address.Fr°  r±  r²  Ú')rÿ   r�  r.  )rr   r  r  r·  s       r   Úget_ib_hwaddrs_by_interfacerÌ  v  sa   € ð €CÜ'Ö)‰ˆˆa��AÜ(¨¨uÓ5ˆß‰6ØŒ}Ý"ã˜SŸ[˜[«&ð2óð ð �‹Iñ *ð €Jr   c                ó0   € V ^8„  d   QhR\         R\        /# )ri   Úconvert_to_addressr  )r   r‚   )rm   s   "r   rn   rn   †  s   € ÷ ñ ¬(ð ¼Sñ r   c                ó:   €  V ! V3/ VB #   \          d     R# i ; i)zçUse a function to return an address. If conversion throws a ValueError
exception return False.

:param check_cb:
    Test function, must return a truthy value
:param address:
    The string to test.

:return:
    Address or False

F)rA   )rÎ  r  Úkwargss   &&,r   Úmaybe_get_addressrÑ  †  s)   € ðÙ! 'Ñ4¨VÑ4Ð4øÜô Úðús   ‚ ‹™c                ó0   € V ^8„  d   QhR\         R\        /# ©ri   r  rj   r�   )rm   s   "r   rn   rn   ™  s   € ÷ 	Bñ 	Bœ3ð 	B¤4ñ 	Br   c                óH   € \        \        \        P                  V 4      4      # )z¥Returns a bool indicating if ``s`` is an IP address.

:param address:
    The string to test.

:return:
    A bool indicating if the string is an IP address or not.
)rl   rÑ  Ú	ipaddressÚ
ip_address©r  s   &r   Úis_ip_addressrØ  ™  s   € ô Ô!¤)×"6Ñ"6¸Ó@ÓAÐAr   c                ó0   € V ^8„  d   QhR\         R\        /# rÓ  r�   )rm   s   "r   rn   rn   ¥  ó   € ÷ 	Cñ 	CœSð 	C¤Tñ 	Cr   c                óH   € \        \        \        P                  V 4      4      # )z©Returns a bool indicating if ``s`` is an IPv4 address.

:param address:
    The string to test.

:return:
    A bool indicating if the string is an IPv4 address or not.
)rl   rÑ  rÕ  ÚIPv4Addressr×  s   &r   Úis_ipv4_addressrÝ  ¥  ó   € ô Ô!¤)×"7Ñ"7¸ÓAÓBÐBr   c                ó0   € V ^8„  d   QhR\         R\        /# rÓ  r�   )rm   s   "r   rn   rn   ±  rÚ  r   c                óH   € \        \        \        P                  V 4      4      # )z©Returns a bool indicating if ``s`` is an IPv6 address.

:param address:
    The string to test.

:return:
    A bool indicating if the string is an IPv4 address or not.
)rl   rÑ  rÕ  ÚIPv6Addressr×  s   &r   Úis_ipv6_addressrâ  ±  rÞ  r   c                ó0   € V ^8„  d   QhR\         R\        /# rÓ  r�   )rm   s   "r   rn   rn   ½  s   € ÷ 	Pñ 	Pœ3ð 	P¤4ñ 	Pr   c                óL   € \        \        \        P                  V RR7      4      # )z±Returns a bool indicating if ``s`` is an IPv4 or IPv6 network.

:param address:
    The string to test.

:return:
    A bool indicating if the string is an IPv4 address or not.
F©r5  )rl   rÑ  rÕ  Ú
ip_networkr×  s   &r   Úis_ip_networkrç  ½  s   € ô Ô!¤)×"6Ñ"6¸ÈÔNÓOÐOr   c                ó0   € V ^8„  d   QhR\         R\        /# rÓ  r�   )rm   s   "r   rn   rn   É  ó   € ÷ ñ œSð ¤Tñ r   c                óL   € \        \        \        P                  V RR7      4      # )z©Returns a bool indicating if ``s`` is an IPv4 network.

:param address:
    The string to test.

:return:
    A bool indicating if the string is an IPv4 address or not.
Frå  )rl   rÑ  rÕ  ÚIPv4Networkr×  s   &r   Úis_ipv4_networkrì  É  ó#   € ô Üœ)×/Ñ/°ÀÔGóð r   c                ó0   € V ^8„  d   QhR\         R\        /# rÓ  r�   )rm   s   "r   rn   rn   ×  ré  r   c                óL   € \        \        \        P                  V RR7      4      # )z©Returns a bool indicating if ``s`` is an IPv6 network.

:param address:
    The string to test.

:return:
    A bool indicating if the string is an IPv4 address or not.
Frå  )rl   rÑ  rÕ  ÚIPv6Networkr×  s   &r   Úis_ipv6_networkrñ  ×  rí  r   c                ó<   € V ^8„  d   QhR\         R\         R\        /# )ri   r  Úsubnetrj   r�   )rm   s   "r   rn   rn   å  s!   € ÷ (ñ (œSð (¬#ð (´$ñ (r   c                óf   € \         P                  ! V 4      p\         P                  ! VRR7      pW#9   # )zÆReturns a bool indicating if ``s`` is in subnet.

:param address:
    The string of IP address.

:param subnet:
    The string of subnet.

:return:
    A bool indicating if the string is in subnet.
Frå  )rÕ  rÖ  ræ  )r  ró  rÖ  Úsubnet_networks   &&  r   Úis_ip_in_subnetrö  å  s/   € ô ×%Ò% gÓ.€JÜ×)Ò)¨&¸Ô?€NØÑ'Ð'r   c                ó<   € V ^8„  d   QhR\         R\         R\        /# )ri   Úgatewayró  rj   r�   )rm   s   "r   rn   rn   ö  s!   € ÷ ñ ¬Cð ¼ð Äñ r   c                ó†   €  \        W4      '       * #   \         d$   p\        P                  RT TT4        Rp?R# Rp?ii ; i)z×Returns a bool indicating if should add gateway onlink flag.

:param gateway:
    The string of gateway address.

:param subnet:
    The string of subnet.

:return:
    A bool indicating if the string is in subnet.
zDFailed to check whether gateway %s is contained within subnet %s: %sNF)rö  rA   r-   rü   )rø  ró  r5   s   && r   Úshould_add_gateway_onlink_flagrú  ö  sD   € ð
Ü" 7Ó3Ô3Ð3øÜô Ü�‰ð1àØØô	
õ ûðús   ‚ ’A �;»A c                ó$   € V ^8„  d   QhR\         /# rh   rk   )rm   s   "r   rn   rn     s   € ÷ ñ œdñ r   c                óÊ   € V R,          P                  R4      '       g   V R,          \        9   d   R# V R,          R8X  d#   \        V P                  R4      4      '       d   R# R# )z:Common helper for checking network_state subnets for ipv6.rc   Ú6TÚstaticr  F)ÚendswithÚIPV6_DYNAMIC_TYPESrâ  rÉ   )ró  s   &r   Úsubnet_is_ipv6r    sM   € ð ˆf…~×Ñ˜s×#Ò# v¨f¥~Ô9KÔ'KáØ	��˜8Ô	#¬¸¿
¹
À9Ó8M×(NÒ(NÙÙr   c                ó$   € V ^8„  d   QhR\         /# rh   ©r‚   )rm   s   "r   rn   rn     s   € ÷ Cñ C¤sñ Cr   c                óZ   € \        \        P                  ! RV  24      P                  4      # )z˜Convert a network prefix to an ipv4 netmask.

This is the inverse of ipv4_mask_to_net_prefix.
    24 -> "255.255.255.0"
Also supports input as a string.ú0.0.0.0/)r‚   rÕ  rë  Únetmask)Úprefixs   &r   Únet_prefix_to_ipv4_maskr    s'   € ô Œy×$Ò$ x°¨xÐ%8Ó9×AÑAÓBÐBr   c                ó$   € V ^8„  d   QhR\         /# rh   ©r   )rm   s   "r   rn   rn   &  s   € ÷ 	=ñ 	=¤Sñ 	=r   c                óH   € \         P                  ! RV  24      P                  # )zðConvert an ipv4 netmask into a network prefix length.

If the input is already an integer or a string representation of
an integer, then int(mask) will be returned.
   "255.255.255.0" => 24
   str(24)         => 24
   "24"            => 24
r  )rÕ  ræ  Ú	prefixlen)Úmasks   &r   Úipv4_mask_to_net_prefixr  &  s"   € ô ×Ò (¨4¨&Ð 1Ó2×<Ñ<Ð<r   c                ó$   € V ^8„  d   QhR\         /# rh   r
  )rm   s   "r   rn   rn   2  s   € ÷  ñ  ¤Sñ  r   c                óÄ  €  \         P                  ! RV  24      P                  pV#   \         d     Mi ; i\         P                  ! T 4      p\        T4      pT^ 8X  d   T# \        \         P                  T( T^,
          ,          P                  4       4      pY4,	          p\         P                  T,
          p^T,          ^,
          pYV8w  d   \        RT ,          4      hT# )zëConvert an ipv6 netmask (very uncommon) or prefix (64) to prefix.

If the input is already an integer or a string representation of
an integer, then int(mask) will be returned.
   "ffff:ffff:ffff::"  => 48
   "48"                => 48
z::/zInvalid network mask '%s')	rÕ  ræ  r  rA   rÖ  r   ÚminÚ
IPV6LENGTHÚ
bit_length)r  r  r  Úmask_intÚtrailing_zeroesÚleading_onesÚall_oness   &      r   Úipv6_mask_to_net_prefixr  2  sÒ   € ðä×(Ò(¨3¨t¨f¨Ó6×@Ñ@ˆ	ØÐøÜô ñ 	ðúô
 ×"Ò" 4Ó(€GÜ�7‹|€Hà�1„}ØˆäÜ×Ñ ˜y¨H°q­LÕ9×EÑEÓGó€Oð Õ.€LÜ×$Ñ$ Õ6€IØ�Y• !Õ#€HØÔÜÐ4°tÕ;Ó<Ð<àÐs   ‚$' §5´5c                ó<   € V ^8„  d   QhR\         R\         R\         /# )ri   r  r;  rj   r  )rm   s   "r   rn   rn   U  s!   € ÷ ñ ¤cð ¬sð ´sñ r   c                ób   € \        \        P                  ! V RV  2RR7      P                  4      # )zCGet string representation of broadcast address from an ip/mask pairr   Frå  )r‚   rÕ  rë  Úbroadcast_address)r  r;  s   &&r   Úmask_and_ipv4_to_bcast_addrr  U  s/   € äÜ×Ò   A d V˜n°UÔ;×MÑMóð r   c                   ó   € ] tR tRtRtR# )ÚRendererNotFoundErrori\  r   N)r¾   r¿   rÀ   rÁ   rÃ   r   r   r   r  r  \  s   † Ûr   r  )r  Ú
ipv6_slaaczipv6_dhcpv6-statelesszipv6_dhcpv6-stateful)rp   z--formatÚcsvz--no-headingsz	--timeoutÚ10z	--columnsr  Úfindr
  ztype=internal)rŽ   )NNNNr´   r:   )T)TTN)TTTTTTF)`r#   Ú	functoolsrÕ  ÚloggingrN   r   Útypingr   r   r   r   r   Ú	cloudinitr   r	   Úcloudinit.net.netops.iproute2r
   Ú	getLoggerr¾   r-   r   r  r   rw   rA  r   r   r!   r7   r?   rC   rJ   rQ   rT   rX   r^   ra   re   Ú	lru_cachers   r   r…   rŒ   r’   r–   r›   rˆ   r‰   r¨   r«   r‡   r²   r»   r�   r½   rË   rÔ   rÛ   rÒ   rÙ   rÏ   rØ   rÓ   rÚ   r  r/  r7  rM  ry  r}  r�  r·   r�  r…  r†  r‡  rˆ  rÿ   rÁ  rÌ  rÑ  rØ  rÝ  râ  rç  rì  rñ  rö  rú  r  r  r  r  r  r.  r  r   r   r   Ú<module>r*     s  ðó Û Û Û Û 	Û 	ß 8Õ 8ç  Ý 2à×Ò˜Ó!€Ø!€Ø"Ð òÐ ò%Ð !ð !Ÿjšj¨Ó4ô 
òô
7ô"ôJòòHò;ò<òòGò$ò6ð ×Ò˜TÔ"ôó #ðð ×Ò˜TÔ"ô ó #ð õ(ôòò
÷ô0ôBò0ò1ò
òòôA�)ô Aò+õ
.õ,õJõ	õJõ	õOõd	÷ò:-Gô`$ô(+ô\[.ò|+òõ0õõõ8õ õ D÷N:õz'%òTõ õ&	Bõ	Cõ	Cõ	Põõõ(õ"õ2õCõ	=õ õFô	˜Lö 	r   