From nobody Mon Aug 29 12:59:37 2022 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 4MGVrp38R0z4b5LZ; Mon, 29 Aug 2022 12:59:38 +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 4MGVrp0Cmrz47K4; Mon, 29 Aug 2022 12:59:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661777978; 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=Ogx8O3FuhOIJJQkqmcd9PCMCYsqR+u7YTjlcTjqT2wE=; b=rS/GVR3AA9Hq6WoN0PGl5w7tet+boz8sjoqdVc2vtWhtIkFNPKTXZ9iEAFxlq0bzwpXcyg cqiF+rt2JNy/PRcR4AXZicQCSxpqnuStXLwYbGmVgTTbFoJLP21B8ThI+jdJ7kwnV938Xc TEZnNb4sZ6uujH8oc4+Z705SmC2QOqJ18yn9dM058/TCvv1jNbG/z7qGzU6gMi4N7HfYi+ 5YS1aLCMSM94e/PCWZOhhhFaPtZCG7Vdi6qlTgclaT9F+9IMLnlLff0nBCS9faijna+y5N W/eIDcxICphhCNlK+Avi3ndH5q4QjEb5Eb4BJjgEGjTDmXX0nqv36Rzv65g/Vg== 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 4MGVrn6JQ1zR12; Mon, 29 Aug 2022 12:59:37 +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 27TCxbe3001114; Mon, 29 Aug 2022 12:59:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27TCxbhs001113; Mon, 29 Aug 2022 12:59:37 GMT (envelope-from git) Date: Mon, 29 Aug 2022 12:59:37 GMT Message-Id: <202208291259.27TCxbhs001113@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: c24a8f19c5d5 - main - 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/main X-Git-Reftype: branch X-Git-Commit: c24a8f19c5d554b828908e7dacf1855cd4ee21f3 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661777978; 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=Ogx8O3FuhOIJJQkqmcd9PCMCYsqR+u7YTjlcTjqT2wE=; b=lcO2yJV3lPIr3e/kaanbU7zuwbT3t1u5ApsGezOzUhOq3FZdo3Cae89Aeh4D6RhMUQGJXI Kaf82U5rS87na6JsgGww+YU/h0rilOB9OVz1BJJFkho90LOo3YgVjgHpfONW7CClnj2lpA 3EMpysJRRIimybcnc5Qk6DPEQoLBCowPkvuo0J4tiDTzo6JYyqCBf+Asme8DHGhwk/BLQ1 a4eBVIWqQrvHn67enbt66nq2hNzdV4quiGYVMqywU02RScI42B5lscoIJ6KEf8DnupLW83 iemMc3t3KRt90sIn1xQPEPKLDFvHEZEyWM3y4qHVDOWSxQCloTkGQ7XyrHEZQA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1661777978; a=rsa-sha256; cv=none; b=NjpxYvhwLa4U8yMyRVAMfkI5UkAIWZ9KNg2hWndY2XTlyFGigd7ClN1kEm7/fr/LOLMDhO AsyZtI73034H4RfSZlwWLEwcFKhEjfVgoaLkoZuNY+CcNiuWMiVDjJY+1P8vAYFF4D9yiK 9fzT1CGKxuS6lC+vB6oK4a01Hxii0lSmlcB1b+e4mxC7ENwRfyQZfKsDcDIt6YBWGusMt9 iDi5nsKu3ceChUMmHAf1fkys4g7UOnqGrRp0zZRWTnztGHs/P7nUu4ESx9FbUyr5C4pBlH m51pfQ49f9G2RAVo2UyToNeV1legpCcc4WqTchn/iVBHKfC6E8LHew+8UU6GDA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=c24a8f19c5d554b828908e7dacf1855cd4ee21f3 commit c24a8f19c5d554b828908e7dacf1855cd4ee21f3 Author: Alexander V. Chernikov AuthorDate: 2022-08-29 12:23:06 +0000 Commit: Alexander V. Chernikov CommitDate: 2022-08-29 12:57:47 +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 --- 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;