| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: udp_usrreq.c,v 1.226 2016/06/10 13:31:44 ozaki-r Exp $ */ | | 1 | /* $NetBSD: udp_usrreq.c,v 1.227 2016/10/19 01:13: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. |
| @@ -56,27 +56,27 @@ | | | @@ -56,27 +56,27 @@ |
56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
58 | * SUCH DAMAGE. | | 58 | * SUCH DAMAGE. |
59 | * | | 59 | * |
60 | * @(#)udp_usrreq.c 8.6 (Berkeley) 5/23/95 | | 60 | * @(#)udp_usrreq.c 8.6 (Berkeley) 5/23/95 |
61 | */ | | 61 | */ |
62 | | | 62 | |
63 | /* | | 63 | /* |
64 | * UDP protocol implementation. | | 64 | * UDP protocol implementation. |
65 | * Per RFC 768, August, 1980. | | 65 | * Per RFC 768, August, 1980. |
66 | */ | | 66 | */ |
67 | | | 67 | |
68 | #include <sys/cdefs.h> | | 68 | #include <sys/cdefs.h> |
69 | __KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.226 2016/06/10 13:31:44 ozaki-r Exp $"); | | 69 | __KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.227 2016/10/19 01:13:01 ozaki-r Exp $"); |
70 | | | 70 | |
71 | #ifdef _KERNEL_OPT | | 71 | #ifdef _KERNEL_OPT |
72 | #include "opt_inet.h" | | 72 | #include "opt_inet.h" |
73 | #include "opt_compat_netbsd.h" | | 73 | #include "opt_compat_netbsd.h" |
74 | #include "opt_ipsec.h" | | 74 | #include "opt_ipsec.h" |
75 | #include "opt_inet_csum.h" | | 75 | #include "opt_inet_csum.h" |
76 | #include "opt_ipkdb.h" | | 76 | #include "opt_ipkdb.h" |
77 | #include "opt_mbuftrace.h" | | 77 | #include "opt_mbuftrace.h" |
78 | #endif | | 78 | #endif |
79 | | | 79 | |
80 | #include <sys/param.h> | | 80 | #include <sys/param.h> |
81 | #include <sys/mbuf.h> | | 81 | #include <sys/mbuf.h> |
82 | #include <sys/once.h> | | 82 | #include <sys/once.h> |
| @@ -1329,33 +1329,29 @@ udp4_espinudp(struct mbuf **mp, int off, | | | @@ -1329,33 +1329,29 @@ udp4_espinudp(struct mbuf **mp, int off, |
1329 | * to select the right SPD for multiple hosts behind | | 1329 | * to select the right SPD for multiple hosts behind |
1330 | * same NAT | | 1330 | * same NAT |
1331 | */ | | 1331 | */ |
1332 | if ((tag = m_tag_get(PACKET_TAG_IPSEC_NAT_T_PORTS, | | 1332 | if ((tag = m_tag_get(PACKET_TAG_IPSEC_NAT_T_PORTS, |
1333 | sizeof(sport) + sizeof(dport), M_DONTWAIT)) == NULL) { | | 1333 | sizeof(sport) + sizeof(dport), M_DONTWAIT)) == NULL) { |
1334 | printf("udp4_espinudp: m_tag_get failed\n"); | | 1334 | printf("udp4_espinudp: m_tag_get failed\n"); |
1335 | m_freem(m); | | 1335 | m_freem(m); |
1336 | return -1; | | 1336 | return -1; |
1337 | } | | 1337 | } |
1338 | ((u_int16_t *)(tag + 1))[0] = sport; | | 1338 | ((u_int16_t *)(tag + 1))[0] = sport; |
1339 | ((u_int16_t *)(tag + 1))[1] = dport; | | 1339 | ((u_int16_t *)(tag + 1))[1] = dport; |
1340 | m_tag_prepend(m, tag); | | 1340 | m_tag_prepend(m, tag); |
1341 | | | 1341 | |
1342 | #ifdef IPSEC | | | |
1343 | if (ipsec_used) | | 1342 | if (ipsec_used) |
1344 | ipsec4_common_input(m, iphdrlen, IPPROTO_ESP); | | 1343 | ipsec4_common_input(m, iphdrlen, IPPROTO_ESP); |
1345 | /* XXX: else */ | | 1344 | /* XXX: else */ |
1346 | #else | | | |
1347 | esp4_input(m, iphdrlen); | | | |
1348 | #endif | | | |
1349 | | | 1345 | |
1350 | /* We handled it, it shouldn't be handled by UDP */ | | 1346 | /* We handled it, it shouldn't be handled by UDP */ |
1351 | *mp = NULL; /* avoid free by caller ... */ | | 1347 | *mp = NULL; /* avoid free by caller ... */ |
1352 | return 1; | | 1348 | return 1; |
1353 | } | | 1349 | } |
1354 | #endif | | 1350 | #endif |
1355 | | | 1351 | |
1356 | PR_WRAP_USRREQS(udp) | | 1352 | PR_WRAP_USRREQS(udp) |
1357 | #define udp_attach udp_attach_wrapper | | 1353 | #define udp_attach udp_attach_wrapper |
1358 | #define udp_detach udp_detach_wrapper | | 1354 | #define udp_detach udp_detach_wrapper |
1359 | #define udp_accept udp_accept_wrapper | | 1355 | #define udp_accept udp_accept_wrapper |
1360 | #define udp_bind udp_bind_wrapper | | 1356 | #define udp_bind udp_bind_wrapper |
1361 | #define udp_listen udp_listen_wrapper | | 1357 | #define udp_listen udp_listen_wrapper |