From nobody Fri Feb 17 18:16:42 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 4PJKlH2R4Fz3rGZf; Fri, 17 Feb 2023 18:16: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 4PJKlH1hQgz3sb0; Fri, 17 Feb 2023 18:16:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676657803; 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=8Uak2lpbos1l05WZlZE36uKu/ZjNPeNOb1rUQfHZQI8=; b=hj/tQfrnWzB3yXXBOC8LRGn8pUB9Ww8OrjoNxSS4d64D1B+0Esstp6DIEz3evKofWgJ4rh NrMwgWD2lBbGDEiTdD/wrfYF7GuWMIBjsfbZFaBwJqjNXKC80OFLUXlqiRn5dBB64RZSm8 5pK4Kn+Uruq7C3YLW6cgZ9pg5P9jEsZMz8/Pvym+eBOjKdW7kq5T3leE9uYk3jMTlGlOa0 fREL/P6ZdFxpe3vh7Q57WaDlSzWq7MDnJ9MkMpsJZf/rwKtWn3wyXEPPv1ihFqNbnR94XV /ctp8TpHIxHuxbrcGLj4TZlezr6bXUg5yUQfSk4wR1gd/m5o1s9WxTqDbbmNtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676657803; 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=8Uak2lpbos1l05WZlZE36uKu/ZjNPeNOb1rUQfHZQI8=; b=INS3SMvYAzr2HwLC6PsR4NSIP95+mSDh/LcUxhQh6C4x+OWbH121dDVOhOGom4xdBS/neB GHTA7Wn9q99+XBWz/nNqdnIQYzNSG7oqbO96K8gPs8hUmGNq4ywdp7al1NioYj+BrnL4hn qGzgDSQdJftm11iMB1O1mSohvr9SvznupgG/8O+vwxUZP03JGe15caoDnRVuzJ5njTxpv+ RyF9Uw4gq8SX+jHWmvxcC6uohIxHrvY+XjxsKextrdpkcxzrHnQ2pZArW/6wijj4z8sQOk XdHLiOQO8qRm7WGpBHKS9kbOZQ+k7Npq3AkP2hvw0rM1FnFj1EIG6vZ+zBZg8A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676657803; a=rsa-sha256; cv=none; b=hbs6DwDIi/tKUK+HZnEira170kQg8Bbr0thaxVXfFGk5gAJOZ8OGgJimL+niLI/CWwd7Ta 0+qLLbjhUNzUJ/WisaANYiFaoCxggVthXrn+UeO0GZvT1OG8CsMuoJ5wHcwjmXgNZF4sH5 cTWM9uPtmH+12wa36zYYvRsHj4jdmT8xk+mLueaQy/ieLLV7i+PStMoNyMIR5XDY/I0V75 ELevYGyCs4Z+qVzjyVvxhGAXRPUNGRYMudOY4a/IeyGKcR8h1GyCFld1sji3G1z7i/FmWl SSSeFr/nPSKCBojmrKZum7GF1bC1qb2yWFVeL6y1YWCFehiZros6yIDJp+m2Og== 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 4PJKlG6sTbzscK; Fri, 17 Feb 2023 18:16: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 31HIGgPk054295; Fri, 17 Feb 2023 18:16:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31HIGg18054294; Fri, 17 Feb 2023 18:16:42 GMT (envelope-from git) Date: Fri, 17 Feb 2023 18:16:42 GMT Message-Id: <202302171816.31HIGg18054294@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: a0aa160b6d26 - main - routing: always pass rtentry to add_route_flags(). 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: a0aa160b6d261f67b29a25c7cc5e04668fb6faf7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=a0aa160b6d261f67b29a25c7cc5e04668fb6faf7 commit a0aa160b6d261f67b29a25c7cc5e04668fb6faf7 Author: Alexander V. Chernikov AuthorDate: 2023-02-17 17:20:38 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-02-17 18:00:37 +0000 routing: always pass rtentry to add_route_flags(). add_route_flags() uses `rt` prefix data to lookup the the current rtentry from the routing table. Update rib_add_route_px() to always pass rtentry regardless of the op_flags. Reported by: Stefan Grundmann MFC after: 1 day --- sys/net/route/route_ctl.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index fd374b468b7c..755765869e84 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -455,7 +455,7 @@ fill_pxmask_family(int family, int plen, struct sockaddr *_dst, * Attempts to add @dst/plen prefix with nexthop/nexhopgroup data @rnd * to the routing table. * - * @fibnum: rtable id to insert route to + * @fibnum: verified kernel rtable id to insert route to * @dst: verified kernel-originated sockaddr, can be masked if plen non-empty * @plen: prefix length (or -1 if host route or not applicable for AF) * @op_flags: combination of RTM_F_ flags @@ -490,6 +490,16 @@ rib_add_route_px(uint32_t fibnum, struct sockaddr *dst, int plen, FIB_RH_LOG(LOG_INFO, rnh, "rtentry allocation failed"); return (ENOMEM); } + } else { + struct route_nhop_data rnd_tmp; + RIB_RLOCK_TRACKER; + + RIB_RLOCK(rnh); + rt = lookup_prefix_bysa(rnh, dst, netmask, &rnd_tmp); + RIB_RUNLOCK(rnh); + + if (rt == NULL) + return (ESRCH); } return (add_route_flags(rnh, rt, rnd, op_flags, rc)); @@ -766,6 +776,8 @@ add_route_flags(struct rib_head *rnh, struct rtentry *rt, struct route_nhop_data struct rtentry *rt_orig; int error = 0; + MPASS(rt != NULL); + nh = rnd_add->rnd_nhop; RIB_WLOCK(rnh);