From owner-freebsd-net@FreeBSD.ORG Tue Apr 30 01:46:22 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3072E8E9; Tue, 30 Apr 2013 01:46:22 +0000 (UTC) (envelope-from qing.li@bluecoat.com) Received: from plsvl-mailgw-02.bluecoat.com (plsvl-mailgw-02.bluecoat.com [199.91.133.12]) by mx1.freebsd.org (Postfix) with ESMTP id 0EB9C12FB; Tue, 30 Apr 2013 01:46:21 +0000 (UTC) Received: from PWSVL-EXCHTS-01.internal.cacheflow.com (unknown [10.2.2.122]) by plsvl-mailgw-02.bluecoat.com (Postfix) with ESMTP id 358A02010F; Mon, 29 Apr 2013 18:40:57 -0700 (PDT) Received: from PWSVL-EXCMBX-04.internal.cacheflow.com ([fe80::c596:c77:dd67:b72d]) by PWSVL-EXCHTS-01.internal.cacheflow.com ([fe80::5c50:e2ba:8115:4223%20]) with mapi id 14.01.0289.001; Mon, 29 Apr 2013 18:40:56 -0700 From: "Li, Qing" To: Juan Mojica , FreeBSD Net Subject: RE: in_lltable_rtcheck Thread-Topic: in_lltable_rtcheck Thread-Index: AQHORUCD21qRbZKIH0GzdfKaIfmSsJjt+vYI Date: Tue, 30 Apr 2013 01:40:55 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [199.91.133.85] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "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 01:46:22 -0000 The problem you described here seemed familiar so I checked into the svn hi= story,=0A= and found I have in fact fixed this issue in other parts of the code.=0A= =0A= Please see =0A= http://svnweb.freebsd.org/base?view=3Drevision&revision=3D186708=0A= =0A= So I think similar fix should be applied here as well.=0A= =0A= --Qing=0A= =0A= =0A= ________________________________________=0A= From: owner-freebsd-net@freebsd.org [owner-freebsd-net@freebsd.org] on beha= lf of Juan Mojica [jmojica@gmail.com]=0A= Sent: Monday, April 29, 2013 6:17 PM=0A= To: FreeBSD Net=0A= Subject: in_lltable_rtcheck=0A= =0A= Why is the code comparing the entire sockaddr structure instead of just the= =0A= relevant fields? We have a flood of the log message below when=0A= transitioning an IP address from one port to another. And this triggers=0A= other behavior as well.=0A= =0A= Through GDB, we can see that the addresses are in the same subnet. The=0A= problem is that the sin_port port fields in the l3addr and in sa do not=0A= match.=0A= =0A= Is there a reason sin_port should be compared here?=0A= =0A= I can come up with a patch, that's not an issue, but I wanted to confirm=0A= with others first.=0A= =0A= =0A= if (!(rt->rt_flags & RTF_HOST) && rt->rt_ifp !=3D ifp) {=0A= const char *sa, *mask, *addr, *lim;=0A= int len;=0A= =0A= mask =3D (const char *)rt_mask(rt);=0A= /*=0A= * Just being extra cautious to avoid some custom=0A= * code getting into trouble.=0A= */=0A= if (mask =3D=3D NULL) {=0A= RTFREE_LOCKED(rt);=0A= return (EINVAL);=0A= }=0A= =0A= sa =3D (const char *)rt_key(rt);=0A= addr =3D (const char *)l3addr;=0A= len =3D ((const struct sockaddr_in *)l3addr)->sin_len;=0A= lim =3D addr + len;=0A= =0A= for ( ; addr < lim; sa++, mask++, addr++) {=0A= if ((*sa ^ *addr) & *mask) {=0A= #ifdef DIAGNOSTIC=0A= log(LOG_INFO, "IPv4 address: \"%s\" is not = on the network\n",=0A= inet_ntoa(((const struct sockaddr_in *)= l3addr)->sin_addr));=0A= #endif=0A= RTFREE_LOCKED(rt);=0A= return (EINVAL);=0A= }=0A= }=0A= }=0A= =0A= =0A= Regards=0A= =0A= --=0A= Juan Mojica=0A= Email: jmojica@gmail.com=0A= _______________________________________________=0A= freebsd-net@freebsd.org mailing list=0A= http://lists.freebsd.org/mailman/listinfo/freebsd-net=0A= To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"=0A=