diff packages/net/common/current/src/dhcp_prot.c @ 253:d364b93024e5

From Red Hat - fix problem with IPv6 when using DHCP.
author gthomas
date Fri, 26 Jul 2002 15:06:38 +0000
parents f9db7cb0692e
children 7c34839e7e97
line wrap: on
line diff
--- 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 */