From owner-freebsd-current@FreeBSD.ORG Mon Aug 8 14:57:43 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4AF50106567A for ; Mon, 8 Aug 2011 14:57:43 +0000 (UTC) (envelope-from onwahe@gmail.com) Received: from mail-pz0-f45.google.com (mail-pz0-f45.google.com [209.85.210.45]) by mx1.freebsd.org (Postfix) with ESMTP id 17F678FC19 for ; Mon, 8 Aug 2011 14:57:42 +0000 (UTC) Received: by pzk33 with SMTP id 33so1234729pzk.18 for ; Mon, 08 Aug 2011 07:57:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=cHeWXLVlEy4xn4wCFnNV0KCK0SjW5FOKiIsVYHUQVf8=; b=W6armr4gYuS547lDMH/3UebyvU9XE55pnjojekrszrGENBHXpEdpPsBmX/xZHsMb9A 9bkgPK6X5WyBi7sYy1R9/YAQHgmKnBXmOat6HbnLD46s0ngevHjwtV07blTKH74w0FY3 vl5JBMTBPOpLQNYdAd/B6fUktmIpnm7Pfc3zk= MIME-Version: 1.0 Received: by 10.143.91.1 with SMTP id t1mr1420857wfl.272.1312815462462; Mon, 08 Aug 2011 07:57:42 -0700 (PDT) Received: by 10.142.144.20 with HTTP; Mon, 8 Aug 2011 07:57:42 -0700 (PDT) In-Reply-To: <1312781293.2521.1.camel@srgsec> References: <92B5D566-9816-4134-9358-2306D0F7DAFC@averesystems.com> <1312781293.2521.1.camel@srgsec> Date: Mon, 8 Aug 2011 16:57:42 +0200 Message-ID: From: Svatopluk Kraus To: Kevin Lo Content-Type: multipart/mixed; boundary=001517503e824bb41804a9ffab21 Cc: Jeremiah Lott , freebsd-current@freebsd.org, Andrew Boyer Subject: Re: [patch] Problem with two NIC on same NET (in_scrubprefix: err=17, new prefix add failed) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2011 14:57:43 -0000 --001517503e824bb41804a9ffab21 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks for committing the fix. I've continued with work on two NIC on same NET. Now, with point-to-point interfaces too and I have more small fixes which I submitted today: http://www.freebsd.org/cgi/query-pr.cgi?pr=3D159600 http://www.freebsd.org/cgi/query-pr.cgi?pr=3D159601 http://www.freebsd.org/cgi/query-pr.cgi?pr=3D159602 http://www.freebsd.org/cgi/query-pr.cgi?pr=3D159603 I have one more related problem, but I'm not sure how complex the fix shoul= d be. When an interface is marked down a network route is deleted (or replaced) and a loopback route persists in routing table. It is OK. However, when an interface is marked up again, then a network route is installed unconditionally (but error is ignored) and a loopbak route is deleted and added immediately and unconditionally too. IMHO, it is not correct behaviour. I think that a second half of in_ifinit() should be here starting by in_addprefix() call with some small or bigger changes. Maybe, adding network route and ignoring error could be OK, but deleting loopback route should be done under IFA_RTSELF flag is set condition (with existing route refcount check). V_useloopback should be check before re-adding the route and existing route must be check to evaluate refcount correctly. The proposed patch is attached. However, I prefer to call in_addprefix() (which is static now) instead of rtinit() and add some more checks from in_ifinit(). Can you (or anyone) review the patch? Thanks once again, Svata On Mon, Aug 8, 2011 at 7:28 AM, Kevin Lo wrote: > Hi Andrew, > > I just committed Svatopluk's fix to HEAD, thanks! > > =A0 =A0 =A0 =A0Kevin > > On Wed, 2011-08-03 at 11:11 -0400, Andrew Boyer wrote: >> We found and fixed a similar issue with an identical patch. =A0It has be= en working fine for us under stable/8. >> >> Unfortunately I am weeks and weeks behind on pushing fixes back to the t= ree, so you had to duplicate the work. =A0If it can be committed (and MFC'd= to 8, please) it would save others the trouble. >> >> -Andrew >> >> On Aug 3, 2011, at 10:51 AM, Svatopluk Kraus wrote: >> >> > I have two NIC on same NET (both are up). If a NIC which installs >> > network route is going down then an error happens during network route >> > replacement (in_scrubprefix: err=3D17, new prefix add failed). >> > >> > =A0I've done a little bit investigation. In rtinit1(), before >> > rtrequest1_fib() is called, info.rti_flags is initialized by flags >> > (function argument) or-ed with ifa->ifa_flags. Both NIC has a loopback >> > route to itself, so IFA_RTSELF is set on ifa(s). As IFA_RTSELF is >> > defined by RTF_HOST, rtrequest1_fib() is called with RTF_HOST flag >> > even if netmask is not NULL. Consequently, netmask is set to zero in >> > rtrequest1_fib(), and request to add network route is changed under >> > hands to request to add host route. It is the reason of logged info >> > and my problem. >> > >> > =A0When I've done more investigation, it looks similar to >> > http://svnweb.freebsd.org/base?view=3Drevision&revision=3D201543. So, = I >> > propose the following patch. >> > >> > Index: sys/net/route.c >> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> > --- sys/net/route.c (revision 224635) >> > +++ sys/net/route.c (working copy) >> > @@ -1478,7 +1478,7 @@ >> > =A0 =A0 =A0 =A0 =A0 =A0 =A0*/ >> > =A0 =A0 =A0 =A0 =A0 =A0 bzero((caddr_t)&info, sizeof(info)); >> > =A0 =A0 =A0 =A0 =A0 =A0 info.rti_ifa =3D ifa; >> > - =A0 =A0 =A0 =A0 =A0 info.rti_flags =3D flags | ifa->ifa_flags; >> > + =A0 =A0 =A0 =A0 =A0 info.rti_flags =3D flags | (ifa->ifa_flags & ~IF= A_RTSELF); >> > =A0 =A0 =A0 =A0 =A0 =A0 info.rti_info[RTAX_DST] =3D dst; >> > =A0 =A0 =A0 =A0 =A0 =A0 /* >> > =A0 =A0 =A0 =A0 =A0 =A0 =A0* doing this for compatibility reason >> > >> > >> > =A0Is the patch sufficient? >> > >> > =A0 =A0 =A0Svata >> > _______________________________________________ >> > freebsd-current@freebsd.org mailing list >> > http://lists.freebsd.org/mailman/listinfo/freebsd-current >> > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.= org" >> >> -------------------------------------------------- >> Andrew Boyer =A0aboyer@averesystems.com >> >> >> >> >> _______________________________________________ >> freebsd-current@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-current >> To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.or= g" > > > --001517503e824bb41804a9ffab21 Content-Type: text/plain; charset=US-ASCII; name="patch_raw_ip.txt" Content-Disposition: attachment; filename="patch_raw_ip.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gr3kaauw0 SW5kZXg6IHN5cy9uZXRpbmV0L3Jhd19pcC5jCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIHN5cy9uZXRpbmV0L3Jh d19pcC5jCShyZXZpc2lvbiAyMjQ3MDUpCisrKyBzeXMvbmV0aW5ldC9yYXdfaXAuYwkod29ya2lu ZyBjb3B5KQpAQCAtNzYxLDE3ICs3NjEsNjYgQEAKIAkJICAgIHx8IChpZnAtPmlmX2ZsYWdzICYg SUZGX1BPSU5UT1BPSU5UKSkKIAkJCWZsYWdzIHw9IFJURl9IT1NUOwogCi0JCWVyciA9IGlmYV9k ZWxfbG9vcGJhY2tfcm91dGUoKHN0cnVjdCBpZmFkZHIgKilpYSwgc2EpOwotCQlpZiAoZXJyID09 IDApCi0JCQlpYS0+aWFfZmxhZ3MgJj0gfklGQV9SVFNFTEY7CisJCS8qCisJCSAqIFRyeSB0byBp bnN0YWxsIG91ciBwcmVmaXguIFRoZSBwcmVmaXggYWxyZWFkeSBjYW4gYmUKKwkJICogaW5zdGFs bGVkIGJ5IGFub3RoZXIgaW50ZXJmYWNlLCBzbyBlcnJvciBjYW4gYmU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VjdCBpZmFkZHIgKilpYSwKKwkJCQkgICAgICAgCQkJCSAgICAgIHNhKTsKKwkJ CQkJaWYgKGVyciA9PSAwKQorCQkJCQkJaWEtPmlhX2ZsYWdzICY9IH5JRkFfUlRTRUxGOworCQkJ CX0KKwkJCX0KKwkJfQorCQllbHNlIGlmICghKGlhLT5pYV9mbGFncyAmIElGQV9SVFNFTEYpICYm CisJCQkgIShpZnAtPmlmX2ZsYWdzICYgSUZGX0xPT1BCQUNLKSkgeworCQkJc3RydWN0IHJvdXRl IGlhX3JvOworCisJCQliemVybygmaWFfcm8sIHNpemVvZihpYV9ybykpOworCQkJKigoc3RydWN0 IHNvY2thZGRyX2luICopKCZpYV9yby5yb19kc3QpKSA9IGlhLT5pYV9hZGRyOworCQkJcnRhbGxv Y19pZ25fZmliKCZpYV9ybywgMCwgMCk7CisJCQlpZiAoKGlhX3JvLnJvX3J0ICE9IE5VTEwpICYm IChpYV9yby5yb19ydC0+cnRfaWZwICE9IE5VTEwpICYmCisJCQkgICAgKGlhX3JvLnJvX3J0LT5y dF9pZnAgPT0gVl9sb2lmKSkgeworCQkJCVJUX0xPQ0soaWFfcm8ucm9fcnQpOworCQkJCVJUX0FE RFJFRihpYV9yby5yb19ydCk7CisJCQkJUlRGUkVFX0xPQ0tFRChpYV9yby5yb19ydCk7CisJCQl9 IGVsc2UKIAkJZXJyID0gaWZhX2FkZF9sb29wYmFja19yb3V0ZSgoc3RydWN0IGlmYWRkciAqKWlh LCBzYSk7CisKIAkJaWYgKGVyciA9PSAwKQogCQkJaWEtPmlhX2ZsYWdzIHw9IElGQV9SVFNFTEY7 CisJCQlpZiAoaWFfcm8ucm9fcnQgIT0gTlVMTCkKKwkJCQlSVEZSRUUoaWFfcm8ucm9fcnQpOwor CQl9CiAKIAkJaWZhX2ZyZWUoJmlhLT5pYV9pZmEpOwogCQlicmVhazsK --001517503e824bb41804a9ffab21--