This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Re: patch to fix IPv6 link local addressing
- From: Gary Thomas <gary at chez-thomas dot org>
- To: Ken Cox <jkc at redhat dot com>
- Cc: eCos patches <ecos-patches at sources dot redhat dot com>
- Date: 26 Jul 2002 09:07:20 -0600
- Subject: Re: patch to fix IPv6 link local addressing
- References: <Pine.LNX.4.44.0207260723080.22931-100000@Bigboy>
On Fri, 2002-07-26 at 06:29, Ken Cox wrote:
> 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.
>
Committed:
Index: net/common/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos-opt/net/net/common/current/ChangeLog,v
retrieving revision 1.8
diff -u -5 -p -r1.8 ChangeLog
--- net/common/current/ChangeLog 10 Jul 2002 15:26:27 -0000 1.8
+++ net/common/current/ChangeLog 26 Jul 2002 15:06:17 -0000
@@ -1,5 +1,14 @@
+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:
* src/getproto.c:
* src/dhcp_prot.c:
Index: net/common/current/src/dhcp_prot.c
===================================================================
RCS file: /misc/cvsfiles/ecos-opt/net/net/common/current/src/dhcp_prot.c,v
retrieving revision 1.5
diff -u -5 -p -r1.5 dhcp_prot.c
--- net/common/current/src/dhcp_prot.c 10 Jul 2002 15:26:28 -0000 1.5
+++ net/common/current/src/dhcp_prot.c 26 Jul 2002 15:04:52 -0000
@@ -40,10 +40,15 @@
#include <dhcp.h>
#include <errno.h>
#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
// data.
@@ -1269,10 +1274,34 @@ do_dhcp_down_net(const char *intf, struc
strcpy(ifr.ifr_name, intf);
if (ioctl(s, SIOCDIFADDR, &ifr)) { /* delete IF addr */
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 */
perror("SIOCSIFFLAGS down");