naccyde / rpms / systemd

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