summaryrefslogtreecommitdiff
path: root/src/network/netdev/tunnel.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-03-22 01:47:35 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-03-22 01:47:38 +0900
commitbb9683e096f0f4db364885a71ae4e9b48e7b9ddf (patch)
tree30a35eaea58351ffdcb65f32614a5c9b987f8b12 /src/network/netdev/tunnel.c
parentfa28e4e37778a825fca19a912ae478994c217e5c (diff)
downloadsystemd-bb9683e096f0f4db364885a71ae4e9b48e7b9ddf.tar.gz
network: fix netdev_tunnel_verify()
Fixes #12041.
Diffstat (limited to 'src/network/netdev/tunnel.c')
-rw-r--r--src/network/netdev/tunnel.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
index 90992199ed..55d6f7a32c 100644
--- a/src/network/netdev/tunnel.c
+++ b/src/network/netdev/tunnel.c
@@ -437,15 +437,25 @@ static int netdev_tunnel_verify(NetDev *netdev, const char *filename) {
assert(t);
- if (IN_SET(netdev->kind, NETDEV_KIND_VTI, NETDEV_KIND_IPIP, NETDEV_KIND_SIT, NETDEV_KIND_GRE, NETDEV_KIND_GRETAP, NETDEV_KIND_ERSPAN) &&
- (t->family != AF_INET || in_addr_is_null(t->family, &t->local)))
+ if (IN_SET(netdev->kind, NETDEV_KIND_VTI, NETDEV_KIND_IPIP, NETDEV_KIND_SIT, NETDEV_KIND_GRE, NETDEV_KIND_GRETAP) &&
+ t->family != AF_INET)
return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
- "vti/ipip/sit/gre/gretap/erspan tunnel without a local IPv4 address configured in %s. Ignoring", filename);
+ "vti/ipip/sit/gre tunnel without a local/remote IPv4 address configured in %s. Ignoring", filename);
+
+ if (IN_SET(netdev->kind, NETDEV_KIND_GRETAP, NETDEV_KIND_ERSPAN) &&
+ (t->family != AF_INET || in_addr_is_null(t->family, &t->remote)))
+ return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
+ "gretap/erspan tunnel without a remote IPv4 address configured in %s. Ignoring", filename);
if (IN_SET(netdev->kind, NETDEV_KIND_VTI6, NETDEV_KIND_IP6TNL, NETDEV_KIND_IP6GRE, NETDEV_KIND_IP6GRETAP) &&
- (t->family != AF_INET6 || in_addr_is_null(t->family, &t->local)))
+ t->family != AF_INET6)
+ return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
+ "vti6/ip6tnl/ip6gre tunnel without a local/remote IPv6 address configured in %s. Ignoring", filename);
+
+ if (netdev->kind == NETDEV_KIND_IP6GRETAP &&
+ (t->family != AF_INET6 || in_addr_is_null(t->family, &t->remote)))
return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
- "vti6/ip6tnl/ip6gre/ip6gretap tunnel without a local IPv6 address configured in %s. Ignoring", filename);
+ "ip6gretap tunnel without a remote IPv6 address configured in %s. Ignoring", filename);
if (netdev->kind == NETDEV_KIND_IP6TNL &&
t->ip6tnl_mode == _NETDEV_IP6_TNL_MODE_INVALID)