From nobody Thu Jun 12 18:47:47 2025 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 4bJBNg2HJsz5yF6C; Thu, 12 Jun 2025 18:47:47 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bJBNg1Zr7z3ml5; Thu, 12 Jun 2025 18:47:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1749754067; 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=JJv6XJI6jufcTw9qVkyI0lQbvgOnN2rtIv7S9ew2/hg=; b=IMgfU2oRMaxeWMQe50ddJpH2IibUWxIerj8K/mQdH8PpLR4Bq3giw2lFwBcNjkf05tNhxc 50bAS+C1vH7fV8nLLGBPtNQy6fomRllWscQBN7gzXYXxZE2N8/2uxiLhDMHVB8QDW6EuP6 vl3l6SKglBymPS6Kz2D8T0ja5P/nbdnGaNPOq1LNGTZPl1xLOkg824mpDjvm6XLj5ZDWdn 684+uWpCq7k8jA+MXf+NgztqoMxtsahYWnhocuQ67lg6nnZQp+xTBHOwfV/MIoVe3nhVin DgsXBtpjXqsMF/OJxq9UHFaegLStbOJTlTqWx1npAnCVw1mYOLjgdmtJdvrA6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1749754067; 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=JJv6XJI6jufcTw9qVkyI0lQbvgOnN2rtIv7S9ew2/hg=; b=rE84zZTwbnDV5YPOR90yTEF8Y80e7XSeFzmCzvHnsAHl24Intr7IoN0x7KXwAA+QXv0t+u C/TAwU+iMcHHW6RXeGEzQ18fbdqI0CB9j6M6f2QNY1fz66kgXB9NPIliDx6RAqke3M8HxP 7qNfSwyYZfWPQKt86hUjQ/CJm4Oymcw0ZSQj22xXp8IYhmT1SeMAl8ZDK7uPfh++v0t0LK Fm5mEYNGVh5ZwZBm96Ez5FeNdzlTxHVlXs2ev/lWDOo5Y9kb0tkWhXUKNmhWb4pf7KQTJ7 OOf9yDdGJkO34uWhs5BAys3WKxB9eyNq3X8Y6EEbqsl0UTv7UvfpQlDLoPMaxw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1749754067; a=rsa-sha256; cv=none; b=rCTIL2wx58nvNRmRdTUxQNtKTTaUsrHlygUWHOXaj55BwxWNl5LOppy26oEvknluM03zbD lc57wXVzG/wTnwRTJ8EKa9MkGFFMFLG/+lfGFUpXgy0A9VR3qc6c9Mpw7Jw7ojnWE6+tl1 TCdhwtkq7Lbpd6s65kxilcvpuodv18TSaP1BGp5viNqN9pSvS23hrMvuSxR8Bn5WreXMxc fel7L+9SVWve22U6MQV/sxZnn7h/SXsXNfTuU1Sw23aIMpU+XQjhCKlkdSm9HtKJ3TQnCG tgcthaJ7LNam7PCFZ/mTFhRp8uvVfUKE9Mz9Oy4AOr+HEy+q0IxbcXw+oM5duQ== 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 4bJBNg19rPz8Qs; Thu, 12 Jun 2025 18:47:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55CIllnX043489; Thu, 12 Jun 2025 18:47:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55CIllvW043486; Thu, 12 Jun 2025 18:47:47 GMT (envelope-from git) Date: Thu, 12 Jun 2025 18:47:47 GMT Message-Id: <202506121847.55CIllvW043486@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hiroki Sato Subject: git: 0c891822310c - main - netinet6: Remove ndpr_raf_ra_derived flag 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0c891822310cebd11c22bb59391f85bc53c94fa3 Auto-Submitted: auto-generated The branch main has been updated by hrs: URL: https://cgit.FreeBSD.org/src/commit/?id=0c891822310cebd11c22bb59391f85bc53c94fa3 commit 0c891822310cebd11c22bb59391f85bc53c94fa3 Author: Hiroki Sato AuthorDate: 2025-06-12 18:46:46 +0000 Commit: Hiroki Sato CommitDate: 2025-06-12 18:47:06 +0000 netinet6: Remove ndpr_raf_ra_derived flag This flag was introduced at 8036234c72c9361711e867cc1a0c6a7fe0babd84 to prevent the SIOCSPFXFLUSH_IN6 ioctl from removing manually-added entries. However, this flag did actually not work due to an incomplete implementation making prelist_update() not handle it before calling nd6_prelist_add(). This patch removes the flag because a prefix is derived from an RA always has an entry in the ndpr_advrtrs member in the struct nd_prefix. Having a separate flag is not a good idea because it can cause a mismatch between the flag and the ndpr_advrtrs entry. Testing using LIST_EMPTY() is simpler for the origial goal. This also removes in a prefix check in the ICMPV6CTL_ND6_PRLIST sysctl to exclude manually-added entries. This ioctl is designed to list all entries, and there is no relationship to SIOCSPFXFLUSH_IN6. Differential Revision: https://reviews.freebsd.org/D46441 --- sys/netinet6/in6_var.h | 4 +--- sys/netinet6/nd6.c | 8 +++----- sys/netinet6/nd6.h | 1 - sys/netinet6/nd6_rtr.c | 1 - 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h index 918a3abe426e..e5ab83e6a2a1 100644 --- a/sys/netinet6/in6_var.h +++ b/sys/netinet6/in6_var.h @@ -323,8 +323,7 @@ struct in6_prflags { struct prf_ra { u_char onlink : 1; u_char autonomous : 1; - u_char ra_derived: 1; - u_char reserved : 5; + u_char reserved : 6; } prf_ra; u_char prf_reserved1; u_short prf_reserved2; @@ -355,7 +354,6 @@ struct in6_prefixreq { #define ipr_raf_onlink ipr_flags.prf_ra.onlink #define ipr_raf_auto ipr_flags.prf_ra.autonomous -#define ipr_raf_ra_derived ipr_flags.prf_ra.ra_derived #define ipr_statef_onlink ipr_flags.prf_state.onlink diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 6ec5a8b54cf4..8480e7fc90e3 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -84,11 +84,11 @@ #include +#define ND6_PREFIX_WITH_ROUTER(pr) !LIST_EMPTY(&(pr)->ndpr_advrtrs) + #define ND6_SLOWTIMER_INTERVAL (60 * 60) /* 1 hour */ #define ND6_RECALC_REACHTM_INTERVAL (60 * 120) /* 2 hours */ -#define SIN6(s) ((const struct sockaddr_in6 *)(s)) - MALLOC_DEFINE(M_IP6NDP, "ip6ndp", "IPv6 Neighbor Discovery"); VNET_DEFINE_STATIC(int, nd6_prune) = 1; @@ -1796,7 +1796,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) ND6_WLOCK(); LIST_FOREACH_SAFE(pr, &V_nd_prefix, ndpr_entry, next) { - if (pr->ndpr_raf_ra_derived) + if (ND6_PREFIX_WITH_ROUTER(pr)) nd6_prefix_unlink(pr, &prl); } ND6_WUNLOCK(); @@ -2675,8 +2675,6 @@ nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS) ND6_RLOCK(); LIST_FOREACH(pr, &V_nd_prefix, ndpr_entry) { - if (!pr->ndpr_raf_ra_derived) - continue; p.prefix = pr->ndpr_prefix; if (sa6_recoverscope(&p.prefix)) { log(LOG_ERR, "scope error in prefix list (%s)\n", diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h index 1db1b666c60b..d0cbacff29d2 100644 --- a/sys/netinet6/nd6.h +++ b/sys/netinet6/nd6.h @@ -242,7 +242,6 @@ struct nd_prefix { #define ndpr_raf ndpr_flags #define ndpr_raf_onlink ndpr_flags.onlink #define ndpr_raf_auto ndpr_flags.autonomous -#define ndpr_raf_ra_derived ndpr_flags.ra_derived #define ndpr_raf_router ndpr_flags.router struct nd_pfxrouter { diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index c145af7d3ffc..927c7895305a 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -520,7 +520,6 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) ND_OPT_PI_FLAG_ONLINK) ? 1 : 0; pr.ndpr_raf_auto = (pi->nd_opt_pi_flags_reserved & ND_OPT_PI_FLAG_AUTO) ? 1 : 0; - pr.ndpr_raf_ra_derived = 1; pr.ndpr_plen = pi->nd_opt_pi_prefix_len; pr.ndpr_vltime = ntohl(pi->nd_opt_pi_valid_time); pr.ndpr_pltime = ntohl(pi->nd_opt_pi_preferred_time);