mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-22 18:56:38 +00:00
netlink: fix adding an interface route
route add <host> -iface <netif>" for a netif without an IPv4/IPv6 address fails with EINVAL. Need to use a link-level ifaddr for gw if an ifaddr for dst is not found as the rtsock-based implementation does. PR: 275341 Reported by: Sean Cody <sean@tinfoilhat.ca> Reviewed by: rcm Tested by: rcm Approved by: kp (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D41330
This commit is contained in:
parent
2276e53940
commit
f818559774
|
@ -750,9 +750,14 @@ finalize_nhop(struct nhop_object *nh, const struct sockaddr *dst, int *perror)
|
|||
|
||||
struct ifaddr *ifa = ifaof_ifpforaddr(gw_sa, nh->nh_ifp);
|
||||
if (ifa == NULL) {
|
||||
NL_LOG(LOG_DEBUG, "Unable to determine ifa, skipping");
|
||||
*perror = EINVAL;
|
||||
return (NULL);
|
||||
/* Try link-level ifa. */
|
||||
gw_sa = &nh->gw_sa;
|
||||
ifa = ifaof_ifpforaddr(gw_sa, nh->nh_ifp);
|
||||
if (ifa == NULL) {
|
||||
NL_LOG(LOG_DEBUG, "Unable to determine ifa, skipping");
|
||||
*perror = EINVAL;
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
nhop_set_src(nh, ifa);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue