Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 May 2011 21:53:18 +0200
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        Bjoern A. Zeeb <bz@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r221904 - head/sys/netinet
Message-ID:  <B630D76F-0F27-46BF-9C2D-8AC09AE0021F@FreeBSD.org>
In-Reply-To: <796DC8CC-57FB-4C71-966F-F36519D5DA6E@FreeBSD.org>
References:  <201105141822.p4EIMFuB011323@svn.freebsd.org> <796DC8CC-57FB-4C71-966F-F36519D5DA6E@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B630D76F-0F27-46BF-9C2D-8AC09AE0021F>