From owner-svn-src-all@freebsd.org Sat Sep 9 07:21:28 2017 Return-Path: Delivered-To: svn-src-all@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 A46E5E07399; Sat, 9 Sep 2017 07:21:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 715BE83837; Sat, 9 Sep 2017 07:21:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v897LR2J084297; Sat, 9 Sep 2017 07:21:27 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v897LRWA084296; Sat, 9 Sep 2017 07:21:27 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201709090721.v897LRWA084296@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sat, 9 Sep 2017 07:21:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323351 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 323351 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 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: Sat, 09 Sep 2017 07:21:28 -0000 Author: hselasky Date: Sat Sep 9 07:21:27 2017 New Revision: 323351 URL: https://svnweb.freebsd.org/changeset/base/323351 Log: Resolve IPv6 scope ID issues when using ip6_find_dev() in the LinuxKPI. 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. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/inetdevice.h Modified: head/sys/compat/linuxkpi/common/include/linux/inetdevice.h ============================================================================== --- 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 addr) { struct sockaddr_in6 sin6; struct ifaddr *ifa; - struct ifnet *ifp; + struct ifnet *ifp = NULL; + int x; memset(&sin6, 0, sizeof(sin6)); sin6.sin6_addr = addr; sin6.sin6_len = sizeof(sin6); sin6.sin6_family = AF_INET6; CURVNET_SET_QUIET(vnet); - ifa = ifa_ifwithaddr((struct sockaddr *)&sin6); - CURVNET_RESTORE(); - if (ifa) { - ifp = ifa->ifa_ifp; - if_ref(ifp); - ifa_free(ifa); - } else { - ifp = NULL; + /* XXX need to search all scope ID's */ + for (x = 0; x <= V_if_index; x++) { + sin6.sin6_addr.s6_addr[3] = x; + ifa = ifa_ifwithaddr((struct sockaddr *)&sin6); + if (ifa != NULL) { + ifp = ifa->ifa_ifp; + if_ref(ifp); + ifa_free(ifa); + break; + } } + CURVNET_RESTORE(); return (ifp); }