From nobody Tue Feb 21 12:27:48 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 4PLdps0j85z3sKf6; Tue, 21 Feb 2023 12:27:49 +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 4PLdps0BPgz4Dw4; Tue, 21 Feb 2023 12:27:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676982469; 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=tl9j/oaOh7csbaB5VAB1yWPvamQGaulxDe5uxi1NUtU=; b=Fdvnwf6l0nOF/AHljfZMkupU2Y4X4L0kpxiZ6QSqswvaJRimPH2DgVlFezx6oh7ebVwKOW L3UIBNYPLVHn+Dc1gRUCuqw5Kt458KPqWEWKQHUNZUk2PUfKN8xyR7emSV8QasTMqfOxLG SeH6TiQf+2WttMgmyyZv1QVvHcfztXqyNGY0SRAn3woVsvAiGz7J1TL3uZq10IRXTkLGNV moldv1BiLo9WcbZ6Ap+DRew8b5pZb+awJjdxbI4WyDP0IN6OuxbZjlVAOafiXK4dPyNRmC PPey8HeYG8h/OV8FFh+4SZeXK5jV+4fC7X2FjXvR81EcuafUK7Zw26BglX6RNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676982469; 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=tl9j/oaOh7csbaB5VAB1yWPvamQGaulxDe5uxi1NUtU=; b=IcKky1f6SDFUzexcG2mvlFXjEweiy7UIPSDE0yQA/in4injdkWTGNjq4C/PX18HGUaj1Qs neFukjv3OVUXgLgEk/eAQq5uxTihg9xGm1A+iCL9L9kao5fK4it+n5opyxo6XAs/+h+0Ts nZH6wlhGnDsHyIfjPt8s+QpwbI9GhSQZPiB4QEhg2hAOkLA4+uQBrQJNEQuDCywJlJwMoe 10pDJwUIPNE1mjXnxhxGIOPPTMQvVUDVkcKn5rwDmjlRRwdQuktfWRehIvMm4dzxzn4S5y 0U+/1JavqRUtgcYKj+3eHnajT2XaibAl/FKuNgHglvUkwu7BNohAPntQgOtk8w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676982469; a=rsa-sha256; cv=none; b=RSXJwsxihyTyH3DaqPi7V7KrqC43M17WnOtzW1VbuGrqNbRneULa1crRH7wyIk8q+SCs1T s/mShmfO6Y9jjOXCE+HnmZdHeEWmBNQ46agOne3DzyU17TMvHkrc5IvqQjSUV/mfKPVAkW iGKGC0KQs9EcE19c/scyuC+1hcH0Q/1sD4qtibpxj97rCBH0mvuhmy9LTTWrqHT2ZjViU5 gr3onIsDXimIlCovtIdKuD/CDpmiSU4BLhfEdZVwd2bFfASsdQyxRXdaFNfogMC161D1Rc R2ybVZINXrIfkZDQNK9EChqtM7/IPYFdsf06KW+UEOmYuXXuMS29pZxspayFyw== 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 4PLdpr6LSCzLZt; Tue, 21 Feb 2023 12:27:48 +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 31LCRm16079804; Tue, 21 Feb 2023 12:27:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31LCRmA5079803; Tue, 21 Feb 2023 12:27:48 GMT (envelope-from git) Date: Tue, 21 Feb 2023 12:27:48 GMT Message-Id: <202302211227.31LCRmA5079803@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: b9b2184322da - main - 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/main X-Git-Reftype: branch X-Git-Commit: b9b2184322da85e1f4d52e3b0a6322dd214210ec Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=b9b2184322da85e1f4d52e3b0a6322dd214210ec commit b9b2184322da85e1f4d52e3b0a6322dd214210ec Author: Alexander V. Chernikov AuthorDate: 2023-02-21 12:25:58 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-21 12:27:26 +0000 netlink: clear IPv6 embedded scope when dumping route gateways. Reported by: zarychtam@plan-b.pwste.edu.pl MFC after: 3 days --- 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 } }