From owner-svn-src-head@FreeBSD.ORG Wed May 18 19:53:22 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5DF2B1065678; Wed, 18 May 2011 19:53:22 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mail-n.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) by mx1.freebsd.org (Postfix) with ESMTP id A07EF8FC08; Wed, 18 May 2011 19:53:21 +0000 (UTC) Received: from [192.168.1.195] (p508FC1D9.dip.t-dialin.net [80.143.193.217]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTP id 676E11C0C0BD8; Wed, 18 May 2011 21:53:19 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Michael Tuexen In-Reply-To: <796DC8CC-57FB-4C71-966F-F36519D5DA6E@FreeBSD.org> Date: Wed, 18 May 2011 21:53:18 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201105141822.p4EIMFuB011323@svn.freebsd.org> <796DC8CC-57FB-4C71-966F-F36519D5DA6E@FreeBSD.org> To: Bjoern A. Zeeb X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221904 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 May 2011 19:53:22 -0000 Hi Bjoern, fixed in http://svn.freebsd.org/changeset/base/222077 Thanks for reporting it. Best regards Michael On May 18, 2011, at 6:35 PM, Bjoern A. Zeeb wrote: >=20 > On May 14, 2011, at 6:22 PM, Michael Tuexen wrote: >=20 >> Author: tuexen >> Date: Sat May 14 18:22:14 2011 >> New Revision: 221904 >> URL: http://svn.freebsd.org/changeset/base/221904 >>=20 >> Log: >> Fix the source address selection for boundall sockets >> when sending INITs to a global IPv4 address having >> only private IPv4 address. >> Allow the usage of a private address and make sure >> that no other private address will be used by the >> association. >> Initial work was done by rrs@. >>=20 >> MFC after: 1 week. >>=20 >> Modified: >> head/sys/netinet/sctp_output.c >> head/sys/netinet/sctp_output.h >>=20 >> Modified: head/sys/netinet/sctp_output.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=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/sys/netinet/sctp_output.c Sat May 14 18:22:08 2011 = (r221903) >> +++ head/sys/netinet/sctp_output.c Sat May 14 18:22:14 2011 = (r221904) >=20 > ... >=20 >> @@ -3068,19 +3112,81 @@ plan_d: >> * It is restricted for some >> * reason.. probably not yet = added. >> */ >> + sifa =3D NULL; >> continue; >> } >> } >> - atomic_add_int(&sifa->refcount, 1); >> - return (sifa); >> + goto out; >> } >> } >> - /* >> - * Ok we can find NO address to source from that is not on our >> - * restricted list and non_asoc_address is NOT ok, or it is on = our >> - * restricted list. We can't source to it :-( >> - */ >> - return (NULL); >> +#ifdef INET >> + if ((retried =3D=3D 0) && (stcb->asoc.ipv4_local_scope =3D=3D = 0)) { >> + stcb->asoc.ipv4_local_scope =3D 1; >> + retried =3D 1; >> + goto again_with_private_addresses_allowed; >> + } else if (retried =3D=3D 1) { >> + stcb->asoc.ipv4_local_scope =3D 0; >> + } >> +#endif >> +out: >> + if (sifa) { >> +#ifdef INET >=20 > either this needs to go outside the if() or ... >=20 >> + if (retried =3D=3D 1) { >> + LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) = { >> + if (dest_is_loop =3D=3D 0 && = SCTP_IFN_IS_IFT_LOOP(sctp_ifn)) { >> + /* wrong base scope */ >> + continue; >> + } >> + LIST_FOREACH(sctp_ifa, = &sctp_ifn->ifalist, next_ifa) { >> + struct sctp_ifa *tmp_sifa; >> + >> + if ((sctp_ifa->localifa_flags & = SCTP_ADDR_DEFER_USE) && >> + (non_asoc_addr_ok =3D=3D 0)) >> + continue; >> + tmp_sifa =3D = sctp_is_ifa_addr_acceptable(sctp_ifa, >> + dest_is_loop, >> + dest_is_priv, fam); >> + if (tmp_sifa =3D=3D NULL) { >> + continue; >> + } >> + if (tmp_sifa =3D=3D sifa) { >> + continue; >> + } >> + if (stcb) { >> + if = (sctp_is_address_in_scope(tmp_sifa, >> + = stcb->asoc.ipv4_addr_legal, >> + = stcb->asoc.ipv6_addr_legal, >> + = stcb->asoc.loopback_scope, >> + = stcb->asoc.ipv4_local_scope, >> + = stcb->asoc.local_scope, >> + = stcb->asoc.site_scope, 0) =3D=3D 0) { >> + continue; >> + } >> + if (((non_asoc_addr_ok = =3D=3D 0) && >> + = (sctp_is_addr_restricted(stcb, tmp_sifa))) || >> + (non_asoc_addr_ok && >> + = (sctp_is_addr_restricted(stcb, tmp_sifa)) && >> + = (!sctp_is_addr_pending(stcb, tmp_sifa)))) { >> + /* >> + * It is = restricted >> + * for some = reason.. >> + * probably not = yet >> + * added. >> + */ >> + continue; >> + } >> + } >> + if = ((tmp_sifa->address.sin.sin_family =3D=3D AF_INET) && >> + = (IN4_ISPRIVATE_ADDRESS(&(tmp_sifa->address.sin.sin_addr)))) { >> + = sctp_add_local_addr_restricted(stcb, tmp_sifa); >> + } >> + } >> + } >> + } >> + atomic_add_int(&sifa->refcount, 1); >> + } >> +#endif >=20 > ... this needs to be inside the block. Either way will unbreak INET = free kernels again. >=20 >> + return (sifa); >> } >=20 >=20 >=20 > --=20 > Bjoern A. Zeeb You have to have = visions! > Stop bit received. Insert coin for new address family. >=20 >=20