summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoritojun <itojun@openbsd.org>2001-02-16 08:48:03 +0000
committeritojun <itojun@openbsd.org>2001-02-16 08:48:03 +0000
commit841d7adbf8aa739d1418d97b655dd59032a18fe3 (patch)
tree7ce389b2665dff125cbd1e34427a3f49007581fc
parentmake sure to clear ln_byhint when neighbor state goes to REACHABLE. (diff)
downloadwireguard-openbsd-841d7adbf8aa739d1418d97b655dd59032a18fe3.tar.xz
wireguard-openbsd-841d7adbf8aa739d1418d97b655dd59032a18fe3.zip
sync whitespace/comment with kame. to help merge tasks
-rw-r--r--sys/net/if_gif.h7
-rw-r--r--sys/net/net_osdep.c7
-rw-r--r--sys/net/net_osdep.h33
-rw-r--r--sys/netinet/in4_cksum.c6
-rw-r--r--sys/netinet/in_gif.c7
-rw-r--r--sys/netinet/in_gif.h7
-rw-r--r--sys/netinet/ip_ecn.c8
-rw-r--r--sys/netinet/ip_ecn.h8
-rw-r--r--sys/netinet6/dest6.c9
-rw-r--r--sys/netinet6/frag6.c17
-rw-r--r--sys/netinet6/in6_gif.c7
-rw-r--r--sys/netinet6/in6_gif.h7
-rw-r--r--sys/netinet6/ip6_forward.c6
-rw-r--r--sys/netinet6/ip6_input.c124
-rw-r--r--sys/netinet6/ip6_mroute.c57
-rw-r--r--sys/netinet6/ip6_output.c6
-rw-r--r--sys/netinet6/mld6.c28
-rw-r--r--sys/netinet6/mld6_var.h11
-rw-r--r--sys/netinet6/nd6.c34
-rw-r--r--sys/netinet6/pim6.h9
-rw-r--r--sys/netinet6/pim6_var.h9
-rw-r--r--sys/netinet6/route6.c60
22 files changed, 256 insertions, 211 deletions
diff --git a/sys/net/if_gif.h b/sys/net/if_gif.h
index e9ffbbcc4e1..dff8955e6ee 100644
--- a/sys/net/if_gif.h
+++ b/sys/net/if_gif.h
@@ -1,9 +1,10 @@
-/* $OpenBSD: if_gif.h,v 1.4 2000/12/30 21:51:50 angelos Exp $ */
+/* $OpenBSD: if_gif.h,v 1.5 2001/02/16 08:48:03 itojun Exp $ */
+/* $KAME: if_gif.h,v 1.17 2000/09/11 11:36:41 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:
@@ -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
diff --git a/sys/net/net_osdep.c b/sys/net/net_osdep.c
index 55822ed49f3..6312fd378b4 100644
--- a/sys/net/net_osdep.c
+++ b/sys/net/net_osdep.c
@@ -1,9 +1,10 @@
-/* $OpenBSD: net_osdep.c,v 1.1 1999/12/08 06:50:18 itojun Exp $ */
+/* $OpenBSD: net_osdep.c,v 1.2 2001/02/16 08:48:03 itojun Exp $ */
+/* $KAME: net_osdep.c,v 1.8 2000/12/03 00:39:27 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
diff --git a/sys/net/net_osdep.h b/sys/net/net_osdep.h
index 0c7d6c19df4..3080960b92b 100644
--- a/sys/net/net_osdep.h
+++ b/sys/net/net_osdep.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: net_osdep.h,v 1.5 2001/02/08 14:51:21 itojun Exp $ */
-/* $KAME: net_osdep.h,v 1.36 2001/02/08 10:21:27 itojun Exp $ */
+/* $OpenBSD: net_osdep.h,v 1.6 2001/02/16 08:48:03 itojun Exp $ */
+/* $KAME: net_osdep.h,v 1.40 2001/02/14 17:07:50 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -55,10 +55,10 @@
* FreeBSD[234]: delete all protocol-cloned routes underneath the route.
* note that cloned routes from an interface direct route
* still remain.
- * NetBSD: official release versions (the latest is 1.5 as of Jan. 2001)
- * have no side effects. KAME for NetBSD has the same effects
- * as of BSDI.
- * OpenBSD: no side effects.
+ * NetBSD: 1.5 have no side effects. KAME/netbsd15, and 1.5R, have
+ * the same effects as of BSDI.
+ * OpenBSD: 2.8 have no side effects. KAME/openbsd28, and 2.9 have
+ * the same effects as of BSDI.
*
* - privileged process
* NetBSD, FreeBSD 3
@@ -78,11 +78,13 @@
* needs to give struct proc * as argument
* OpenBSD, BSDI [34], FreeBSD 2
* do not need struct proc *
+ *
* - bpf:
* OpenBSD, NetBSD 1.5, BSDI [34]
* need caddr_t * (= if_bpf **) and struct ifnet *
* FreeBSD 2, FreeBSD 3, NetBSD 1.6? (1.5N and later)
* need only struct ifnet * as argument
+ *
* - struct ifnet
* use queue.h? member names if name
* --- --- ---
@@ -91,25 +93,30 @@
* OpenBSD yes standard if_xname
* NetBSD yes standard if_xname
* BSDI [34] no old standard if_name+unit
+ *
* - usrreq
* NetBSD, OpenBSD, BSDI [34], FreeBSD 2
* single function with PRU_xx, arguments are mbuf
* FreeBSD 3
* separates functions, non-mbuf arguments
+ *
* - {set,get}sockopt
* NetBSD, OpenBSD, BSDI [34], FreeBSD 2
* manipulation based on mbuf
* FreeBSD 3
* non-mbuf manipulation using sooptcopy{in,out}()
+ *
* - timeout() and untimeout()
* NetBSD 1.4.x, OpenBSD, BSDI [34], FreeBSD 2
* timeout() is a void function
* FreeBSD 3
* timeout() is non-void, must keep returned value for untimeout()
+ * callout_xx is also available (sys/callout.h)
* NetBSD 1.5
* timeout() is obsoleted, use callout_xx (sys/callout.h)
* OpenBSD 2.8
* timeout_{add,set,del} is encouraged (sys/timeout.h)
+ *
* - sysctl
* NetBSD, OpenBSD
* foo_sysctl()
@@ -123,6 +130,7 @@
* 2nd argument is u_long cmd
* FreeBSD 2
* 2nd argument is int cmd
+ *
* - if attach routines
* NetBSD
* void xxattach(int);
@@ -133,6 +141,7 @@
* - ovbcopy()
* in NetBSD 1.4 or later, ovbcopy() is not supplied in the kernel.
* bcopy() is safe against overwrites.
+ *
* - splnet()
* NetBSD 1.4 or later requires splsoftnet().
* other operating systems use splnet().
@@ -164,8 +173,11 @@
* FreeBSD4: struct ipprotosw in netinet/ipprotosw.h
* others: struct protosw in sys/protosw.h
*
- * - protosw. NetBSD 1.5 has extra member for ipfilter. NetBSD 1.5 requires
- * PR_LISTEN flag bit with protocols that permit listen/accept (like tcp).
+ * - protosw in general.
+ * NetBSD 1.5 has extra member for ipfilter (netbsd-current dropped
+ * it so it will go away in 1.6).
+ * NetBSD 1.5 requires PR_LISTEN flag bit with protocols that permit
+ * listen/accept (like tcp).
*
* - header files with defopt (opt_xx.h)
* FreeBSD3: opt_{inet,ipsec,ip6fw,altq}.h
@@ -180,6 +192,11 @@
* - (m->m_flags & M_EXT) != 0 does *not* mean that the max data length of
* the mbuf == MCLBYTES.
*
+ * - sys/kern/uipc_mbuf.c:m_dup()
+ * freebsd[34]: copies the whole mbuf chain.
+ * netbsd: similar arg with m_copym().
+ * others: no m_dup().
+ *
* - ifa_refcnt (struct ifaddr) management (IFAREF/IFAFREE).
* NetBSD 1.5: always use IFAREF whenever reference gets added.
* always use IFAFREE whenever reference gets freed.
diff --git a/sys/netinet/in4_cksum.c b/sys/netinet/in4_cksum.c
index 171d5467420..90c2ff4b8ed 100644
--- a/sys/netinet/in4_cksum.c
+++ b/sys/netinet/in4_cksum.c
@@ -1,11 +1,11 @@
-/* $OpenBSD: in4_cksum.c,v 1.1 1999/12/08 06:50:19 itojun Exp $ */
+/* $OpenBSD: in4_cksum.c,v 1.2 2001/02/16 08:48:04 itojun Exp $ */
/* $NetBSD: in_cksum.c,v 1.13 1996/10/13 02:03:03 christos Exp $ */
/*
* Copyright (C) 1999 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:
@@ -17,7 +17,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
diff --git a/sys/netinet/in_gif.c b/sys/netinet/in_gif.c
index ff90d8e59f2..5b35e3c3745 100644
--- a/sys/netinet/in_gif.c
+++ b/sys/netinet/in_gif.c
@@ -1,9 +1,10 @@
-/* $OpenBSD: in_gif.c,v 1.13 2000/12/31 17:23:35 angelos Exp $ */
+/* $OpenBSD: in_gif.c,v 1.14 2001/02/16 08:48:04 itojun Exp $ */
+/* $KAME: in_gif.c,v 1.50 2001/01/22 07:27:16 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
diff --git a/sys/netinet/in_gif.h b/sys/netinet/in_gif.h
index 26a2952a390..da3218d6c2e 100644
--- a/sys/netinet/in_gif.h
+++ b/sys/netinet/in_gif.h
@@ -1,9 +1,10 @@
-/* $OpenBSD: in_gif.h,v 1.2 2000/05/25 01:22:00 itojun Exp $ */
+/* $OpenBSD: in_gif.h,v 1.3 2001/02/16 08:48:04 itojun Exp $ */
+/* $KAME: in_gif.h,v 1.5 2000/04/14 08:36:02 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
diff --git a/sys/netinet/ip_ecn.c b/sys/netinet/ip_ecn.c
index ad8770fcfd7..1d9ee292b28 100644
--- a/sys/netinet/ip_ecn.c
+++ b/sys/netinet/ip_ecn.c
@@ -1,9 +1,10 @@
-/* $OpenBSD: ip_ecn.c,v 1.1 1999/12/08 06:50:19 itojun Exp $ */
+/* $OpenBSD: ip_ecn.c,v 1.2 2001/02/16 08:48:04 itojun Exp $ */
+/* $KAME: ip_ecn.c,v 1.9 2000/10/01 12:44:48 itojun Exp $ */
/*
* Copyright (C) 1999 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
@@ -28,7 +29,6 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * KAME Id: ip_ecn.c,v 1.2 1999/07/30 12:17:15 itojun Exp
*/
/*
* ECN consideration on tunnel ingress/egress operation.
diff --git a/sys/netinet/ip_ecn.h b/sys/netinet/ip_ecn.h
index e82daec9822..7f6f4f529ea 100644
--- a/sys/netinet/ip_ecn.h
+++ b/sys/netinet/ip_ecn.h
@@ -1,9 +1,10 @@
-/* $OpenBSD: ip_ecn.h,v 1.1 1999/12/08 06:50:19 itojun Exp $ */
+/* $OpenBSD: ip_ecn.h,v 1.2 2001/02/16 08:48:04 itojun Exp $ */
+/* $KAME: ip_ecn.h,v 1.5 2000/03/27 04:58:38 sumikawa Exp $ */
/*
* Copyright (C) 1999 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
@@ -28,7 +29,6 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * KAME Id: ip_ecn.h,v 1.2 1999/08/19 12:57:44 itojun Exp
*/
/*
* ECN consideration on tunnel ingress/egress operation.
diff --git a/sys/netinet6/dest6.c b/sys/netinet6/dest6.c
index 9dbdaf4652c..94a26b9bc5f 100644
--- a/sys/netinet6/dest6.c
+++ b/sys/netinet6/dest6.c
@@ -1,9 +1,10 @@
-/* $OpenBSD: dest6.c,v 1.4 2001/02/16 08:22:04 itojun Exp $ */
+/* $OpenBSD: dest6.c,v 1.5 2001/02/16 08:48:05 itojun Exp $ */
+/* $KAME: dest6.c,v 1.23 2001/01/23 13:32:26 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
@@ -116,5 +117,5 @@ dest6_input(mp, offp, proto)
bad:
m_freem(m);
- return(IPPROTO_DONE);
+ return (IPPROTO_DONE);
}
diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c
index 9074cf00705..334eb2fd37a 100644
--- a/sys/netinet6/frag6.c
+++ b/sys/netinet6/frag6.c
@@ -1,9 +1,10 @@
-/* $OpenBSD: frag6.c,v 1.6 2000/02/07 06:09:09 itojun Exp $ */
+/* $OpenBSD: frag6.c,v 1.7 2001/02/16 08:48:05 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
@@ -97,7 +98,7 @@ frag6_init()
* 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.
@@ -182,7 +183,7 @@ frag6_input(mp, offp, proto)
/*
* 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
*/
@@ -216,7 +217,7 @@ frag6_input(mp, offp, proto)
/*
* 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.
*/
@@ -590,7 +591,7 @@ frag6_deq(af6)
af6->ip6af_down->ip6af_up = af6->ip6af_up;
}
-void
+void
frag6_insque(new, old)
struct ip6q *new, *old;
{
@@ -609,7 +610,7 @@ frag6_remque(p6)
}
/*
- * IP timer processing;
+ * IPv6 reassembling timer processing;
* if a timer expires on a reassembly
* queue, discard it.
*/
diff --git a/sys/netinet6/in6_gif.c b/sys/netinet6/in6_gif.c
index 52dd846b16a..aca3ed95665 100644
--- a/sys/netinet6/in6_gif.c
+++ b/sys/netinet6/in6_gif.c
@@ -1,9 +1,10 @@
-/* $OpenBSD: in6_gif.c,v 1.10 2000/12/31 17:23:35 angelos Exp $ */
+/* $OpenBSD: in6_gif.c,v 1.11 2001/02/16 08:48:05 itojun Exp $ */
+/* $KAME: in6_gif.c,v 1.43 2001/01/22 07:27:17 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
diff --git a/sys/netinet6/in6_gif.h b/sys/netinet6/in6_gif.h
index c81d046046d..922f8340a9e 100644
--- a/sys/netinet6/in6_gif.h
+++ b/sys/netinet6/in6_gif.h
@@ -1,9 +1,10 @@
-/* $OpenBSD: in6_gif.h,v 1.2 2000/05/25 01:22:00 itojun Exp $ */
+/* $OpenBSD: in6_gif.h,v 1.3 2001/02/16 08:48:05 itojun Exp $ */
+/* $KAME: in6_gif.h,v 1.5 2000/04/14 08:36:03 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
diff --git a/sys/netinet6/ip6_forward.c b/sys/netinet6/ip6_forward.c
index 49413d8d15b..355c5c966cd 100644
--- a/sys/netinet6/ip6_forward.c
+++ b/sys/netinet6/ip6_forward.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_forward.c,v 1.10 2001/02/16 08:22:06 itojun Exp $ */
+/* $OpenBSD: ip6_forward.c,v 1.11 2001/02/16 08:48:05 itojun Exp $ */
/* $KAME: ip6_forward.c,v 1.44 2000/07/27 13:43:21 itojun Exp $ */
/*
@@ -438,8 +438,8 @@ ip6_forward(m, srcrt)
* destinaion can appear, if the originating node just sends the
* packet to us (without address resolution for the destination).
* Since both icmp6_error and icmp6_redirect_output fill the embedded
- * link identifiers, we can do this stuff after make a copy for
- * returning error.
+ * link identifiers, we can do this stuff after making a copy for
+ * returning an error.
*/
if ((rt->rt_ifp->if_flags & IFF_LOOPBACK) != 0) {
/*
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index d8186e12a8f..0e11a16c106 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_input.c,v 1.23 2001/02/16 08:22:06 itojun Exp $ */
+/* $OpenBSD: ip6_input.c,v 1.24 2001/02/16 08:48:05 itojun Exp $ */
/* $KAME: ip6_input.c,v 1.172 2001/02/08 11:18:05 itojun Exp $ */
/*
@@ -755,39 +755,39 @@ ip6_process_hopopts(m, opthead, hbhlen, rtalertp, plenp)
u_int32_t jumboplen;
for (; hbhlen > 0; hbhlen -= optlen, opt += optlen) {
- switch(*opt) {
- case IP6OPT_PAD1:
- optlen = 1;
- break;
- case IP6OPT_PADN:
- if (hbhlen < IP6OPT_MINLEN) {
- ip6stat.ip6s_toosmall++;
- goto bad;
- }
- optlen = *(opt + 1) + 2;
- break;
- case IP6OPT_RTALERT:
- /* XXX may need check for alignment */
- if (hbhlen < IP6OPT_RTALERT_LEN) {
- ip6stat.ip6s_toosmall++;
- goto bad;
- }
- if (*(opt + 1) != IP6OPT_RTALERT_LEN - 2)
- /* XXX: should we discard the packet? */
- log(LOG_ERR, "length of router alert opt is inconsitent(%d)",
- *(opt + 1));
- optlen = IP6OPT_RTALERT_LEN;
- bcopy((caddr_t)(opt + 2), (caddr_t)&rtalert_val, 2);
- *rtalertp = ntohs(rtalert_val);
- break;
- case IP6OPT_JUMBO:
+ switch (*opt) {
+ case IP6OPT_PAD1:
+ optlen = 1;
+ break;
+ case IP6OPT_PADN:
+ if (hbhlen < IP6OPT_MINLEN) {
+ ip6stat.ip6s_toosmall++;
+ goto bad;
+ }
+ optlen = *(opt + 1) + 2;
+ break;
+ case IP6OPT_RTALERT:
+ /* XXX may need check for alignment */
+ if (hbhlen < IP6OPT_RTALERT_LEN) {
+ ip6stat.ip6s_toosmall++;
+ goto bad;
+ }
+ if (*(opt + 1) != IP6OPT_RTALERT_LEN - 2)
+ /* XXX: should we discard the packet? */
+ log(LOG_ERR, "length of router alert opt is inconsitent(%d)",
+ *(opt + 1));
+ optlen = IP6OPT_RTALERT_LEN;
+ bcopy((caddr_t)(opt + 2), (caddr_t)&rtalert_val, 2);
+ *rtalertp = ntohs(rtalert_val);
+ break;
+ case IP6OPT_JUMBO:
/* XXX may need check for alignment */
if (hbhlen < IP6OPT_JUMBO_LEN) {
ip6stat.ip6s_toosmall++;
goto bad;
}
if (*(opt + 1) != IP6OPT_JUMBO_LEN - 2)
- /* XXX: should we discard the packet? */
+ /* XXX: should we discard the packet? */
log(LOG_ERR, "length of jumbopayload opt "
"is inconsistent(%d)\n",
*(opt + 1));
@@ -850,18 +850,18 @@ ip6_process_hopopts(m, opthead, hbhlen, rtalertp, plenp)
*plenp = jumboplen;
break;
- default: /* unknown option */
- if (hbhlen < IP6OPT_MINLEN) {
- ip6stat.ip6s_toosmall++;
- goto bad;
- }
- if ((optlen = ip6_unknown_opt(opt, m,
- sizeof(struct ip6_hdr) +
- sizeof(struct ip6_hbh) +
- opt - opthead)) == -1)
- return(-1);
- optlen += 2;
- break;
+ default: /* unknown option */
+ if (hbhlen < IP6OPT_MINLEN) {
+ ip6stat.ip6s_toosmall++;
+ goto bad;
+ }
+ if ((optlen = ip6_unknown_opt(opt, m,
+ sizeof(struct ip6_hdr) +
+ sizeof(struct ip6_hbh) +
+ opt - opthead)) == -1)
+ return(-1);
+ optlen += 2;
+ break;
}
}
@@ -886,26 +886,26 @@ ip6_unknown_opt(optp, m, off)
{
struct ip6_hdr *ip6;
- switch(IP6OPT_TYPE(*optp)) {
- case IP6OPT_TYPE_SKIP: /* ignore the option */
- return((int)*(optp + 1));
- case IP6OPT_TYPE_DISCARD: /* silently discard */
- m_freem(m);
- return(-1);
- case IP6OPT_TYPE_FORCEICMP: /* send ICMP even if multicasted */
- ip6stat.ip6s_badoptions++;
- icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_OPTION, off);
- return(-1);
- case IP6OPT_TYPE_ICMP: /* send ICMP if not multicasted */
- ip6stat.ip6s_badoptions++;
- ip6 = mtod(m, struct ip6_hdr *);
- if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) ||
- (m->m_flags & (M_BCAST|M_MCAST)))
- m_freem(m);
- else
- icmp6_error(m, ICMP6_PARAM_PROB,
- ICMP6_PARAMPROB_OPTION, off);
- return(-1);
+ switch (IP6OPT_TYPE(*optp)) {
+ case IP6OPT_TYPE_SKIP: /* ignore the option */
+ return((int)*(optp + 1));
+ case IP6OPT_TYPE_DISCARD: /* silently discard */
+ m_freem(m);
+ return(-1);
+ case IP6OPT_TYPE_FORCEICMP: /* send ICMP even if multicasted */
+ ip6stat.ip6s_badoptions++;
+ icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_OPTION, off);
+ return(-1);
+ case IP6OPT_TYPE_ICMP: /* send ICMP if not multicasted */
+ ip6stat.ip6s_badoptions++;
+ ip6 = mtod(m, struct ip6_hdr *);
+ if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) ||
+ (m->m_flags & (M_BCAST|M_MCAST)))
+ m_freem(m);
+ else
+ icmp6_error(m, ICMP6_PARAM_PROB,
+ ICMP6_PARAMPROB_OPTION, off);
+ return(-1);
}
m_freem(m); /* XXX: NOTREACHED */
@@ -1107,7 +1107,7 @@ ip6_savecontrol(in6p, mp, ip6, m)
#endif
switch (nxt) {
- case IPPROTO_DSTOPTS:
+ case IPPROTO_DSTOPTS:
if (!in6p->in6p_flags & IN6P_DSTOPTS)
break;
@@ -1143,7 +1143,7 @@ ip6_savecontrol(in6p, mp, ip6, m)
default:
/*
- * other cases have been filtered in the above.
+ * other cases have been filtered in the above.
* none will visit this case. here we supply
* the code just in case (nxt overwritten or
* other cases).
diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c
index 21e5e7dd1fa..afcec2e60a4 100644
--- a/sys/netinet6/ip6_mroute.c
+++ b/sys/netinet6/ip6_mroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_mroute.c,v 1.10 2001/02/16 08:12:29 itojun Exp $ */
+/* $OpenBSD: ip6_mroute.c,v 1.11 2001/02/16 08:48:06 itojun Exp $ */
/* $KAME: ip6_mroute.c,v 1.39 2001/02/10 02:13:13 itojun Exp $ */
/*
@@ -239,16 +239,16 @@ ip6_mrouter_set(cmd, so, m)
switch (cmd) {
#ifdef MRT6_OINIT
- case MRT6_OINIT: return ip6_mrouter_init(so, m, cmd);
+ case MRT6_OINIT: return ip6_mrouter_init(so, m, cmd);
#endif
- case MRT6_INIT: return ip6_mrouter_init(so, m, cmd);
- case MRT6_DONE: return ip6_mrouter_done();
- case MRT6_ADD_MIF: return add_m6if(mtod(m, struct mif6ctl *));
- case MRT6_DEL_MIF: return del_m6if(mtod(m, mifi_t *));
- case MRT6_ADD_MFC: return add_m6fc(mtod(m, struct mf6cctl *));
- case MRT6_DEL_MFC: return del_m6fc(mtod(m, struct mf6cctl *));
- case MRT6_PIM: return set_pim6(mtod(m, int *));
- default: return EOPNOTSUPP;
+ case MRT6_INIT: return ip6_mrouter_init(so, m, cmd);
+ case MRT6_DONE: return ip6_mrouter_done();
+ case MRT6_ADD_MIF: return add_m6if(mtod(m, struct mif6ctl *));
+ case MRT6_DEL_MIF: return del_m6if(mtod(m, mifi_t *));
+ case MRT6_ADD_MFC: return add_m6fc(mtod(m, struct mf6cctl *));
+ case MRT6_DEL_MFC: return del_m6fc(mtod(m, struct mf6cctl *));
+ case MRT6_PIM: return set_pim6(mtod(m, int *));
+ default: return EOPNOTSUPP;
}
}
@@ -268,10 +268,11 @@ ip6_mrouter_get(cmd, so, m)
*m = mb = m_get(M_WAIT, MT_SOOPTS);
switch (cmd) {
- case MRT6_PIM: return get_pim6(mb);
- default:
- m_free(mb);
- return EOPNOTSUPP;
+ case MRT6_PIM:
+ return get_pim6(mb);
+ default:
+ m_free(mb);
+ return EOPNOTSUPP;
}
}
@@ -283,20 +284,20 @@ mrt6_ioctl(cmd, data)
int cmd;
caddr_t data;
{
- int error = 0;
-
- switch (cmd) {
- case SIOCGETSGCNT_IN6:
- return(get_sg_cnt((struct sioc_sg_req6 *)data));
- break; /* for safety */
- case SIOCGETMIFCNT_IN6:
- return(get_mif6_cnt((struct sioc_mif_req6 *)data));
- break; /* for safety */
- default:
- return (EINVAL);
- break;
- }
- return error;
+ int error = 0;
+
+ switch (cmd) {
+ case SIOCGETSGCNT_IN6:
+ return(get_sg_cnt((struct sioc_sg_req6 *)data));
+ break; /* for safety */
+ case SIOCGETMIFCNT_IN6:
+ return(get_mif6_cnt((struct sioc_mif_req6 *)data));
+ break; /* for safety */
+ default:
+ return (EINVAL);
+ break;
+ }
+ return error;
}
/*
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index 6a467c12faa..e34b8f7bceb 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_output.c,v 1.22 2001/02/16 08:22:06 itojun Exp $ */
+/* $OpenBSD: ip6_output.c,v 1.23 2001/02/16 08:48:06 itojun Exp $ */
/* $KAME: ip6_output.c,v 1.152 2001/02/02 15:36:33 jinmei Exp $ */
/*
@@ -133,6 +133,10 @@ static int ip6_splithdr __P((struct mbuf *, struct ip6_exthdrs *));
* This function may modify ver and hlim only.
* The mbuf chain containing the packet will be freed.
* The mbuf opt, if present, will not be freed.
+ *
+ * type of "mtu": rt_rmx.rmx_mtu is u_long, ifnet.ifr_mtu is int, and
+ * nd_ifinfo.linkmtu is u_int32_t. so we use u_long to hold largest one,
+ * which is rt_rmx.rmx_mtu.
*/
int
ip6_output(m0, opt, ro, flags, im6o, ifpp)
diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c
index a136d1503c0..5a8dba7b6ac 100644
--- a/sys/netinet6/mld6.c
+++ b/sys/netinet6/mld6.c
@@ -1,10 +1,10 @@
-/* $OpenBSD: mld6.c,v 1.7 2001/02/16 08:22:06 itojun Exp $ */
-/* $KAME: mld6.c,v 1.16 2000/02/22 14:04:27 itojun Exp $ */
+/* $OpenBSD: mld6.c,v 1.8 2001/02/16 08:48:06 itojun Exp $ */
+/* $KAME: mld6.c,v 1.25 2001/01/16 14:14:18 itojun Exp $ */
/*
* Copyright (C) 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
@@ -452,16 +452,16 @@ mld6_sendpkt(in6m, type, dst)
ip6_output(mh, &ip6_opts, NULL, 0, &im6o, &outif);
if (outif) {
icmp6_ifstat_inc(outif, ifs6_out_msg);
- switch(type) {
- case MLD6_LISTENER_QUERY:
- icmp6_ifstat_inc(outif, ifs6_out_mldquery);
- break;
- case MLD6_LISTENER_REPORT:
- icmp6_ifstat_inc(outif, ifs6_out_mldreport);
- break;
- case MLD6_LISTENER_DONE:
- icmp6_ifstat_inc(outif, ifs6_out_mlddone);
- break;
+ switch (type) {
+ case MLD6_LISTENER_QUERY:
+ icmp6_ifstat_inc(outif, ifs6_out_mldquery);
+ break;
+ case MLD6_LISTENER_REPORT:
+ icmp6_ifstat_inc(outif, ifs6_out_mldreport);
+ break;
+ case MLD6_LISTENER_DONE:
+ icmp6_ifstat_inc(outif, ifs6_out_mlddone);
+ break;
}
}
}
diff --git a/sys/netinet6/mld6_var.h b/sys/netinet6/mld6_var.h
index b77b6927fd4..a6bf9f71523 100644
--- a/sys/netinet6/mld6_var.h
+++ b/sys/netinet6/mld6_var.h
@@ -1,9 +1,10 @@
-/* $OpenBSD: mld6_var.h,v 1.2 2000/01/08 04:49:22 deraadt Exp $ */
+/* $OpenBSD: mld6_var.h,v 1.3 2001/02/16 08:48:06 itojun Exp $ */
+/* $KAME: mld6_var.h,v 1.4 2000/03/25 07:23:54 sumikawa Exp $ */
/*
* Copyright (C) 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
@@ -29,8 +30,8 @@
* SUCH DAMAGE.
*/
-#ifndef _NETINET6_MLD6_VAR_H_
-#define _NETINET6_MLD6_VAR_H_
+#ifndef _NETINET6_MLD6_VAR_H_
+#define _NETINET6_MLD6_VAR_H_
#ifdef _KERNEL
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index 5bca449a625..53618307ae5 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6.c,v 1.24 2001/02/08 15:07:27 itojun Exp $ */
+/* $OpenBSD: nd6.c,v 1.25 2001/02/16 08:48:06 itojun Exp $ */
/* $KAME: nd6.c,v 1.114 2001/02/08 10:57:00 itojun Exp $ */
/*
@@ -196,19 +196,19 @@ nd6_setmtu(ifp)
u_long oldmaxmtu = ndi->maxmtu;
u_long oldlinkmtu = ndi->linkmtu;
- switch(ifp->if_type) {
- case IFT_ARCNET: /* XXX MTU handling needs more work */
- ndi->maxmtu = MIN(60480, ifp->if_mtu);
- break;
- case IFT_ETHER:
- ndi->maxmtu = MIN(ETHERMTU, ifp->if_mtu);
- break;
- case IFT_ATM:
- ndi->maxmtu = MIN(ATMMTU, ifp->if_mtu);
- break;
- default:
- ndi->maxmtu = ifp->if_mtu;
- break;
+ switch (ifp->if_type) {
+ case IFT_ARCNET: /* XXX MTU handling needs more work */
+ ndi->maxmtu = MIN(60480, ifp->if_mtu);
+ break;
+ case IFT_ETHER:
+ ndi->maxmtu = MIN(ETHERMTU, ifp->if_mtu);
+ break;
+ case IFT_ATM:
+ ndi->maxmtu = MIN(ATMMTU, ifp->if_mtu);
+ break;
+ default:
+ ndi->maxmtu = ifp->if_mtu;
+ break;
}
if (oldmaxmtu != ndi->maxmtu) {
@@ -1098,10 +1098,10 @@ nd6_rtrequest(req, rt, info)
* (7.2.6 paragraph 4), however, it also says that we
* SHOULD provide a mechanism to prevent multicast NA storm.
* we don't have anything like it right now.
- * note that the mechanism need a mutual agreement
+ * note that the mechanism needs a mutual agreement
* between proxies, which means that we need to implement
- * a new protocol, or new kludge.
- * - from RFC2461 6.2.4, host MUST NOT send unsolicited NA.
+ * a new protocol, or a new kludge.
+ * - from RFC2461 6.2.4, host MUST NOT send an unsolicited NA.
* we need to check ip6forwarding before sending it.
* (or should we allow proxy ND configuration only for
* routers? there's no mention about proxy ND from hosts)
diff --git a/sys/netinet6/pim6.h b/sys/netinet6/pim6.h
index dc49e2bbd3c..41d5f4cffb5 100644
--- a/sys/netinet6/pim6.h
+++ b/sys/netinet6/pim6.h
@@ -1,9 +1,10 @@
-/* $OpenBSD: pim6.h,v 1.1 1999/12/08 06:50:23 itojun Exp $ */
+/* $OpenBSD: pim6.h,v 1.2 2001/02/16 08:48:06 itojun Exp $ */
+/* $KAME: pim6.h,v 1.3 2000/03/25 07:23:58 sumikawa Exp $ */
/*
* Copyright (C) 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
@@ -59,7 +60,7 @@ struct pim {
#define PIM_MINLEN 8 /* The header min. length is 8 */
#define PIM6_REG_MINLEN (PIM_MINLEN+40) /* Register message + inner IP6 header */
-/*
+/*
* Message types
*/
#define PIM_REGISTER 1 /* PIM Register type is 1 */
diff --git a/sys/netinet6/pim6_var.h b/sys/netinet6/pim6_var.h
index eeb2f2f46e4..88cd22ed50b 100644
--- a/sys/netinet6/pim6_var.h
+++ b/sys/netinet6/pim6_var.h
@@ -1,9 +1,10 @@
-/* $OpenBSD: pim6_var.h,v 1.2 2000/06/07 00:20:32 itojun Exp $ */
+/* $OpenBSD: pim6_var.h,v 1.3 2001/02/16 08:48:06 itojun Exp $ */
+/* $KAME: pim6_var.h,v 1.8 2000/06/06 08:07:43 jinmei Exp $ */
/*
* Copyright (C) 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
@@ -28,7 +29,6 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* KAME Id: pim6_var.h,v 1.2 1999/08/01 15:58:13 itojun Exp */
#ifndef _NETINET6_PIM6_VAR_H_
#define _NETINET6_PIM6_VAR_H_
@@ -67,5 +67,4 @@ int pim6_input __P((struct mbuf **, int*, int));
{ 0, 0 }, \
{ 0, 0 }, \
}
-
#endif /* _NETINET6_PIM6_VAR_H_ */
diff --git a/sys/netinet6/route6.c b/sys/netinet6/route6.c
index e68e41f7792..b941ba5f745 100644
--- a/sys/netinet6/route6.c
+++ b/sys/netinet6/route6.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: route6.c,v 1.4 2001/02/16 08:22:07 itojun Exp $ */
-/* $KAME: route6.c,v 1.21 2000/09/20 23:00:49 itojun Exp $ */
+/* $OpenBSD: route6.c,v 1.5 2001/02/16 08:48:07 itojun Exp $ */
+/* $KAME: route6.c,v 1.22 2000/12/03 00:54:00 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -44,7 +44,8 @@
#include <netinet/icmp6.h>
-static int ip6_rthdr0 __P((struct mbuf *, struct ip6_hdr *, struct ip6_rthdr0 *));
+static int ip6_rthdr0 __P((struct mbuf *, struct ip6_hdr *,
+ struct ip6_rthdr0 *));
int
route6_input(mp, offp, proto)
@@ -69,31 +70,44 @@ route6_input(mp, offp, proto)
}
#endif
- switch(rh->ip6r_type) {
- case IPV6_RTHDR_TYPE_0:
- rhlen = (rh->ip6r_len + 1) << 3;
+ switch (rh->ip6r_type) {
+ case IPV6_RTHDR_TYPE_0:
+ rhlen = (rh->ip6r_len + 1) << 3;
#ifndef PULLDOWN_TEST
- IP6_EXTHDR_CHECK(m, off, rhlen, IPPROTO_DONE);
+ /*
+ * note on option length:
+ * due to IP6_EXTHDR_CHECK assumption, we cannot handle
+ * very big routing header (max rhlen == 2048).
+ */
+ IP6_EXTHDR_CHECK(m, off, rhlen, IPPROTO_DONE);
#else
- IP6_EXTHDR_GET(rh, struct ip6_rthdr *, m, off, rhlen);
- if (rh == NULL) {
+ /*
+ * note on option length:
+ * maximum rhlen: 2048
+ * max mbuf m_pulldown can handle: MCLBYTES == usually 2048
+ * so, here we are assuming that m_pulldown can handle
+ * rhlen == 2048 case. this may not be a good thing to
+ * assume - we may want to avoid pulling it up altogether.
+ */
+ IP6_EXTHDR_GET(rh, struct ip6_rthdr *, m, off, rhlen);
+ if (rh == NULL) {
ip6stat.ip6s_tooshort++;
return IPPROTO_DONE;
- }
+ }
#endif
- if (ip6_rthdr0(m, ip6, (struct ip6_rthdr0 *)rh))
- return(IPPROTO_DONE);
- break;
- default:
- /* unknown routing type */
- if (rh->ip6r_segleft == 0) {
- rhlen = (rh->ip6r_len + 1) << 3;
- break; /* Final dst. Just ignore the header. */
- }
- ip6stat.ip6s_badoptions++;
- icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER,
- (caddr_t)&rh->ip6r_type - (caddr_t)ip6);
- return(IPPROTO_DONE);
+ if (ip6_rthdr0(m, ip6, (struct ip6_rthdr0 *)rh))
+ return(IPPROTO_DONE);
+ break;
+ default:
+ /* unknown routing type */
+ if (rh->ip6r_segleft == 0) {
+ rhlen = (rh->ip6r_len + 1) << 3;
+ break; /* Final dst. Just ignore the header. */
+ }
+ ip6stat.ip6s_badoptions++;
+ icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER,
+ (caddr_t)&rh->ip6r_type - (caddr_t)ip6);
+ return(IPPROTO_DONE);
}
*offp += rhlen;