fix in-kernel packet forwarding loop (till TTL becomes 0) when:

- a packet is delivered to an address X,
- and the address X is configured on my !IFF_UP interface
- and ipforwarding=1

NetBSD PR: 9387
From: nrt@iij.ad.jp
This commit is contained in:
itojun 2000-02-11 05:57:58 +00:00
parent 160bf15b09
commit 46dfa55555

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_input.c,v 1.96 2000/02/01 00:07:09 thorpej Exp $ */
/* $NetBSD: ip_input.c,v 1.97 2000/02/11 05:57:58 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -488,7 +488,19 @@ ip_input(struct mbuf *m)
/*
* Check our list of addresses, to see if the packet is for us.
*/
INADDR_TO_IA(ip->ip_dst, ia);
for (ia = IN_IFADDR_HASH(ip->ip_dst.s_addr).lh_first;
ia != NULL;
ia = ia->ia_hash.le_next) {
if (in_hosteq(ia->ia_addr.sin_addr, ip->ip_dst)) {
if ((ia->ia_ifp->if_flags & IFF_UP) != 0)
break;
else {
icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST,
0, m->m_pkthdr.rcvif);
return;
}
}
}
if (ia != NULL)
goto ours;
if (m->m_pkthdr.rcvif->if_flags & IFF_BROADCAST) {