git: 8230cf1aa18d - main - route(8): Fix -expire argument when using netlink
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 26 Feb 2026 12:35:26 UTC
The branch main has been updated by pouria:
URL: https://cgit.FreeBSD.org/src/commit/?id=8230cf1aa18d9215ee17fec743fc7c7c8fa2da13
commit 8230cf1aa18d9215ee17fec743fc7c7c8fa2da13
Author: Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
AuthorDate: 2026-02-22 18:41:31 +0000
Commit: Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
CommitDate: 2026-02-26 09:49:01 +0000
route(8): Fix -expire argument when using netlink
Also fixes nexthop expire value on route get using netlink.
Reviewed by: glebius
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D55444
---
sbin/route/route_netlink.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/sbin/route/route_netlink.c b/sbin/route/route_netlink.c
index ba22a2ec1e22..5dde7501d6b4 100644
--- a/sbin/route/route_netlink.c
+++ b/sbin/route/route_netlink.c
@@ -263,6 +263,9 @@ rtmsg_nl_int(struct nl_helper *h, int cmd, int rtm_flags, int fib, int rtm_addrs
snl_end_attr_nested(&nw, off);
}
+ if (rt_metrics->rmx_expire > 0)
+ snl_add_msg_attr_u32(&nw, NL_RTA_EXPIRES, rt_metrics->rmx_expire);
+
if (rt_metrics->rmx_weight > 0)
snl_add_msg_attr_u32(&nw, NL_RTA_WEIGHT, rt_metrics->rmx_weight);
@@ -343,7 +346,6 @@ static void
print_getmsg(struct nl_helper *h, struct nlmsghdr *hdr, struct sockaddr *dst)
{
struct snl_state *ss = &h->ss_cmd;
- struct timespec ts;
struct snl_parsed_route r = { .rtax_weight = RT_DEFAULT_WEIGHT };
if (!snl_parse_nlmsg(ss, hdr, &snl_rtm_route_parser, &r))
@@ -385,11 +387,7 @@ print_getmsg(struct nl_helper *h, struct nlmsghdr *hdr, struct sockaddr *dst)
printf("%8lu ", 0UL);
printf("%8lu ", rmx.rmx_mtu);
printf("%8lu ", rmx.rmx_weight);
- if (rmx.rmx_expire > 0)
- clock_gettime(CLOCK_REALTIME_FAST, &ts);
- else
- ts.tv_sec = 0;
- printf("%8ld \n", (long)(rmx.rmx_expire - ts.tv_sec));
+ printf("%8ld \n", rmx.rmx_expire);
}
static void