Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144330732
D39335.id119661.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D39335.id119661.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
@@ -661,7 +661,7 @@
}
static struct nhop_object *
-finalize_nhop(struct nhop_object *nh, int *perror)
+finalize_nhop(struct nhop_object *nh, const struct sockaddr *dst, int *perror)
{
/*
* The following MUST be filled:
@@ -682,7 +682,15 @@
} else {
/* Gateway is set up, we can derive ifp if not set */
if (nh->nh_ifp == NULL) {
- struct ifaddr *ifa = ifa_ifwithnet(&nh->gw_sa, 1, nhop_get_fibnum(nh));
+ uint32_t fibnum = nhop_get_fibnum(nh);
+ uint32_t flags = 0;
+
+ if (nh->nh_flags & NHF_GATEWAY)
+ flags = RTF_GATEWAY;
+ else if (nh->nh_flags & NHF_HOST)
+ flags = RTF_HOST;
+
+ struct ifaddr *ifa = ifa_ifwithroute(flags, dst, &nh->gw_sa, fibnum);
if (ifa == NULL) {
NL_LOG(LOG_DEBUG, "Unable to determine ifp, skipping");
*perror = EINVAL;
@@ -765,7 +773,7 @@
if (attrs->rtm_protocol > RTPROT_STATIC)
nhop_set_origin(nh, attrs->rtm_protocol);
- *pnh = finalize_nhop(nh, &error);
+ *pnh = finalize_nhop(nh, attrs->rta_dst, &error);
return (error);
}
@@ -852,7 +860,7 @@
/* TODO: return ENOTSUP for other types if strict option is set */
}
- nh = finalize_nhop(nh, perror);
+ nh = finalize_nhop(nh, attrs->rta_dst, perror);
}
return (nh);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 8, 9:30 PM (17 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28493158
Default Alt Text
D39335.id119661.diff (1 KB)
Attached To
Mode
D39335: Fix adding routes with nexthops on p2p interfaces via netlink
Attached
Detach File
Event Timeline
Log In to Comment