Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet6 better sync with latest kame (cosmetic only).



details:   https://anonhg.NetBSD.org/src/rev/5500e559a7fa
branches:  trunk
changeset: 484999:5500e559a7fa
user:      itojun <itojun%NetBSD.org@localhost>
date:      Sun Apr 16 15:00:56 2000 +0000

description:
better sync with latest kame (cosmetic only).

diffstat:

 sys/netinet6/in6.c          |  27 +++++++++-------------
 sys/netinet6/in6_ifattach.c |  20 +++++++++++------
 sys/netinet6/in6_var.h      |  12 +++++-----
 sys/netinet6/nd6.c          |  52 +++++++++++++++++++++++++-------------------
 sys/netinet6/nd6.h          |   8 +++---
 5 files changed, 63 insertions(+), 56 deletions(-)

diffs (truncated from 415 to 300 lines):

diff -r 2c73bab5c9b4 -r 5500e559a7fa sys/netinet6/in6.c
--- a/sys/netinet6/in6.c        Sun Apr 16 14:44:03 2000 +0000
+++ b/sys/netinet6/in6.c        Sun Apr 16 15:00:56 2000 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: in6.c,v 1.29 2000/04/12 10:36:44 itojun Exp $  */
-/*     $KAME: in6.c,v 1.63 2000/03/21 05:18:38 itojun Exp $    */
+/*     $NetBSD: in6.c,v 1.30 2000/04/16 15:00:56 itojun Exp $  */
+/*     $KAME: in6.c,v 1.75 2000/04/12 03:51:29 itojun Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -325,7 +325,7 @@
        struct  in6_aliasreq *ifra = (struct in6_aliasreq *)data;
        struct  sockaddr_in6 oldaddr;
 #ifdef COMPAT_IN6IFIOCTL
-       struct sockaddr_in6 net;
+       struct  sockaddr_in6 net;
 #endif
        int error = 0, hostIsNew, prefixIsNew;
        int newifaddr;
@@ -412,8 +412,7 @@
                                /* interface ID is not embedded by the user */
                                sa6->sin6_addr.s6_addr16[1] =
                                        htons(ifp->if_index);
-                       }
-                       else if (sa6->sin6_addr.s6_addr16[1] !=
+                       } else if (sa6->sin6_addr.s6_addr16[1] !=
                                    htons(ifp->if_index)) {
                                return(EINVAL); /* ifid is contradict */
                        }
@@ -450,7 +449,7 @@
                 * on a single interface, SIOCSIFxxx ioctls are not suitable
                 * and should be unused.
                 */
-#endif 
+#endif
                if (ifra->ifra_addr.sin6_family != AF_INET6)
                        return(EAFNOSUPPORT);
                if (!privileged)
@@ -461,7 +460,6 @@
                        if (ia == NULL)
                                return (ENOBUFS);
                        bzero((caddr_t)ia, sizeof(*ia));
-
                        /* Initialize the address and masks */
                        ia->ia_ifa.ifa_addr = (struct sockaddr *)&ia->ia_addr;
                        ia->ia_addr.sin6_family = AF_INET6;
@@ -601,8 +599,7 @@
                                /* interface ID is not embedded by the user */
                                ia->ia_dstaddr.sin6_addr.s6_addr16[1]
                                        = htons(ifp->if_index);
-                       }
-                       else if (ia->ia_dstaddr.sin6_addr.s6_addr16[1] !=
+                       } else if (ia->ia_dstaddr.sin6_addr.s6_addr16[1] !=
                                    htons(ifp->if_index)) {
                                ia->ia_dstaddr = oldaddr;
                                return(EINVAL); /* ifid is contradict */
@@ -623,7 +620,7 @@
                }
                break;
 
-#endif 
+#endif
        case SIOCGIFALIFETIME_IN6:
                ifr->ifr_ifru.ifru_lifetime = ia->ia6_lifetime;
                break;
@@ -698,7 +695,7 @@
                                ia->ia_prefixmask.sin6_addr.s6_addr32[3];
                ia->ia_net = net;
                break;
-#endif 
+#endif
 
        case SIOCAIFADDR_IN6:
                prefixIsNew = 0;
