From nobody Fri Feb 24 10:44:42 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PNRNW1ssQz3t5QG; Fri, 24 Feb 2023 10:44:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PNRNW0wHYz3pkF; Fri, 24 Feb 2023 10:44:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677235483; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1GNK0Yf0jkm0TyRmi2ekk/7tCQqc5wDxxZzQy+idO8w=; b=psi3HgRRjcJ9Q1rXHzmjZGZPvH4vDRckxzFHn+rc8aBoshwCwbqieolLUrXBGLrHcBvru3 rqyPZc0wFBjCwQfICrSOtL7O3ULo//QFEijiE9iMii1wAqzbTQPpd/vnB59NuYHib47hza MtmR3myl9hFC6qj2asgvdbhyO8NsPOtPgw3vUZvmUwcW8fkkQqiiTd/4e3+4nxKZTrYZuM 7eY2Qo6eqX2P66nVg73vqrdtZlk945KYzB0R60sfA3JOlU642rDgwcZLULPJN5NHF5UXin vIBkf7dXWCEe9sESSEwabKFK7Fr8FWgYGUEbyLxiFdaMkGvfOG6z0Y69KoAl+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677235483; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1GNK0Yf0jkm0TyRmi2ekk/7tCQqc5wDxxZzQy+idO8w=; b=v15N2BjDvV2DZoRxs5YlCHvY3jcmt0rSGZiztezuiQzANpSgT7JJoTrnPhsBHKPn84JTf9 wvWy5sXO03xU3N8XbRAkZ2C/qADZ6/1o0H0vMveUXIx8KUyiWRUeasFJtK00yY5G0w8r4s uUW4oZXLfczO12abzsiyNYzSsLgMi+vFdaoa/rti3jUVmYHQamv987I0RyWZcGUuomLTgh fsRS5aUkdZmRzj4Q7xiUOaYS7Z777oHfGyUG15p/wa1ebaLPf8hqsolOAX47+M+F8pNanR 4iLcYoJVniMtt/kz4yqeHOWLJhxz2h7/LmIg0E09btaFjjeuiWLDzCMB587MCA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677235483; a=rsa-sha256; cv=none; b=JqUOROSUN2BrcEVsEI4GuIfc2pCioOkAp/hUYhhmFapiHRl70gb2F85hI1Cz+pk8cURTcr bGV9YSCa3SMslMu5X+gL+1PwkrIRhEl14k6tdka3rbcJv/HMqdONtf+lCXioKEkBeyNZPh tmsa7zHp66e5VoYxWj/Pn7FGZHrgFqQ/LIPP5P+m5JbBAJk59cKGWDWEwUFCGFrz7VVGoV xvnJE/0R4YIg1UbehunHjyfKyl2IJ5LtHhQE/ovnv69lDJjTQy1WKAV29Od/FBClUViVsk A7FRt7HVZ3cAp9/BWlJrfp+Dz4randkbJHUS9gghY2c689L4DbzgC/DpqZuxXg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PNRNV70STzLRL; Fri, 24 Feb 2023 10:44:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31OAigJw019938; Fri, 24 Feb 2023 10:44:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31OAigeV019937; Fri, 24 Feb 2023 10:44:42 GMT (envelope-from git) Date: Fri, 24 Feb 2023 10:44:42 GMT Message-Id: <202302241044.31OAigeV019937@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: d101991d8dcc - stable/13 - netlink: clear IPv6 embedded scope when dumping route gateways. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d101991d8dcc1e056d1c06ca83b88826f4d65ae5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=d101991d8dcc1e056d1c06ca83b88826f4d65ae5 commit d101991d8dcc1e056d1c06ca83b88826f4d65ae5 Author: Alexander V. Chernikov AuthorDate: 2023-02-21 12:25:58 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-24 10:44:02 +0000 netlink: clear IPv6 embedded scope when dumping route gateways. Reported by: zarychtam@plan-b.pwste.edu.pl MFC after: 3 days (cherry picked from commit b9b2184322da85e1f4d52e3b0a6322dd214210ec) --- sys/netlink/route/rt.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sys/netlink/route/rt.c b/sys/netlink/route/rt.c index 534186447b4d..dabdaea3e03b 100644 --- a/sys/netlink/route/rt.c +++ b/sys/netlink/route/rt.c @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -123,7 +124,9 @@ rc_get_nhop(const struct rib_cmd_info *rc) static void dump_rc_nhop_gw(struct nl_writer *nw, const struct nhop_object *nh) { +#ifdef INET6 int upper_family; +#endif switch (nhop_get_neigh_family(nh)) { case AF_LINK: @@ -132,19 +135,27 @@ dump_rc_nhop_gw(struct nl_writer *nw, const struct nhop_object *nh) case AF_INET: nlattr_add(nw, NL_RTA_GATEWAY, 4, &nh->gw4_sa.sin_addr); break; +#ifdef INET6 case AF_INET6: upper_family = nhop_get_upper_family(nh); if (upper_family == AF_INET6) { - nlattr_add(nw, NL_RTA_GATEWAY, 16, &nh->gw6_sa.sin6_addr); + struct in6_addr gw6 = nh->gw6_sa.sin6_addr; + in6_clearscope(&gw6); + + nlattr_add(nw, NL_RTA_GATEWAY, 16, &gw6); } else if (upper_family == AF_INET) { /* IPv4 over IPv6 */ + struct in6_addr gw6 = nh->gw6_sa.sin6_addr; + in6_clearscope(&gw6); + char buf[20]; struct rtvia *via = (struct rtvia *)&buf[0]; via->rtvia_family = AF_INET6; - memcpy(via->rtvia_addr, &nh->gw6_sa.sin6_addr, 16); + memcpy(via->rtvia_addr, &gw6, 16); nlattr_add(nw, NL_RTA_VIA, 17, via); } break; +#endif } }