From nobody Wed Jan 7 13:50:59 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 4dmTvl4GWpz6Mt8R for ; Wed, 07 Jan 2026 13:50:59 +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" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dmTvl0qz3z3WSl for ; Wed, 07 Jan 2026 13:50:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1767793859; 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=g6e0WaGlNbC6lax4GC0kuJ2QOa+0KGU6JHoK9UHsC70=; b=jzUUnuhHiHOPC7CCmwmy39lwz2C/slgMuaAnwOeCWCmrHfz9WV5WpXpS4KSGhCfQwAUlMF DKCMKB2RiNpXauns5QmZv+AnbkenkGcOiNFC8K8VmTiKqAeHQknHxFqbytDfr1feofVwsO wnoQW7r0OlSKUxuhd9fcYnUvwPyjjVISyOrGkJYEiiIo+3VybF3GvkO0Ps1hfn+jENehcS Wu3FvT4XM0Dobr0KKj7ACuxU3o49IOV3O7cOXVU0MK9x/9Tsbmnjx4byb1MZxmDwgcmIow oDFgiHkRkwXchU9HC37V2Pyq6ldh2jxhibT9n0uRo5K94hNw/C6UoPx1yfSW/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1767793859; 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=g6e0WaGlNbC6lax4GC0kuJ2QOa+0KGU6JHoK9UHsC70=; b=rjEpBrD0Z0iZX/roXlke2A2f5nCJI2v+rrcqR8r8BgScyYVBb49zEHrbMjWaQzwkg+fhK/ 4RTdRC2snaT4uIDiXDnz5qlaszDS9yAq/gp5vDR5ygCOw29NlH8dXkYikBYguwzjGpK99d I9glJGBs4zvhT+O1Fq+X7avU9p5/XdhCU+U9ydpysPS1B3E783cjrWRQU2YrpzrilrtEKo VT1+WbAd2e8aVqIKW08v1Qp+5nJqDjftEGOtr58lo7o7vewJ/LvIiA5RKFPj+XUf0dRbw8 WS5YcdRJhwAEddm8LM+MxbnBkoNMZ6nAa8Bi7MkrMqLXlVPuWNQ8yzq4FLS0bw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1767793859; a=rsa-sha256; cv=none; b=KoqUGDVQG8yeyrDWS166xslKqwU/b2DZ/FOqDDsfcQ1X36ecclBMQlane34CYGXXGcbLXe ODG75SHKT/cMA/jHQnefY0IPDnxo0Tk9P7+JiMCK+mmMThcZG/GoAsdCRDu6etOHiSW1qA c/5xpWo0Qr+wZ4MZlJNCPyofNcGTK4NjJWjWgVBOzQmLEFVpBW6fD9XVH8+TaxLYyM2Sxy +yQFIWfLfCNE/5bhmvqZMe47v4CRBuit1BnVwo3XGhJ1RKvHop79+WSx75I3EdlumHGj3Y CiX/VOXRpMfBrStfRImKaLsIBUUg2a8AthQiFWPaCfLHCcrU4mCooyk0EPCCJg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dmTvl0HwRzvRW for ; Wed, 07 Jan 2026 13:50:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3ee1e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 07 Jan 2026 13:50:59 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 65cf47bad664 - stable/14 - ifconfig: Fix the -L flag when using netlink 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 65cf47bad664f9395f17e698759be50fd8599e27 Auto-Submitted: auto-generated Date: Wed, 07 Jan 2026 13:50:59 +0000 Message-Id: <695e64c3.3ee1e.5dfb8dd3@gitrepo.freebsd.org> The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=65cf47bad664f9395f17e698759be50fd8599e27 commit 65cf47bad664f9395f17e698759be50fd8599e27 Author: Mark Johnston AuthorDate: 2025-12-19 14:11:20 +0000 Commit: Mark Johnston CommitDate: 2026-01-07 13:50:38 +0000 ifconfig: Fix the -L flag when using netlink By default, when ifconfig shows a v6 address derived from a router-advertised prefix, it shows the initial preferred and valid lifetimes. When -L is specified, it is supposed to show the remaining lifetimes, but this was broken in the conversion to netlink. Fix that, and add a regression test which validates ifconfig output before and after a short-lived address expires. Reported by: Franco Fichtner Reviewed by: melifaro, allanjude, Seyed Pouria Mousavizadeh Tehrani Fixes: 4c91a5dfe483 ("ifconfig: make interface and address listing use Netlink as transport") MFC after: 2 weeks Sponsored by: OPNsense Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D54294 (cherry picked from commit df6861d755c8f72380ae7fb8df535b27eba8c0be) --- sbin/ifconfig/af_inet6.c | 6 +++-- tests/sys/netinet6/ndp.sh | 62 +++++++++++++++++++++++++++++++++++++++++++++++ tests/sys/netinet6/ra.py | 11 ++++++++- 3 files changed, 76 insertions(+), 3 deletions(-) diff --git a/sbin/ifconfig/af_inet6.c b/sbin/ifconfig/af_inet6.c index 7aed391c7bf5..511b25580f07 100644 --- a/sbin/ifconfig/af_inet6.c +++ b/sbin/ifconfig/af_inet6.c @@ -375,8 +375,10 @@ show_lifetime(struct ifa_cacheinfo *ci) vl = (ci->ifa_valid == ND6_INFINITE_LIFETIME) ? 0 : ci->ifa_valid; clock_gettime(CLOCK_MONOTONIC_FAST, &now); - print_lifetime("pltime", pl + now.tv_sec, &now); - print_lifetime("vltime", vl + now.tv_sec, &now); + print_lifetime("pltime", + pl + (ip6lifetime ? ci->tstamp / 1000 : now.tv_sec), &now); + print_lifetime("vltime", + vl + (ip6lifetime ? ci->tstamp / 1000 : now.tv_sec), &now); } static void diff --git a/tests/sys/netinet6/ndp.sh b/tests/sys/netinet6/ndp.sh index 378759eb9ba4..10c101c09a19 100755 --- a/tests/sys/netinet6/ndp.sh +++ b/tests/sys/netinet6/ndp.sh @@ -188,9 +188,71 @@ ndp_slaac_default_route_cleanup() { vnet_cleanup } +atf_test_case "ndp_prefix_lifetime" "cleanup" +ndp_prefix_lifetime_head() { + atf_set descr 'Test ndp slaac address lifetime handling' + atf_set require.user root + atf_set require.progs python3 scapy +} + +ndp_prefix_lifetime_body() { + local epair0 jname prefix + + vnet_init + + jname="v6t-ndp_prefix_lifetime" + + epair0=$(vnet_mkepair) + + vnet_mkjail ${jname} ${epair0}a + + ndp_if_up ${epair0}a ${jname} + ndp_if_up ${epair0}b + atf_check jexec ${jname} ifconfig ${epair0}a inet6 accept_rtadv no_dad + + prefix="2001:db8:ffff:1000:" + + # Send an RA advertising a prefix. + atf_check -e ignore python3 $(atf_get_srcdir)/ra.py \ + --sendif ${epair0}b \ + --dst $(ndp_if_lladdr ${epair0}a ${jname}) \ + --src $(ndp_if_lladdr ${epair0}b) \ + --prefix "2001:db8:ffff:1000::" --prefixlen 64 \ + --validlifetime 10 --preferredlifetime 5 + + # Wait for a default router to appear. + while [ -z "$(jexec ${jname} ndp -r)" ]; do + sleep 0.1 + done + atf_check \ + -o match:"^default[[:space:]]+fe80:" \ + jexec ${jname} netstat -rn -6 + + atf_check \ + -o match:"inet6 ${prefix}.* prefixlen 64 autoconf pltime 5 vltime 10" \ + jexec ${jname} ifconfig ${epair0}a + + # Wait for the address to become deprecated. + sleep 6 + atf_check \ + -o match:"inet6 ${prefix}.* prefixlen 64 deprecated autoconf pltime 0 vltime [1-9]+" \ + jexec ${jname} ifconfig -L ${epair0}a + + # Wait for the address to expire. + sleep 6 + atf_check \ + -o not-match:"inet6 ${prefix}.*" \ + jexec ${jname} ifconfig ${epair0}a +} + +ndp_prefix_lifetime_cleanup() { + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "ndp_add_gu_success" atf_add_test_case "ndp_del_gu_success" atf_add_test_case "ndp_slaac_default_route" + atf_add_test_case "ndp_prefix_lifetime" } diff --git a/tests/sys/netinet6/ra.py b/tests/sys/netinet6/ra.py index a5016b3f6e9b..1b08c3e53c05 100644 --- a/tests/sys/netinet6/ra.py +++ b/tests/sys/netinet6/ra.py @@ -25,12 +25,21 @@ def main(): help='The prefix to be advertised') parser.add_argument('--prefixlen', nargs=1, required=True, type=int, help='The prefix length to be advertised') + parser.add_argument('--validlifetime', nargs=1, required=False, + type=int, default=4294967295, + help='The valid lifetime of the prefix') + parser.add_argument('--preferredlifetime', nargs=1, required=False, + type=int, default=4294967295, + help='The preferred lifetime of the prefix') args = parser.parse_args() pkt = sp.Ether() / \ sp.IPv6(src=args.src, dst=args.dst) / \ sp.ICMPv6ND_RA(chlim=64) / \ - sp.ICMPv6NDOptPrefixInfo(prefix=args.prefix, prefixlen=args.prefixlen) + sp.ICMPv6NDOptPrefixInfo(prefix=args.prefix, + prefixlen=args.prefixlen, + validlifetime=args.validlifetime, + preferredlifetime=args.preferredlifetime) sp.sendp(pkt, iface=args.sendif[0], verbose=False) sys.exit(0)