diff options
author | barinet <matt@bernstein.org.uk> | 2020-10-09 09:40:08 +0000 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-10-20 13:45:19 +0200 |
commit | 676fe327d4c1fe0d11dae41b39e232ea64f4e1ea (patch) | |
tree | e5d1f22615cee27b4f6cda8bed2764ad38268566 | |
parent | e29f00fa0c69e8a3c114766bd93af6d059f6dafb (diff) | |
download | NetworkManager-676fe327d4c1fe0d11dae41b39e232ea64f4e1ea.tar.gz |
libnm,core: allow VXLAN connections without an explicit remote VTEP
[thaller@redhat.com: squashed commits, resolve merge conflict and coding
style]
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/645
-rw-r--r-- | libnm-core/nm-setting-vxlan.c | 38 | ||||
-rw-r--r-- | src/devices/nm-device-vxlan.c | 8 |
2 files changed, 22 insertions, 24 deletions
diff --git a/libnm-core/nm-setting-vxlan.c b/libnm-core/nm-setting-vxlan.c index 213219baaa..3beb5463c6 100644 --- a/libnm-core/nm-setting-vxlan.c +++ b/libnm-core/nm-setting-vxlan.c @@ -315,27 +315,23 @@ verify(NMSetting *setting, NMConnection *connection, GError **error) NMSettingVxlanPrivate *priv = NM_SETTING_VXLAN_GET_PRIVATE(setting); int family = AF_UNSPEC; - if (!priv->remote) { - g_set_error_literal(error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_MISSING_PROPERTY, - _("property is missing")); - g_prefix_error(error, "%s.%s: ", NM_SETTING_VXLAN_SETTING_NAME, NM_SETTING_VXLAN_REMOTE); - return FALSE; - } - - if (nm_utils_ipaddr_is_valid(AF_INET, priv->remote)) - family = AF_INET; - else if (nm_utils_ipaddr_is_valid(AF_INET6, priv->remote)) - family = AF_INET6; - else { - g_set_error(error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("'%s' is not a valid IP address"), - priv->remote); - g_prefix_error(error, "%s.%s: ", NM_SETTING_VXLAN_SETTING_NAME, NM_SETTING_VXLAN_REMOTE); - return FALSE; + if (priv->remote) { + if (nm_utils_ipaddr_is_valid(AF_INET, priv->remote)) + family = AF_INET; + else if (nm_utils_ipaddr_is_valid(AF_INET6, priv->remote)) + family = AF_INET6; + else { + g_set_error(error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("'%s' is not a valid IP address"), + priv->remote); + g_prefix_error(error, + "%s.%s: ", + NM_SETTING_VXLAN_SETTING_NAME, + NM_SETTING_VXLAN_REMOTE); + return FALSE; + } } if (priv->local) { diff --git a/src/devices/nm-device-vxlan.c b/src/devices/nm-device-vxlan.c index 4522662449..2ed66a644d 100644 --- a/src/devices/nm-device-vxlan.c +++ b/src/devices/nm-device-vxlan.c @@ -180,9 +180,11 @@ create_and_realize(NMDevice * device, } str = nm_setting_vxlan_get_remote(s_vxlan); - if (!nm_utils_parse_inaddr_bin(AF_INET, str, NULL, &props.group) - && !nm_utils_parse_inaddr_bin(AF_INET6, str, NULL, &props.group6)) - return FALSE; + if (str) { + if (!nm_utils_parse_inaddr_bin(AF_INET, str, NULL, &props.group) + && !nm_utils_parse_inaddr_bin(AF_INET6, str, NULL, &props.group6)) + return FALSE; + } props.tos = nm_setting_vxlan_get_tos(s_vxlan); props.ttl = nm_setting_vxlan_get_ttl(s_vxlan); |