diff options
| author | christos <christos@NetBSD.org> | 2013-06-04 22:47:37 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2013-06-04 22:47:37 +0000 |
| commit | 65d98280bb5f01798caabfc78abca05ba6d5f28e (patch) | |
| tree | 88f63084077e918d8a674e5ac4c74ed122a7740e /sys/netipsec/ipsec_input.c | |
| parent | 7f18c4d528c345ce6ec5d61f6c04109e8aa16b57 (diff) | |
PR/47886: Dr. Wolfgang Stukenbrock: IPSEC_NAT_T enabled kernels may access
outdated pointers and pass ESP data to UPD-sockets.
While here, simplify the code and remove the IPSEC_NAT_T option; always
compile nat-traversal in so that it does not bitrot.
Diffstat (limited to 'sys/netipsec/ipsec_input.c')
| -rw-r--r-- | sys/netipsec/ipsec_input.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/sys/netipsec/ipsec_input.c b/sys/netipsec/ipsec_input.c index 986f0d16805..304929f9553 100644 --- a/sys/netipsec/ipsec_input.c +++ b/sys/netipsec/ipsec_input.c @@ -1,4 +1,4 @@ -/* $NetBSD: ipsec_input.c,v 1.29 2012/01/25 21:58:10 drochner Exp $ */ +/* $NetBSD: ipsec_input.c,v 1.30 2013/06/04 22:47:37 christos Exp $ */ /* $FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netipsec/ipsec_input.c,v 1.2.4.2 2003/03/28 20:32:53 sam Exp $ */ /* $OpenBSD: ipsec_input.c,v 1.63 2003/02/20 18:35:43 deraadt Exp $ */ @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ipsec_input.c,v 1.29 2012/01/25 21:58:10 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ipsec_input.c,v 1.30 2013/06/04 22:47:37 christos Exp $"); /* * IPsec input processing. @@ -129,12 +129,9 @@ ipsec_common_input(struct mbuf *m, int skip, int protoff, int af, int sproto) union sockaddr_union dst_address; struct secasvar *sav; u_int32_t spi; - u_int16_t sport = 0; - u_int16_t dport = 0; + u_int16_t sport; + u_int16_t dport; int s, error; -#ifdef IPSEC_NAT_T - struct m_tag * tag = NULL; -#endif IPSEC_ISTAT(sproto, ESP_STAT_INPUT, AH_STAT_INPUT, IPCOMP_STAT_INPUT); @@ -173,13 +170,8 @@ ipsec_common_input(struct mbuf *m, int skip, int protoff, int af, int sproto) } -#ifdef IPSEC_NAT_T /* find the source port for NAT-T */ - if ((tag = m_tag_find(m, PACKET_TAG_IPSEC_NAT_T_PORTS, NULL))) { - sport = ((u_int16_t *)(tag + 1))[0]; - dport = ((u_int16_t *)(tag + 1))[1]; - } -#endif + nat_t_ports_get(m, &dport, &sport); /* * Find the SA and (indirectly) call the appropriate |
