From owner-freebsd-net@FreeBSD.ORG Tue Apr 30 13:22:41 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 890D5199; Tue, 30 Apr 2013 13:22:41 +0000 (UTC) (envelope-from jmojica@gmail.com) Received: from mail-wi0-x22c.google.com (mail-wi0-x22c.google.com [IPv6:2a00:1450:400c:c05::22c]) by mx1.freebsd.org (Postfix) with ESMTP id F128012B0; Tue, 30 Apr 2013 13:22:40 +0000 (UTC) Received: by mail-wi0-f172.google.com with SMTP id hm14so3905415wib.17 for ; Tue, 30 Apr 2013 06:22:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=sYO21latCbIbOt1o85M1nLnmUwAEF7Sbkz1phOH5yaY=; b=fq858XOQl2yE/eC084HLYjlH624zqV0iOWOTUXiMUDg0fHiMnD/6mTAvJ9NJFdT7e4 MA+O+eCCu5g65IrDioYrvMUdfhzScbl53gEfgXIF9vydQG/jxiXgLDXQVZsSza0KMR6c bvfeFe6i6vD4u16UT2vnH6XEwqD20J/lf9BPPLAmQDZ0tAy1i/mnh3vnyduDQxpD/iZI j5yaEzgGFbaDpJ0FGoMfQhSAzZw4+X9JBJNneH8tFuXFbZWNEL4rwd05S9tsPUsQ2NCm 3Awzthi6HialsYJRY3A5A7VziFnVaEQoMZqU3srjk4pGlqJjqA/MWA3szFE+C7lnbxck fZ9Q== MIME-Version: 1.0 X-Received: by 10.180.94.196 with SMTP id de4mr24481232wib.23.1367328160126; Tue, 30 Apr 2013 06:22:40 -0700 (PDT) Received: by 10.194.82.138 with HTTP; Tue, 30 Apr 2013 06:22:40 -0700 (PDT) In-Reply-To: References: Date: Tue, 30 Apr 2013 09:22:40 -0400 Message-ID: Subject: Re: in_lltable_rtcheck From: Juan Mojica To: "Li, Qing" Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: FreeBSD Net , "qingli@freebsd.org" X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Apr 2013 13:22:41 -0000 Great! Thanks Qing. I'll come up with a patch and reply. -Juan On Mon, Apr 29, 2013 at 9:40 PM, Li, Qing wrote: > The problem you described here seemed familiar so I checked into the svn > history, > and found I have in fact fixed this issue in other parts of the code. > > Please see > http://svnweb.freebsd.org/base?view=revision&revision=186708 > > So I think similar fix should be applied here as well. > > --Qing > > > ________________________________________ > From: owner-freebsd-net@freebsd.org [owner-freebsd-net@freebsd.org] on > behalf of Juan Mojica [jmojica@gmail.com] > Sent: Monday, April 29, 2013 6:17 PM > To: FreeBSD Net > Subject: in_lltable_rtcheck > > Why is the code comparing the entire sockaddr structure instead of just the > relevant fields? We have a flood of the log message below when > transitioning an IP address from one port to another. And this triggers > other behavior as well. > > Through GDB, we can see that the addresses are in the same subnet. The > problem is that the sin_port port fields in the l3addr and in sa do not > match. > > Is there a reason sin_port should be compared here? > > I can come up with a patch, that's not an issue, but I wanted to confirm > with others first. > > > if (!(rt->rt_flags & RTF_HOST) && rt->rt_ifp != ifp) { > const char *sa, *mask, *addr, *lim; > int len; > > mask = (const char *)rt_mask(rt); > /* > * Just being extra cautious to avoid some custom > * code getting into trouble. > */ > if (mask == NULL) { > RTFREE_LOCKED(rt); > return (EINVAL); > } > > sa = (const char *)rt_key(rt); > addr = (const char *)l3addr; > len = ((const struct sockaddr_in *)l3addr)->sin_len; > lim = addr + len; > > for ( ; addr < lim; sa++, mask++, addr++) { > if ((*sa ^ *addr) & *mask) { > #ifdef DIAGNOSTIC > log(LOG_INFO, "IPv4 address: \"%s\" is not > on the network\n", > inet_ntoa(((const struct sockaddr_in > *)l3addr)->sin_addr)); > #endif > RTFREE_LOCKED(rt); > return (EINVAL); > } > } > } > > > Regards > > -- > Juan Mojica > Email: jmojica@gmail.com > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" > -- Juan Mojica Email: jmojica@gmail.com