]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: support gre tunnel or friends with Local=any Remote=any
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 10 Jul 2019 16:37:24 +0000 (01:37 +0900)
committerLennart Poettering <lennart@poettering.net>
Wed, 10 Jul 2019 22:03:57 +0000 (00:03 +0200)
Fixes #13014.

src/network/netdev/tunnel.c

index 1572836b69cc7c1eab932df8701750c3b227b876..a59d18d5d90188e201bf4f6267ac724b4250e190 100644 (file)
@@ -435,20 +435,26 @@ 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) &&
-            t->family != AF_INET)
-                return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
-                                              "vti/ipip/sit/gre tunnel without a local/remote IPv4 address configured in %s. Ignoring", filename);
+        if (IN_SET(netdev->kind, NETDEV_KIND_VTI, NETDEV_KIND_IPIP, NETDEV_KIND_SIT, NETDEV_KIND_GRE)) {
+                if (t->family == AF_UNSPEC)
+                        t->family = AF_INET;
+                if (t->family != AF_INET)
+                        return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
+                                                      "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)
-                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 (IN_SET(netdev->kind, NETDEV_KIND_VTI6, NETDEV_KIND_IP6TNL, NETDEV_KIND_IP6GRE)) {
+                if (t->family == AF_UNSPEC)
+                        t->family = AF_INET6;
+                if (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)))