]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: VXLan - Add support for remote address
authorSusant Sahani <ssahani@vmware.com>
Fri, 10 Apr 2020 13:37:21 +0000 (15:37 +0200)
committerSusant Sahani <ssahani@vmware.com>
Sat, 11 Apr 2020 04:11:51 +0000 (06:11 +0200)
src/network/netdev/vxlan.c

index c27c9bf5120f3d2a780569c44f56a824d80f265f..d49f39e0c9c9c110a4cb893efc9cb7f85eab3898 100644 (file)
@@ -45,6 +45,13 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_netli
                         r = sd_netlink_message_append_in6_addr(m, IFLA_VXLAN_GROUP6, &v->group.in6);
                 if (r < 0)
                         return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_GROUP attribute: %m");
+        } else  if (in_addr_is_null(v->remote_family, &v->remote) == 0) {
+                if (v->remote_family == AF_INET)
+                        r = sd_netlink_message_append_in_addr(m, IFLA_VXLAN_GROUP, &v->remote.in);
+                else
+                        r = sd_netlink_message_append_in6_addr(m, IFLA_VXLAN_GROUP6, &v->remote.in6);
+                if (r < 0)
+                        return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_GROUP attribute: %m");
         }
 
         if (in_addr_is_null(v->local_family, &v->local) == 0) {
@@ -348,6 +355,11 @@ static int netdev_vxlan_verify(NetDev *netdev, const char *filename) {
         if (!v->dest_port && v->generic_protocol_extension)
                 v->dest_port = 4790;
 
+        if (in_addr_is_null(v->group_family, &v->group) == 0 && in_addr_is_null(v->remote_family, &v->remote) == 0)
+                return log_netdev_warning_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
+                                                "%s: VXLAN both 'Group=' and 'Remote=' cannot be specified. Ignoring.",
+                                                filename);
+
         return 0;
 }