From nobody Thu Mar 26 11:20:45 2026 X-Original-To: dev-commits-src-branches@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 4fhLtQ1y6xz6WnTt for ; Thu, 26 Mar 2026 11:20:46 +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 4fhLtQ00BHz3F8P for ; Thu, 26 Mar 2026 11:20:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1774524046; 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=z5E/OjJjxmtH6iMPBwHQef1Bax9Si2zA2rXNfC8R+S8=; b=XLUWzBwOPpcEwrq9yk3+etm0W+lEKcjOXWKrEBT/606t75pgs7KAobJousI4jYQnJkHnfh U+uLNdQz0IAwWc3Tf3HHxR/UztCYxSSxoRsVYV6zujA3ORQ014MWzprxin2XTOTcFIuruW I7j2+wRqe3vq+PlKZBthPo/iTFD7Uc7YZVQJ8zH6j/O6IQ8JQlS/G3T1T6JtGIPLdH1F73 YuVJuaArbsohV+vxNQcsl/c0DGwE+UAOLVh1d2wrgs251VvMMRtfoLE6nlu/0ZHia9qHKB Q309bOXJwVj7CfhBMmPw3cQxYhog+ifZkKj5VW2vyCoKfBf5C2oqWWsqDbPfBw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1774524046; a=rsa-sha256; cv=none; b=U8kDoopjYoXU53aejLWVwDAlQZSWMN+2F9c6FEWXi56Tv+GlAkOkBaptkvmwC1wPeMsmj1 IOO2jXXWEMeQk0DW1oClfUjZSl0ips6xxXzIZ81u780ZO8mrUjoh93hmEGmEvLbJt5rW17 aUEWgJWh7zkiS2bsRKzucUZQtzVshQWAbqUFSPXrzGvcZ58hYjTSPPciS/HnmSIo5HSnok DKnW+dw9i2n94TxsVg3GL6FSXxhmn4FV6rhD3AltC7LJf/Vxgk9XxrPvWkP9H2S8fLCRei +BOWJ1pTFexJnwyAb8mEWtMbsDIVrMdSiFlpOBUaoN2+x/pGqTPEPGHarHG6jg== 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=1774524046; 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=z5E/OjJjxmtH6iMPBwHQef1Bax9Si2zA2rXNfC8R+S8=; b=JpY6rFGrRFMkY83syZJDSS2rs0hqFfFJjaW+BtUeeyDlDldO3GLaLVE7x/vyohtf05RES0 PzSBxdSRTIqsHHjQEYVX5vxPXTIMlHHmUJwTGNPkcsoUYWy+7rWa9PTimRZR5F9/Em6Glz sfK6K9LIp21rVgmlGIX7THnbLvtS5cIHcVyGOXqAts+jiNoy/NyVPfurQqd5hanzu9GfIv 2wkhE5+5MReDd/+1ZwmaqTNgzPRzbMuLElM+yU32WfjlaZuuoHiROX0zGpnOScD8klbFQM 1fANso1lckyPFBtxlLN5NNRRN2rK7jr3A2msQInaduk4HGgBsrNiP4LZbOBrUA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fhLtP6cKgzq7M for ; Thu, 26 Mar 2026 11:20:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3ae59 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 26 Mar 2026 11:20:45 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Pouria Mousavizadeh Tehrani Subject: git: b51cfb5e3c2e - stable/15 - rtnetlink: Add support for nexthop expiration in new/get route List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/15 X-Git-Reftype: branch X-Git-Commit: b51cfb5e3c2edbe1c487a80e7e9c7ce8095525e9 Auto-Submitted: auto-generated Date: Thu, 26 Mar 2026 11:20:45 +0000 Message-Id: <69c5168d.3ae59.3f790dec@gitrepo.freebsd.org> The branch stable/15 has been updated by pouria: URL: https://cgit.FreeBSD.org/src/commit/?id=b51cfb5e3c2edbe1c487a80e7e9c7ce8095525e9 commit b51cfb5e3c2edbe1c487a80e7e9c7ce8095525e9 Author: Pouria Mousavizadeh Tehrani AuthorDate: 2026-02-22 17:46:12 +0000 Commit: Pouria Mousavizadeh Tehrani CommitDate: 2026-03-26 09:12:10 +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 (cherry picked from commit ff6d1faa65a1a77d04746b43023feb457cfa27b8) --- 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)