| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ip_input.c,v 1.341 2016/09/07 15:41:44 roy Exp $ */ | | 1 | /* $NetBSD: ip_input.c,v 1.342 2016/10/11 05:15:01 ozaki-r Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | | 4 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -81,27 +81,27 @@ | | | @@ -81,27 +81,27 @@ |
81 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 81 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
82 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 82 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
83 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 83 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
84 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 84 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
85 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 85 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
86 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 86 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
87 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 87 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
88 | * SUCH DAMAGE. | | 88 | * SUCH DAMAGE. |
89 | * | | 89 | * |
90 | * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 | | 90 | * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 |
91 | */ | | 91 | */ |
92 | | | 92 | |
93 | #include <sys/cdefs.h> | | 93 | #include <sys/cdefs.h> |
94 | __KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.341 2016/09/07 15:41:44 roy Exp $"); | | 94 | __KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.342 2016/10/11 05:15:01 ozaki-r Exp $"); |
95 | | | 95 | |
96 | #ifdef _KERNEL_OPT | | 96 | #ifdef _KERNEL_OPT |
97 | #include "opt_inet.h" | | 97 | #include "opt_inet.h" |
98 | #include "opt_compat_netbsd.h" | | 98 | #include "opt_compat_netbsd.h" |
99 | #include "opt_gateway.h" | | 99 | #include "opt_gateway.h" |
100 | #include "opt_ipsec.h" | | 100 | #include "opt_ipsec.h" |
101 | #include "opt_mrouting.h" | | 101 | #include "opt_mrouting.h" |
102 | #include "opt_mbuftrace.h" | | 102 | #include "opt_mbuftrace.h" |
103 | #include "opt_inet_csum.h" | | 103 | #include "opt_inet_csum.h" |
104 | #endif | | 104 | #endif |
105 | | | 105 | |
106 | #include "arp.h" | | 106 | #include "arp.h" |
107 | | | 107 | |
| @@ -819,27 +819,27 @@ ours: | | | @@ -819,27 +819,27 @@ ours: |
819 | #endif | | 819 | #endif |
820 | | | 820 | |
821 | /* | | 821 | /* |
822 | * Switch out to protocol's input routine. | | 822 | * Switch out to protocol's input routine. |
823 | */ | | 823 | */ |
824 | #if IFA_STATS | | 824 | #if IFA_STATS |
825 | if (ia && ip) { | | 825 | if (ia && ip) { |
826 | struct in_ifaddr *_ia; | | 826 | struct in_ifaddr *_ia; |
827 | /* | | 827 | /* |
828 | * Keep a reference from ip_match_our_address with psref | | 828 | * Keep a reference from ip_match_our_address with psref |
829 | * is expensive, so explore ia here again. | | 829 | * is expensive, so explore ia here again. |
830 | */ | | 830 | */ |
831 | s = pserialize_read_enter(); | | 831 | s = pserialize_read_enter(); |
832 | _ia = in_get_ia(ip->ip_dst.s_addr); | | 832 | _ia = in_get_ia(ip->ip_dst); |
833 | _ia->ia_ifa.ifa_data.ifad_inbytes += ntohs(ip->ip_len); | | 833 | _ia->ia_ifa.ifa_data.ifad_inbytes += ntohs(ip->ip_len); |
834 | pserialize_read_exit(s); | | 834 | pserialize_read_exit(s); |
835 | } | | 835 | } |
836 | #endif | | 836 | #endif |
837 | IP_STATINC(IP_STAT_DELIVERED); | | 837 | IP_STATINC(IP_STAT_DELIVERED); |
838 | | | 838 | |
839 | const int off = hlen, nh = ip->ip_p; | | 839 | const int off = hlen, nh = ip->ip_p; |
840 | | | 840 | |
841 | SOFTNET_LOCK(); | | 841 | SOFTNET_LOCK(); |
842 | (*inetsw[ip_protox[nh]].pr_input)(m, off, nh); | | 842 | (*inetsw[ip_protox[nh]].pr_input)(m, off, nh); |
843 | SOFTNET_UNLOCK(); | | 843 | SOFTNET_UNLOCK(); |
844 | return; | | 844 | return; |
845 | | | 845 | |