Red Hat Bugzilla – Bug 1010387
NetworkManager forgets wireless networks when HWADDR changes
Last modified: 2013-10-07 11:52:24 EDT
Description of problem:
When NetworkManager stores wireless networks, it includes the MAC address of the adapter in the HWADDR field inside /etc/sysconfig/network-scripts/ifcfg-*. Because of this, if your wireless adapter's MAC changes, NetworkManager will "forget" all of your wireless networks, and you'll have to put in your WPA2 keys again, etc. That's easy enough to recover with sed (or whatever) but if NetworkManager would instead omit the HWADDR field entirely, wireless networks would be available regardless of the adapter.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Authenticate to a wireless network which requires a passphrase
2. systemctl stop NetworkManager.service
3. Change your wireless MAC via whatever method (hardware swap or otherwise)
4. systemctl start NetworkManager.service
Wireless network is no longer remembered, /etc/sysconfig/network-scripts/ifcfg-<essid> contains a HWADDR line with the original MAC.
Wireless networks should still be remembered.
I can see how MAC address tracking could be useful in a number of circumstances, but I'm not sure it makes sense for wireless networks. What's in the air is in the air regardless of the adapter you're using to get to it.
HWADDR variable in ifcfg-* file corresponds to "Device MAC address" in nm-connection-editor. The field is used to "lock" particular connection with a Wi-Fi device.
If you create a connection using nm-connection-editor, the field is empty by default, which means the connection can be used with any compatible device.
However, when the connection is created first time by clicking a Wi-Fi network in nm-applet, nm-applet creates (*and* activates) a connection that is "locked" to the device. But you can easily edit that "Auto blahblah" connection in nm-connection-editor and remove "Device MAC address" if you prefer.
Is that really a sensible default, though? Who, when connecting to a wifi network, actually wants that connection to be locked to that particular wifi adapter? I have a hard time thinking of a situation where that would be the case. I suppose it's nice that there's a way to disassociate it via the nm-applet GUI, but in the event of an adapter swap, asking a user to manually go in and disassociate every single wifi network they might care about seems hardly ideal (and a mass 'sed' like the one I used would be far more efficient).
I won't keep harping on it, 'cause it's not really that big of a deal, especially given Fedora's short life cycle, but IMO the *default* for a wireless network should be to omit the HWADDR, rather than requiring a user to have the foresight to modify every single wifi connection they encounter.
Unlocked connections have a number of problems, two off the top of my head:
1) wifi device and driver capabilities can be quite different; if you have your connection set up for a network with specific requirements and then change your device, the old connection may fail to work and you'll have no idea why
2) unlocked connections apply to all wifi devices; which means if you plug two devices into your system, both devices will immediately connect to the same wifi network. This is almost always unexpected and not the intention of the user.
Most users do not change the wifi adapter, or change it quite rarely. Changing hardware is not a minor event and thus some system changes can also be expected. Basically, locking is the lesser of two evils is most situations and this is the direction we've chosen.