From nobody Fri Apr 17 22:58:45 2026 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 4fy9Kl0B3Qz6ZGcF for ; Fri, 17 Apr 2026 22:58:51 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fy9Kk4Ytvz3Slb for ; Fri, 17 Apr 2026 22:58:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776466730; 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=d7ZKl8/lTP2IQ+8386W+jYrnXIVnV/lvZ4EFHKkbj9w=; b=xVTs1inBAGQJ/Q0OPkGpweji2g9ANcffq24011wTR2vZRZ0ze9qX89gF8oB1gZwp0VECeC 3hC5kOKuR98ySgJxtMwvDHXSnA1na2eGXKxY9oxw5xRskVf/RfrITVsoCU1CSAX4LM5pLd MKznDV4wVXcwzWmB54uds0z4R5EnU/SPmMa4HDK1iXZSAXUyGY7ectk7THErG7A/dDh1Tm RsdRVZlpqHrVzWQvrMsKtpZslFIcYjMSdkYWfXJuuXT5Q4DO4IISEbJkqk2E84nAsBX+q0 byncCg+E+t7lJ6lKtXs0ythONRFQ2awcRvRUH180mFbRLYKZA5Arnzg7nXxXNA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776466730; a=rsa-sha256; cv=none; b=YUYnCctksIzSVFP+/PHyt2Z1TdCGu4dt4rOKLUypmPyHguPQZ7PvUWF280dl5oBqXUODCt WGsLLDranQJsGLCt57oipSbcx3nafLhSoSmidTdWuoaDaPx1pmw9aWG6k0+Mad2Mybz59N eghKMoLZAXYm4itm7/y0ElWEuXHWyfsjWjiN2C/eKJoLgEKb4oFkXRYxEPpXOMDrWHxQxq olkvaiaoV5U4wfKt83fwqvrNMm/RABCFm0F/REq5hoz+3inQdnr71xHx1vFmfsHiFg1K+F jjLKXW2jMljpNGQ64pXG3P9wk1d4Vm/lTgUy6uQQ/g7gaHmz8meSfFY+tFY3Mg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776466730; 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=d7ZKl8/lTP2IQ+8386W+jYrnXIVnV/lvZ4EFHKkbj9w=; b=pCxWSmapnZZBzUQegcghhH2cTsKgeBkxFQcHSuDQhER1mlYRUOUOHX6TwKJMjM4XoshSQ0 q/B1cJQxsNd/sBMsnNxsRo+QIfA0flMB6KSTy04iVeKvDwr7gfvBOdywIz80CEHU5H0GJ6 H4hgFZQFCOvLRfF6Lae3q5HZ871+EYwlPOxS2IdvPNWu58R3qm4b/gPItyjIaxEXPn5o34 4JCxWl/Sg8zIidBZIwrHLPvK8J+JaWhhaFFOwUNlMZ+13ifUtFE+Vq96/xE8kdLj5ooDJa /DLpm5V6rndlHlWHnhT1Moflrp+/QYFS/Dn+/xg+6qsMSDmiDNcaEb4Yc7te4Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fy9Kk415Gz1CTB for ; Fri, 17 Apr 2026 22:58:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 39818 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 17 Apr 2026 22:58:45 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Pouria Mousavizadeh Tehrani Subject: git: d96e8cb4e728 - main - nd6: Break nd6_prefix_update out of prelist_update 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pouria X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d96e8cb4e72847ac545423460af122fa14b2b1f1 Auto-Submitted: auto-generated Date: Fri, 17 Apr 2026 22:58:45 +0000 Message-Id: <69e2bb25.39818.171c71b0@gitrepo.freebsd.org> The branch main has been updated by pouria: URL: https://cgit.FreeBSD.org/src/commit/?id=d96e8cb4e72847ac545423460af122fa14b2b1f1 commit d96e8cb4e72847ac545423460af122fa14b2b1f1 Author: Pouria Mousavizadeh Tehrani AuthorDate: 2026-04-16 22:18:02 +0000 Commit: Pouria Mousavizadeh Tehrani CommitDate: 2026-04-17 22:52:13 +0000 nd6: Break nd6_prefix_update out of prelist_update if PI exists, call prefix_update, instead of doing it inside the prelist_update. no functional change intended. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D56130 --- sys/netinet6/nd6_rtr.c | 78 ++++++++++++++++++++++++++------------------------ 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 623bfd60918e..7b7db1b95e31 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -1516,6 +1516,45 @@ nd6_prefix_del(struct nd_prefix *pr) pfxlist_onlink_check(); } +static void +nd6_prefix_update(struct nd_prefixctl *new, struct nd_prefix *pr) +{ + int error; + char ip6buf[INET6_ADDRSTRLEN]; + + /* + * Update prefix information. Note that the on-link (L) bit + * and the autonomous (A) bit should NOT be changed from 1 + * to 0. + */ + if (new->ndpr_raf_onlink == 1) + pr->ndpr_raf_onlink = 1; + if (new->ndpr_raf_auto == 1) + pr->ndpr_raf_auto = 1; + if (new->ndpr_raf_onlink != 0) { + pr->ndpr_vltime = new->ndpr_vltime; + pr->ndpr_pltime = new->ndpr_pltime; + in6_init_prefix_ltimes(pr); + pr->ndpr_lastupdate = time_uptime; + } + + if (new->ndpr_raf_onlink != 0 && + (pr->ndpr_stateflags & NDPRF_ONLINK) == 0) { + ND6_ONLINK_LOCK(); + if ((error = nd6_prefix_onlink(pr)) != 0) { + nd6log((LOG_ERR, + "%s: failed to make the prefix %s/%d " + "on-link on %s (errno=%d)\n", __func__, + ip6_sprintf(ip6buf, + &pr->ndpr_prefix.sin6_addr), + pr->ndpr_plen, if_name(pr->ndpr_ifp), + error)); + /* proceed anyway. XXX: is it correct? */ + } + ND6_ONLINK_UNLOCK(); + } +} + static int prelist_update(struct nd_prefixctl *new, struct nd_defrouter *dr, bool auth, int mcast) @@ -1531,44 +1570,9 @@ prelist_update(struct nd_prefixctl *new, struct nd_defrouter *dr, NET_EPOCH_ASSERT(); + /* check if prefix already exists on the same interface */ if ((pr = nd6_prefix_lookup(new)) != NULL) { - /* - * nd6_prefix_lookup() ensures that pr and new have the same - * prefix on a same interface. - */ - - /* - * Update prefix information. Note that the on-link (L) bit - * and the autonomous (A) bit should NOT be changed from 1 - * to 0. - */ - if (new->ndpr_raf_onlink == 1) - pr->ndpr_raf_onlink = 1; - if (new->ndpr_raf_auto == 1) - pr->ndpr_raf_auto = 1; - if (new->ndpr_raf_onlink) { - pr->ndpr_vltime = new->ndpr_vltime; - pr->ndpr_pltime = new->ndpr_pltime; - in6_init_prefix_ltimes(pr); - pr->ndpr_lastupdate = time_uptime; - } - - if (new->ndpr_raf_onlink && - (pr->ndpr_stateflags & NDPRF_ONLINK) == 0) { - ND6_ONLINK_LOCK(); - if ((error = nd6_prefix_onlink(pr)) != 0) { - nd6log((LOG_ERR, - "%s: failed to make the prefix %s/%d " - "on-link on %s (errno=%d)\n", __func__, - ip6_sprintf(ip6buf, - &pr->ndpr_prefix.sin6_addr), - pr->ndpr_plen, if_name(pr->ndpr_ifp), - error)); - /* proceed anyway. XXX: is it correct? */ - } - ND6_ONLINK_UNLOCK(); - } - + nd6_prefix_update(new, pr); if (dr != NULL) pfxrtr_add(pr, dr); } else {