ifcfg-rh: use nm_utils_ifname_valid() for validating interface-name in reader
Maybe the reader should not try to add its own validation. It could just read the value, set it in the profile, and let nm_connection_verify() handle it. However: - in this form the code only logs a warning about invalid setting. If we let it come to nm_connection_verify(), the connection profile will be entirely rejected. I think this makes sense, because ifcfg files may be edited by the user and we don't know what is out there. - it's nicer to show a warning that specifically mentions the DEVICE= variable. There error message we get from nm_connection_verify() is no longer aware of ifcfg peculiarities. Instead: use the appropriate validation function.
This commit is contained in:
@@ -399,7 +399,9 @@ make_connection_setting (const char *file,
|
||||
if (v) {
|
||||
GError *error = NULL;
|
||||
|
||||
if (nm_utils_ifname_valid_kernel (v, &error)) {
|
||||
/* Only validate for NMU_IFACE_KERNEL, because ifcfg plugin anyway
|
||||
* doesn't support OVS types. */
|
||||
if (nm_utils_ifname_valid (v, NMU_IFACE_KERNEL, &error)) {
|
||||
g_object_set (s_con,
|
||||
NM_SETTING_CONNECTION_INTERFACE_NAME, v,
|
||||
NULL);
|
||||
|
Reference in New Issue
Block a user