diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-12-03 22:23:06 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-12-03 22:23:21 +0100 |
commit | a98433c05c5cce62a6a17db74e49363a88156486 (patch) | |
tree | baa8b92a0de5f70292bd5f71d054ee62fd075557 /src/libsystemd/sd-rtnl/local-addresses.c | |
parent | e9140aff750e4f251f5f09b67412fed995fe9c47 (diff) |
rtnl: make checks for default routes more strict
Also check that the source netmask is 0, not only the destination
netmask.
Diffstat (limited to 'src/libsystemd/sd-rtnl/local-addresses.c')
-rw-r--r-- | src/libsystemd/sd-rtnl/local-addresses.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libsystemd/sd-rtnl/local-addresses.c b/src/libsystemd/sd-rtnl/local-addresses.c index 3ab99420a3..b669f9025b 100644 --- a/src/libsystemd/sd-rtnl/local-addresses.c +++ b/src/libsystemd/sd-rtnl/local-addresses.c @@ -197,7 +197,7 @@ int local_gateways(sd_rtnl *context, int ifindex, struct local_address **ret) { for (m = reply; m; m = sd_rtnl_message_next(m)) { struct local_address *a; uint16_t type; - unsigned char dst_len; + unsigned char dst_len, src_len; uint32_t ifi; r = sd_rtnl_message_get_errno(m); @@ -211,14 +211,19 @@ int local_gateways(sd_rtnl *context, int ifindex, struct local_address **ret) { if (type != RTM_NEWROUTE) continue; + /* We only care for default routes */ r = sd_rtnl_message_route_get_dst_len(m, &dst_len); if (r < 0) return r; - - /* We only care for default routes */ if (dst_len != 0) continue; + r = sd_rtnl_message_route_get_src_len(m, &src_len); + if (r < 0) + return r; + if (src_len != 0) + continue; + r = sd_rtnl_message_read_u32(m, RTA_OIF, &ifi); if (r < 0) return r; |