From owner-svn-src-head@freebsd.org Sat Sep 9 11:14:00 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74277E102B8; Sat, 9 Sep 2017 11:14:00 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward104p.mail.yandex.net (forward104p.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Yandex CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1726064A97; Sat, 9 Sep 2017 11:13:59 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from mxback10j.mail.yandex.net (mxback10j.mail.yandex.net [IPv6:2a02:6b8:0:1619::113]) by forward104p.mail.yandex.net (Yandex) with ESMTP id 8B2EB185234; Sat, 9 Sep 2017 14:13:56 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback10j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id ww4GX6AxIk-DuFuSPA9; Sat, 09 Sep 2017 14:13:56 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1504955636; bh=iLJRtWqVXA6f/20PQrhlMZbbOtwAau/KDXClqwQtKd8=; h=Subject:To:References:From:Message-ID:Date:In-Reply-To; b=idURqReEJIt4qr5nwvcwdrng31Ov7ntGNpZX1X1sRwhSUBeS36g4Ho22qeMV3rPtg af9hfCPtxglxXm8kocDeIjOtFN/zObOBTpg0jaegxeQjj8sj+b+KIqwc4GT7GpjBKi oMhKmAq+Vs2oP7/INSom8Tikid3DjwL8gqF5wuE0= Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id HxIs9oc2QJ-DtB8H00g; Sat, 09 Sep 2017 14:13:55 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1504955636; bh=iLJRtWqVXA6f/20PQrhlMZbbOtwAau/KDXClqwQtKd8=; h=Subject:To:References:From:Message-ID:Date:In-Reply-To; b=idURqReEJIt4qr5nwvcwdrng31Ov7ntGNpZX1X1sRwhSUBeS36g4Ho22qeMV3rPtg af9hfCPtxglxXm8kocDeIjOtFN/zObOBTpg0jaegxeQjj8sj+b+KIqwc4GT7GpjBKi oMhKmAq+Vs2oP7/INSom8Tikid3DjwL8gqF5wuE0= Authentication-Results: smtp3o.mail.yandex.net; dkim=pass header.i=@yandex.ru Subject: Re: svn commit: r323351 - head/sys/compat/linuxkpi/common/include/linux To: Hans Petter Selasky , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201709090721.v897LRWA084296@repo.freebsd.org> From: "Andrey V. Elsukov" Openpgp: id=E6591E1B41DA1516F0C9BC0001C5EA0410C8A17A Message-ID: <1b752f11-2ec8-4c07-d53a-9e32a5fcf56c@yandex.ru> Date: Sat, 9 Sep 2017 14:10:09 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <201709090721.v897LRWA084296@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="uM0Lw8OWixNWN3KGnXXfo8EBDuLuhWhFV" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 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: Sat, 09 Sep 2017 11:14:00 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --uM0Lw8OWixNWN3KGnXXfo8EBDuLuhWhFV Content-Type: multipart/mixed; boundary="6sld1W72nU0TTXlieE9kjsANimh2dWr46"; protected-headers="v1" From: "Andrey V. Elsukov" To: Hans Petter Selasky , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <1b752f11-2ec8-4c07-d53a-9e32a5fcf56c@yandex.ru> Subject: Re: svn commit: r323351 - head/sys/compat/linuxkpi/common/include/linux References: <201709090721.v897LRWA084296@repo.freebsd.org> In-Reply-To: <201709090721.v897LRWA084296@repo.freebsd.org> --6sld1W72nU0TTXlieE9kjsANimh2dWr46 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 09.09.2017 10:21, Hans Petter Selasky wrote: > Author: hselasky > Date: Sat Sep 9 07:21:27 2017 > New Revision: 323351 > URL: https://svnweb.freebsd.org/changeset/base/323351 >=20 > Log: > Resolve IPv6 scope ID issues when using ip6_find_dev() in the LinuxKP= I. > =20 > Workaround problem that ifa_ifwithaddr() also matches the scope ID of= > the IPv6 address when searching for a maching IPv6 address. For now > simply try all valid scope IDs until a match is found. > =20 > MFC after: 1 week > Sponsored by: Mellanox Technologies >=20 > Modified: > head/sys/compat/linuxkpi/common/include/linux/inetdevice.h >=20 > Modified: head/sys/compat/linuxkpi/common/include/linux/inetdevice.h > =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/compat/linuxkpi/common/include/linux/inetdevice.h Sat Sep = 9 06:34:20 2017 (r323350) > +++ head/sys/compat/linuxkpi/common/include/linux/inetdevice.h Sat Sep = 9 07:21:27 2017 (r323351) > @@ -62,22 +62,26 @@ ip6_dev_find(struct vnet *vnet, struct in6_addr add= r) > { > struct sockaddr_in6 sin6; > struct ifaddr *ifa; > - struct ifnet *ifp; > + struct ifnet *ifp =3D NULL; > + int x; > =20 > memset(&sin6, 0, sizeof(sin6)); > sin6.sin6_addr =3D addr; > sin6.sin6_len =3D sizeof(sin6); > sin6.sin6_family =3D AF_INET6; > CURVNET_SET_QUIET(vnet); > - ifa =3D ifa_ifwithaddr((struct sockaddr *)&sin6); > - CURVNET_RESTORE(); > - if (ifa) { > - ifp =3D ifa->ifa_ifp; > - if_ref(ifp); > - ifa_free(ifa); > - } else { > - ifp =3D NULL; > + /* XXX need to search all scope ID's */ > + for (x =3D 0; x <=3D V_if_index; x++) { > + sin6.sin6_addr.s6_addr[3] =3D x; This doesn't look right. We use s6_addr16[1] to keep scope zone id. And if_index value should be converted into network byte order. It is quite usual to have more that 255 interfaces. And what is more important, you must not use this code for global IPv6 addresses. --=20 WBR, Andrey V. Elsukov --6sld1W72nU0TTXlieE9kjsANimh2dWr46-- --uM0Lw8OWixNWN3KGnXXfo8EBDuLuhWhFV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEzBAEBCAAdFiEE5lkeG0HaFRbwybwAAcXqBBDIoXoFAlmzzBEACgkQAcXqBBDI oXqS1gf/XUB8rlcPl7LxzAUBeSsiOhKkBOLWsPvmhrZnvjzjOwtau7hmqb5h8Ofg U/aXp4StREcM8pV4bodObDWI6MCmwriDFgCAUhaTDjufi/WdWruBwEkNQCTM6az7 XVEV2CwktjayckbE19usPVHo8V9JR1fmiOUiiAYhr5NUYp1Xf/QwKzKYVb1YWUJG PCpIjMXdWQduRRreBLKJsI6nLfOwdQ1E+ISTMlsX6HU5NWWFA3O0+E6PVm5J63Rb TVR9Fka3eAO/yqM2RssvwrX60yNQmiq1XU2aC2AFr97VMaF06X3ASXUR2JRV6znV rOncsFmAt/KODRXc8bfEikAaYC4O1Q== =mqOK -----END PGP SIGNATURE----- --uM0Lw8OWixNWN3KGnXXfo8EBDuLuhWhFV--