Commit graph

85 commits

Author SHA1 Message Date
Adrián Laviós Gomis 7621fe4e1a man: update NetworkManager.conf man page to account for stub-resolv.conf (#68)
NetworkManager checks if /etc/resolv.conf is a symlink to
/run/systemd/resolve/stub-resolv.conf since commit
e09503dcc4. This should be
documented in the corresponding section of NetworkManager.conf(5).

https://github.com/NetworkManager/NetworkManager/pull/68
2018-02-18 14:22:24 +01:00
Thomas Haller f5bedd3655 device: make ipv4.dhcp-client-id configurable via a global default 2018-02-15 16:23:20 +01:00
Masashi Honma b4bbe5179f wifi: add support for FILS
The FILS(Fast Initial Link Setup) is a specification defined by IEEE 802.11ai to
speed up roaming. This patch adds support of it.

I have tested with these cases.
+-----+-------------------------+----------------+
| STA |            AP           |                |
|FILS |         key-mgmt        |     result     |
+-----+-------------------------+----------------+
|  1  | WPA-EAP                 |       O        |
+-----+-------------------------+----------------+
|  1  | WPA-EAP-SHA256          |       O        |
+-----+-------------------------+----------------+
|  1  | FILS-SHA256             |       X        |
+-----+-------------------------+----------------+
|  1  | FILS-SHA384             |       X        |
+-----+-------------------------+----------------+
|  1  | WPA-EAP WPA-EAP-SHA256  |       O        |
|     | FILS-SHA256 FILS-SHA384 | WPA-EAP-SHA256 |
+-----+-------------------------+----------------+
|  2  | WPA-EAP                 |       O        |
+-----+-------------------------+----------------+
|  2  | WPA-EAP-SHA256          |       O        |
+-----+-------------------------+----------------+
|  2  | FILS-SHA256             |       O        |
+-----+-------------------------+----------------+
|  2  | FILS-SHA384             |       O        |
+-----+-------------------------+----------------+
|  2  | WPA-EAP WPA-EAP-SHA256  |       O        |
|     | FILS-SHA256 FILS-SHA384 | FILS-SHA384    |
+-----+-------------------------+----------------+
|  3  | WPA-EAP                 |       X        |
+-----+-------------------------+----------------+
|  3  | WPA-EAP-SHA256          |       X        |
+-----+-------------------------+----------------+
|  3  | FILS-SHA256             |       O        |
+-----+-------------------------+----------------+
|  3  | FILS-SHA384             |       O        |
+-----+-------------------------+----------------+
|  3  | WPA-EAP WPA-EAP-SHA256  |       O        |
|     | FILS-SHA256 FILS-SHA384 | FILS-SHA384    |
+-----+-------------------------+----------------+

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2018-01-16 15:01:59 +01:00
Thomas Haller c03a534963 core: implement setting MDNS setting for systemd
The connection.mdns setting is a per-connection setting,
so one might expect that one activated device can only have
one MDNS setting at a time.

However, with certain VPN plugins (those that don't have their
own IP interface, like libreswan), the VPN configuration is merged
into the configuration of the device. So, in this case, there
might be multiple settings for one device that must be merged.

We already have a mechanism for that. It's NMIP4Config. Let NMIP4Config
track this piece of information. Although, stricitly speaking this
is not tied to IPv4, the alternative would be to introduce a new
object to track such data, which would be a tremendous effort
and more complicated then this.

Luckily, NMDnsManager and NMDnsPlugin are already equipped to
handle multiple NMIPConfig instances per device (IPv4 vs. IPv6,
and Device vs. VPN).

Also make "connection.mdns" configurable via global defaults in
NetworkManager.conf.
2018-01-09 14:24:54 +01:00
Thomas Haller 16e75d4db5 wifi: configure wifi-backend per device
This allows to configure the wifi-backend per device, like

  [device-wifi-backend-eth0]
  match-device=interface-name:wlan0
  wifi-backend=iwd
2017-12-27 09:18:54 +01:00
Thomas Haller 0474441e22 settings: drop unmaintained ifnet settings plugin of Gentoo
Even Gentoo disables this plugin since before 0.9.8 release
of NetworkManager. Time to say goodbye.

If somebody happens to show up to maintain it, we may resurrect it
later.

If "$distro_plugins=ifnet" was set, configure.ac would use that
to autodetect --with-hostname-persist=gentoo. Replace that autodetect
part by checking for /etc/gentoo-release file.
2017-12-21 10:50:33 +01:00
Thomas Haller 68fa0ea8eb man: document all setting plugins in NetworkManager.conf manual
although they are deprecated and unused, document them.
2017-12-21 10:50:33 +01:00
Thomas Haller b595a80977 device: make carrier-wait-timeout configurable per device
As this depends on the particular host configuration, it's hard to find
a default that suits everybody. At least make it configurable per-device.

https://bugzilla.redhat.com/show_bug.cgi?id=1483343
https://bugzilla.redhat.com/show_bug.cgi?id=1515027
2017-11-28 10:33:26 +01:00
Thomas Haller 45fc95f051 logging: configure dnsmasq's logging in shared mode via nm-logging
(cherry picked from commit cc993aa020)
2017-11-06 12:25:23 +01:00
Thomas Haller 90d8e26159 man: document PROXY logging domain
(cherry picked from commit 43da186ec3)
2017-11-06 12:25:23 +01:00
Thomas Haller 2730dc60de all: move setting 802-1x.auth-retries to connection.auth-retries
The number of authentication retires is useful also for passwords aside
802-1x settings. For example, src/devices/wifi/nm-device-wifi.c also has
a retry counter and uses a hard-coded value of 3.

Move the setting, so that it can be used in general. Although it is still
not implemented for other settings.

This is an API and ABI break.
2017-11-02 11:41:01 +01:00
Thomas Haller 89e518db5a libnm,cli,ifcfg-rh: add NMSetting8021x:auth-retries property 2017-10-31 19:35:33 +01:00
Thomas Haller cc1ee1d286 all: rework configuring route table support by adding "route-table" setting
We added "ipv4.route-table-sync" and "ipv6.route-table-sync" to not change
behavior for users that configured policy routing outside of NetworkManager,
for example, via a dispatcher script. Users had to explicitly opt-in
for NetworkManager to fully manage all routing tables.

These settings were awkward. Replace them with new settings "ipv4.route-table"
and "ipv6.route-table". Note that this commit breaks API/ABI on the unstable
development branch by removing recently added API.

As before, a connection will have no route-table set by default. This
has the meaning that policy-routing is not enabled and only the main table
will be fully synced. Once the user sets a table, we recognize that and
NetworkManager manages all routing tables.

The new route-table setting has other important uses: analog to
"ipv4.route-metric", it is the default that applies to all routes.
Currently it only works for static routes, not DHCP, SLAAC,
default-route, etc. That will be implemented later.

For static routes, each route still can explicitly set a table, and
overwrite the per-connection setting in "ipv4.route-table" and
"ipv6.route-table".
2017-10-09 22:05:36 +02:00
Thomas Haller cfb14ce17e core: cleanup autoconnect retry handling
- clearify in the manual page that setting retry to 1 means to try
  once, without retry.
- log the initially set retry value in nm_settings_connection_get_autoconnect_retries().
- use nm_settings_connection_get_autoconnect_retries() in
  nm_settings_connection_can_autoconnect().
2017-10-04 13:57:16 +02:00
Thomas Haller 46dc919e68 man: clearify plain text secrets in keyfile 2017-09-28 17:56:49 +02:00
Thomas Haller 5778bc6a34 device: add configuration option to mark devices as unmanaged
We already have various ways to mark a device as unmanaged.

1) via udev-rule ENV{NM_UNMANAGED}. This can be overwritten via D-Bus
  at runtime.

