File: //lib/python3/dist-packages/landscape/lib/__pycache__/network.cpython-310.pyc
o
�1Db�% � @ s� d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl m
Z
mZ ddgZdZ
dZdZd d
� Zdd� Zd
d� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Z d%dd�Zd&d d�Zd!d"� Zd#d$� ZdS )'� )�absolute_importN)�long�_PY3�get_active_device_info�get_network_traffici� iF� � c C s t �d�dkS )z>Returns C{True} if the platform is 64-bit, otherwise C{False}.�l� )�struct�calcsize� r r �7/usr/lib/python3/dist-packages/landscape/lib/network.py�is_64 s r c C s | d@ S )z�Returns C{True} if the interface is up, otherwise C{False}.
@param flags: the integer value of an interface's flags.
@see /usr/include/linux/if.h for the meaning of the flags.
r r )�flagsr r r
�is_up s r c c sd � t �� D ]*} t �| �}|�t ji g�d �d�}|�t ji g�d �d�}|s*|r/| |fV qdS )a} Generator yields (active network interface name, address data) tuples.
Address data is formatted exactly like L{netifaces.ifaddresses}, e.g.::
('eth0', {
AF_LINK: [
{'addr': '...', 'broadcast': '...'}, ],
AF_INET: [
{'addr': '...', 'broadcast': '...', 'netmask': '...'},
{'addr': '...', 'broadcast': '...', 'netmask': '...'},
...],
AF_INET6: [
{'addr': '...', 'netmask': '...'},
{'addr': '...', 'netmask': '...'},
...], })
Interfaces with no IP address are ignored.
r �addrN)� netifaces�
interfaces�ifaddresses�get�AF_INET�AF_INET6)� interfacer � inet_addr�
inet6_addrr r r
�get_active_interfaces&