Skip to content

Commit 2e68de2

Browse files
yuwatabluca
authored andcommitted
network/tunnel: allow Local=/Remote=any for all tunnel types
It seems there is no restriction for local and remote addresses. Fixes #34930. (cherry picked from commit 5e48fd0) (cherry picked from commit 3093ac0) (cherry picked from commit 81c8433) (cherry picked from commit 6f19e9f)
1 parent bf4d3b2 commit 2e68de2

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

src/network/netdev/tunnel.c

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -710,34 +710,27 @@ static int netdev_tunnel_verify(NetDev *netdev, const char *filename) {
710710
}
711711
}
712712

713-
if (IN_SET(netdev->kind, NETDEV_KIND_VTI, NETDEV_KIND_IPIP, NETDEV_KIND_SIT, NETDEV_KIND_GRE) &&
714-
!IN_SET(t->family, AF_UNSPEC, AF_INET))
715-
return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
716-
"vti/ipip/sit/gre tunnel without a local/remote IPv4 address configured in %s. Ignoring", filename);
717-
718-
if (IN_SET(netdev->kind, NETDEV_KIND_GRETAP, NETDEV_KIND_ERSPAN) &&
719-
(t->family != AF_INET || !in_addr_is_set(t->family, &t->remote)))
720-
return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
721-
"gretap/erspan tunnel without a remote IPv4 address configured in %s. Ignoring", filename);
713+
if (IN_SET(netdev->kind, NETDEV_KIND_VTI, NETDEV_KIND_IPIP, NETDEV_KIND_SIT, NETDEV_KIND_GRE, NETDEV_KIND_GRETAP, NETDEV_KIND_ERSPAN)) {
714+
if (!IN_SET(t->family, AF_UNSPEC, AF_INET))
715+
return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
716+
"%s tunnel without a local/remote IPv4 address configured in %s, ignoring.",
717+
netdev_kind_to_string(netdev->kind), filename);
722718

723-
if ((IN_SET(netdev->kind, NETDEV_KIND_VTI6, NETDEV_KIND_IP6TNL) && t->family != AF_INET6) ||
724-
(netdev->kind == NETDEV_KIND_IP6GRE && !IN_SET(t->family, AF_UNSPEC, AF_INET6)))
725-
return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
726-
"vti6/ip6tnl/ip6gre tunnel without a local/remote IPv6 address configured in %s. Ignoring", filename);
719+
t->family = AF_INET; /* For netlink_message_append_in_addr_union(). */
720+
}
727721

728-
if (netdev->kind == NETDEV_KIND_IP6GRETAP &&
729-
(t->family != AF_INET6 || !in_addr_is_set(t->family, &t->remote)))
730-
return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
731-
"ip6gretap tunnel without a remote IPv6 address configured in %s. Ignoring", filename);
722+
if (IN_SET(netdev->kind, NETDEV_KIND_VTI6, NETDEV_KIND_IP6TNL, NETDEV_KIND_IP6GRE, NETDEV_KIND_IP6GRETAP)) {
723+
if (!IN_SET(t->family, AF_UNSPEC, AF_INET6))
724+
return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
725+
"%s tunnel without a local/remote IPv6 address configured in %s, ignoring,",
726+
netdev_kind_to_string(netdev->kind), filename);
727+
t->family = AF_INET6; /* For netlink_message_append_in_addr_union(). */
728+
}
732729

733730
if (t->fou_tunnel && t->fou_destination_port <= 0)
734731
return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
735732
"FooOverUDP missing port configured in %s. Ignoring", filename);
736733

737-
/* netlink_message_append_in_addr_union() is used for vti/vti6. So, t->family cannot be AF_UNSPEC. */
738-
if (netdev->kind == NETDEV_KIND_VTI)
739-
t->family = AF_INET;
740-
741734
if (t->assign_to_loopback)
742735
t->independent = true;
743736

0 commit comments

Comments
 (0)