@@ -1309,8 +1306,7 @@
 
                if (mk->mk_head.lh_first != NULL) {
                        LIST_INSERT_HEAD(&in6_mk, mk, mk_entry);
-               }
-               else {
+               } else {
                        FREE(mk, M_IPMADDR);
                }
        }
@@ -1335,7 +1331,7 @@
                        for (in6m = mk->mk_head.lh_first; in6m; in6m = next){
                                next = in6m->in6m_entry.le_next;
                                in6m->in6m_ia = ia;
-                               IFAREF(&ia->ia_ifa);    /* gain a reference */
+                               IFAREF(&ia->ia_ifa);
                                LIST_INSERT_HEAD(&ia->ia6_multiaddrs,
                                                 in6m, in6m_entry);
                        }
@@ -1772,7 +1768,7 @@
        register struct ifnet *oifp;
        register struct in6_addr *dst;
 {
-       int dst_scope = in6_addrscope(dst), src_scope, best_scope;
+       int dst_scope = in6_addrscope(dst), src_scope, best_scope = 0;
        int blen = -1;
        struct ifaddr *ifa;
        struct ifnet *ifp;
@@ -2113,7 +2109,6 @@
        /*
         * special cases, like 6to4, are handled in in6_ifattach
         */
-
        in6_ifattach(ifp, NULL);
 
        dad_delay = 0;
diff -r 2c73bab5c9b4 -r 5500e559a7fa sys/netinet6/in6_ifattach.c
--- a/sys/netinet6/in6_ifattach.c       Sun Apr 16 14:44:03 2000 +0000
+++ b/sys/netinet6/in6_ifattach.c       Sun Apr 16 15:00:56 2000 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: in6_ifattach.c,v 1.26 2000/04/13 16:21:25 itojun Exp $ */
-/*     $KAME: in6_ifattach.c,v 1.48 2000/04/12 03:51:29 itojun Exp $   */
+/*     $NetBSD: in6_ifattach.c,v 1.27 2000/04/16 15:00:57 itojun Exp $ */
+/*     $KAME: in6_ifattach.c,v 1.53 2000/04/16 14:01:42 itojun Exp $   */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -201,6 +201,9 @@
                bzero(&in6->s6_addr[8], 8);
                in6->s6_addr[15] = addr[0];
 
+               /*
+                * due to insufficient bitwidth, we mark it local.
+                */
                in6->s6_addr[8] &= ~EUI64_GBIT; /* g bit to "individual" */
                in6->s6_addr[8] |= EUI64_UBIT;  /* u bit to "local" */
                break;
@@ -210,9 +213,10 @@
        case IFT_STF:
 #endif
                /*
-                * mech-05/6to4-05: use IPv4 address as ifid source.
-                * the specification does not survive IPv4 renumbering.
-                * I'd rather not implement it, or make it optional (itojun).
+                * mech-06 says: "SHOULD use IPv4 address as ifid source".
+                * however, IPv4 address is not very suitable as unique
+                * identifier source (can be renumbered).
+                * we don't do this.
                 */
                return -1;
 
@@ -277,6 +281,7 @@
                        continue;
                if (get_hw_ifid(ifp, in6) != 0)
                        continue;
+
                /*
                 * to borrow ifid from other interface, ifid needs to be
                 * globally unique
@@ -342,7 +347,7 @@
         * link the interface address to global list
         */
        TAILQ_INSERT_TAIL(&ifp->if_addrlist, (struct ifaddr *)ia, ifa_list);
-       ia->ia_ifa.ifa_refcnt++;
+       IFAREF(&ia->ia_ifa);
 
        /*
         * Also link into the IPv6 address chain beginning with in6_ifaddr.
@@ -354,7 +359,7 @@
                oia->ia_next = ia;
        } else
                in6_ifaddr = ia;
-       ia->ia_ifa.ifa_refcnt++;
+       IFAREF(&ia->ia_ifa);
 
        /*
         * give the interface a chance to initialize, in case this
@@ -390,6 +395,7 @@
        }
 
        /* configure link-layer address resolution */
+       rtflag = 0;
        if (IN6_ARE_ADDR_EQUAL(&ia->ia_prefixmask.sin6_addr, &in6mask128))
                rtflag = RTF_HOST;
        else {
diff -r 2c73bab5c9b4 -r 5500e559a7fa sys/netinet6/in6_var.h
--- a/sys/netinet6/in6_var.h    Sun Apr 16 14:44:03 2000 +0000
+++ b/sys/netinet6/in6_var.h    Sun Apr 16 15:00:56 2000 +0000
@@ -1,10 +1,10 @@
-/*     $NetBSD: in6_var.h,v 1.14 2000/03/24 04:09:05 itojun Exp $      */
-/*     $KAME: in6_var.h,v 1.29 2000/02/25 05:20:58 itojun Exp $        */
+/*     $NetBSD: in6_var.h,v 1.15 2000/04/16 15:00:57 itojun Exp $      */
+/*     $KAME: in6_var.h,v 1.31 2000/03/25 07:23:46 sumikawa Exp $      */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -16,7 +16,7 @@
  * 3. Neither the name of the project nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -189,7 +189,7 @@
        u_quad_t ifs6_in_mlddone;
 
        /*
-        * Output statistics. We should solve unresolved routing problem...  
+        * Output statistics. We should solve unresolved routing problem...
         */
        /* ipv6IfIcmpOutMsgs, total # of output messages */
        u_quad_t ifs6_out_msg;
@@ -365,7 +365,7 @@
  */
 #define SIOCSIFDSTADDR_IN6      _IOW('i', 14, struct in6_ifreq)
 #define SIOCSIFNETMASK_IN6      _IOW('i', 22, struct in6_ifreq)
-#endif 
+#endif
 
 #define SIOCGIFDSTADDR_IN6     _IOWR('i', 34, struct in6_ifreq)
 #define SIOCGIFNETMASK_IN6     _IOWR('i', 37, struct in6_ifreq)
diff -r 2c73bab5c9b4 -r 5500e559a7fa sys/netinet6/nd6.c
--- a/sys/netinet6/nd6.c        Sun Apr 16 14:44:03 2000 +0000
+++ b/sys/netinet6/nd6.c        Sun Apr 16 15:00:56 2000 +0000
@@ -1,10 +1,10 @@
-/*     $NetBSD: nd6.c,v 1.24 2000/04/13 16:27:00 itojun Exp $  */
-/*     $KAME: nd6.c,v 1.41 2000/02/24 16:34:50 itojun Exp $    */
+/*     $NetBSD: nd6.c,v 1.25 2000/04/16 15:00:57 itojun Exp $  */
+/*     $KAME: nd6.c,v 1.55 2000/04/16 14:08:30 itojun Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -16,7 +16,7 @@
  * 3. Neither the name of the project nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -348,7 +348,7 @@
                         * Unknown options must be silently ignored,
                         * to accomodate future extension to the protocol.
                         */
-                       log(LOG_INFO,
+                       log(LOG_DEBUG,
                            "nd6_options: unsupported option %d - "
                            "option ignored\n", nd_opt->nd_opt_type);
                }
@@ -411,6 +411,9 @@
                /* sanity check */
                if (!rt)
                        panic("rt=0 in nd6_timer(ln=%p)\n", ln);
+               if (rt->rt_llinfo && (struct llinfo_nd6 *)rt->rt_llinfo != ln)
+                       panic("rt_llinfo(%p) is not equal to ln(%p)\n",
+                             rt->rt_llinfo, ln);
                if (!dst)
                        panic("dst=0 in nd6_timer(ln=%p)\n", ln);
 
@@ -446,7 +449,7 @@
                        if (ln->ln_expire)
                                ln->ln_state = ND6_LLINFO_STALE;
                        break;
-               /* 
+               /*
                 * ND6_LLINFO_STALE state requires nothing for timer
                 * routine.
                 */
@@ -648,7 +651,7 @@
        if (rt && (rt->rt_flags & RTF_LLINFO) == 0) {
                /*
                 * This is the case for the default route.
-                * If we want to create a neighbor cache for the address, we 
+                * If we want to create a neighbor cache for the address, we
                 * should free the route for the destination and allocate an
                 * interface route.
                 */
@@ -659,6 +662,8 @@
        }
        if (!rt) {
                if (create && ifp) {
+                       int e;
+
                        /*
                         * If no route is available and create is set,
                         * we allocate a host route for the destination
@@ -675,17 +680,19 @@
                         * Create a new route. RTF_LLINFO is necessary
                         * to create a Neighbor Cache entry for the
                         * destination in nd6_rtrequest which will be



Home | Main Index | Thread Index | Old Index