mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-06 03:30:31 +01:00
shared: add NMU_IFACE_ANY for nm_utils_ifname_valid()
nm_utils_ifname_valid() is to validate "connection.interface-name" property. But the exact validation depends on the connection type. Add "NMU_IFACE_ANY" to validate the name to check whether it would be valid for any connection type. This is for completeness and for places where the caller might not know the connection type.
This commit is contained in:
parent
a11edd4a82
commit
807cddc754
2 changed files with 13 additions and 1 deletions
|
|
@ -4211,6 +4211,17 @@ nm_utils_ifname_valid (const char* name,
|
|||
return _nm_utils_ifname_valid_kernel (name, error);
|
||||
case NMU_IFACE_OVS:
|
||||
return _nm_utils_ifname_valid_ovs (name, error);
|
||||
case NMU_IFACE_ANY: {
|
||||
gs_free_error GError *local = NULL;
|
||||
|
||||
if (_nm_utils_ifname_valid_kernel (name, error ? &local : NULL))
|
||||
return TRUE;
|
||||
if (_nm_utils_ifname_valid_ovs (name, NULL))
|
||||
return TRUE;
|
||||
if (error)
|
||||
g_propagate_error (error, g_steal_pointer (&local));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
g_return_val_if_reached (FALSE);
|
||||
|
|
|
|||
|
|
@ -1678,7 +1678,8 @@ nm_utils_strdup_reset (char **dst, const char *src)
|
|||
/*****************************************************************************/
|
||||
|
||||
typedef enum {
|
||||
NMU_IFACE_KERNEL = 0,
|
||||
NMU_IFACE_ANY,
|
||||
NMU_IFACE_KERNEL,
|
||||
NMU_IFACE_OVS,
|
||||
} NMUtilsIfaceType;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue