Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet6 to sync with kame better, (1) remove register d...



details:   https://anonhg.NetBSD.org/src/rev/b0bc6f40b5ed
branches:  trunk
changeset: 503602:b0bc6f40b5ed
user:      itojun <itojun%NetBSD.org@localhost>
date:      Sat Feb 10 04:14:26 2001 +0000

description:
to sync with kame better, (1) remove register declaration for variables,
(2) sync whitespaces, (3) update comments. (4) bring in some of portability
and logging enhancements.  no functional changes here.

diffstat:

 sys/netinet6/frag6.c       |   17 +-
 sys/netinet6/icmp6.c       |  115 ++++++++++--------
 sys/netinet6/in6.c         |   57 ++++----
 sys/netinet6/in6_cksum.c   |   10 +-
 sys/netinet6/in6_pcb.c     |   14 +-
 sys/netinet6/in6_prefix.c  |   10 +-
 sys/netinet6/in6_prefix.h  |    7 +-
 sys/netinet6/in6_var.h     |    8 +-
 sys/netinet6/ip6_forward.c |   30 +----
 sys/netinet6/ip6_input.c   |  274 +++++++++++++++++++++-----------------------
 sys/netinet6/ip6_output.c  |   41 +++---
 sys/netinet6/ip6protosw.h  |    4 +-
 sys/netinet6/mld6.c        |   43 +++---
 sys/netinet6/mld6_var.h    |   11 +-
 sys/netinet6/nd6.c         |   28 ++--
 sys/netinet6/pim6.h        |    9 +-
 sys/netinet6/pim6_var.h    |    9 +-
 sys/netinet6/raw_ip6.c     |    5 +-
 sys/netinet6/route6.c      |   67 ++++++----
 sys/netinet6/udp6.h        |    7 +-
 sys/netinet6/udp6_usrreq.c |   16 +-
 21 files changed, 391 insertions(+), 391 deletions(-)

diffs (truncated from 1741 to 300 lines):

diff -r 54b1226b6e69 -r b0bc6f40b5ed sys/netinet6/frag6.c
--- a/sys/netinet6/frag6.c      Sat Feb 10 03:06:39 2001 +0000
+++ b/sys/netinet6/frag6.c      Sat Feb 10 04:14:26 2001 +0000
@@ -1,9 +1,10 @@
-/*     $NetBSD: frag6.c,v 1.10 2000/02/06 12:49:42 itojun Exp $        */
+/*     $NetBSD: frag6.c,v 1.11 2001/02/10 04:14:26 itojun Exp $        */
+/*     $KAME: frag6.c,v 1.28 2000/12/12 10:54:06 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:
@@ -15,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
@@ -103,7 +104,7 @@
  *     the Fragmentable Part of the original packet.
  *             -> next header field is same for all fragments
  *
- * reassembly rule (p21): 
+ * reassembly rule (p21):
  *     The Next Header field of the last header of the Unfragmentable
  *     Part is obtained from the Next Header field of the first
  *     fragment's Fragment header.
@@ -186,7 +187,7 @@
 
        /*
         * check whether fragment packet's fragment length is
-        * multiple of 8 octets. 
+        * multiple of 8 octets.
         * sizeof(struct ip6_frag) == 8
         * sizeof(struct ip6_hdr) = 40
         */
@@ -220,7 +221,7 @@
 
                /*
                 * Enforce upper bound on number of fragmented packets
-                * for which we attempt reassembly; 
+                * for which we attempt reassembly;
                 * If maxfrag is 0, never accept fragments.
                 * If maxfrag is -1, accept all fragments without limitation.
                 */
@@ -594,7 +595,7 @@
        af6->ip6af_down->ip6af_up = af6->ip6af_up;
 }
 
-void 
+void
 frag6_insque(new, old)
        struct ip6q *new, *old;
 {
@@ -613,7 +614,7 @@
 }
 
 /*
- * IP timer processing;
+ * IPv6 reassembling timer processing;
  * if a timer expires on a reassembly
  * queue, discard it.
  */
