dryang / rpms / systemd

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