def add(iface, ipv4, ipv6): if ipv4: _add_ipv4_address(iface, ipv4) if ipv6: if sysctl.is_disabled_ipv6(iface): sysctl.enable_ipv6(iface) _add_ipv6_address(iface, ipv6) elif ipv6_supported(): sysctl.disable_ipv6(iface)
def add(iface, ipv4, ipv6): if ipv4: _add_ipv4_address(iface, ipv4) if ipv6: sysctl.enable_ipv6(iface) flush(iface, family=6) _add_ipv6_address(iface, ipv6) elif ipv6_supported(): sysctl.disable_ipv6(iface)
def add(iface, ipv4, ipv6): if ipv4: _add_ipv4_address(iface, ipv4) if ipv6: if sysctl.is_disabled_ipv6(iface): sysctl.enable_ipv6(iface) _add_ipv6_address(iface, ipv6) elif ipv6_supported(): sysctl.disable_ipv6(iface)
def add(iface, ipv4, ipv6): if ipv4: _add_ipv4_address(iface, ipv4) if ipv6: sysctl.enable_ipv6(iface) flush(iface, family=6) _add_ipv6_address(iface, ipv6) elif ipv6_supported(): sysctl.disable_ipv6(iface)
def _restore_disable_ipv6(): """ Disable IPv6 on networks with no IPv6 configuration. This must be done even before actual restoration is performed because there is probably going to be a link-local address already (or "worse", initscripts may have acquired a global address through autoconfiguration) and thus the network's state would differ from the persisted config, causing needless restoration. This is implemented for unified persistence only. """ for filename in _owned_ifcfg_files(): device = _ifcfg_dev_name(filename) if not _ipv6_ifcfg(device): try: sysctl.disable_ipv6(device) except IOError as e: if e.errno == errno.ENOENT: pass # the network is broken, but we have to handle it else: raise
def _restore_disable_ipv6(): """ Disable IPv6 on networks with no IPv6 configuration. This must be done even before actual restoration is performed because there is probably going to be a link-local address already (or "worse", initscripts may have acquired a global address through autoconfiguration) and thus the network's state would differ from the persisted config, causing needless restoration. This is implemented for unified persistence only. """ for filename in _owned_ifcfg_files(): device = _ifcfg_dev_name(filename) if not _ipv6_ifcfg(device): try: sysctl.disable_ipv6(device) except IOError as e: if e.errno == errno.ENOENT: pass # the network is broken, but we have to handle it else: raise
def testGetRouteDeviceTo(self): with dummyIf(1) as nics: nic, = nics addrAdd(nic, IP_ADDRESS, IP_CIDR) try: linkSet(nic, ['up']) self.assertEqual(getRouteDeviceTo(IP_ADDRESS_IN_NETWORK), nic) finally: addrFlush(nic) sysctl.disable_ipv6(nic, False) addrAdd(nic, IPv6_ADDRESS, IPv6_CIDR, family=6) try: linkSet(nic, ['up']) self.assertEqual(getRouteDeviceTo(IPv6_ADDRESS_IN_NETWORK), nic) finally: addrFlush(nic)
def _enable_ipv6(device_name, enable=True): # In broken networks, the device (and thus its sysctl node) may be missing. with _ignore_missing_device(device_name, enable): sysctl.disable_ipv6(device_name, disable=not enable)
def test_local_auto_when_ipv6_is_disabled(self): with dummy_device() as dev: sysctl.disable_ipv6(dev) self.assertFalse(addresses.is_ipv6_local_auto(dev))
def test_local_auto_when_ipv6_is_disabled(self): with dummy_device() as dev: sysctl.disable_ipv6(dev) self.assertFalse(addresses.is_ipv6_local_auto(dev))
def _enable_ipv6(device_name, enable=True): # In broken networks, the device (and thus its sysctl node) may be missing. with _ignore_missing_device(device_name, enable): sysctl.disable_ipv6(device_name, disable=not enable)
def test_local_auto_when_ipv6_is_disabled(self, nic0): sysctl.disable_ipv6(nic0) assert not addresses.is_ipv6_local_auto(nic0)
def disable_ipv6(iface): if ipv6_supported(): sysctl.disable_ipv6(iface)
def disable_ipv6(iface): if ipv6_supported(): sysctl.disable_ipv6(iface)