From 7c9b26900cc33daf080627daf5904de74c1ef267 Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Fri, 10 Apr 2020 15:29:10 +0200 Subject: [PATCH 1/3] network: VXLan - fix adding Group address --- src/network/netdev/vxlan.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c index ace3c5d2ed..c27c9bf512 100644 --- a/src/network/netdev/vxlan.c +++ b/src/network/netdev/vxlan.c @@ -38,11 +38,11 @@ static int netdev_vxlan_fill_message_create(NetDev *netdev, Link *link, sd_netli return log_netdev_error_errno(netdev, r, "Could not append IFLA_VXLAN_ID attribute: %m"); } - 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); + if (in_addr_is_null(v->group_family, &v->group) == 0) { + if (v->group_family == AF_INET) + r = sd_netlink_message_append_in_addr(m, IFLA_VXLAN_GROUP, &v->group.in); else - r = sd_netlink_message_append_in6_addr(m, IFLA_VXLAN_GROUP6, &v->remote.in6); + 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"); } From fc1d9c7b0c8f83446928d53d644088235bcac235 Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Fri, 10 Apr 2020 15:37:21 +0200 Subject: [PATCH 2/3] network: VXLan - Add support for remote address --- src/network/netdev/vxlan.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c index c27c9bf512..d49f39e0c9 100644 --- a/src/network/netdev/vxlan.c +++ b/src/network/netdev/vxlan.c @@ -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; } From 659f85a519f4e33c17079d613603db7c822f17aa Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Fri, 10 Apr 2020 15:50:23 +0200 Subject: [PATCH 3/3] networkctl: Add support to display VXLan remote address --- src/network/networkctl.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/network/networkctl.c b/src/network/networkctl.c index 952fd55578..2e2ba4732c 100644 --- a/src/network/networkctl.c +++ b/src/network/networkctl.c @@ -1549,9 +1549,17 @@ static int link_status_one( } if (IN_SET(info->vxlan_info.group_family, AF_INET, AF_INET6)) { + const char *p; + + r = in_addr_is_multicast(info->vxlan_info.group_family, &info->vxlan_info.group); + if (r <= 0) + p = "Remote:"; + else + p = "Group:"; + r = table_add_many(table, TABLE_EMPTY, - TABLE_STRING, "Group:", + TABLE_STRING, p, info->vxlan_info.group_family == AF_INET ? TABLE_IN_ADDR : TABLE_IN6_ADDR, &info->vxlan_info.group); if (r < 0)