From nobody Thu Feb 26 12:35:24 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 4fM9sZ2MS3z6TYB8 for ; Thu, 26 Feb 2026 12:35:30 +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 "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fM9sY5tZcz4JBL for ; Thu, 26 Feb 2026 12:35:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1772109329; 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=ns1eWDPB5MiI7+ql/xHIVjT0uyxvAWl3YxUCErToqOs=; b=Imtvv1ucriMo9Fnvg8Fq+rH+o0N8pjhVAUwDkMfXe+2OJASwRxbQF/dMes57tK+OM8yem1 pBDrAaxoKMKCl3Ic5PTprr4+GXHTQZ2IPG0NGB875b37A0EmTAo6KOdsL+YuqptTUHvnML b68KjHMfDieQDjGxywmqzpUijAXJ6/09iaZy1v4CuoPcwhWzZbleEI/TNxij5jY/NxFUko DXjldc6W/YwIApr3LVoxhB6m2KE/9ODoGepjRqm+wB9iHOBVEWCrbGP/IkpDcg9UEPEwB3 IxQxxir2VI8hGlKJ6a8Wo7/h5AoVRbnPf8Oc/d67TU50Y9aMJPUqvdglNo1/oA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1772109329; a=rsa-sha256; cv=none; b=Mh0EVCWChf/uqrqRAoJTvnfYgk8EFYJ05Mmzz7HkYMOULvsVg4aXScmks7sAXCg+9BGRMn 62361upNgtYNRsSFruKiEYsZSl3BBC2MON6qylnsQkPu/xOWK5WY46lc5HvYWReOVHRboT Ud0yCMb3IfQzN1u5tQYjPFrNIj6IF5ZcujjbdYLKgDsj9K/SVTXIINjVwOdnhcNZWeCTjW YJo7XDf/wbCuM+cYQ8lH9muMutTiH0vewIUKBLzrY6pnrp83YFVtnKLT7vGvN5rW4mtaTl 6W1C7x4G26UccUYW3Kr80qC6ZsR3gRgR3X/OUvmfGLi4TIVidu18cokjp9Pihw== 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=1772109329; 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=ns1eWDPB5MiI7+ql/xHIVjT0uyxvAWl3YxUCErToqOs=; b=d8eNn6r+tMmQ4Zc9UyA/Ru6iajAiAPPsTJd9Xhmq+QSsMyt3ygAbDjhLz/Rr4df1rf/J9m fTy/m7vko3QajGn8ueTOVbh3HUdYKnbcYhNIEQfIWsr2NyCxYx+TZYALcPc6ImpCIS7YTU 5cxU4ySTEZpzoeugwdkaLSw40jEfeKFIPJKkA0QggHjgL/DVsK4PD+d5GLb+bfDtdH4TDP pWZ7cD1SI1TlI9dNN0LLewapu3VaqNFSJe9K3U2C+i8Ty2Vxe4Evl3Xtzll5bCjeoXspBA IIqUhwJVUdFgnJtrsGuW4heq/Hun/txnySqawmnS4GVcEA5GddyP1WWLzhvHIw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fM9sY5RvqzY4b for ; Thu, 26 Feb 2026 12:35:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 19468 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 26 Feb 2026 12:35:24 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Pouria Mousavizadeh Tehrani Subject: git: ff6d1faa65a1 - main - rtnetlink: Add support for nexthop expiration in new/get route 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: ff6d1faa65a1a77d04746b43023feb457cfa27b8 Auto-Submitted: auto-generated Date: Thu, 26 Feb 2026 12:35:24 +0000 Message-Id: <69a03e0c.19468.6b3899bb@gitrepo.freebsd.org> The branch main has been updated by pouria: URL: https://cgit.FreeBSD.org/src/commit/?id=ff6d1faa65a1a77d04746b43023feb457cfa27b8 commit ff6d1faa65a1a77d04746b43023feb457cfa27b8 Author: Pouria Mousavizadeh Tehrani AuthorDate: 2026-02-22 17:46:12 +0000 Commit: Pouria Mousavizadeh Tehrani CommitDate: 2026-02-26 09:37:14 +0000 rtnetlink: Add support for nexthop expiration in new/get route Before this change, netlink only shows nexthop expire value if route is not multipath. Now it can set expire time during route creation. Also, show expire time of multipath nexthops. Reviewed by: glebius MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D55442 --- sys/netlink/netlink_snl_route_parsers.h | 2 ++ sys/netlink/route/rt.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/netlink/netlink_snl_route_parsers.h b/sys/netlink/netlink_snl_route_parsers.h index 6b7a8188180d..70a12ad3ad74 100644 --- a/sys/netlink/netlink_snl_route_parsers.h +++ b/sys/netlink/netlink_snl_route_parsers.h @@ -53,6 +53,7 @@ struct rta_mpath_nh { uint8_t rtnh_weight; uint32_t rtax_mtu; uint32_t rta_rtflags; + uint32_t rta_expire; }; #define _IN(_field) offsetof(struct rtnexthop, _field) @@ -67,6 +68,7 @@ static const struct snl_attr_parser _nla_p_mp_nh[] = { { .type = NL_RTA_METRICS, .arg = &_metrics_mp_nh_parser, .cb = snl_attr_get_nested }, { .type = NL_RTA_RTFLAGS, .off = _OUT(rta_rtflags), .cb = snl_attr_get_uint32 }, { .type = NL_RTA_VIA, .off = _OUT(gw), .cb = snl_attr_get_ipvia }, + { .type = NL_RTA_EXPIRES, .off = _OUT(rta_expire), .cb = snl_attr_get_uint32 }, }; static const struct snl_field_parser _fp_p_mp_nh[] = { diff --git a/sys/netlink/route/rt.c b/sys/netlink/route/rt.c index dcd19b43105c..4d7f676d2aec 100644 --- a/sys/netlink/route/rt.c +++ b/sys/netlink/route/rt.c @@ -179,7 +179,7 @@ static void dump_rc_nhg(struct nl_writer *nw, const struct nhgrp_object *nhg, struct rtmsg *rtm) { uint32_t uidx = nhgrp_get_uidx(nhg); - uint32_t num_nhops; + uint32_t num_nhops, nh_expire; const struct weightened_nhop *wn = nhgrp_get_nhops(nhg, &num_nhops); uint32_t base_rtflags = nhop_get_rtflags(wn[0].nh); @@ -206,6 +206,9 @@ dump_rc_nhg(struct nl_writer *nw, const struct nhgrp_object *nhg, struct rtmsg * nlattr_add_u32(nw, NL_RTA_RTFLAGS, rtflags); if (rtflags & RTF_FIXEDMTU) dump_rc_nhop_mtu(nw, wn[i].nh); + nh_expire = nhop_get_expire(wn[i].nh); + if (nh_expire > 0) + nlattr_add_u32(nw, NL_RTA_EXPIRES, nh_expire - time_uptime); rtnh = nlattr_restore_offset(nw, nh_off, struct rtnexthop); /* * nlattr_add() allocates 4-byte aligned storage, no need to aligh @@ -487,6 +490,7 @@ struct nl_parsed_route { uint32_t rta_rtflags; uint32_t rta_nh_id; uint32_t rta_weight; + uint32_t rta_expire; uint32_t rtax_mtu; uint8_t rtm_table; uint8_t rtm_family; @@ -513,6 +517,7 @@ static const struct nlattr_parser nla_p_rtmsg[] = { { .type = NL_RTA_RTFLAGS, .off = _OUT(rta_rtflags), .cb = nlattr_get_uint32 }, { .type = NL_RTA_TABLE, .off = _OUT(rta_table), .cb = nlattr_get_uint32 }, { .type = NL_RTA_VIA, .off = _OUT(rta_gw), .cb = nlattr_get_ipvia }, + { .type = NL_RTA_EXPIRES, .off = _OUT(rta_expire), .cb = nlattr_get_uint32 }, { .type = NL_RTA_NH_ID, .off = _OUT(rta_nh_id), .cb = nlattr_get_uint32 }, }; @@ -851,6 +856,7 @@ create_nexthop_from_attrs(struct nl_parsed_route *attrs, { struct nhop_object *nh = NULL; int error = 0; + uint32_t nh_expire = 0; if (attrs->rta_multipath != NULL) { #ifdef ROUTE_MPATH @@ -907,6 +913,10 @@ create_nexthop_from_attrs(struct nl_parsed_route *attrs, nhop_set_transmit_ifp(nh, attrs->rta_oif); if (attrs->rtax_mtu != 0) nhop_set_mtu(nh, attrs->rtax_mtu, true); + if (attrs->rta_expire > 0) { + nh_expire = attrs->rta_expire - time_second + time_uptime; + nhop_set_expire(nh, nh_expire); + } if (attrs->rta_rtflags & RTF_BROADCAST) nhop_set_broadcast(nh, true); if (attrs->rtm_protocol > RTPROT_STATIC)