From nobody Mon Mar 06 15:08:33 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 4PVhmK4kBkz3x0V9; Mon, 6 Mar 2023 15:08:33 +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 4PVhmK1zg1z3nDh; Mon, 6 Mar 2023 15:08:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678115313; 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=B0R2oiGZutIxk0fi0URuHsbmHMq5ClBmDrztissHoeg=; b=lP4yNBJoB7gOdhc/ryoVRT9f2dRFIaLn54EZsAFaFsUjxAWS8HXRy6jcFCGGi0I/yjNBTV BrkHZ3BvCNOE5sXvbCeacFqM4bN40yS2TazXMZE+SN8cLvaPXqLfm+vpy+PjblO9Pf/yAf 1BFU3biPMd+FSY9p/kMa9Af5yl44hxvU2YlGGfIQ1QdnOnRwKueVjNVqy1dbKFWGhDAYft tlvGmYROzEkaZWOaRqRFxkWjKkNdCwdazWoU5yjWXRthQTypQ13Z+ooASIzO5Y1e4JpTxI CFQRk4ZKLUPGJBgRqICvNMfxmAHxwvXAx+9ePWLJ3uqOBgyAaeHcLG1UjM64rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678115313; 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=B0R2oiGZutIxk0fi0URuHsbmHMq5ClBmDrztissHoeg=; b=nSdsRovrs26kr7wKe5w2+fLtbJLXhRjHjdr7y2tVqkPq7LiJOAVvI7HeHbUfWWtIUwBDYA h4/cg+SKBqBfmXWgQQPMEeelxedpeu7b4bceZ9iqbF18HRlFPti8XwE+o/eAo7t0w4dhTv R3GjYxoq/5hCEetlaQxADOnbo7Y8SzXWXA9h7XaaEeGvfvo2Loh4KDquCawz7IieHQQ8Rk WR+YJpm3iF+eUBWEyYI/wWl3xkiYcCOm/0hlHxZRR+yDH8YmO643C789Jc7Z74ZoZb3QmP vXQOZOXjXJTbVLfLAOKmM8uSSAUIt3WDv4OrDo5WPknugGOWZ9kajb0gkFhHdA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678115313; a=rsa-sha256; cv=none; b=AeKLVd9RtGMoVmG64HZowgRkSHlInT7VHhGkhbq1QwW7TkRkVFkoa9jmVQthI8bLwQ2Awg HSq/QsRx4ra6g4xT3DreRND7dbgvICp2s12q/SuL17LjQQTyV+Yl+2PCSCYqyh91STjCs9 YlM/RD/RIHFeeUTrHLUXG31YemB5K7DcNg6d2JnrWITMXEVOiE02y3cJ3hXe62HNZmhxne LLHjyj/ZtNjeUWFgQdJmZPbt1RYxaKIlfiHe6b/9alrucs8OQWkKGhQHbl4sPgIxntzDEZ 224dXhzULas3XMIogoLgsMmJ9ZJxm2h/v6CA6RkSk4oKr7uCMSOPL/zpfVgzpw== 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 4PVhmK15wcz15tg; Mon, 6 Mar 2023 15:08:33 +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 326F8XYD076716; Mon, 6 Mar 2023 15:08:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 326F8XHZ076715; Mon, 6 Mar 2023 15:08:33 GMT (envelope-from git) Date: Mon, 6 Mar 2023 15:08:33 GMT Message-Id: <202303061508.326F8XHZ076715@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: 6a6f2b0ce9e6 - main - netstat: fix IPv6 link-locals & custom multipath printing. 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: 6a6f2b0ce9e6f4be276405118e296f2d42eedba7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=6a6f2b0ce9e6f4be276405118e296f2d42eedba7 commit 6a6f2b0ce9e6f4be276405118e296f2d42eedba7 Author: Alexander V. Chernikov AuthorDate: 2023-03-06 15:06:04 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-03-06 15:08:09 +0000 netstat: fix IPv6 link-locals & custom multipath printing. --- usr.bin/netstat/route_netlink.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/usr.bin/netstat/route_netlink.c b/usr.bin/netstat/route_netlink.c index 17b15579b83b..ea50d8076182 100644 --- a/usr.bin/netstat/route_netlink.c +++ b/usr.bin/netstat/route_netlink.c @@ -163,7 +163,7 @@ SNL_DECLARE_ATTR_PARSER(metrics_mp_parser, nla_p_mp_rtmetrics); static const struct snl_attr_parser psnh[] = { { .type = NL_RTA_GATEWAY, .off = _OUT(gw), .cb = snl_attr_get_ip }, { .type = NL_RTA_METRICS, .arg = &metrics_mp_parser, .cb = snl_attr_get_nested }, - { .type = NL_RTA_RTFLAGS, .off = _OUT(gw), .cb = snl_attr_get_uint32 }, + { .type = NL_RTA_RTFLAGS, .off = _OUT(rta_rtflags), .cb = snl_attr_get_uint32 }, { .type = NL_RTA_VIA, .off = _OUT(gw), .cb = snl_attr_get_ipvia }, }; @@ -320,6 +320,16 @@ struct sockaddr_dl_short { char sdl_data[8]; /* unused */ }; +static void +add_scopeid(struct sockaddr *sa, int ifindex) +{ + if (sa->sa_family == AF_INET6) { + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa; + if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) + sin6->sin6_scope_id = ifindex; + } +} + static void p_path(struct nl_parsed_route *rt, bool is_mpath) { @@ -330,6 +340,8 @@ p_path(struct nl_parsed_route *rt, bool is_mpath) int protrusion; gen_mask(rt->rtm_family, rt->rtm_dst_len, pmask); + add_scopeid(rt->rta_dst, rt->rta_oif); + add_scopeid(rt->rta_gw, rt->rta_oif); protrusion = p_sockaddr("destination", rt->rta_dst, pmask, rt->rta_rtflags, wid.dst); protrusion = p_sockaddr("gateway", rt->rta_gw, NULL, RTF_HOST, wid.gw - protrusion);