Hello Ido Barkan, Ollie Armstrong, Dan Kenigsberg, I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/50457 to review the following change. Change subject: config: Resolve crash when IPv6 disabled in kernel ...................................................................... config: Resolve crash when IPv6 disabled in kernel The configuration for creating the management bridge attempts to do some things with IPv6 which causes an uncaught exception when IPv6 is disabled at the kernel level with `ipv6.disable=1`. This patch checks that IPv6 is actually available before attempting to do anything with it. Change-Id: I774cac868ddee08ac072adf2104a811594779052 Bug-Url: https://bugzilla.redhat.com/1277204 Backport-To: 3.6 Signed-off-by: Ollie Armstrong <ol...@fubra.com> Signed-off-by: Ondřej Svoboda <osvob...@redhat.com> Reviewed-on: https://gerrit.ovirt.org/47978 Continuous-Integration: Jenkins CI Reviewed-by: Ido Barkan <ibar...@redhat.com> Reviewed-by: Dan Kenigsberg <dan...@redhat.com> --- M lib/vdsm/netinfo.py M vdsm/network/configurators/ifcfg.py M vdsm/network/configurators/iproute2.py 3 files changed, 14 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/57/50457/1 diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py index f1932ee..fd5b209 100644 --- a/lib/vdsm/netinfo.py +++ b/lib/vdsm/netinfo.py @@ -337,6 +337,18 @@ return ipv4addr, ipv4netmask, ipv4addrs, ipv6addrs +@memoized +def ipv6_supported(): + """ + Check if IPv6 is disabled by kernel arguments (or even compiled out). + """ + try: + socket.socket(socket.AF_INET6, socket.SOCK_DGRAM) + except socket.error: + return False + return True + + def gethwaddr(dev): with open('/sys/class/net/%s/address' % dev) as addr: return addr.read().strip() diff --git a/vdsm/network/configurators/ifcfg.py b/vdsm/network/configurators/ifcfg.py index 3990212..12b0b14 100644 --- a/vdsm/network/configurators/ifcfg.py +++ b/vdsm/network/configurators/ifcfg.py @@ -100,7 +100,7 @@ self._addSourceRoute(bridge) _ifup(bridge) if not bridge.ipv6.address and not bridge.ipv6.ipv6autoconf and ( - not bridge.ipv6.dhcpv6): + not bridge.ipv6.dhcpv6 and netinfo.ipv6_supported()): wait_for_device(bridge.name) sysctl.disable_ipv6(bridge.name) diff --git a/vdsm/network/configurators/iproute2.py b/vdsm/network/configurators/iproute2.py index 4f58fba..ffc69ad 100644 --- a/vdsm/network/configurators/iproute2.py +++ b/vdsm/network/configurators/iproute2.py @@ -76,7 +76,7 @@ DynamicSourceRoute.addInterfaceTracking(bridge) self.configApplier.setIfaceConfigAndUp(bridge) if not bridge.ipv6.address and not bridge.ipv6.ipv6autoconf and ( - not bridge.ipv6.dhcpv6): + not bridge.ipv6.dhcpv6 and netinfo.ipv6_supported()): wait_for_device(bridge.name) sysctl.disable_ipv6(bridge.name) self._addSourceRoute(bridge) -- To view, visit https://gerrit.ovirt.org/50457 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I774cac868ddee08ac072adf2104a811594779052 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: ovirt-3.6 Gerrit-Owner: Ondřej Svoboda <osvob...@redhat.com> Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com> Gerrit-Reviewer: Ido Barkan <ibar...@redhat.com> Gerrit-Reviewer: Ollie Armstrong <ol...@fubra.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches