From nobody Sun Mar 26 18:07:31 2023 X-Original-To: dev-commits-src-main@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 4Pl3nc2Wdcz427sP; Sun, 26 Mar 2023 18:07:32 +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 4Pl3nc1J8Xz3qxl; Sun, 26 Mar 2023 18:07:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679854052; 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=i3pwVzDh+F9iLZx0ArkMtbPULqRfMK/NrVcqH7xMO2U=; b=jWH/scuOtxOM6YBXG9I71PPFd10hGC7EJQGAJUvQanGjGzf3mwB+750fx+YTwtdVrTA4cs 0Rl7I8dRNLzL0byzYp4M7edMSVjRWjprUOm45tVa8HKRiQ8Ee+cCIDK2PVsayc70cpgA7I kdsGwaG5zTrobiF9Fza83+W5Yl/bSJ4D/g+BUq2RMq6O9MOUh1S+mjqFqCiEodkhiVAV4z 6utZFJ3gAMjbpQHkie8niWVbPQu+hgeg1Dh2iTYUCJ48kMjFSKOYFYjwJUXx/fhCduypvv p+xzob6+pQin/FB+SveQpEXTHN2BU/yEPFEkwMfJMRKNH/VJT7ITJeY+5V1F9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679854052; 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=i3pwVzDh+F9iLZx0ArkMtbPULqRfMK/NrVcqH7xMO2U=; b=oQMkLKKBO2eKY791fvf6WPZI6kZVeACg+MullxYiyYfECA5K9w31XHzX/q4sNF7GdNJBKa +WY+twjjQnk6Don2Kmj55rtFkWsHHh81Pom0NxZJf73/1loE+pEuHAit0Q+QDFm9mRvxuv F358/esc7xRVXFaNFNcjR991R6DimbNAh5z2ta2kDvpFJ3F1mUe2GCEYKqgsHT3smZk/c7 AaHjTYB+GZNjnXDps7nrh0dFCNdr27efp8quKVkzsxtxd+f+6RAP3hK31kNoXiMqeox8yI J7jMEbw3U/X123WfjlRFehFK00aqGVj3V1B8dvQF0+vmBUPlRdqtEgeHg81sUw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679854052; a=rsa-sha256; cv=none; b=ynQNDxiQR/Eg71wljXFJSNZhgLvIO2TTaNMCLj9DfKnuof7qJIAU/+x+7Ovv4vn6tBY7H2 B2ww9OIpjMI2s5lFhmpdJDP1n/jnvABbKdVkLKeedHNlQVOEHUjcVNezsbXTNdkIcbBkFm dA6/jBpFVEkfb/xaGzBp1OTb8D7D+QmlB42VNRdE8bu4Bg8eKT9/r1oLsOZBuTFu4QcJzb no5++BhAd5Lxu1F2PwGkxUi7OcSmwZM5Kk7HXbuVK8JHLHYZbjbriTC0rSmnqzC6q79DoW 7OYWfM4DHtgcr2MJ9r1aeT0ka3hYXP2N7izY4nUxkmTg1S02mzYCnAuZW6Jl5A== 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 4Pl3nc0KvnzqYl; Sun, 26 Mar 2023 18:07:32 +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 32QI7VOe049888; Sun, 26 Mar 2023 18:07:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32QI7V1f049887; Sun, 26 Mar 2023 18:07:31 GMT (envelope-from git) Date: Sun, 26 Mar 2023 18:07:31 GMT Message-Id: <202303261807.32QI7V1f049887@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: 3a151e31ac6e - main - route: fix RTF_HOST & non-empty mask handling in netlink translation. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: 3a151e31ac6ea7e4555dd874fc23f70527eb359b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=3a151e31ac6ea7e4555dd874fc23f70527eb359b commit 3a151e31ac6ea7e4555dd874fc23f70527eb359b Author: Alexander V. Chernikov AuthorDate: 2023-03-26 18:06:34 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-03-26 18:07:23 +0000 route: fix RTF_HOST & non-empty mask handling in netlink translation. --- sbin/route/route_netlink.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sbin/route/route_netlink.c b/sbin/route/route_netlink.c index 648d866670fc..0b9bb4ff5750 100644 --- a/sbin/route/route_netlink.c +++ b/sbin/route/route_netlink.c @@ -154,14 +154,20 @@ rtmsg_nl_int(struct nl_helper *h, int cmd, int rtm_flags, int fib, { struct sockaddr_in *mask4 = (struct sockaddr_in *)mask; - plen = mask4 ? bitcount32(mask4->sin_addr.s_addr) : 32; + if ((rtm_flags & RTF_HOST) == 0 && mask4 != NULL) + plen = bitcount32(mask4->sin_addr.s_addr); + else + plen = 32; break; } case AF_INET6: { struct sockaddr_in6 *mask6 = (struct sockaddr_in6 *)mask; - plen = mask6 ? inet6_get_plen(&mask6->sin6_addr) : 128; + if ((rtm_flags & RTF_HOST) == 0 && mask6 != NULL) + plen = inet6_get_plen(&mask6->sin6_addr); + else + plen = 128; break; } default: