Example #1
0
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)
Example #2
0
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)
Example #3
0
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)
Example #4
0
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)
Example #5
0
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
Example #6
0
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
Example #7
0
    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)
Example #8
0
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)
Example #9
0
 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))
Example #10
0
 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))
Example #11
0
File: ifcfg.py Project: EdDev/vdsm
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)
Example #12
0
 def test_local_auto_when_ipv6_is_disabled(self, nic0):
     sysctl.disable_ipv6(nic0)
     assert not addresses.is_ipv6_local_auto(nic0)
Example #13
0
def disable_ipv6(iface):
    if ipv6_supported():
        sysctl.disable_ipv6(iface)
Example #14
0
def disable_ipv6(iface):
    if ipv6_supported():
        sysctl.disable_ipv6(iface)