platform: add oif argument to nm_platform_ip_route_get()

Analog to `ip route get $DST oif $IFACE`.
This commit is contained in:
Thomas Haller
2017-09-07 11:11:32 +02:00
parent cac10198f6
commit 7046ce5332
5 changed files with 20 additions and 2 deletions

View File

@@ -6033,6 +6033,7 @@ static NMPlatformError
ip_route_get (NMPlatform *platform,
int addr_family,
gconstpointer address,
int oif_ifindex,
NMPObject **out_route)
{
const gboolean is_v4 = (addr_family == AF_INET);
@@ -6066,6 +6067,13 @@ ip_route_get (NMPlatform *platform,
if (!_nl_addattr_l (&req.n, sizeof (req), RTA_DST, address, addr_len))
nm_assert_not_reached ();
if (oif_ifindex > 0) {
gint32 ii = oif_ifindex;
if (!_nl_addattr_l (&req.n, sizeof (req), RTA_OIF, &ii, sizeof (ii)))
nm_assert_not_reached ();
}
seq_result = WAIT_FOR_NL_RESPONSE_RESULT_UNKNOWN;
nle = _nl_send_nlmsghdr (platform, &req.n, &seq_result, DELAYED_ACTION_RESPONSE_TYPE_ROUTE_GET, &route);
if (nle < 0) {