Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Oct 2001 11:50:17 +0300
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        Jonathan Lemon <jlemon@FreeBSD.org>
Cc:        cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/netinet if_ether.c in.c in_var.h ip_icmp.c ip_input.c ip_output.c
Message-ID:  <20011024115017.C92032@sunbay.com>
In-Reply-To: <200109290434.f8T4YB458912@freefall.freebsd.org>; from jlemon@FreeBSD.org on Fri, Sep 28, 2001 at 09:34:11PM -0700
References:  <200109290434.f8T4YB458912@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Sep 28, 2001 at 09:34:11PM -0700, Jonathan Lemon wrote:
> jlemon      2001/09/28 21:34:11 PDT
> 
>   Modified files:
>     sys/netinet          if_ether.c in.c in_var.h ip_icmp.c 
>                          ip_input.c ip_output.c 
>   Log:
>   Add a hash table that contains the list of internet addresses, and use
>   this in place of the in_ifaddr list when appropriate.  This improves
>   performance on hosts which have a large number of IP aliases.
>   
>   Revision  Changes    Path
>   1.83      +25 -18    src/sys/netinet/if_ether.c
>   1.58      +20 -14    src/sys/netinet/in.c
>   1.41      +19 -3     src/sys/netinet/in_var.h
>   1.61      +21 -14    src/sys/netinet/ip_icmp.c
>   1.181     +31 -18    src/sys/netinet/ip_input.c
>   1.138     +3 -2      src/sys/netinet/ip_output.c
> 
I've been looking into these changes, and have a few comments.

The KASSERT() you added in ip_icmp.c:icmp_reflect() should be
moved slightly up.

In if_ether.c:in_arpinput(), in the BRIDGE case, the old code
initialized "maybe_ia" irrespective of the receive interface.
The new code, in the case of non-match, falls back to the first
INET address on the receive interface (only).  While it's OK if
that address exists, and the behavior is better that with the
old code, it should also fall back to the first INET address
in the system if the INET address on the receive doesn't exist
(ifa is still NULL) and BRIDGE_TEST is true.  Here's patch,
untested:

Index: if_ether.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/if_ether.c,v
retrieving revision 1.86
diff -u -p -r1.86 if_ether.c
--- if_ether.c	2001/10/20 05:14:06	1.86
+++ if_ether.c	2001/10/24 08:47:46
@@ -600,10 +600,13 @@ in_arpinput(m)
 		if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET)
 			break;
 	if (ifa == NULL) {
-		m_freem(m);
-		return;
-	}
-	ia = ifatoia(ifa);
+		if (!BRIDGE_TEST ||
+		    (ia = TAILQ_FIRST(&in_ifaddrhead)) == NULL) {
+			m_freem(m);
+			return;
+		}
+	} else
+		ia = ifatoia(ifa);
 match:
 	myaddr = ia->ia_addr.sin_addr;
 	if (!bcmp(ar_sha(ah), IF_LLADDR(ifp), ifp->if_addrlen)) {


Cheers,
-- 
Ruslan Ermilov		Oracle Developer/DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011024115017.C92032>