]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Don't look for IPv6 interfaces on Linux when running in DHCPv4 mode. [RT#18721,19367...
authorPaul Selkirk <pselkirk@isc.org>
Thu, 16 Jul 2009 21:44:55 +0000 (21:44 +0000)
committerPaul Selkirk <pselkirk@isc.org>
Thu, 16 Jul 2009 21:44:55 +0000 (21:44 +0000)
RELNOTES
common/discover.c

index 476c8621819abda4b997d656c2eedccba5721143..b7e516e80e4fff7439edfcacd9b314943d7ce184 100644 (file)
--- 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
index 77a4e7a915efbac76d5030dd34b109a3e69d2e33..c55797654df8aa9b90f726a5ae3c71d3c31b45b6 100644 (file)
@@ -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