diff options
| author | 1998-12-28 23:54:57 +0000 | |
|---|---|---|
| committer | 1998-12-28 23:54:57 +0000 | |
| commit | 49d7a964bc50017d63b519c83dfcf9b6d85f42fb (patch) | |
| tree | 0b545081f13770c818dbab18adc51bf9bba243a5 /sys/netinet/udp_usrreq.c | |
| parent | use getcwd(3) (diff) | |
| download | wireguard-openbsd-49d7a964bc50017d63b519c83dfcf9b6d85f42fb.tar.xz wireguard-openbsd-49d7a964bc50017d63b519c83dfcf9b6d85f42fb.zip | |
ensure the ip packet embedded inside an icmp packet has correct ip_len,
ip_off, ip_id. for udp, also correct uh_sum. ip_sum is still set to 0;
(all this debugged using nmap)
Diffstat (limited to 'sys/netinet/udp_usrreq.c')
| -rw-r--r-- | sys/netinet/udp_usrreq.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index b3bf8845dd5..1fe83330053 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udp_usrreq.c,v 1.15 1998/05/18 21:11:12 provos Exp $ */ +/* $OpenBSD: udp_usrreq.c,v 1.16 1998/12/28 23:54:58 deraadt Exp $ */ /* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */ /* @@ -172,7 +172,7 @@ udp_input(m, va_alist) bzero(((struct ipovly *)ip)->ih_x1, sizeof ((struct ipovly *)ip)->ih_x1); ((struct ipovly *)ip)->ih_len = uh->uh_ulen; - if ((uh->uh_sum = in_cksum(m, len + sizeof (struct ip))) != 0) { + if (in_cksum(m, len + sizeof (struct ip)) != 0) { udpstat.udps_badsum++; m_freem(m); return; @@ -288,6 +288,9 @@ udp_input(m, va_alist) goto bad; } *ip = save_ip; + HTONS(ip->ip_len); + HTONS(ip->ip_id); + HTONS(ip->ip_off); icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PORT, 0, 0); return; } |
