summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-06-15 13:15:07 +0200
committerThomas Haller <thaller@redhat.com>2016-06-30 08:29:55 +0200
commiteb3247c09707be41a34987b8d5e0037139f7bfb0 (patch)
treeacc90904431637fa4f95883afd586e4a144d8ca4
parent481cdc2706ae9467ca4a2527463e26c539e49e24 (diff)
downloadNetworkManager-eb3247c09707be41a34987b8d5e0037139f7bfb0.tar.gz
core: fix comparing nm_setting_wired_get_mac_address() with permanent MAC address
`man nm-settings` says about ethernet.mac-address: If specified, this connection will only apply to the Ethernet device whose permanent MAC address matches.
-rw-r--r--man/nm-settings-ifcfg-rh.xsl5
-rw-r--r--src/settings/nm-settings.c8
2 files changed, 9 insertions, 4 deletions
diff --git a/man/nm-settings-ifcfg-rh.xsl b/man/nm-settings-ifcfg-rh.xsl
index aac457c80b..80d33f2bdd 100644
--- a/man/nm-settings-ifcfg-rh.xsl
+++ b/man/nm-settings-ifcfg-rh.xsl
@@ -257,6 +257,11 @@ DEVICETYPE=TeamPort
assigns the interface 10.42.0.1, or it uses the first static address,
if configured.</para>
</listitem>
+ <listitem>
+ <para><literal>HWADDR</literal> -
+ initscripts compare the currently set hardware address of a device, while
+ NetworkManager considers the permanent one.</para>
+ </listitem>
</itemizedlist>
</para></listitem>
</varlistentry>
diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c
index a11696fd65..284e173d24 100644
--- a/src/settings/nm-settings.c
+++ b/src/settings/nm-settings.c
@@ -1879,11 +1879,11 @@ have_connection_for_device (NMSettings *self, NMDevice *device)
NMSettingConnection *s_con;
NMSettingWired *s_wired;
const char *setting_hwaddr;
- const char *device_hwaddr;
+ const char *perm_hw_addr;
g_return_val_if_fail (NM_IS_SETTINGS (self), FALSE);
- device_hwaddr = nm_device_get_hw_address (device);
+ perm_hw_addr = nm_device_get_permanent_hw_address (device, FALSE);
/* Find a wired connection locked to the given MAC address, if any */
g_hash_table_iter_init (&iter, priv->connections);
@@ -1917,8 +1917,8 @@ have_connection_for_device (NMSettings *self, NMDevice *device)
setting_hwaddr = nm_setting_wired_get_mac_address (s_wired);
if (setting_hwaddr) {
/* A connection mac-locked to this device */
- if ( device_hwaddr
- && nm_utils_hwaddr_matches (setting_hwaddr, -1, device_hwaddr, -1))
+ if ( perm_hw_addr
+ && nm_utils_hwaddr_matches (setting_hwaddr, -1, perm_hw_addr, -1))
return TRUE;
} else {
/* A connection that applies to any wired device */