Don't decrement the ttl, until we are sure that we can forward this packet.
Before if there was no route, we would call icmp_error with a datagram packet that has an incorrect checksum. (From Liam Foy)
This commit is contained in:
parent
58654bce56
commit
8481673c7a
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ip_input.c,v 1.220 2005/10/23 18:38:53 christos Exp $ */
|
||||
/* $NetBSD: ip_input.c,v 1.221 2005/11/01 21:21:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
|
@ -98,7 +98,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.220 2005/10/23 18:38:53 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.221 2005/11/01 21:21:09 christos Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_gateway.h"
|
||||
|
@ -1853,7 +1853,6 @@ ip_forward(struct mbuf *m, int 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 ||
|
||||
|
@ -1883,6 +1882,8 @@ ip_forward(struct mbuf *m, int 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.
|
||||
|
|
Loading…
Reference in New Issue