2) via settings plugin. That is NM_CONTROLLED=no for ifcfg-rh and
  keyfile.unmanaged-devices in NetworkManager.conf.

3) at runtime, via D-Bus. This is persisted in the run state file
  and persists restarts (but not reboot).

This adds another way via NetworkManager.conf file. Note that the
existing keyfile.unmanaged-devices (above 2) is also a configuration
optin in NetworkManager.conf. However it has various downsides:

  - it cannot be overwritten at runtime (see commit
    c210134bd5).

  - you can only explicitly mark a device as unmanaged. That means,
    you cannot use it to manage a device which is unmanaged due to
    a udev rule.

  - the name "keyfile.*" sounds like it's only relevant for the keyfile settings
    plugin. Nowadays the keyfile plugin is always loaded, so the option applies
    to NetworkManager in general.

https://github.com/NetworkManager/NetworkManager/pull/29
2017-09-28 14:44:46 +02:00
Thomas Haller 286f21db1c man: fix example for device section in NetworkManager.conf's manual
We currently don't support marking a device a managed/unmanaged via
the [device] section. Eventually, I think we should, because the
existing "keyfile.unmanaged-devices" looks keyfile specific (which
it isn't). But more importantly, "keyfile.unmanaged-devices" sets the
unmanaged flag NM_UNMANAGED_USER_SETTINGS, which cannot be overruled
via D-Bus (see commit c210134bd5).
A device.managed flag would make sense for a more sensible way to
express configuration in NetworkManager.conf, which still can be
overwritten via D-Bus.

Anyway, it's not yet implemented. Fix the example.
2017-09-28 14:40:17 +02:00
Thomas Haller c71f26bf92 libnm,cli: add IP setting "route-table-sync" 2017-09-26 19:39:36 +02:00
Thomas Haller 1aa36dde94 device: enable support for ipv6.dhcp-timeout
- cleanup data type and use guint32 consistently. We might want to
  introduce a new "infinity" value. But since libnm's
  NM_SETTING_IP_CONFIG_DHCP_TIMEOUT asserts against the range
  0 - G_MAXINT32, we cannot express it as -1 anyway. So, infinity
  will have the numerical value G_MAXINT32, hence guint32 is just
  fine.

- make use of existing ipv6.dhcp-timeout setting and add global
  default configuration in NetworkManager.conf

- instead of having subclasses call nm_device_set_dhcp_timeout(),
  add a virtual function get_dhcp_timeout().
2017-09-11 15:05:57 +02:00
Nikolay Martynov 8c91422954 device: handle carrier changes for master device differently
For master devices, instead of ignoring loss of carrier entirely,
handle it.

First of all, master devices are now by default ignore-carrier=yes.
That means, without explict user configuration in NetworkManager.conf,
the previous behavior in carrier_changed() does not change.

If the user decides to configure the master device like

    [device-with-carrier]
    match-device=type:bond,type:bridge,type:team
    ignore-carrier=no

then, master device will disconnect on carrier loss like
regular devices.

https://github.com/NetworkManager/NetworkManager/pull/18

Co-authored-by: Thomas Haller <thaller@redhat.com>
2017-06-22 13:27:01 +02:00
Thomas Haller 4ca3002b86 device: don't set MTU of device unless explicitly configured
Since commit 2b51d3967 "device: merge branch 'th/device-mtu-bgo777251'",
we always set the MTU for certain device types during activation. Even
if the MTU is neither specified via the connection nor other means, like
DHCP.

Revert that change. On activation, if nothing explicitly configures the
MTU, leave it unchanged. This is like what we do with ethernet's
cloned-mac-address, which has a default value "preserve".
So, as last resort the default value for MTU is now 0 (don't change),
instead of depending on the device type.

Note that you also can override the default value in global
configuration via NetworkManager.conf.

This behavior makes sense, because whenever NM actively resets the MTU,
it remembers the previous value and restores it when deactivating
the connection. That wasn't implemented before 2b51d3967, and the
MTU would depend on which connection was previously active. That
is no longer an issue as the MTU gets reset when deactivating.

https://bugzilla.redhat.com/show_bug.cgi?id=1460760
2017-06-13 15:05:30 +02:00
Beniamino Galvani 31656a066b core: add configuration flag to choose slaves activation order
Commits 39d0559d9a ("platform: sort links by name instead of
ifindex") and 529a0a1a7f ("manager: sort slaves to be autoconnected
by device name") changed the order of activation of slaves. Introduce
a system-wide configuration property to preserve the old behavior.

https://bugzilla.redhat.com/show_bug.cgi?id=1452585
2017-05-24 15:56:15 +02:00
Beniamino Galvani acb70d84f9 supplicant: configure PMF for each connection
Now that we have a PMF connection property, get rid of the previous
code to globally enable/disable PMF and use the 'ieee80211w'
configuration option for each configured network when the supplicant
supports it.
2017-04-28 09:46:06 +02:00
Beniamino Galvani 32975b6aa5 core: allow setting SR-IOV num_vfs 2017-04-18 23:10:36 +02:00
Francesco Giudici 70c768901b man: add description for the 'hostname' config option in the main section 2017-03-24 15:18:09 +01:00
Thomas Haller 051c8917f4 man: fix default location for keyfile.path in documentation
Fixes: 530af7009e
Fixes: 90683fcb3a
2017-03-24 10:40:52 +01:00
Thomas Haller b869d9cc0d device: add spec "driver:" to match devices
Changing the MAC address of devices is known to fail with
certain drivers. Add a device-spec to allow disabling it
for for such devices.

Related: https://bugzilla.gnome.org/show_bug.cgi?id=777523
2017-03-17 17:40:00 +01:00
Thomas Haller 15177a34be dns: change behavior for "rc-manager=symlink" to preserve "/etc/resolv.conf" as file
The purpose of "rc-manager=symlink" is so that the administrator can point
the "/etc/resolv.conf" as a symlink to a certain file, and thus indicating
that a certain component is responsible to manage resolv.conf, while others
should stay away from it.
For example, systemd-resolved never touches "/etc/resolv.conf", but
expects the admin to setup the symlink appropriately. It also recognizes
whether the symlink points to it's own resolv.conf in /run or to another
component.

Previously, "rc-manager=symlink" would always replace a regular file
with a symlink to "/var/run/NetworkManager/resolv.conf". Only if
"/etc/resolv.conf" is already a symlink somewhere else, NM would not
touch it. This with the exception that if "/etc/resolv.conf" points to
"/var/run/NetworkManager/resolv.conf", it would replace the symlink
with the same link to raise inotify events.

Change behavior so if "/etc/resolv.conf" is already a regular file, keep
it as file.
This means, if you have multiple components that don't care, everybody
can write the "/etc/resolv.conf" (as file) and there is no clear
expressed responsibility.
It was wrong that NetworkManager would convert the file to a symlink,
this should be reserved to the admin. Instead, NetworkManager should
accept that the intent is unspecified and preserve the regular file.
It's up to the admin to replace the symlink to somewhere else (to keep
NM off), or to point it to "/var/run/NetworkManager/resolv.conf", to show
the explicit intent.

The wrong behavior causes dangling symlinks when somebody disables
NetworkManager for good.

https://bugzilla.redhat.com/show_bug.cgi?id=1367551
2017-02-14 17:45:55 +01:00
Thomas Haller be813707f0 device: make the MTU globally configurable via connection-defaults
This allows a user to restore the previous behavior where NetworkManager
would not reconfigure the MTU during device activation, if no MTU is
available (commit "22e8af6 device: set a per-device default MTU on
activation").

Well, not exactly. The previous behavior was to use per-connection
configuration, then DHCP provided value, or finally leave the MTU
unspecified.
Now, we prefer a per-connection configuration, followed by a global
connection default. If "ethernet.mtu=0", the MTU is left unspecified.
In absense of a global connection default, the value from DHCP is used
or finally a per-device-type default. That is effectively 1500 for most
types, except for infiniband where the MTU is still left unspecified.
2017-01-17 13:43:50 +01:00
Thomas Haller f0d40525df device: support dynamic "connection.stable-id" in form of text-substitution
Usecase: when connecting to a public Wi-Fi with MAC address randomization
("wifi.cloned-mac-address=random") you get on every re-connect a new
IP address due to the changing MAC address.
"wifi.cloned-mac-address=stable" is the solution for that. But that
means, every time when reconnecting to this network, the same ID will
be reused. We want an ID that is stable for a while, but at a later
point a new ID should e generated when revisiting the Wi-Fi network.

Extend the stable-id to become dynamic and support templates/substitutions.
Currently supported is "${CONNECTION}", "${BOOT}" and "${RANDOM}".
Any unrecognized pattern is treated verbaim/untranslated.

"$$" is treated special to allow escaping the '$' character. This allows
the user to still embed verbatim '$' characters with the guarantee that
future versions of NetworkManager will still generate the same ID.
Of course, a user could just avoid '$' in the stable-id unless using
it for dynamic substitutions.

Later we might want to add more recognized substitutions. For example, it
could be useful to generate new IDs based on the current time. The ${} syntax
is extendable to support arguments like "${PERIODIC:weekly}".

Also allow "connection.stable-id" to be set as global default value.
Previously that made no sense because the stable-id was static
and is anyway strongly tied to the identity of the connection profile.
Now, with dynamic stable-ids it gets much more useful to specify
a global default.

Note that pre-existing stable-ids don't change and still generate
the same addresses -- unless they contain one of the new ${} patterns.
2017-01-09 14:50:33 +01:00
Thomas Haller afcfa7be2b config/trivial: unify name of compile time config defaults 2016-11-25 18:02:38 +01:00
Thomas Haller ce28e6ab30 man: clarify dns=default setting in NetworkManager.conf manual
https://bugzilla.gnome.org/show_bug.cgi?id=774399
2016-11-14 12:34:28 +01:00
Lubomir Rintel 7b589e2b72 man: use <filename> to mark file names
This gives the templates a chance to do something extra clever with the
formatting. The templates, of course, choose not to :(
2016-11-11 14:42:27 +01:00
Lubomir Rintel bcad38ac31 man: use /run instead of /var/run
/var/run is just a compatibility symlink, according to file-hierarchy(7).
2016-11-03 17:56:13 +01:00
Thomas Haller e9bf87805c dhcp: make default dhcp plugin configurable at compile-time 2016-10-27 11:28:01 +02:00
Thomas Haller a5e3016fc9 man: document /var/run/NetworkManager/conf.d directory 2016-10-23 13:33:09 +02:00
Beniamino Galvani a67bdbc331 core: handle the autoconnect-retries property 2016-10-16 12:56:09 +02:00
Beniamino Galvani 58349c3885 man: NetworkManager.conf: better document dns=dnsmasq
It's potentially unexpected by user that dnsmasq works differently
from the libc resolver and doesn't try the servers in order. Add a
paragraph to explain that and how to tweak the resolution order.
2016-09-20 15:32:37 +02:00
Thomas Haller fae5ecec5a device: change default value for cloned-mac-address to "preserve" (bgo#770611)
Long ago before commit 1b49f94, NetworkManager did not touch the
MAC address at all. Since 0.8.2 NetworkManager would modify the
MAC address, and eventually it would reset the permanent MAC address
of the device.

This prevents a user from externally setting the MAC address via tools
like macchanger and rely on NetworkManager not to reset it to the
permanent MAC address. This is considered a security regression in
bgo#708820.

This only changed with commit 9a354cd and 1.4.0. Since then it is possible
to configure "cloned-mac-address=preserve", which instead uses the "initial"
MAC address when the device activates.
That also changed that the "initial" MAC address is the address which was
externally configured on the device as last. In other words, the
"initial" MAC address is picked up from external changes, unless it
was NetworkManager itself who configured the address when activating a
connection.

However, in absence of an explicit configuration the default for
"cloned-mac-address" is still "permanent". Meaning, the user has to
explicitly configure that NetworkManager should not touch the MAC address.
It makes sense to change the upstream default to "preserve". Although this
is a change in behavior since 0.8.2, it seems a better default.

This change has the drastic effect that all the existing connections
out there with "cloned-mac-address=$(nil)" change behavior after upgrade.
I think most users won't notice, because their devices have the permanent
address set by default anyway. I would think that there are few users
who intentionally configured "cloned-mac-address=" to have NetworkManager
restore the permanent address.

https://bugzilla.gnome.org/show_bug.cgi?id=770611
2016-09-12 14:01:57 +02:00
Beniamino Galvani 3719816c7f man: document dns=systemd-resolved 2016-09-08 12:51:22 +02:00
Thomas Haller e284651f4c man: fix wording in NetworkManager.conf for "rc-manager" 2016-09-02 17:04:37 +02:00
Thomas Haller 9aee7b493e doc: add comment to systemd's NetworkManager.service about ibft requiring CAP_SYS_ADMIN
We don't want to enable this upstream, but make the requirement
more discoverable by documenting it and put a comment to
NetworkManager.service.

https://bugzilla.redhat.com/show_bug.cgi?id=1371201
2016-09-02 15:39:08 +02:00
Beniamino Galvani f87ca31341 man: NetworkManager.conf: fix link syntax
Fixes: c7cee12189
2016-08-26 20:53:28 +02:00
Thomas Haller 6fb2a24f3a man: fix reference in NetworkManager.conf
Without this, it reads:
  See the section called “Sections” for details.
but there are multiple sections called “Sections” and it should
explicitly refer to the one from the other top-level section.

With this change, it reads:
  See “Sections” under the section called “CONNECTION SECTION” for details.
2016-08-26 14:58:20 +02:00
Thomas Haller ede6ddf58f man: improve NetworkManager.conf manual fo "wifi.scan-rand-mac-address" 2016-06-30 09:22:12 +02:00
Thomas Haller 96cabbcbb8 all: make MAC address randomization algorithm configurable
For the per-connection settings "ethernet.cloned-mac-address"
and "wifi.cloned-mac-address", and for the per-device setting
"wifi.scan-rand-mac-address", we may generate MAC addresses using
either the "random" or "stable" algorithm.

Add new properties "generate-mac-address-mask" that allow to configure
which bits of the MAC address will be scrambled.

By default, the "random" and "stable" algorithms scamble all bits
of the MAC address, including the OUI part and generate a locally-
administered, unicast address.

By specifying a MAC address mask, we can now configure to perserve
parts of the current MAC address of the device. For example, setting
"FF:FF:FF:00:00:00" will preserve the first 3 octects of the current
MAC address.

One can also explicitly specify a MAC address to use instead of the
current MAC address. For example, "FF:FF:FF:00:00:00 68:F7:28:00:00:00"
sets the OUI part of the MAC address to "68:F7:28" while scrambling
the last 3 octects.
Similarly, "02:00:00:00:00:00 00:00:00:00:00:00" will scamble
all bits of the MAC address, except clearing the second-least
significant bit. Thus, creating a burned-in address, globally
administered.

One can also supply a list of MAC addresses like
"FF:FF:FF:00:00:00 68:F7:28:00:00:00 00:0C:29:00:00:00 ..." in which
case a MAC address is choosen randomly.

To fully scamble the MAC address one can configure
"02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00".
which also randomly creates either a locally or globally administered
address.

With this, the following macchanger options can be implemented:

  `macchanger --random`
   This is the default if no mask is configured.
   -> ""
   while is the same as:
   -> "00:00:00:00:00:00"
   -> "02:00:00:00:00:00 02:00:00:00:00:00"

  `macchanger --random --bia`
   -> "02:00:00:00:00:00 00:00:00:00:00:00"

  `macchanger --ending`
   This option cannot be fully implemented, because macchanger
   uses the current MAC address but also implies --bia.
   -> "FF:FF:FF:00:00:00"
      This would yields the same result only if the current MAC address
      is already a burned-in address too. Otherwise, it has not the same
      effect as --ending.
   -> "FF:FF:FF:00:00:00 <MAC_ADDR>"
      Alternatively, instead of using the current MAC address,
      spell the OUI part out. But again, that is not really the
      same as macchanger does because you explictly have to name
      the OUI part to use.

  `machanger --another`
  `machanger --another_any`
  -> "FF:FF:FF:00:00:00 <MAC_ADDR> <MAC_ADDR> ..."
     "$(printf "FF:FF:FF:00:00:00 %s\n" "$(sed -n 's/^\([0-9a-fA-F][0-9a-fA-F]\) \([0-9a-fA-F][0-9a-fA-F]\) \([0-9a-fA-F][0-9a-fA-F]\) .*/\1:\2:\3:00:00:00/p' /usr/share/macchanger/wireless.list | xargs)")"
2016-06-30 08:32:50 +02:00
Thomas Haller 7b585bcc93 wifi: make MAC address randomization during scanning configurable
This allows the user to disable MAC address randomization during
scanning for Wi-Fi networks, which is done by default.

For one, this allows the user to disable the randomization for whatever
reason.

Also, together with configuring the per-connection setting
wifi.cloned-mac-address=preserve, this allows to disable NetworkManager
to modify the MAC address of the interface. This may allow the user
to set the MAC address outside of NetworkManager without NetworkManager
interfering.
2016-06-30 08:29:56 +02:00
Thomas Haller 767abfa690 wifi: implement MAC address randomization in NetworkManager instead of supplicant
'wireless.mac-address-randomization' broke 'wireless.cloned-mac-address',
because we would always set 'PreassocMacAddr=1'. The reason is that
supplicant would set 'wpa_s->mac_addr_changed' during scanning, and
later during association it would either set a random MAC address or
reset the permanent MAC address [1].

Anyway, 'wireless.mac-address-randomization' conflicts with
'wireless.cloned-mac-address'. Instead of letting supplicant set the
MAC address, manage the MAC addresses entirely from NetworkManager.
Supplicant should not touch it.

[1] https://w1.fi/cgit/hostap/tree/wpa_supplicant/wpa_supplicant.c?id=f885b8e97cf39b56fe7ca6577890f2d20df7ae08#n1663
2016-06-30 08:29:56 +02:00
Thomas Haller 8eed67122c device: extend MAC address handling including randomization for ethernet and wifi
Extend the "ethernet.cloned-mac-address" and "wifi.cloned-mac-address"
settings. Instead of specifying an explicit MAC address, the additional
special values "permanent", "preserve", "random", "random-bia", "stable" and
"stable-bia" are supported.

"permanent" means to use the permanent hardware address. Previously that
was the default if no explict cloned-mac-address was set. The default is
thus still "permanent", but it can be overwritten by global
configuration.

"preserve" means not to configure the MAC address when activating the
device. That was actually the default behavior before introducing MAC
address handling with commit 1b49f941a6.

"random" and "random-bia" use a randomized MAC address for each
connection. "stable" and "stable-bia" use a generated, stable
address based on some token. The "bia" suffix says to generate a
burned-in address. The stable method by default uses as token the
connection UUID, but the token can be explicitly choosen via
"stable:<TOKEN>" and "stable-bia:<TOKEN>".

On a D-Bus level, the "cloned-mac-address" is a bytestring and thus
cannot express the new forms. It is replaced by the new
"assigned-mac-address" field. For the GObject property, libnm's API,
nmcli, keyfile, etc. the old name "cloned-mac-address" is still used.
Deprecating the old field seems more complicated then just extending
the use of the existing "cloned-mac-address" field, although the name
doesn't match well with the extended meaning.

There is some overlap with the "wifi.mac-address-randomization" setting.

https://bugzilla.gnome.org/show_bug.cgi?id=705545
https://bugzilla.gnome.org/show_bug.cgi?id=708820
https://bugzilla.gnome.org/show_bug.cgi?id=758301
2016-06-30 08:29:56 +02:00
Thomas Haller 481cdc2706 device: let device specs match on permanent MAC address
Using the current, possibly non-permanent MAC address doesn't really
make sense.

Also, NM_DEVICE_HW_ADDRESS used to be writable and was set by NMDeviceBt
to the bdaddr. That is wrong, because bdaddr should not be the current
address, but the permanent one.
2016-06-30 08:29:55 +02:00