diff options
author | Thomas Haller <thaller@redhat.com> | 2019-07-18 13:42:28 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-07-25 10:49:48 +0200 |
commit | 8437cd0895ce6e7af4bf17f7dbf17f09469e2a99 (patch) | |
tree | 10382ca441dc05e6ac631e99b184024d7df1d9d2 | |
parent | f13454cb1c503a8b35fb3c4b241c4cfb9aabf226 (diff) | |
download | NetworkManager-8437cd0895ce6e7af4bf17f7dbf17f09469e2a99.tar.gz |
device,config: don't write fake MAC address to "no-auto-default.state" file
For one, nm_config_get_no_auto_default_for_device() uses
nm_device_spec_match_list(). This ignores fake MAC addresses.
Maybe it should not do that, but it's also not clear what it
would mean for the function to consider them.
As such, it makes not sense trying to persist such MAC addresses
to "/var/lib/NetworkManager/no-auto-default.state". For the moment,
just do nothing.
This still leaves the problem how we prevent the device from generating
a auto-default connection. But this patch is no change in behavior, because
it didn't work anyway.
-rw-r--r-- | src/nm-config.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/nm-config.c b/src/nm-config.c index bb37d08fc3..1cb98e3739 100644 --- a/src/nm-config.c +++ b/src/nm-config.c @@ -416,6 +416,7 @@ nm_config_set_no_auto_default_for_device (NMConfig *self, NMDevice *device) const char *hw_address; const char *const*no_auto_default_current; GPtrArray *no_auto_default_new = NULL; + gboolean is_fake; guint i; g_return_if_fail (NM_IS_CONFIG (self)); @@ -423,10 +424,23 @@ nm_config_set_no_auto_default_for_device (NMConfig *self, NMDevice *device) priv = NM_CONFIG_GET_PRIVATE (self); - hw_address = nm_device_get_permanent_hw_address (device); + hw_address = nm_device_get_permanent_hw_address_full (device, TRUE, &is_fake); + if (!hw_address) return; + if (is_fake) { + /* this is a problem. The MAC address is fake, it's possibly only valid + * until reboot (or even less). + * + * Also, nm_device_spec_match_list() ignores fake addresses, so even if + * we would persist it, it wouldn't work (well, maybe it should?). + * + * Anyway, let's do nothing here. NMSettings needs to remember this + * in memory. */ + return; + } + no_auto_default_current = nm_config_data_get_no_auto_default (priv->config_data); if (nm_utils_strv_find_first ((char **) no_auto_default_current, -1, hw_address) >= 0) { |