changeset 253:d364b93024e5

From Red Hat - fix problem with IPv6 when using DHCP.
author gthomas
date Fri, 26 Jul 2002 15:06:38 +0000
parents 8ec2d05eea5d
children 8f06eb89a9e3
files packages/net/common/current/ChangeLog packages/net/common/current/src/dhcp_prot.c
diffstat 2 files changed, 38 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/packages/net/common/current/ChangeLog
+++ b/packages/net/common/current/ChangeLog
@@ -1,3 +1,12 @@
+2002-07-26  Gary Thomas  <gary@chez-thomas.org>
+2002-07-26  Ken Cox <jkc@redhat.com>
+
+	* src/dhcp_prot.c: The IPv6 link local address would not be 
+	recognized if configured to use dhcp.  When dhcp reconfigures 
+	the interface after obtaining it's info, it needs to delete 
+	the IPv6 link local address (as well as the IPv4) address before 
+	reconfiguring.
+
 2002-07-10  Gary Thomas  <gary@chez-thomas.org>
 
 	* src/inet_addr.c: 
--- a/packages/net/common/current/src/dhcp_prot.c
+++ b/packages/net/common/current/src/dhcp_prot.c
@@ -42,6 +42,11 @@
 
 #include <cyg/infra/cyg_ass.h>
 
+#ifdef INET6
+#include <net/if_var.h>
+#include <netinet6/in6_var.h>
+#endif
+
 // ------------------------------------------------------------------------
 // Returns a pointer to the end of dhcp message (or NULL if invalid)
 // meaning the address of the byte *after* the TAG_END token in the vendor
@@ -1272,6 +1277,30 @@ do_dhcp_down_net(const char *intf, struc
         perror("SIOCDIFADDR1");
     }
 
+#ifdef INET6
+    {
+      int s6;
+    
+      s6 = socket(AF_INET6, SOCK_DGRAM, 0);
+      if (s6 < 0) {
+        perror("socket AF_INET6");
+        return false;
+      }
+      // Now delete the ipv6 addr
+      strcpy(ifr.ifr_name, intf);
+      if (ioctl(s6, SIOCGLIFADDR, &ifr)) {
+	perror("SIOCGIFADDR_IN6 1");
+	return false;
+      }
+      
+      strcpy(ifr.ifr_name, intf);
+      if (ioctl(s6, SIOCDLIFADDR, &ifr)) { /* delete IF addr */
+        perror("SIOCDIFADDR_IN61");
+      }
+      close(s6);
+    }
+#endif /* IP6 */
+
     // Shut down interface so it can be reinitialized
     ifr.ifr_flags &= ~(IFF_UP | IFF_RUNNING);
     if (ioctl(s, SIOCSIFFLAGS, &ifr)) { /* set ifnet flags */