ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
923a60
From c4037813ad63527be927a88fd6a28521cdff0762 Mon Sep 17 00:00:00 2001
923a60
From: Lennart Poettering <lennart@poettering.net>
923a60
Date: Tue, 23 Jan 2018 15:48:28 +0100
923a60
Subject: [PATCH] local-addresses: handle gracefully if routes lack an RTA_OIF
923a60
 attribute
923a60
923a60
Some routes (such as those using "nexthop") don't have an RTA_OIF
923a60
attribute. We need to handle that gracefully, by simply ignoring the
923a60
route.
923a60
923a60
Fixes: #7854
923a60
(cherry picked from commit 568fc5c3f7223770b8f3471da314745742125bb9)
923a60
923a60
Resolves: #1627750
923a60
---
923a60
 src/libsystemd/sd-rtnl/local-addresses.c | 2 ++
923a60
 1 file changed, 2 insertions(+)
923a60
923a60
diff --git a/src/libsystemd/sd-rtnl/local-addresses.c b/src/libsystemd/sd-rtnl/local-addresses.c
923a60
index 31bfa06066..82bad373b7 100644
923a60
--- a/src/libsystemd/sd-rtnl/local-addresses.c
923a60
+++ b/src/libsystemd/sd-rtnl/local-addresses.c
923a60
@@ -225,6 +225,8 @@ int local_gateways(sd_rtnl *context, int ifindex, int af, struct local_address *
923a60
                         continue;
923a60
 
923a60
                 r = sd_rtnl_message_read_u32(m, RTA_OIF, &ifi;;
923a60
+                if (r == -ENODATA) /* Not all routes have an RTA_OIF attribute (for example nexthop ones) */
923a60
+                        continue;
923a60
                 if (r < 0)
923a60
                         return r;
923a60
                 if (ifindex > 0 && (int) ifi != ifindex)