How to use the ethtool.get_broadcast function in ethtool

To help you get started, we’ve selected a few ethtool examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uyuni-project / uyuni / client / rhel / spacewalk-client-tools / src / up2date_client / hardware.py View on Github external
else:
                ipaddr = netifaces.ifaddresses(interface)[netifaces.AF_INET][0]['addr']
        except:
            ipaddr = ""

        try:
            if ethtool_present:
                netmask = ethtool.get_netmask(interface)
            else:
                netmask = netifaces.ifaddresses(interface)[netifaces.AF_INET][0]['netmask']
        except:
            netmask = ""

        try:
            if ethtool_present:
                broadcast = ethtool.get_broadcast(interface)
            else:
                broadcast = netifaces.ifaddresses(interface)[netifaces.AF_INET][0]['broadcast']
        except:
            broadcast = ""

        ip6_list = []
        if ethtool_present:
            dev_info = ethtool.get_interfaces_info(interface)
            # an interface with label (contains character ':') does not have ipv6
            # addresses assigned which confuses python-ethtool
            # so collect info about ipv6 addresses for the "base" interface only
            # correct change would require fixing python-ethtool on all supported
            # operating systems (it still mimics old style ifconfig output) and
            # extend UI to allow list of ipv4 addresses for single interface
            if ':' not in interface:
                for info in dev_info:
github uyuni-project / uyuni / client / debian / packages-already-in-debian / python-ethtool / pifconfig.py View on Github external
def show_config(device):
        ipaddr = ethtool.get_ipaddr(device)
        netmask = ethtool.get_netmask(device)
        flags = ethtool.get_flags(device)
        print '%-9.9s' % device,
        if not (flags & ethtool.IFF_LOOPBACK):
                print "HWaddr %s" % ethtool.get_hwaddr(device),
        print '''
          inet addr:%s''' % ipaddr,
        if not (flags & (ethtool.IFF_LOOPBACK | ethtool.IFF_POINTOPOINT)):
                print "Bcast:%s" % ethtool.get_broadcast(device),
        print '''  Mask:%s
          %s
''' % (netmask, flags2str(flags))
github uyuni-project / uyuni / client / debian / packages-already-in-debian / rhn-client-tools / src / up2date_client / hardware.py View on Github external
if interface == 'lo':
                module = "loopback"
            else:
                module = "Unknown"
        try:
            ipaddr = ethtool.get_ipaddr(interface)
        except:
            ipaddr = ""

        try:
            netmask = ethtool.get_netmask(interface)
        except:
            netmask = ""

        try:
            broadcast = ethtool.get_broadcast(interface)
        except:
            broadcast = ""

        ip6_list = []
        dev_info = ethtool.get_interfaces_info(interface)
        for info in dev_info:
            # one interface may have more IPv6 addresses
            for ip6 in info.get_ipv6_addresses():
                scope = ip6.scope
                if scope == 'global':
                    scope = 'universe'
                ip6_list.append({
                    'scope':   scope,
                    'addr':    ip6.address,
                    'netmask': ip6.netmask
                })