diff options
author | Dan Williams <dcbw@redhat.com> | 2014-03-26 17:08:07 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2014-03-26 17:14:24 -0500 |
commit | 6c2115b0a306b0950eaf4dc5bda9e13ef8211549 (patch) | |
tree | ee7ac659eee6582e6f4fc4556b3154300c72b084 | |
parent | f15daac0921ef2b489115c320cea914e78c34c0a (diff) | |
download | NetworkManager-dcbw/098-slave-fixup.tar.gz |
libnm-util: if one of slave-type and master is set, both must be setdcbw/098-slave-fixup
slave-type is required because master may refer to an interface that
is not yet created, and thus the details of the slave connection are
ambiguous. While we can auto-detect slave-type in some cases (like
if a bridge-port setting exists, then slave-type=bridge), that
functionality isn't implemented yet and doesn't work for all cases.
So for the moment, require that both slave-type and master are
set if one is set.
-rw-r--r-- | libnm-util/nm-setting-connection.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libnm-util/nm-setting-connection.c b/libnm-util/nm-setting-connection.c index 9c3f2ce287..215f9c2ccf 100644 --- a/libnm-util/nm-setting-connection.c +++ b/libnm-util/nm-setting-connection.c @@ -697,6 +697,15 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) return FALSE; } + /* If one of master or slave_type is set, the other must also be set */ + if ((priv->master || priv->slave_type) && !(priv->master && priv->slave_type)) { + g_set_error (error, + NM_SETTING_CONNECTION_ERROR, + NM_SETTING_CONNECTION_ERROR_INVALID_PROPERTY, + priv->master ? NM_SETTING_CONNECTION_SLAVE_TYPE : NM_SETTING_CONNECTION_MASTER); + return FALSE; + } + /* * Bonding: Slaves are not allowed to have any IP configuration. */ |