@@ -681,34 +681,27 @@ static int netdev_tunnel_verify(NetDev *netdev, const char *filename) {
681681 }
682682 }
683683
684- if (IN_SET (netdev -> kind , NETDEV_KIND_VTI , NETDEV_KIND_IPIP , NETDEV_KIND_SIT , NETDEV_KIND_GRE ) &&
685- !IN_SET (t -> family , AF_UNSPEC , AF_INET ))
686- return log_netdev_error_errno (netdev , SYNTHETIC_ERRNO (EINVAL ),
687- "vti/ipip/sit/gre tunnel without a local/remote IPv4 address configured in %s. Ignoring" , filename );
688-
689- if (IN_SET (netdev -> kind , NETDEV_KIND_GRETAP , NETDEV_KIND_ERSPAN ) &&
690- (t -> family != AF_INET || !in_addr_is_set (t -> family , & t -> remote )))
691- return log_netdev_error_errno (netdev , SYNTHETIC_ERRNO (EINVAL ),
692- "gretap/erspan tunnel without a remote IPv4 address configured in %s. Ignoring" , filename );
684+ if (IN_SET (netdev -> kind , NETDEV_KIND_VTI , NETDEV_KIND_IPIP , NETDEV_KIND_SIT , NETDEV_KIND_GRE , NETDEV_KIND_GRETAP , NETDEV_KIND_ERSPAN )) {
685+ if (!IN_SET (t -> family , AF_UNSPEC , AF_INET ))
686+ return log_netdev_error_errno (netdev , SYNTHETIC_ERRNO (EINVAL ),
687+ "%s tunnel without a local/remote IPv4 address configured in %s, ignoring." ,
688+ netdev_kind_to_string (netdev -> kind ), filename );
693689
694- if ((IN_SET (netdev -> kind , NETDEV_KIND_VTI6 , NETDEV_KIND_IP6TNL ) && t -> family != AF_INET6 ) ||
695- (netdev -> kind == NETDEV_KIND_IP6GRE && !IN_SET (t -> family , AF_UNSPEC , AF_INET6 )))
696- return log_netdev_error_errno (netdev , SYNTHETIC_ERRNO (EINVAL ),
697- "vti6/ip6tnl/ip6gre tunnel without a local/remote IPv6 address configured in %s. Ignoring" , filename );
690+ t -> family = AF_INET ; /* For netlink_message_append_in_addr_union(). */
691+ }
698692
699- if (netdev -> kind == NETDEV_KIND_IP6GRETAP &&
700- (t -> family != AF_INET6 || !in_addr_is_set (t -> family , & t -> remote )))
701- return log_netdev_error_errno (netdev , SYNTHETIC_ERRNO (EINVAL ),
702- "ip6gretap tunnel without a remote IPv6 address configured in %s. Ignoring" , filename );
693+ if (IN_SET (netdev -> kind , NETDEV_KIND_VTI6 , NETDEV_KIND_IP6TNL , NETDEV_KIND_IP6GRE , NETDEV_KIND_IP6GRETAP )) {
694+ if (!IN_SET (t -> family , AF_UNSPEC , AF_INET6 ))
695+ return log_netdev_error_errno (netdev , SYNTHETIC_ERRNO (EINVAL ),
696+ "%s tunnel without a local/remote IPv6 address configured in %s, ignoring," ,
697+ netdev_kind_to_string (netdev -> kind ), filename );
698+ t -> family = AF_INET6 ; /* For netlink_message_append_in_addr_union(). */
699+ }
703700
704701 if (t -> fou_tunnel && t -> fou_destination_port <= 0 )
705702 return log_netdev_error_errno (netdev , SYNTHETIC_ERRNO (EINVAL ),
706703 "FooOverUDP missing port configured in %s. Ignoring" , filename );
707704
708- /* netlink_message_append_in_addr_union() is used for vti/vti6. So, t->family cannot be AF_UNSPEC. */
709- if (netdev -> kind == NETDEV_KIND_VTI )
710- t -> family = AF_INET ;
711-
712705 if (t -> assign_to_loopback )
713706 t -> independent = true;
714707
0 commit comments