summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_input.c
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2004-10-18 07:41:29 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2004-10-18 07:41:29 +0000
commitbc24360311a5e2cbac2179f14bcc0d29307b65ec (patch)
tree7a185ee80413020717a5cf101ed3ecb69d0e981a /sys/netinet/ip_input.c
parent2a6a6048d3513792218ebcc39e9cf08b1e62190e (diff)
Do not embed an ip header with a decremented ttl into an icmp message.
Wait with the decrement until after the copy is done. Resolves checksum mismatches on the embedded header, as reported by tcpdump. ok markus@ itojun@
Diffstat (limited to 'sys/netinet/ip_input.c')
-rw-r--r--sys/netinet/ip_input.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 97a3d16d427..4d18a606827 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_input.c,v 1.123 2004/09/23 17:38:10 brad Exp $ */
+/* $OpenBSD: ip_input.c,v 1.124 2004/10/18 07:41:28 otto Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@@ -1426,7 +1426,6 @@ ip_forward(m, srcrt)
icmp_error(m, ICMP_TIMXCEED, ICMP_TIMXCEED_INTRANS, dest, 0);
return;
}
- ip->ip_ttl -= IPTTLDEC;
sin = satosin(&ipforward_rt.ro_dst);
if ((rt = ipforward_rt.ro_rt) == 0 ||
@@ -1456,6 +1455,8 @@ ip_forward(m, srcrt)
if (mcopy)
mcopy = m_pullup(mcopy, ip->ip_hl << 2);
+ ip->ip_ttl -= IPTTLDEC;
+
/*
* If forwarding packet using same interface that it came in on,
* perhaps should send a redirect to sender to shortcut a hop.