summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-07-10 23:48:37 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-07-11 09:59:06 +0900
commit3140e8a55aba4366790a26ec95c39e245bc8f6bd (patch)
treefed6848b36ed2207bf523b3aeffc1f7409a043be
parent8e27167cc9b8beda2bf49789b15f0b0301b95d17 (diff)
downloadsystemd-3140e8a55aba4366790a26ec95c39e245bc8f6bd.tar.gz
network: simplify the condition about xfrm
-rw-r--r--src/network/netdev/xfrm.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
index c60b0b1ab7..afedb4b424 100644
--- a/src/network/netdev/xfrm.c
+++ b/src/network/netdev/xfrm.c
@@ -4,24 +4,17 @@
#include "netdev/xfrm.h"
static int xfrm_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *message) {
- int if_idx, r;
Xfrm *x;
+ int r;
assert(netdev);
assert(message);
x = XFRM(netdev);
- if (x->independent)
- if_idx = LOOPBACK_IFINDEX;
- else {
- assert(link);
- if (link->ifindex == 0)
- return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(ENODEV), "Could not get interface index: %m");
- if_idx = link->ifindex;
- }
+ assert(link || x->independent);
- r = sd_netlink_message_append_u32(message, IFLA_XFRM_LINK, if_idx);
+ r = sd_netlink_message_append_u32(message, IFLA_XFRM_LINK, link ? link->ifindex : LOOPBACK_IFINDEX);
if (r < 0)
return log_netdev_error_errno(netdev, r, "Could not append IFLA_XFRM_LINK: %m");