Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet6 - invert u bit on interface id for pseudo inter...



details:   https://anonhg.NetBSD.org/src/rev/1f63cbd130b8
branches:  trunk
changeset: 476067:1f63cbd130b8
user:      itojun <itojun%NetBSD.org@localhost>
date:      Sun Sep 05 01:57:10 1999 +0000

description:
- invert u bit on interface id for pseudo interfaces, as suggested in RFC2373.
- do not perform IPv6 initialization for faith* interface, as they become
  mistakingly IFF_UP.  we are wondering if we should nuke in6_ifattach_p2p().
(sync with recent kame)

diffstat:

 sys/netinet6/in6_ifattach.c |  19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diffs (71 lines):

diff -r 923fce235408 -r 1f63cbd130b8 sys/netinet6/in6_ifattach.c
--- a/sys/netinet6/in6_ifattach.c       Sun Sep 05 01:46:35 1999 +0000
+++ b/sys/netinet6/in6_ifattach.c       Sun Sep 05 01:57:10 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6_ifattach.c,v 1.4 1999/07/10 19:46:10 thorpej Exp $ */
+/*     $NetBSD: in6_ifattach.c,v 1.5 1999/09/05 01:57:10 itojun Exp $  */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -81,7 +81,9 @@
 }
 
 /*
- * find first ifid on list of interfaces.
+ * Find first ifid on list of interfaces.
+ * This is assumed that ifp0's interface token (for example, IEEE802 MAC)
+ * is globally unique.  We may need to have a flag parameter in the future.
  */
 int
 in6_ifattach_getifid(ifp0)
@@ -149,6 +151,10 @@
                        first_ifid[2] & 0xff, first_ifid[3] & 0xff,
                        first_ifid[4] & 0xff, first_ifid[5] & 0xff,
                        first_ifid[6] & 0xff, first_ifid[7] & 0xff);
+
+               /* invert u bit to convert EUI64 to RFC2373 interface ID. */
+               first_ifid[0] ^= 0x02;
+
                return 0;
        } else {
 #ifdef DEBUG
@@ -161,6 +167,8 @@
 /*
  * add link-local address to *pseudo* p2p interfaces.
  * get called when the first MAC address is made available in in6_ifattach().
+ *
+ * XXX I start feeling this as a bad idea. (itojun)
  */
 void
 in6_ifattach_p2p()
@@ -174,10 +182,12 @@
        for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_list.tqe_next) {
                switch (ifp->if_type) {
                case IFT_GIF:
-               case IFT_FAITH:
                        /* pseudo interfaces - safe to initialize here */
                        in6_ifattach(ifp, IN6_IFT_P2P, 0, 0);
                        break;
+               case IFT_FAITH:
+                       /* this mistakingly becomes IFF_UP */
+                       break;
                case IFT_SLIP:
                        /* IPv6 is not supported */
                        break;
@@ -305,8 +315,6 @@
                if (laddr == NULL)
                        break;
                ieee802_to_eui64(&ia->ia_addr.sin6_addr.s6_addr8[8], laddr);
-               /* set global bit */
-               ia->ia_addr.sin6_addr.s6_addr8[8] |= 0x02;
                if (found_first_ifid == 0) {
                        if (in6_ifattach_getifid(ifp) == 0)
                                in6_ifattach_p2p();
@@ -365,7 +373,6 @@
                  (struct rtentry **)0);
        ia->ia_flags |= IFA_ROUTE;
 
-
        if (type == IN6_IFT_P2P || type == IN6_IFT_P2P802) {
                /*
                 * route local address to loopback



Home | Main Index | Thread Index | Old Index