Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152966823
D56188.id174672.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
D56188.id174672.diff
View Options
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
@@ -175,18 +175,35 @@
}
static void
-dump_rc_nhg(struct nl_writer *nw, const struct nhgrp_object *nhg, struct rtmsg *rtm)
+dump_rc_nhg(struct nl_writer *nw, const struct route_nhop_data *rnd, struct rtmsg *rtm)
{
- uint32_t uidx = nhgrp_get_uidx(nhg);
- 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);
+ const struct nhgrp_object *nhg = rnd->rnd_nhgrp;
+ const struct weightened_nhop *wn;
+ struct nhop_object *nh;
+ uint32_t uidx, num_nhops, nh_expire;
+ uint32_t base_rtflags, rtflags;
+ MPASS((NH_IS_NHGRP(rnd->rnd_nhop)));
+
+ /* select a nhop from nhgrp to not confuse non-mpath consumers */
+ nh = nhop_select_func(rnd->rnd_nhop, 0);
+ rtflags = nhop_get_rtflags(nh);
+ if (nh->nh_flags & NHF_GATEWAY)
+ dump_rc_nhop_gw(nw, nh);
+
+ wn = nhgrp_get_nhops(nhg, &num_nhops);
+ base_rtflags = nhop_get_rtflags(wn[0].nh);
+ uidx = nhgrp_get_uidx(nhg);
if (uidx != 0)
nlattr_add_u32(nw, NL_RTA_NH_ID, uidx);
nlattr_add_u32(nw, NL_RTA_KNH_ID, nhgrp_get_idx(nhg));
-
nlattr_add_u32(nw, NL_RTA_RTFLAGS, base_rtflags);
+
+ if (rtflags & RTF_FIXEDMTU)
+ dump_rc_nhop_mtu(nw, nh);
+ /* In any case, fill outgoing interface */
+ nlattr_add_u32(nw, NL_RTA_OIF, if_getindex(nh->nh_ifp));
+
int off = nlattr_add_nested(nw, NL_RTA_MULTIPATH);
if (off == 0)
return;
@@ -225,7 +242,7 @@
uint32_t rtflags, uidx, nh_expire;
if (NH_IS_NHGRP(rnd->rnd_nhop)) {
- dump_rc_nhg(nw, rnd->rnd_nhgrp, rtm);
+ dump_rc_nhg(nw, rnd, rtm);
return;
}
@@ -324,7 +341,10 @@
rtm = nlattr_restore_offset(nw, rtm_off, struct rtmsg);
if (plen > 0)
rtm->rtm_dst_len = plen;
- dump_rc_nhop(nw, rnd, rtm);
+ if (NH_IS_NHGRP(rnd->rnd_nhop))
+ dump_rc_nhg(nw, rnd, rtm);
+ else
+ dump_rc_nhop(nw, rnd, rtm);
if (nlmsg_end(nw))
return (0);
@@ -655,7 +675,6 @@
}
rt_get_rnd(rt, &rnd);
- rnd.rnd_nhop = nhop_select_func(rnd.rnd_nhop, 0);
RIB_RUNLOCK(rnh);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 19, 9:27 AM (2 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30682400
Default Alt Text
D56188.id174672.diff (2 KB)
Attached To
Mode
D56188: netlink: Fix RTA_MULTIPATH on RTM_GETROUTE
Attached
Detach File
Event Timeline
Log In to Comment