示例#1
0
文件: __init__.py 项目: xin49/vdsm
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)
示例#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)
示例#3
0
文件: __init__.py 项目: nirs/vdsm
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)
示例#4
0
文件: address.py 项目: EdDev/vdsm
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)
示例#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
示例#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
示例#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)
示例#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)
示例#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))
示例#10
0
文件: netinfo_test.py 项目: nirs/vdsm
 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))
示例#11
0
文件: ifcfg.py 项目: 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)
示例#12
0
 def test_local_auto_when_ipv6_is_disabled(self, nic0):
     sysctl.disable_ipv6(nic0)
     assert not addresses.is_ipv6_local_auto(nic0)
示例#13
0
文件: __init__.py 项目: xin49/vdsm
def disable_ipv6(iface):
    if ipv6_supported():
        sysctl.disable_ipv6(iface)
示例#14
0
文件: __init__.py 项目: nirs/vdsm
def disable_ipv6(iface):
    if ipv6_supported():
        sysctl.disable_ipv6(iface)