diff -r 54b1226b6e69 -r b0bc6f40b5ed sys/netinet6/icmp6.c
--- a/sys/netinet6/icmp6.c      Sat Feb 10 03:06:39 2001 +0000
+++ b/sys/netinet6/icmp6.c      Sat Feb 10 04:14:26 2001 +0000
@@ -175,7 +175,7 @@
        struct icmp6errstat *stat;
        int type, code;
 {
-       switch(type) {
+       switch (type) {
        case ICMP6_DST_UNREACH:
                switch (code) {
                case ICMP6_DST_UNREACH_NOROUTE:
@@ -199,7 +199,7 @@
                stat->icp6errs_packet_too_big++;
                return;
        case ICMP6_TIME_EXCEEDED:
-               switch(code) {
+               switch (code) {
                case ICMP6_TIME_EXCEED_TRANSIT:
                        stat->icp6errs_time_exceed_transit++;
                        return;
@@ -209,7 +209,7 @@
                }
                break;
        case ICMP6_PARAM_PROB:
-               switch(code) {
+               switch (code) {
                case ICMP6_PARAMPROB_HEADER:
                        stat->icp6errs_paramprob_header++;
                        return;
@@ -879,7 +879,7 @@
                while (1) { /* XXX: should avoid inf. loop explicitly? */
                        struct ip6_ext *eh;
 
-                       switch(nxt) {
+                       switch (nxt) {
                        case IPPROTO_HOPOPTS:
                        case IPPROTO_DSTOPTS:
                        case IPPROTO_AH:
@@ -1595,7 +1595,7 @@
        int niflags = ni6->ni_flags;
 
        if ((niflags & NI_NODEADDR_FLAG_ALL) == 0) {
-               switch(ni6->ni_code) {
+               switch (ni6->ni_code) {
                case ICMP6_NI_SUBJ_IPV6:
                        if (subj == NULL) /* must be impossible... */
                                return(0);
@@ -1636,7 +1636,7 @@
                         */
 
                        /* What do we have to do about ::1? */
-                       switch(in6_addrscope(&ifa6->ia_addr.sin6_addr)) {
+                       switch (in6_addrscope(&ifa6->ia_addr.sin6_addr)) {
                        case IPV6_ADDR_SCOPE_LINKLOCAL:
                                if ((niflags & NI_NODEADDR_FLAG_LINKLOCAL) == 0)
                                        continue;
@@ -1722,7 +1722,7 @@
                                continue; /* we now collect deprecated addrs */
 
                        /* What do we have to do about ::1? */
-                       switch(in6_addrscope(&ifa6->ia_addr.sin6_addr)) {
+                       switch (in6_addrscope(&ifa6->ia_addr.sin6_addr)) {
                        case IPV6_ADDR_SCOPE_LINKLOCAL:
                                if ((niflags & NI_NODEADDR_FLAG_LINKLOCAL) == 0)
                                        continue;
@@ -2649,64 +2649,73 @@
        int level, optname;
        struct mbuf **mp;
 {
-       register struct in6pcb *in6p = sotoin6pcb(so);
-       register struct mbuf *m = *mp;
        int error = 0;
+       int optlen;
+       struct in6pcb *in6p = sotoin6pcb(so);
+       struct mbuf *m = *mp;
+
+       optlen = m ? m->m_len : 0;
 
        if (level != IPPROTO_ICMPV6) {
-               error = EINVAL;
                if (op == PRCO_SETOPT && m)
                        (void)m_free(m);
-       } else switch(op) {
-        case PRCO_SETOPT:
-                switch (optname) {
-                 case ICMP6_FILTER:
-                 {
-                         struct icmp6_filter *p;
+               return EINVAL;
+       }
+
+       switch (op) {
+       case PRCO_SETOPT:
+               switch (optname) {
+               case ICMP6_FILTER:
+                   {
+                       struct icmp6_filter *p;
 
-                         p = mtod(m, struct icmp6_filter *);
-                         if (!p || !in6p->in6p_icmp6filt) {
-                                 error = EINVAL;
-                                 break;
-                         }
-                         bcopy(p, in6p->in6p_icmp6filt,
+                       if (optlen != sizeof(*p)) {
+                               error = EMSGSIZE;
+                               break;
+                       }
+                       p = mtod(m, struct icmp6_filter *);
+                       if (!p || !in6p->in6p_icmp6filt) {
+                               error = EINVAL;
+                               break;
+                       }
+                       bcopy(p, in6p->in6p_icmp6filt,
                                sizeof(struct icmp6_filter));
-                         error = 0;
-                         break;
-                 }
+                       error = 0;
+                       break;
+                   }
 
-                 default:
-                         error = ENOPROTOOPT;
-                         break;
-                }
-                if (m)
-                        (void)m_free(m);
-                break;
+               default:
+                       error = ENOPROTOOPT;
+                       break;
+               }
+               if (m)
+                       (void)m_freem(m);
+               break;
 
-        case PRCO_GETOPT:
-                switch (optname) {
-                 case ICMP6_FILTER:
-                 {
-                         struct icmp6_filter *p;
+       case PRCO_GETOPT:
+               switch (optname) {
+               case ICMP6_FILTER:
+                   {
+                       struct icmp6_filter *p;
 
-                         if (!in6p->in6p_icmp6filt) {
-                                 error = EINVAL;
-                                 break;
-                         }
-                         *mp = m = m_get(M_WAIT, MT_SOOPTS);
-                         m->m_len = sizeof(struct icmp6_filter);
-                         p = mtod(m, struct icmp6_filter *);
-                         bcopy(in6p->in6p_icmp6filt, p,
+                       if (!in6p->in6p_icmp6filt) {
+                               error = EINVAL;
+                               break;
+                       }
+                       *mp = m = m_get(M_WAIT, MT_SOOPTS);
+                       m->m_len = sizeof(struct icmp6_filter);
+                       p = mtod(m, struct icmp6_filter *);
+                       bcopy(in6p->in6p_icmp6filt, p,
                                sizeof(struct icmp6_filter));
-                         error = 0;
-                         break;
-                 }
+                       error = 0;
+                       break;
+                   }
 
-                 default:
-                         error = ENOPROTOOPT;
-                         break;
-                }
-                break;
+               default:
+                       error = ENOPROTOOPT;
+                       break;
+               }
+               break;
        }
 
        return(error);
diff -r 54b1226b6e69 -r b0bc6f40b5ed sys/netinet6/in6.c
--- a/sys/netinet6/in6.c        Sat Feb 10 03:06:39 2001 +0000
+++ b/sys/netinet6/in6.c        Sat Feb 10 04:14:26 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6.c,v 1.40 2001/02/07 08:59:48 itojun Exp $  */
+/*     $NetBSD: in6.c,v 1.41 2001/02/10 04:14:27 itojun Exp $  */
 /*     $KAME: in6.c,v 1.107 2000/10/06 04:58:30 itojun Exp $   */
 
 /*
@@ -195,9 +195,9 @@
        /*
         * Make sure rt_ifa be equal to IFA, the second argument of the
         * function.
-        * We need this because when we refer rt_ifa->ia6_flags in ip6_input,
-        * we assume that the rt_ifa points to the address instead of the
-        * loopback address.
+        * We need this because when we refer to rt_ifa->ia6_flags in
+        * ip6_input, we assume that the rt_ifa points to the address instead
+        * of the loopback address.
         */
        if (cmd == RTM_ADD && nrt && ifa != nrt->rt_ifa) {
                IFAFREE(nrt->rt_ifa);
@@ -418,11 +418,11 @@
 
        case SIOCDIFADDR_IN6:
                /*
-                * for IPv4, we look for existing in6_ifaddr here to allow
+                * for IPv4, we look for existing in_ifaddr here to allow
                 * "ifconfig if0 delete" to remove first IPv4 address on the
                 * interface.  For IPv6, as the spec allow multiple interface
                 * address from the day one, we consider "remove the first one"
-                * semantics to be not preferrable.
+                * semantics to be not preferable.
                 */
                if (ia == NULL)
                        return(EADDRNOTAVAIL);
@@ -538,6 +538,10 @@
        case SIOCGIFDSTADDR_IN6:
                if ((ifp->if_flags & IFF_POINTOPOINT) == 0)
                        return(EINVAL);
+               /*
+                * XXX: should we check if ifa_dstaddr is NULL and return
+                * an error?
+                */



Home | Main Index | Thread Index | Old Index