From nobody Fri Jan 13 21:25: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 4Ntvbd0csmz2qlCF; Fri, 13 Jan 2023 21:25: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 4Ntvbc4p0tz43t9; Fri, 13 Jan 2023 21:25:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673645148; 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=4LTCXwQ5sQyKnn1jMVBgA5OtD5Im611drOURP1wVXZI=; b=pQIpXksZ7uOQKpNy/s7OudZ+nRJX5M3LPMGzVup1eJj5mSiw9OnAAQtJAB6ZDghGfmp+YC sbJ6U2MN+pxtWsScz40IK8OHct+ZPGc9wynYp7r6ruqxxyPq2SY4LocPhRBd5LREkBHO0V O2bAyFJecVqIoNen8uTPNjiB5qeNtbIPciSwVWjNECfywMDxFXyHZo/79GD6T/F8KF/2+q EPelJrFCJaohcM+YgjHjlByxX92oMK+DufFZVFTdIBSG8leW7Z0S4CIwUoSA+NWD1mo9Mo gOn3K/q+66wTFaWURsSH82+81JfAbMayPpf/wD4Wrxr84T23snf020cL96VBwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673645148; 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=4LTCXwQ5sQyKnn1jMVBgA5OtD5Im611drOURP1wVXZI=; b=AJy+wGY16CszonQYua08zXQAGi1EmhpCTVcswHl+zd3+nSo2dZr2H3eK9eXvT4qMLPm/HO 28kLK+P5Pap5cP38mwLI3LLaqhIa9FwmcyKPtKzuX04xgHjdyO6lu1oqU+adfQ+5CSQKQN GPJm62HCznPHxqG9M/rf+qM2C4rRtGZKW4tRkDxo/L8lWVpAjBQDKbNPu/s2iV543Y9VNp xKIL7bwPR35xUDbZGuwnm+YPJJQ2KIpBXJa8g9EshNK27i17GSrpH+7SUrlOntSCxNnnMF ISzRag0wzWiBbrlTlS7uJhG8I9qSbAtmCSa+3m30MvcTzz1ZYHZGzO3ex4rU0w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1673645148; a=rsa-sha256; cv=none; b=dt5LNViJyZjyJwkx2lBrNzb2AmnIiwJCzJDAHN1zYv2Uav/tx90/hXMEm7HdgWc0MEVC3s 1W3P9SebOc0IT6UzU1OsNb7rMXxP9vs9WVPc8N9ivkj0e7+kcZFBdDponvZHXmtYAxO8R0 wJ9pAM1Vo5lDLnweW1pZHxMoA+uU89Y2N9qatvfB2Glulfbo5mOT8NDwtnwOQUUWPGwiVg oup+UIKFoywpEaj2w7D4d7yx2939wNcsGLNCv9bvOCPkp8/w1zaNmgYgW9otOgLYKbP5Vl x54C2t4s+coGi5hQoljiI+NAHjVi4E5toGgfLJxPaYIbyRO0L3FZyOqKDJfTYg== 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 4Ntvbc3ksYzMVw; Fri, 13 Jan 2023 21:25: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 30DLPmIv042356; Fri, 13 Jan 2023 21:25:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30DLPmcp042355; Fri, 13 Jan 2023 21:25:48 GMT (envelope-from git) Date: Fri, 13 Jan 2023 21:25:48 GMT Message-Id: <202301132125.30DLPmcp042355@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: b9a4237c5fce - stable/13 - routing: fix rib_add_route_px() 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: b9a4237c5fceb141d6204dea6151c663598b6ea2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=b9a4237c5fceb141d6204dea6151c663598b6ea2 commit b9a4237c5fceb141d6204dea6151c663598b6ea2 Author: Alexander V. Chernikov AuthorDate: 2022-08-29 12:23:06 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-01-13 21:24:12 +0000 routing: fix rib_add_route_px() Fix panic in newly-added rib_add_route_px() by removin unlocked prefix lookup. MFC after: 2 weeks (cherry picked from commit c24a8f19c5d554b828908e7dacf1855cd4ee21f3) --- sys/net/route/route_ctl.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index 8256fa0c7162..6881b8131d08 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -474,7 +474,7 @@ rib_add_route_px(uint32_t fibnum, struct sockaddr *dst, int plen, { union sockaddr_union mask_storage; struct sockaddr *netmask = &mask_storage.sa; - struct rtentry *rt; + struct rtentry *rt = NULL; NET_EPOCH_ASSERT(); @@ -495,22 +495,8 @@ 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; - - rt = lookup_prefix_bysa(rnh, dst, netmask, &rnd_tmp); - if (rt == NULL) - return (ESRCH); } -#if DEBUG_MAX_LEVEL >= LOG_DEBUG2 - { - char nhbuf[NHOP_PRINT_BUFSIZE], rtbuf[NHOP_PRINT_BUFSIZE]; - nhop_print_buf_any(rnd->rnd_nhop, nhbuf, sizeof(nhbuf)); - rt_print_buf(rt, rtbuf, sizeof(rtbuf)); - FIB_RH_LOG(LOG_DEBUG2, rnh, "request %s -> %s", rtbuf, nhbuf); - } -#endif return (add_route_flags(rnh, rt, rnd, op_flags, rc)); } @@ -817,7 +803,7 @@ add_route_flags(struct rib_head *rnh, struct rtentry *rt, struct route_nhop_data if (op_flags & RTM_F_CREATE) error = add_route(rnh, rt, rnd_add, rc); else - error = ENOENT; // no entry but creation was not required + error = ESRCH; /* no entry but creation was not required */ RIB_WUNLOCK(rnh); if (error != 0) goto out; @@ -852,7 +838,7 @@ add_route_flags(struct rib_head *rnh, struct rtentry *rt, struct route_nhop_data nhop_can_multipath(rnd_orig.rnd_nhop)) { for (int i = 0; i < RIB_MAX_RETRIES; i++) { - error = add_route_flags_mpath(rnh, rt, rnd_add, &rnd_orig, + error = add_route_flags_mpath(rnh, rt_orig, rnd_add, &rnd_orig, op_flags, rc); if (error != EAGAIN) break;