From owner-svn-src-all@FreeBSD.ORG Wed May 18 16:35:05 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47E0D1065670; Wed, 18 May 2011 16:35:05 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) by mx1.freebsd.org (Postfix) with ESMTP id A308A8FC15; Wed, 18 May 2011 16:35:04 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 6877D25D3888; Wed, 18 May 2011 16:35:03 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 94655159FBD1; Wed, 18 May 2011 16:35:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id MLWFaqPkDbTB; Wed, 18 May 2011 16:35:01 +0000 (UTC) Received: from orange-en1.sbone.de (orange-en1.sbone.de [IPv6:fde9:577b:c1a9:31:cabc:c8ff:fecf:e8e3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 02188159FBD0; Wed, 18 May 2011 16:35:00 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: <201105141822.p4EIMFuB011323@svn.freebsd.org> Date: Wed, 18 May 2011 16:35:00 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <796DC8CC-57FB-4C71-966F-F36519D5DA6E@FreeBSD.org> References: <201105141822.p4EIMFuB011323@svn.freebsd.org> To: Michael Tuexen 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-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 May 2011 16:35:05 -0000 On May 14, 2011, at 6:22 PM, Michael Tuexen wrote: > 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) ... > @@ -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 either this needs to go outside the if() or ... > + 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 ... this needs to be inside the block. Either way will unbreak INET = free kernels again. > + return (sifa); > } --=20 Bjoern A. Zeeb You have to have visions! Stop bit received. Insert coin for new address family.