diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2001-12-07 09:16:08 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2001-12-07 09:16:08 +0000 |
commit | d3d53550233ff51d54223f0038313c8832f83f95 (patch) | |
tree | c803d146a9266ff26b4738b2ceda528b0046b5be /sys | |
parent | 682a9f58ff9b22f31d9c8a39ef0588efb6dc8b6f (diff) |
whitespace/comment sync with kame
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet6/icmp6.c | 87 | ||||
-rw-r--r-- | sys/netinet6/in6.c | 21 | ||||
-rw-r--r-- | sys/netinet6/in6.h | 25 | ||||
-rw-r--r-- | sys/netinet6/in6_gif.c | 6 | ||||
-rw-r--r-- | sys/netinet6/in6_ifattach.c | 8 | ||||
-rw-r--r-- | sys/netinet6/ip6_forward.c | 5 | ||||
-rw-r--r-- | sys/netinet6/ip6_input.c | 27 | ||||
-rw-r--r-- | sys/netinet6/ip6_mroute.c | 10 | ||||
-rw-r--r-- | sys/netinet6/ip6_output.c | 18 | ||||
-rw-r--r-- | sys/netinet6/mld6.c | 5 | ||||
-rw-r--r-- | sys/netinet6/nd6.c | 53 | ||||
-rw-r--r-- | sys/netinet6/nd6_nbr.c | 16 | ||||
-rw-r--r-- | sys/netinet6/nd6_rtr.c | 4 | ||||
-rw-r--r-- | sys/netinet6/raw_ip6.c | 14 |
14 files changed, 149 insertions, 150 deletions
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 9f6345d9ab0..1f6c0b237f4 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: icmp6.c,v 1.49 2001/12/06 04:19:25 itojun Exp $ */ +/* $OpenBSD: icmp6.c,v 1.50 2001/12/07 09:16:07 itojun Exp $ */ /* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */ /* @@ -119,7 +119,7 @@ #define in6_rtchange in_rtchange /* - * for KAME src sync over BSD*'s. XXX: FreeBSD (>=3) are VERY different from + * for KAME src sync over BSD*'s. XXX: FreeBSD (>=3) are VERY different from * others... */ #define in6p_ip6_nxt inp_ipv6.ip6_nxt @@ -300,9 +300,15 @@ icmp6_error(m, type, code, param) oip6 = mtod(m, struct ip6_hdr *); /* - * Multicast destination check. For unrecognized option errors, - * this check has already done in ip6_unknown_opt(), so we can - * check only for other errors. + * If the destination address of the erroneous packet is a multicast + * address, or the packet was sent using link-layer multicast, + * we should basically suppress sending an error (RFC 2463, Section + * 2.4). + * We have two exceptions (the item e.2 in that section): + * - the Pakcet Too Big message can be sent for path MTU discovery. + * - the Parameter Problem Message that can be allowed an icmp6 error + * in the option type field. This check has been done in + * ip6_unknown_opt(), so we can just check the type and code. */ if ((m->m_flags & (M_BCAST|M_MCAST) || IN6_IS_ADDR_MULTICAST(&oip6->ip6_dst)) && @@ -311,7 +317,10 @@ icmp6_error(m, type, code, param) code != ICMP6_PARAMPROB_OPTION))) goto freeit; - /* Source address check. XXX: the case of anycast source? */ + /* + * RFC 2463, 2.4 (e.5): source address check. + * XXX: the case of anycast source? + */ if (IN6_IS_ADDR_UNSPECIFIED(&oip6->ip6_src) || IN6_IS_ADDR_MULTICAST(&oip6->ip6_src)) goto freeit; @@ -348,7 +357,8 @@ icmp6_error(m, type, code, param) } else { /* ICMPv6 informational - send the error */ } - } else { + } + else { /* non-ICMPv6 - send the error */ } @@ -400,7 +410,7 @@ icmp6_error(m, type, code, param) m->m_pkthdr.rcvif = NULL; icmp6stat.icp6s_outhist[type]++; - icmp6_reflect(m, sizeof(struct ip6_hdr)); /*header order: IPv6 - ICMPv6*/ + icmp6_reflect(m, sizeof(struct ip6_hdr)); /* header order: IPv6 - ICMPv6 */ return; @@ -428,7 +438,7 @@ icmp6_input(mp, offp, proto) #ifndef PULLDOWN_TEST IP6_EXTHDR_CHECK(m, off, sizeof(struct icmp6_hdr), IPPROTO_DONE); - /* m might change if M_LOOP. So, call mtod after this */ + /* m might change if M_LOOP. So, call mtod after this */ #endif /* @@ -488,7 +498,6 @@ icmp6_input(mp, offp, proto) icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_error); switch (icmp6->icmp6_type) { - case ICMP6_DST_UNREACH: icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_dstunreach); switch (code) { @@ -610,7 +619,7 @@ icmp6_input(mp, offp, proto) noff = sizeof(struct ip6_hdr); n->m_len = noff + sizeof(struct icmp6_hdr); /* - * Adjust mbuf. ip6_plen will be adjusted in + * Adjust mbuf. ip6_plen will be adjusted in * ip6_output(). * n->m_pkthdr.len == n0->m_pkthdr.len at this point. */ @@ -664,7 +673,7 @@ icmp6_input(mp, offp, proto) case MLD6_MTRACE_RESP: case MLD6_MTRACE: - /* XXX: these two are experimental. not officially defind. */ + /* XXX: these two are experimental. not officially defined. */ /* XXX: per-interface statistics? */ break; /* just pass it to applications */ @@ -731,7 +740,7 @@ icmp6_input(mp, offp, proto) bcopy(icmp6, nicmp6, sizeof(struct icmp6_hdr)); p = (u_char *)(nicmp6 + 1); bzero(p, 4); - bcopy(hostname, p + 4, maxhlen); /*meaningless TTL*/ + bcopy(hostname, p + 4, maxhlen); /* meaningless TTL */ noff = sizeof(struct ip6_hdr); M_DUP_PKTHDR(n, m); /* just for rcvif */ n->m_pkthdr.len = n->m_len = sizeof(struct ip6_hdr) + @@ -924,7 +933,7 @@ icmp6_notify_error(m, off, icmp6len, code) struct ip6_rthdr0 *rth0; int rthlen; - while (1) { /* XXX: should avoid inf. loop explicitly? */ + while (1) { /* XXX: should avoid infinite loop explicitly? */ struct ip6_ext *eh; switch (nxt) { @@ -1038,7 +1047,7 @@ icmp6_notify_error(m, off, icmp6len, code) default: /* * This case includes ESP and the No Next - * Header. In such cases going to the notify + * Header. In such cases going to the notify * label does not have any meaning * (i.e. ctlfunc will be NULL), but we go * anyway since we might have to update @@ -1186,8 +1195,9 @@ icmp6_mtudisc_update(ip6cp, validated) rt->rt_rmx.rmx_mtu = mtu; } } - if (rt) + if (rt) { /* XXX: need braces to avoid conflict with else in RTFREE. */ RTFREE(rt); + } /* * Notify protocols that the MTU for this destination @@ -1270,7 +1280,7 @@ ni6_input(m, off) /* 07 draft */ if (ni6->ni_code == ICMP6_NI_SUBJ_FQDN && subjlen == 0) break; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case NI_QTYPE_FQDN: case NI_QTYPE_NODEADDR: switch (ni6->ni_code) { @@ -1400,7 +1410,7 @@ ni6_input(m, off) default: /* * XXX: We must return a reply with the ICMP6 code - * `unknown Qtype' in this case. However we regard the case + * `unknown Qtype' in this case. However we regard the case * as an FQDN query for backward compatibility. * Older versions set a random value to this field, * so it rarely varies in the defined qtypes. @@ -1594,7 +1604,7 @@ ni6_nametodns(name, namelen, old) } panic("should not reach here"); - /*NOTREACHED*/ + /* NOTREACHED */ fail: if (m) @@ -1746,7 +1756,7 @@ ni6_addrs(ni6, m, ifpp, subj) /* * check if anycast is okay. - * XXX: just experimental. not in the spec. + * XXX: just experimental. not in the spec. */ if ((ifa6->ia6_flags & IN6_IFF_ANYCAST) != 0 && (niflags & NI_NODEADDR_FLAG_ANYCAST) == 0) @@ -1832,7 +1842,7 @@ ni6_store_addrs(ni6, nni6, ifp0, resid) /* * check if anycast is okay. - * XXX: just experimental. not in the spec. + * XXX: just experimental. not in the spec. */ if ((ifa6->ia6_flags & IN6_IFF_ANYCAST) != 0 && (niflags & NI_NODEADDR_FLAG_ANYCAST) == 0) @@ -1864,6 +1874,8 @@ ni6_store_addrs(ni6, nni6, ifp0, resid) * Note that we currently do not support stateful * address configuration by DHCPv6, so the former * case can't happen. + * + * TTL must be 2^31 > TTL >= 0. */ if (ifa6->ia6_lifetime.ia6t_expire == 0) ltime = ND6_INFINITE_LIFETIME; @@ -2095,7 +2107,7 @@ icmp6_reflect(m, off) in6_embedscope(&t, &sa6_dst, NULL, NULL); /* - * If the incoming packet was addressed directly to us(i.e. unicast), + * If the incoming packet was addressed directly to us (i.e. unicast), * use dst as the src for the reply. * The IN6_IFF_NOTREADY case would be VERY rare, but is possible * (for example) when we encounter an error while forwarding procedure @@ -2110,7 +2122,7 @@ icmp6_reflect(m, off) if (ia == NULL && IN6_IS_ADDR_LINKLOCAL(&t) && (m->m_flags & M_LOOP)) { /* * This is the case if the dst is our link-local address - * and the sender is also ourseleves. + * and the sender is also ourselves. */ src = &t; } @@ -2121,13 +2133,14 @@ icmp6_reflect(m, off) /* * This case matches to multicasts, our anycast, or unicasts - * that we do not own. Select a source address based on the + * that we do not own. Select a source address based on the * source address of the erroneous packet. */ bzero(&ro, sizeof(ro)); src = in6_selectsrc(&sa6_src, NULL, NULL, &ro, NULL, &e); - if (ro.ro_rt) + if (ro.ro_rt) { /* XXX: see comments in icmp6_mtudisc_update */ RTFREE(ro.ro_rt); /* XXX: we could use this */ + } if (src == NULL) { nd6log((LOG_DEBUG, "icmp6_reflect: source can't be determined: " @@ -2154,7 +2167,7 @@ icmp6_reflect(m, off) sizeof(struct ip6_hdr), plen); /* - * xxx option handling + * XXX option handling */ m->m_flags &= ~(M_BCAST|M_MCAST); @@ -2349,7 +2362,7 @@ icmp6_redirect_input(m, off) nd6_cache_lladdr(ifp, &redtgt6, lladdr, lladdrlen, ND_REDIRECT, is_onlink ? ND_REDIRECT_ONLINK : ND_REDIRECT_ROUTER); - if (!is_onlink) { /* better router case. perform rtredirect. */ + if (!is_onlink) { /* better router case. perform rtredirect. */ /* perform rtredirect */ struct sockaddr_in6 sdst; struct sockaddr_in6 sgw; @@ -2394,15 +2407,15 @@ icmp6_redirect_input(m, off) } } /* finally update cached route in each socket via pfctlinput */ - { - struct sockaddr_in6 sdst; + { + struct sockaddr_in6 sdst; - bzero(&sdst, sizeof(sdst)); - sdst.sin6_family = AF_INET6; - sdst.sin6_len = sizeof(struct sockaddr_in6); - bcopy(&reddst6, &sdst.sin6_addr, sizeof(struct in6_addr)); - pfctlinput(PRC_REDIRECT_HOST, (struct sockaddr *)&sdst); - } + bzero(&sdst, sizeof(sdst)); + sdst.sin6_family = AF_INET6; + sdst.sin6_len = sizeof(struct sockaddr_in6); + bcopy(&reddst6, &sdst.sin6_addr, sizeof(struct in6_addr)); + pfctlinput(PRC_REDIRECT_HOST, (struct sockaddr *)&sdst); + } freeit: m_freem(m); @@ -2557,7 +2570,7 @@ icmp6_redirect_output(m0, rt) if (!rt_router) goto nolladdropt; len = sizeof(*nd_opt) + ifp->if_addrlen; - len = (len + 7) & ~7; /*round by 8*/ + len = (len + 7) & ~7; /* round by 8 */ /* safety check */ if (len + (p - (u_char *)ip6) > maxlen) goto nolladdropt; @@ -2799,7 +2812,7 @@ icmp6_ratelimit(dst, type, code) { int ret; - ret = 0; /*okay to send*/ + ret = 0; /* okay to send */ /* PPS limit */ if (!ppsratecheck(&icmp6errppslim_last, &icmp6errpps_count, diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 656f98caf7a..6f7961cbeb7 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.29 2001/07/18 12:50:44 itojun Exp $ */ +/* $OpenBSD: in6.c,v 1.30 2001/12/07 09:16:07 itojun Exp $ */ /* $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $ */ /* @@ -178,9 +178,9 @@ in6_ifloop_request(int cmd, struct ifaddr *ifa) /* * 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); @@ -817,6 +817,7 @@ in6_control(so, cmd, data, ifp, p) return(EOPNOTSUPP); return((*ifp->if_ioctl)(ifp, cmd, data)); } + return(0); } @@ -881,7 +882,7 @@ in6_purgeaddr(ifa, ifp) /* * SIOC[GAD]LIFADDR. - * SIOCGLIFADDR: get first address. (???) + * SIOCGLIFADDR: get first address. (?) * SIOCGLIFADDR with IFLR_PREFIX: * get first address that matches the specified prefix. * SIOCALIFADDR: add the specified address. @@ -917,7 +918,7 @@ in6_lifaddr_ioctl(so, cmd, data, ifp, p) /* sanity checks */ if (!data || !ifp) { panic("invalid argument to in6_lifaddr_ioctl"); - /*NOTRECHED*/ + /* NOTREACHED */ } switch (cmd) { @@ -925,7 +926,7 @@ in6_lifaddr_ioctl(so, cmd, data, ifp, p) /* address must be specified on GET with IFLR_PREFIX */ if ((iflr->flags & IFLR_PREFIX) == 0) break; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case SIOCALIFADDR: case SIOCDLIFADDR: /* address must be specified on ADD and DELETE */ @@ -941,10 +942,10 @@ in6_lifaddr_ioctl(so, cmd, data, ifp, p) if (sa->sa_len && sa->sa_len != sizeof(struct sockaddr_in6)) return EINVAL; break; - default: /*shouldn't happen*/ + default: /* shouldn't happen */ #if 0 panic("invalid cmd to in6_lifaddr_ioctl"); - /*NOTREACHED*/ + /* NOTREACHED */ #else return EOPNOTSUPP; #endif @@ -1682,7 +1683,6 @@ in6_addr2scopeid(ifp, addr) * return length of part which dst and src are equal * hard coding... */ - int in6_matchlen(src, dst) struct in6_addr *src, *dst; @@ -2006,7 +2006,6 @@ in6_ifawithscope(oifp, dst) * return the best address out of the same scope. if no address was * found, return the first valid address from designated IF. */ - struct in6_ifaddr * in6_ifawithifp(ifp, dst) struct ifnet *ifp; diff --git a/sys/netinet6/in6.h b/sys/netinet6/in6.h index 61df1e6eaeb..34ae7b0cc16 100644 --- a/sys/netinet6/in6.h +++ b/sys/netinet6/in6.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.h,v 1.24 2001/09/19 10:59:21 itojun Exp $ */ +/* $OpenBSD: in6.h,v 1.25 2001/12/07 09:16:07 itojun Exp $ */ /* $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $ */ /* @@ -126,7 +126,7 @@ struct in6_addr { }; #define s6_addr __u6_addr.__u6_addr8 -#ifdef _KERNEL /*XXX nonstandard*/ +#ifdef _KERNEL /* XXX nonstandard */ #define s6_addr8 __u6_addr.__u6_addr8 #define s6_addr16 __u6_addr.__u6_addr16 #define s6_addr32 __u6_addr.__u6_addr32 @@ -152,7 +152,7 @@ struct sockaddr_in6 { /* * Local definition for masks */ -#ifdef _KERNEL /*XXX nonstandard*/ +#ifdef _KERNEL /* XXX nonstandard */ #define IN6MASK0 {{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}} #define IN6MASK32 {{{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}} @@ -177,7 +177,7 @@ extern const struct in6_addr in6mask128; /* * Macros started with IPV6_ADDR is KAME local */ -#ifdef _KERNEL /*XXX nonstandard*/ +#ifdef _KERNEL /* XXX nonstandard */ #if BYTE_ORDER == BIG_ENDIAN #define IPV6_ADDR_INT32_ONE 1 #define IPV6_ADDR_INT32_TWO 2 @@ -278,7 +278,7 @@ extern const struct in6_addr in6addr_linklocal_allrouters; * KAME Scope Values */ -#ifdef _KERNEL /*XXX nonstandard*/ +#ifdef _KERNEL /* XXX nonstandard */ #define IPV6_ADDR_SCOPE_NODELOCAL 0x01 #define IPV6_ADDR_SCOPE_LINKLOCAL 0x02 #define IPV6_ADDR_SCOPE_SITELOCAL 0x05 @@ -306,7 +306,7 @@ extern const struct in6_addr in6addr_linklocal_allrouters; */ #define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff) -#ifdef _KERNEL /*XXX nonstandard*/ +#ifdef _KERNEL /* XXX nonstandard */ #define IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f) #else #define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f) @@ -315,7 +315,7 @@ extern const struct in6_addr in6addr_linklocal_allrouters; /* * Multicast Scope */ -#ifdef _KERNEL /*refers nonstandard items */ +#ifdef _KERNEL /* refers nonstandard items */ #define IN6_IS_ADDR_MC_NODELOCAL(a) \ (IN6_IS_ADDR_MULTICAST(a) && \ (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_NODELOCAL)) @@ -349,17 +349,10 @@ extern const struct in6_addr in6addr_linklocal_allrouters; (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL)) #endif -/* - * Wildcard Socket - */ -#if 0 /*pre-RFC2553*/ -#define IN6_IS_ADDR_ANY(a) IN6_IS_ADDR_UNSPECIFIED(a) -#endif - +#ifdef _KERNEL /* nonstandard */ /* * KAME Scope */ -#ifdef _KERNEL /*nonstandard*/ #define IN6_IS_SCOPE_LINKLOCAL(a) \ ((IN6_IS_ADDR_LINKLOCAL(a)) || \ (IN6_IS_ADDR_MC_LINKLOCAL(a))) @@ -531,7 +524,7 @@ struct in6_pktinfo { #define IPV6CTL_DAD_COUNT 16 #define IPV6CTL_AUTO_FLOWLABEL 17 #define IPV6CTL_DEFMCASTHLIM 18 -#ifdef notdef /*obsolete*/ +#ifdef notdef /* obsolete */ #define IPV6CTL_GIF_HLIM 19 /* default HLIM for gif encap packet */ #endif #define IPV6CTL_KAME_VERSION 20 diff --git a/sys/netinet6/in6_gif.c b/sys/netinet6/in6_gif.c index 24c30aed2d2..5d151177f0f 100644 --- a/sys/netinet6/in6_gif.c +++ b/sys/netinet6/in6_gif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_gif.c,v 1.18 2001/08/19 06:31:56 angelos Exp $ */ +/* $OpenBSD: in6_gif.c,v 1.19 2001/12/07 09:16:07 itojun Exp $ */ /* $KAME: in6_gif.c,v 1.43 2001/01/22 07:27:17 itojun Exp $ */ /* @@ -30,10 +30,6 @@ * SUCH DAMAGE. */ -/* - * in6_gif.c - */ - #include <sys/param.h> #include <sys/systm.h> #include <sys/socket.h> diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index 7427219bbb3..8d4c0bfd88e 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_ifattach.c,v 1.20 2001/08/23 14:10:33 itojun Exp $ */ +/* $OpenBSD: in6_ifattach.c,v 1.21 2001/12/07 09:16:07 itojun Exp $ */ /* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */ /* @@ -88,7 +88,7 @@ static int in6_ifattach_loopback __P((struct ifnet *)); static int get_rand_ifid(ifp, in6) struct ifnet *ifp; - struct in6_addr *in6; /*upper 64bits are preserved */ + struct in6_addr *in6; /* upper 64bits are preserved */ { MD5_CTX ctxt; u_int8_t digest[16]; @@ -125,7 +125,7 @@ get_rand_ifid(ifp, in6) static int get_hw_ifid(ifp, in6) struct ifnet *ifp; - struct in6_addr *in6; /*upper 64bits are preserved */ + struct in6_addr *in6; /* upper 64bits are preserved */ { struct ifaddr *ifa; struct sockaddr_dl *sdl; @@ -251,7 +251,7 @@ found: static int get_ifid(ifp0, altifp, in6) struct ifnet *ifp0; - struct ifnet *altifp; /*secondary EUI64 source*/ + struct ifnet *altifp; /* secondary EUI64 source */ struct in6_addr *in6; { struct ifnet *ifp; diff --git a/sys/netinet6/ip6_forward.c b/sys/netinet6/ip6_forward.c index ee64e4f054f..3b12d1f32c4 100644 --- a/sys/netinet6/ip6_forward.c +++ b/sys/netinet6/ip6_forward.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_forward.c,v 1.19 2001/11/30 07:59:17 itojun Exp $ */ +/* $OpenBSD: ip6_forward.c,v 1.20 2001/12/07 09:16:07 itojun Exp $ */ /* $KAME: ip6_forward.c,v 1.75 2001/06/29 12:42:13 jinmei Exp $ */ /* @@ -263,7 +263,7 @@ ip6_forward(m, srcrt) break; default: printf("ip6_output (ipsec): error code %d\n", error); - /*fall through*/ + /* fall through */ case ENOENT: /* don't show these error codes to the user */ break; @@ -517,7 +517,6 @@ senderr: #endif if (mcopy == NULL) return; - switch (error) { case 0: #if 1 diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index f368bf86560..a9b5b7449d4 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_input.c,v 1.36 2001/11/26 16:50:26 jasoni Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.37 2001/12/07 09:16:07 itojun Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -299,25 +299,28 @@ ip6_input(m) #endif /* - * Scope check + * Check against address spoofing/corruption. */ if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_src) || IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_dst)) { + /* + * XXX: "badscope" is not very suitable for a multicast source. + */ ip6stat.ip6s_badscope++; in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_addrerr); goto bad; } /* - * The following check is not documented in the spec. Malicious party - * may be able to use IPv4 mapped addr to confuse tcp/udp stack and - * bypass security checks (act as if it was from 127.0.0.1 by using - * IPv6 src ::ffff:127.0.0.1). Be cautious. + * The following check is not documented in specs. A malicious + * party may be able to use IPv4 mapped addr to confuse tcp/udp stack + * and bypass security checks (act as if it was from 127.0.0.1 by using + * IPv6 src ::ffff:127.0.0.1). Be cautious. * - * This check chokes if we are in SIIT cloud. As none of BSDs support - * IPv4-less kernel compilation, we cannot support SIIT environment - * at all. So, it makes more sense for us to reject any malicious - * packets for non-SIIT environment, than try to do a partical support - * for SIIT environment. + * This check chokes if we are in an SIIT cloud. As none of BSDs + * support IPv4-less kernel compilation, we cannot support SIIT + * environment at all. So, it makes more sense for us to reject any + * malicious packets for non-SIIT environment, than try to do a + * partical support for SIIT environment. */ if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) || IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst)) { @@ -564,7 +567,7 @@ ip6_input(m) ip6 = mtod(m, struct ip6_hdr *); /* - * if the payload length field is 0 and the next header field + * if the payload length field is 0 and the next header field * indicates Hop-by-Hop Options header, then a Jumbo Payload * option MUST be included. */ diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c index e0fd1bd8898..5de4a0bed63 100644 --- a/sys/netinet6/ip6_mroute.c +++ b/sys/netinet6/ip6_mroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_mroute.c,v 1.16 2001/06/09 06:43:38 angelos Exp $ */ +/* $OpenBSD: ip6_mroute.c,v 1.17 2001/12/07 09:16:07 itojun Exp $ */ /* $KAME: ip6_mroute.c,v 1.45 2001/03/25 08:38:51 itojun Exp $ */ /* @@ -144,11 +144,6 @@ static mifi_t nummifs = 0; static mifi_t reg_mif_num = (mifi_t)-1; static struct pim6stat pim6stat; - -/* - * one-back cache used by ipip_input to locate a tunnel's mif - * given a datagram's src ip address. - */ static int pim6; /* @@ -758,7 +753,8 @@ add_m6fc(mfccp) if (nstl == 0) { #ifdef MRT6DEBUG if (mrt6debug & DEBUG_MFC) - log(LOG_DEBUG,"add_mfc no upcall h %d o %s g %s p %x\n", + log(LOG_DEBUG, + "add_m6fc no upcall h %d o %s g %s p %x\n", hash, ip6_sprintf(&mfccp->mf6cc_origin.sin6_addr), ip6_sprintf(&mfccp->mf6cc_mcastgrp.sin6_addr), diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 7f6fe7273d4..a09717733af 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_output.c,v 1.55 2001/11/30 07:59:17 itojun Exp $ */ +/* $OpenBSD: ip6_output.c,v 1.56 2001/12/07 09:16:07 itojun Exp $ */ /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ /* @@ -560,7 +560,7 @@ skip_ipsec2:; /* Latch to PCB */ if (inp) - tdb_add_inp(tdb, inp, 0); + tdb_add_inp(tdb, inp, 0); m->m_flags &= ~(M_BCAST | M_MCAST); /* just in case */ @@ -817,9 +817,8 @@ skip_ipsec2:; * We eventually have sockaddr_in6 and use the sin6_scope_id * field of the structure here. * We rely on the consistency between two scope zone ids - * of source add destination, which should already be assured - * Larger scopes than link will be supported in the near - * future. + * of source and destination, which should already be assured. + * Larger scopes than link will be supported in the future. */ origifp = NULL; if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_src)) @@ -969,7 +968,8 @@ skip_ipsec2:; /* * Loop through length of segment after first fragment, - * make new header and copy data of each part and link onto chain. + * make new header and copy data of each part and link onto + * chain. */ m0 = m; for (off = hlen; off < tlen; off += len) { @@ -1839,7 +1839,8 @@ ip6_setmoptions(optname, im6op, m) * all multicast addresses. Only super user is allowed * to do this. */ - if (suser(p->p_ucred, &p->p_acflag)) { + if (suser(p->p_ucred, &p->p_acflag)) + { error = EACCES; break; } @@ -1943,7 +1944,8 @@ ip6_setmoptions(optname, im6op, m) } mreq = mtod(m, struct ipv6_mreq *); if (IN6_IS_ADDR_UNSPECIFIED(&mreq->ipv6mr_multiaddr)) { - if (suser(p->p_ucred, &p->p_acflag)) { + if (suser(p->p_ucred, &p->p_acflag)) + { error = EACCES; break; } diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c index c99d3a3f84f..2280e95a915 100644 --- a/sys/netinet6/mld6.c +++ b/sys/netinet6/mld6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mld6.c,v 1.10 2001/06/09 06:43:38 angelos Exp $ */ +/* $OpenBSD: mld6.c,v 1.11 2001/12/07 09:16:07 itojun Exp $ */ /* $KAME: mld6.c,v 1.26 2001/02/16 14:50:35 itojun Exp $ */ /* @@ -209,7 +209,6 @@ mld6_input(m, off) * spec (RFC2710) does not explicitly * specify to discard the packet from a non link-local * source address. But we believe it's expected to do so. - * XXX: do we have to allow :: as source? */ m_freem(m); return; @@ -285,7 +284,7 @@ mld6_input(m, off) in6m->in6m_timer = 0; /* reset timer */ in6m->in6m_state = MLD6_IREPORTEDLAST; } - else if (in6m->in6m_timer == 0 || /*idle state*/ + else if (in6m->in6m_timer == 0 || /* idle */ in6m->in6m_timer > timer) { in6m->in6m_timer = MLD6_RANDOM_DELAY(timer); diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index bccf7fa48a4..89f1a7fb37f 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.c,v 1.38 2001/11/30 07:59:17 itojun Exp $ */ +/* $OpenBSD: nd6.c,v 1.39 2001/12/07 09:16:07 itojun Exp $ */ /* $KAME: nd6.c,v 1.151 2001/06/19 14:24:41 sumikawa Exp $ */ /* @@ -435,7 +435,7 @@ nd6_timer(ignored_arg) ln = next; continue; } - + /* sanity check */ if (!rt) panic("rt=0 in nd6_timer(ln=%p)\n", ln); @@ -691,10 +691,10 @@ nd6_lookup(addr6, create, ifp) return(NULL); /* - * Create a new route. RTF_LLINFO is necessary + * Create a new route. RTF_LLINFO is necessary * to create a Neighbor Cache entry for the * destination in nd6_rtrequest which will be - * called in rtequest via ifa->ifa_rtrequest. + * called in rtrequest via ifa->ifa_rtrequest. */ if ((e = rtrequest(RTM_ADD, (struct sockaddr *)&sin6, ifa->ifa_addr, @@ -835,7 +835,7 @@ nd6_free(rt) /* * Temporarily fake the state to choose a new default * router and to perform on-link determination of - * prefixes coreectly. + * prefixes correctly. * Below the state will be set correctly, * or the entry itself will be deleted. */ @@ -863,7 +863,7 @@ nd6_free(rt) * Before deleting the entry, remember the next entry as the * return value. We need this because pfxlist_onlink_check() above * might have freed other entries (particularly the old next entry) as - * a side effect (XXX). + * a side effect (XXX). */ next = ln->ln_next; @@ -959,7 +959,7 @@ nd6_rtrequest(req, rt, info) if (rt->rt_flags & (RTF_CLONING | RTF_LLINFO)) { /* * Case 1: This route should come from - * a route to interface. RTF_LLINFO flag is set + * a route to interface. RTF_LLINFO flag is set * for a host route whose destination should be * treated as on-link. */ @@ -1431,7 +1431,7 @@ nd6_ioctl(cmd, data, ifp) /* * Create neighbor cache entry and cache link-layer address, - * on reception of inbound ND6 packets. (RS/RA/NS/redirect) + * on reception of inbound ND6 packets. (RS/RA/NS/redirect) */ struct rtentry * nd6_cache_lladdr(ifp, from, lladdr, lladdrlen, type, code) @@ -1524,7 +1524,7 @@ fail: * 1 -- y -- (7) * STALE */ - if (lladdr) { /*(3-5) and (7)*/ + if (lladdr) { /* (3-5) and (7) */ /* * Record source link-layer address * XXX is it dependent to ifp->if_type? @@ -1534,17 +1534,17 @@ fail: } if (!is_newentry) { - if ((!olladdr && lladdr) /*(3)*/ - || (olladdr && lladdr && llchange)) { /*(5)*/ + if ((!olladdr && lladdr) /* (3) */ + || (olladdr && lladdr && llchange)) { /* (5) */ do_update = 1; newstate = ND6_LLINFO_STALE; - } else /*(1-2,4)*/ + } else /* (1-2,4) */ do_update = 0; } else { do_update = 1; - if (!lladdr) /*(6)*/ + if (!lladdr) /* (6) */ newstate = ND6_LLINFO_NOSTATE; - else /*(7)*/ + else /* (7) */ newstate = ND6_LLINFO_STALE; } @@ -1613,18 +1613,18 @@ fail: /* * New entry must have is_router flag cleared. */ - if (is_newentry) /*(6-7)*/ + if (is_newentry) /* (6-7) */ ln->ln_router = 0; break; case ND_REDIRECT: /* * If the icmp is a redirect to a better router, always set the - * is_router flag. Otherwise, if the entry is newly created, - * clear the flag. [RFC 2461, sec 8.3] + * is_router flag. Otherwise, if the entry is newly created, + * clear the flag. [RFC 2461, sec 8.3] */ if (code == ND_REDIRECT_ROUTER) ln->ln_router = 1; - else if (is_newentry) /*(6-7)*/ + else if (is_newentry) /* (6-7) */ ln->ln_router = 0; break; case ND_ROUTER_SOLICIT: @@ -1637,8 +1637,8 @@ fail: /* * Mark an entry with lladdr as a router. */ - if ((!is_newentry && (olladdr || lladdr)) /*(2-5)*/ - || (is_newentry && lladdr)) { /*(7)*/ + if ((!is_newentry && (olladdr || lladdr)) /* (2-5) */ + || (is_newentry && lladdr)) { /* (7) */ ln->ln_router = 1; } break; @@ -1731,7 +1731,7 @@ nd6_output(ifp, origifp, m0, dst, rt0) } /* - * next hop determination. This routine is derived from ether_outpout. + * next hop determination. This routine is derived from ether_outpout. */ if (rt) { if ((rt->rt_flags & RTF_UP) == 0) { @@ -1754,9 +1754,8 @@ nd6_output(ifp, origifp, m0, dst, rt0) /* * We skip link-layer address resolution and NUD * if the gateway is not a neighbor from ND point - * of view, regardless the value of the - * nd_ifinfo.flags. - * The second condition is a bit tricky: we skip + * of view, regardless the value of nd_ifinfo.flags. + * The second condition is a bit tricky; we skip * if the gateway is our own address, which is * sometimes used to install a route to a p2p link. */ @@ -1797,7 +1796,7 @@ nd6_output(ifp, origifp, m0, dst, rt0) else { /* * Since nd6_is_addr_neighbor() internally calls nd6_lookup(), - * the condition below is not very efficient. But we believe + * the condition below is not very efficient. But we believe * it is tolerable, because this should be a rare case. */ if (nd6_is_addr_neighbor(dst, ifp) && @@ -1839,7 +1838,7 @@ nd6_output(ifp, origifp, m0, dst, rt0) /* * If the neighbor cache entry has a state other than INCOMPLETE - * (i.e. its link-layer address is already reloved), just + * (i.e. its link-layer address is already resolved), just * send the packet. */ if (ln->ln_state > ND6_LLINFO_INCOMPLETE) @@ -1847,7 +1846,7 @@ nd6_output(ifp, origifp, m0, dst, rt0) /* * There is a neighbor cache entry, but no ethernet address - * response yet. Replace the held mbuf (if any) with this + * response yet. Replace the held mbuf (if any) with this * latest one. * * XXX Does the code conform to rate-limiting rule? diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index 2429cced007..60812d515d3 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6_nbr.c,v 1.18 2001/11/30 07:59:17 itojun Exp $ */ +/* $OpenBSD: nd6_nbr.c,v 1.19 2001/12/07 09:16:07 itojun Exp $ */ /* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */ /* @@ -123,7 +123,7 @@ nd6_ns_input(m, off, icmp6len) if (IN6_IS_ADDR_UNSPECIFIED(&saddr6)) { /* dst has to be solicited node multicast address. */ if (daddr6.s6_addr16[0] == IPV6_ADDR_INT16_MLL - /*don't check ifindex portion*/ + /* don't check ifindex portion */ && daddr6.s6_addr32[1] == 0 && daddr6.s6_addr32[2] == IPV6_ADDR_INT32_ONE && daddr6.s6_addr8[12] == 0xff) { @@ -372,7 +372,7 @@ nd6_ns_output(ifp, daddr6, taddr6, ln, dad) icmp6len = sizeof(*nd_ns); m->m_pkthdr.len = m->m_len = sizeof(*ip6) + icmp6len; - m->m_data += max_linkhdr; /*or MH_ALIGN() equivalent?*/ + m->m_data += max_linkhdr; /* or MH_ALIGN() equivalent? */ /* fill neighbor solicitation packet */ ip6 = mtod(m, struct ip6_hdr *); @@ -422,7 +422,7 @@ nd6_ns_output(ifp, daddr6, taddr6, ln, dad) * - saddr6 belongs to the outgoing interface. * Otherwise, we perform a scope-wise match. */ - struct ip6_hdr *hip6; /*hold ip6*/ + struct ip6_hdr *hip6; /* hold ip6 */ struct in6_addr *saddr6; if (ln && ln->ln_hold) { @@ -439,7 +439,7 @@ nd6_ns_output(ifp, daddr6, taddr6, ln, dad) else { ia = in6_ifawithifp(ifp, &ip6->ip6_dst); if (ia == NULL) { - m_freem(m); /*XXX*/ + m_freem(m); return; } ip6->ip6_src = ia->ia_addr.sin6_addr; @@ -607,7 +607,7 @@ nd6_na_input(m, off, icmp6len) goto freeit; } - /* Just for safety, maybe unnecessery. */ + /* Just for safety, maybe unnecessary. */ if (ifa) { log(LOG_ERR, "nd6_na_input: duplicate IP6 address %s\n", @@ -1068,7 +1068,7 @@ nd6_dad_start(ifa, tick) dp->dad_count = ip6_dad_count; dp->dad_ns_icount = dp->dad_na_icount = 0; dp->dad_ns_ocount = dp->dad_ns_tcount = 0; - if (!tick) { + if (tick == NULL) { nd6_dad_ns_output(dp, ifa); nd6_dad_starttimer(dp, nd_ifinfo[ifa->ifa_ifp->if_index].retrans * hz / 1000); @@ -1184,7 +1184,7 @@ nd6_dad_timer(ifa) } if (dp->dad_ns_icount) { -#if 0 /*heuristics*/ +#if 0 /* heuristics */ /* * if * - we have sent many(?) DAD NS, and diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index d398db4729f..d7251faf748 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6_rtr.c,v 1.11 2001/06/09 06:43:38 angelos Exp $ */ +/* $OpenBSD: nd6_rtr.c,v 1.12 2001/12/07 09:16:07 itojun Exp $ */ /* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */ /* @@ -381,7 +381,7 @@ nd6_ra_input(m, off, icmp6len) skip: /* - * Src linkaddress + * Source link layer address */ { char *lladdr = NULL; diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index bca4c0814c6..d50d6d8009d 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_ip6.c,v 1.6 2001/12/06 04:19:26 itojun Exp $ */ +/* $OpenBSD: raw_ip6.c,v 1.7 2001/12/07 09:16:07 itojun Exp $ */ /* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */ /* @@ -172,7 +172,7 @@ rip6_input(mp, offp, proto) bzero(&rip6src, sizeof(rip6src)); rip6src.sin6_len = sizeof(struct sockaddr_in6); rip6src.sin6_family = AF_INET6; -#if 0 /*XXX inbound flowlabel */ +#if 0 /* XXX inbound flowlabel */ rip6src.sin6_flowinfo = ip6->ip6_flow & IPV6_FLOWINFO_MASK; #endif /* KAME hack: recover scopeid */ @@ -690,9 +690,9 @@ rip6_usrreq(so, req, m, nam, control, p) in6p->in6p_laddr = addr->sin6_addr; break; } - + case PRU_CONNECT: - { + { struct sockaddr_in6 *addr = mtod(nam, struct sockaddr_in6 *); struct in6_addr *in6a = NULL; #ifdef ENABLE_DEFAULT_SCOPE @@ -738,7 +738,7 @@ rip6_usrreq(so, req, m, nam, control, p) in6p->in6p_faddr = addr->sin6_addr; soisconnected(so); break; - } + } case PRU_CONNECT2: error = EOPNOTSUPP; @@ -755,7 +755,7 @@ rip6_usrreq(so, req, m, nam, control, p) * routine handles any messaging necessary. */ case PRU_SEND: - { + { struct sockaddr_in6 tmp; struct sockaddr_in6 *dst; @@ -789,7 +789,7 @@ rip6_usrreq(so, req, m, nam, control, p) error = rip6_output(m, so, dst, control); m = NULL; break; - } + } case PRU_SENSE: /* |