From: Paul Selkirk Date: Thu, 16 Jul 2009 21:44:55 +0000 (+0000) Subject: Don't look for IPv6 interfaces on Linux when running in DHCPv4 mode. [RT#18721,19367... X-Git-Tag: v4_2_0a1~58 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3e29af1e7275136115a41b5775c4680085dd4898;p=thirdparty%2Fdhcp.git Don't look for IPv6 interfaces on Linux when running in DHCPv4 mode. [RT#18721,19367,19511] --- diff --git a/RELNOTES b/RELNOTES index 476c86218..b7e516e80 100644 --- a/RELNOTES +++ b/RELNOTES @@ -168,6 +168,9 @@ work on other platforms. Please report any problems and suggested fixes to failover pair could cause the primary to crash on contact with the secondary. Thanks to a patch from Steinar Haug. +- Don't look for IPv6 interfaces on Linux when running in DHCPv4 mode. + Thanks to patches from Matthew Newton and David Cantrell. + Changes since 4.1.0b1 - A missing "else" in dhcrelay.c could have caused an interface not to diff --git a/common/discover.c b/common/discover.c index 77a4e7a91..c55797654 100644 --- a/common/discover.c +++ b/common/discover.c @@ -443,15 +443,17 @@ begin_iface_scan(struct iface_conf_list *ifaces) { } #ifdef DHCPv6 - ifaces->fp6 = fopen("/proc/net/if_inet6", "r"); - if (ifaces->fp6 == NULL) { - log_error("Error opening '/proc/net/if_inet6' to " - "list IPv6 interfaces; %m"); - close(ifaces->sock); - ifaces->sock = -1; - fclose(ifaces->fp); - ifaces->fp = NULL; - return 0; + if (local_family == AF_INET6) { + ifaces->fp6 = fopen("/proc/net/if_inet6", "r"); + if (ifaces->fp6 == NULL) { + log_error("Error opening '/proc/net/if_inet6' to " + "list IPv6 interfaces; %m"); + close(ifaces->sock); + ifaces->sock = -1; + fclose(ifaces->fp); + ifaces->fp = NULL; + return 0; + } } #endif @@ -720,7 +722,8 @@ next_iface(struct iface_info *info, int *err, struct iface_conf_list *ifaces) { } #ifdef DHCPv6 if (!(*err)) { - return next_iface6(info, err, ifaces); + if (local_family == AF_INET6) + return next_iface6(info, err, ifaces); } #endif return 0; @@ -736,8 +739,10 @@ end_iface_scan(struct iface_conf_list *ifaces) { close(ifaces->sock); ifaces->sock = -1; #ifdef DHCPv6 - fclose(ifaces->fp6); - ifaces->fp6 = NULL; + if (local_family == AF_INET6) { + fclose(ifaces->fp6); + ifaces->fp6 = NULL; + } #endif } #else