| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ip6_input.c,v 1.122 2008/08/21 15:34:10 matt Exp $ */ | | 1 | /* $NetBSD: ip6_input.c,v 1.122.4.1 2009/05/03 13:22:22 bouyer Exp $ */ |
2 | /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ | | 2 | /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ |
3 | | | 3 | |
4 | /* | | 4 | /* |
5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | | 5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. |
6 | * All rights reserved. | | 6 | * All rights reserved. |
7 | * | | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | | 9 | * modification, are permitted provided that the following conditions |
10 | * are met: | | 10 | * are met: |
11 | * 1. Redistributions of source code must retain the above copyright | | 11 | * 1. Redistributions of source code must retain the above copyright |
12 | * notice, this list of conditions and the following disclaimer. | | 12 | * notice, this list of conditions and the following disclaimer. |
13 | * 2. Redistributions in binary form must reproduce the above copyright | | 13 | * 2. Redistributions in binary form must reproduce the above copyright |
14 | * notice, this list of conditions and the following disclaimer in the | | 14 | * notice, this list of conditions and the following disclaimer in the |
| @@ -52,27 +52,27 @@ | | | @@ -52,27 +52,27 @@ |
52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
59 | * SUCH DAMAGE. | | 59 | * SUCH DAMAGE. |
60 | * | | 60 | * |
61 | * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 | | 61 | * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 |
62 | */ | | 62 | */ |
63 | | | 63 | |
64 | #include <sys/cdefs.h> | | 64 | #include <sys/cdefs.h> |
65 | __KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.122 2008/08/21 15:34:10 matt Exp $"); | | 65 | __KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.122.4.1 2009/05/03 13:22:22 bouyer Exp $"); |
66 | | | 66 | |
67 | #include "opt_inet.h" | | 67 | #include "opt_inet.h" |
68 | #include "opt_inet6.h" | | 68 | #include "opt_inet6.h" |
69 | #include "opt_ipsec.h" | | 69 | #include "opt_ipsec.h" |
70 | #include "opt_pfil_hooks.h" | | 70 | #include "opt_pfil_hooks.h" |
71 | | | 71 | |
72 | #include <sys/param.h> | | 72 | #include <sys/param.h> |
73 | #include <sys/systm.h> | | 73 | #include <sys/systm.h> |
74 | #include <sys/malloc.h> | | 74 | #include <sys/malloc.h> |
75 | #include <sys/mbuf.h> | | 75 | #include <sys/mbuf.h> |
76 | #include <sys/domain.h> | | 76 | #include <sys/domain.h> |
77 | #include <sys/protosw.h> | | 77 | #include <sys/protosw.h> |
78 | #include <sys/socket.h> | | 78 | #include <sys/socket.h> |
| @@ -1247,38 +1247,38 @@ ip6_savecontrol(struct in6pcb *in6p, str | | | @@ -1247,38 +1247,38 @@ ip6_savecontrol(struct in6pcb *in6p, str |
1247 | if (nxt == IPPROTO_AH) | | 1247 | if (nxt == IPPROTO_AH) |
1248 | elen = (ip6e->ip6e_len + 2) << 2; | | 1248 | elen = (ip6e->ip6e_len + 2) << 2; |
1249 | else | | 1249 | else |
1250 | elen = (ip6e->ip6e_len + 1) << 3; | | 1250 | elen = (ip6e->ip6e_len + 1) << 3; |
1251 | if (elen != ext->m_len) { | | 1251 | if (elen != ext->m_len) { |
1252 | m_freem(ext); | | 1252 | m_freem(ext); |
1253 | IP6_STATINC(IP6_STAT_TOOSHORT); | | 1253 | IP6_STATINC(IP6_STAT_TOOSHORT); |
1254 | return; | | 1254 | return; |
1255 | } | | 1255 | } |
1256 | KASSERT(IP6_HDR_ALIGNED_P(ip6e)); | | 1256 | KASSERT(IP6_HDR_ALIGNED_P(ip6e)); |
1257 | | | 1257 | |
1258 | switch (nxt) { | | 1258 | switch (nxt) { |
1259 | case IPPROTO_DSTOPTS: | | 1259 | case IPPROTO_DSTOPTS: |
1260 | if (!in6p->in6p_flags & IN6P_DSTOPTS) | | 1260 | if (!(in6p->in6p_flags & IN6P_DSTOPTS)) |
1261 | break; | | 1261 | break; |
1262 | | | 1262 | |
1263 | *mp = sbcreatecontrol((void *)ip6e, elen, | | 1263 | *mp = sbcreatecontrol((void *)ip6e, elen, |
1264 | IS2292(IPV6_2292DSTOPTS, IPV6_DSTOPTS), | | 1264 | IS2292(IPV6_2292DSTOPTS, IPV6_DSTOPTS), |
1265 | IPPROTO_IPV6); | | 1265 | IPPROTO_IPV6); |
1266 | if (*mp) | | 1266 | if (*mp) |
1267 | mp = &(*mp)->m_next; | | 1267 | mp = &(*mp)->m_next; |
1268 | break; | | 1268 | break; |
1269 | | | 1269 | |
1270 | case IPPROTO_ROUTING: | | 1270 | case IPPROTO_ROUTING: |
1271 | if (!in6p->in6p_flags & IN6P_RTHDR) | | 1271 | if (!(in6p->in6p_flags & IN6P_RTHDR)) |
1272 | break; | | 1272 | break; |
1273 | | | 1273 | |
1274 | *mp = sbcreatecontrol((void *)ip6e, elen, | | 1274 | *mp = sbcreatecontrol((void *)ip6e, elen, |
1275 | IS2292(IPV6_2292RTHDR, IPV6_RTHDR), | | 1275 | IS2292(IPV6_2292RTHDR, IPV6_RTHDR), |
1276 | IPPROTO_IPV6); | | 1276 | IPPROTO_IPV6); |
1277 | if (*mp) | | 1277 | if (*mp) |
1278 | mp = &(*mp)->m_next; | | 1278 | mp = &(*mp)->m_next; |
1279 | break; | | 1279 | break; |
1280 | | | 1280 | |
1281 | case IPPROTO_HOPOPTS: | | 1281 | case IPPROTO_HOPOPTS: |
1282 | case IPPROTO_AH: /* is it possible? */ | | 1282 | case IPPROTO_AH: /* is it possible? */ |
1283 | break; | | 1283 | break; |
1284 | | | 1284 | |