@@ -711,34 +711,27 @@ static int netdev_tunnel_verify(NetDev *netdev, const char *filename) {
711711 }
712712 }
713713
714- if (IN_SET (netdev -> kind , NETDEV_KIND_VTI , NETDEV_KIND_IPIP , NETDEV_KIND_SIT , NETDEV_KIND_GRE ) &&
715- !IN_SET (t -> family , AF_UNSPEC , AF_INET ))
716- return log_netdev_error_errno (netdev , SYNTHETIC_ERRNO (EINVAL ),
717- "vti/ipip/sit/gre tunnel without a local/remote IPv4 address configured in %s. Ignoring" , filename );
718-
719- if (IN_SET (netdev -> kind , NETDEV_KIND_GRETAP , NETDEV_KIND_ERSPAN ) &&
720- (t -> family != AF_INET || !in_addr_is_set (t -> family , & t -> remote )))
721- return log_netdev_error_errno (netdev , SYNTHETIC_ERRNO (EINVAL ),
722- "gretap/erspan tunnel without a remote IPv4 address configured in %s. Ignoring" , filename );
714+ if (IN_SET (netdev -> kind , NETDEV_KIND_VTI , NETDEV_KIND_IPIP , NETDEV_KIND_SIT , NETDEV_KIND_GRE , NETDEV_KIND_GRETAP , NETDEV_KIND_ERSPAN )) {
715+ if (!IN_SET (t -> family , AF_UNSPEC , AF_INET ))
716+ return log_netdev_error_errno (netdev , SYNTHETIC_ERRNO (EINVAL ),
717+ "%s tunnel without a local/remote IPv4 address configured in %s, ignoring." ,
718+ netdev_kind_to_string (netdev -> kind ), filename );
723719
724- if ((IN_SET (netdev -> kind , NETDEV_KIND_VTI6 , NETDEV_KIND_IP6TNL ) && t -> family != AF_INET6 ) ||
725- (netdev -> kind == NETDEV_KIND_IP6GRE && !IN_SET (t -> family , AF_UNSPEC , AF_INET6 )))
726- return log_netdev_error_errno (netdev , SYNTHETIC_ERRNO (EINVAL ),
727- "vti6/ip6tnl/ip6gre tunnel without a local/remote IPv6 address configured in %s. Ignoring" , filename );
720+ t -> family = AF_INET ; /* For netlink_message_append_in_addr_union(). */
721+ }
728722
729- if (netdev -> kind == NETDEV_KIND_IP6GRETAP &&
730- (t -> family != AF_INET6 || !in_addr_is_set (t -> family , & t -> remote )))
731- return log_netdev_error_errno (netdev , SYNTHETIC_ERRNO (EINVAL ),
732- "ip6gretap tunnel without a remote IPv6 address configured in %s. Ignoring" , filename );
723+ if (IN_SET (netdev -> kind , NETDEV_KIND_VTI6 , NETDEV_KIND_IP6TNL , NETDEV_KIND_IP6GRE , NETDEV_KIND_IP6GRETAP )) {
724+ if (!IN_SET (t -> family , AF_UNSPEC , AF_INET6 ))
725+ return log_netdev_error_errno (netdev , SYNTHETIC_ERRNO (EINVAL ),
726+ "%s tunnel without a local/remote IPv6 address configured in %s, ignoring," ,
727+ netdev_kind_to_string (netdev -> kind ), filename );
728+ t -> family = AF_INET6 ; /* For netlink_message_append_in_addr_union(). */
729+ }
733730
734731 if (t -> fou_tunnel && t -> fou_destination_port <= 0 )
735732 return log_netdev_error_errno (netdev , SYNTHETIC_ERRNO (EINVAL ),
736733 "FooOverUDP missing port configured in %s. Ignoring" , filename );
737734
738- /* netlink_message_append_in_addr_union() is used for vti/vti6. So, t->family cannot be AF_UNSPEC. */
739- if (netdev -> kind == NETDEV_KIND_VTI )
740- t -> family = AF_INET ;
741-
742735 if (t -> assign_to_loopback )
743736 t -> independent = true;
744737
0 commit comments