Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153413925
D55442.id172760.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D55442.id172760.diff
View Options
diff --git a/sys/netlink/netlink_snl_route_parsers.h b/sys/netlink/netlink_snl_route_parsers.h
--- a/sys/netlink/netlink_snl_route_parsers.h
+++ b/sys/netlink/netlink_snl_route_parsers.h
@@ -53,6 +53,7 @@
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 @@
{ .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
--- a/sys/netlink/route/rt.c
+++ b/sys/netlink/route/rt.c
@@ -179,7 +179,7 @@
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 @@
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 @@
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 @@
{ .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 @@
{
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 @@
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)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 22, 12:55 AM (10 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31943227
Default Alt Text
D55442.id172760.diff (2 KB)
Attached To
Mode
D55442: rtnetlink: Add support for nexthop expiration in new route
Attached
Detach File
Event Timeline
Log In to Comment