From nobody Thu Mar 26 11:20: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 4fhLtW3lMBz6WnMW for ; Thu, 26 Mar 2026 11:20: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 "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fhLtW0kPPz3FCW for ; Thu, 26 Mar 2026 11:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1774524051; 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=fleZ11n+RCoFxIeCuuMOl4J7YuN46oxUKZ3G6G0pj5VJNAYdJ3hlKEIctA1SYZnFHe5jie 9SAdtImuVfW0+jcbluwGf7eCxGjmOxzMFAqatUU1GckJd32nugCEwgl4wlcd5jQgSM5qCL luZMS1mcLiqABafFq0FKKcsc8Colew8O/lisAQYzqTulV0koMt4t78zdNT3EigIdKBe47m WNELufkJsH7PITN+lDd/oMoIbiPbf4FtXGd7fIE/lY+mz0/FzXVohJ07W6RrMN3gmEr7aE G59a74998Z2N2Ti7CtaScU7TiYj/hBdo3GFVsyNmvYWshLxpb9dYMQP6lv5xyg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1774524051; a=rsa-sha256; cv=none; b=Hv4XM53fWyV/YhlX+Dj8DhFptkslVJ/SYKzWWipfZbNlPxJeG1euJ/CcftdLnBSX/RNXId xjkw22FWE7gOIexfebRSgoksv+LX9LGRgjRWWk55UJoyr33Vbdb6hPWpyD0SYDkNJD62ZP D8zUGZEceM/bzR9pCDbpMFMIPjL6o/BSK/XXiwKuCM6hVOMjjf0E9LpP/RYoNGiEE500mx /Rys3Xkr3fPdJsXWTZ5s6MQmhK9sKj9nr6S1Zyio12bdf1ROT1+leOzoBUAzE597E+Dt41 VVOvO4sHkvifObcnYOlwOSbwAQVLgIXi39Lz5eV0SO7AiME6cjbfzLn7Bt2CjQ== 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=1774524051; 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=i3c3brPV36bk9SnU9QoT//umblVFl/rNseWprel2zlep6hvuiUoLjQB9fLTz58rOVkBq0G owKHlWOhp3RYeDPvzjBMv5AH2LGvUs3pcA15TgIeUuLQK7o83Iez3nDbb6XPKTi1KLCfk2 enMDs+g5DrOUkXuZYfABgmowfPwDv8w7ZtBP7NHZVt3qhB0Yb6kNNIlUf8AA1Xk1LcC/Hd FM1xkC6JdnQevGLRZx1f78PT8OHXkOX2qLQy5Bz8WVxSaj0Qae4K8mUJ8/XMtEX9bBUOIO nTSutNI3BFSpMI9gTEkMjctBFYqCBw9CaQXrKkEsYdiCuVFj1pNAkVghW/5PqA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fhLtW0KtkzqwH for ; Thu, 26 Mar 2026 11:20:51 +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: 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/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)