@@ -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