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
This commit is contained in:
barinet 2020-10-09 09:40:08 +00:00 committed by Thomas Haller
parent e29f00fa0c
commit 676fe327d4
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
2 changed files with 22 additions and 24 deletions

View file

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

View file

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