This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
patch to fix IPv6 link local addressing
- From: Ken Cox <jkc at redhat dot com>
- To: ecos-patches at sources dot redhat dot com
- Date: Fri, 26 Jul 2002 07:29:56 -0500 (CDT)
- Subject: patch to fix IPv6 link local addressing
- Reply-to: Ken Cox <jkc at redhat dot com>
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.
--- net/common/current/src/dhcp_prot.c.orig Fri Jul 26 07:12:07 2002
+++ net/common/current/src/dhcp_prot.c Thu Jul 25 14:50:43 2002
@@ -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 @@
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 */
--
Ken Cox
Communications Software Consultant
Red Hat, Inc.
4900 Corporate Dr.
Suite L
Huntsville, AL. 35805
(256) 217-0142
(256) 837-0057 (fax)