Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet fix in-kernel packet forwarding loop (till TTL b...



details:   https://anonhg.NetBSD.org/src/rev/c3b1b7dab77d
branches:  trunk
changeset: 481980:c3b1b7dab77d
user:      itojun <itojun%NetBSD.org@localhost>
date:      Fri Feb 11 05:57:58 2000 +0000

description:
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@localhost

diffstat:

 sys/netinet/ip_input.c |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r 589de5516bce -r c3b1b7dab77d sys/netinet/ip_input.c
--- a/sys/netinet/ip_input.c    Fri Feb 11 03:20:17 2000 +0000
+++ b/sys/netinet/ip_input.c    Fri Feb 11 05:57:58 2000 +0000
@@ -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 @@
        /*
         * 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) {



Home | Main Index | Thread Index | Old Index