| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: in6_gif.c,v 1.85.6.4 2018/02/11 21:17:34 snj Exp $ */ | | 1 | /* $NetBSD: in6_gif.c,v 1.85.6.5 2018/03/15 11:27:25 bouyer Exp $ */ |
2 | /* $KAME: in6_gif.c,v 1.62 2001/07/29 04:27:25 itojun Exp $ */ | | 2 | /* $KAME: in6_gif.c,v 1.62 2001/07/29 04:27:25 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 |
| @@ -21,27 +21,27 @@ | | | @@ -21,27 +21,27 @@ |
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | | 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | | 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE |
24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
30 | * SUCH DAMAGE. | | 30 | * SUCH DAMAGE. |
31 | */ | | 31 | */ |
32 | | | 32 | |
33 | #include <sys/cdefs.h> | | 33 | #include <sys/cdefs.h> |
34 | __KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v 1.85.6.4 2018/02/11 21:17:34 snj Exp $"); | | 34 | __KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v 1.85.6.5 2018/03/15 11:27:25 bouyer Exp $"); |
35 | | | 35 | |
36 | #ifdef _KERNEL_OPT | | 36 | #ifdef _KERNEL_OPT |
37 | #include "opt_inet.h" | | 37 | #include "opt_inet.h" |
38 | #endif | | 38 | #endif |
39 | | | 39 | |
40 | #include <sys/param.h> | | 40 | #include <sys/param.h> |
41 | #include <sys/systm.h> | | 41 | #include <sys/systm.h> |
42 | #include <sys/socket.h> | | 42 | #include <sys/socket.h> |
43 | #include <sys/sockio.h> | | 43 | #include <sys/sockio.h> |
44 | #include <sys/mbuf.h> | | 44 | #include <sys/mbuf.h> |
45 | #include <sys/errno.h> | | 45 | #include <sys/errno.h> |
46 | #include <sys/ioctl.h> | | 46 | #include <sys/ioctl.h> |
47 | #include <sys/queue.h> | | 47 | #include <sys/queue.h> |
| @@ -449,29 +449,31 @@ in6_gif_ctlinput(int cmd, const struct s | | | @@ -449,29 +449,31 @@ in6_gif_ctlinput(int cmd, const struct s |
449 | return NULL; | | 449 | return NULL; |
450 | | | 450 | |
451 | /* if the parameter is from icmp6, decode it. */ | | 451 | /* if the parameter is from icmp6, decode it. */ |
452 | if (d != NULL) { | | 452 | if (d != NULL) { |
453 | ip6cp = (struct ip6ctlparam *)d; | | 453 | ip6cp = (struct ip6ctlparam *)d; |
454 | ip6 = ip6cp->ip6c_ip6; | | 454 | ip6 = ip6cp->ip6c_ip6; |
455 | } else { | | 455 | } else { |
456 | ip6 = NULL; | | 456 | ip6 = NULL; |
457 | } | | 457 | } |
458 | | | 458 | |
459 | if (!ip6) | | 459 | if (!ip6) |
460 | return NULL; | | 460 | return NULL; |
461 | | | 461 | |
462 | if ((sc->gif_if.if_flags & IFF_RUNNING) == 0) | | | |
463 | return NULL; | | | |
464 | var = gif_getref_variant(sc, &psref); | | 462 | var = gif_getref_variant(sc, &psref); |
| | | 463 | if (var->gv_psrc == NULL || var->gv_pdst == NULL) { |
| | | 464 | gif_putref_variant(var, &psref); |
| | | 465 | return NULL; |
| | | 466 | } |
465 | if (var->gv_psrc->sa_family != AF_INET6) { | | 467 | if (var->gv_psrc->sa_family != AF_INET6) { |
466 | gif_putref_variant(var, &psref); | | 468 | gif_putref_variant(var, &psref); |
467 | return NULL; | | 469 | return NULL; |
468 | } | | 470 | } |
469 | gif_putref_variant(var, &psref); | | 471 | gif_putref_variant(var, &psref); |
470 | | | 472 | |
471 | ro = percpu_getref(sc->gif_ro_percpu); | | 473 | ro = percpu_getref(sc->gif_ro_percpu); |
472 | dst6 = satocsin6(rtcache_getdst(ro)); | | 474 | dst6 = satocsin6(rtcache_getdst(ro)); |
473 | /* XXX scope */ | | 475 | /* XXX scope */ |
474 | if (dst6 == NULL) | | 476 | if (dst6 == NULL) |
475 | ; | | 477 | ; |
476 | else if (IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, &dst6->sin6_addr)) | | 478 | else if (IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, &dst6->sin6_addr)) |
477 | rtcache_free(ro); | | 479 | rtcache_free(ro); |