NetworkManager/clients/cli
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
..
agent.c cli: remove version check against NM 2016-04-28 09:35:20 +02:00
agent.h cli: add 'nmcli agent' command (bgo #739568) 2014-11-07 11:58:25 +01:00
common.c cli: make subcommand dispatch do autocompletion 2016-06-29 20:49:34 +02:00
common.h cli: add boolean value completion helper 2016-06-29 20:49:34 +02:00
connections.c cli/connection: export read_connection_properties() 2016-06-29 20:28:42 +02:00
connections.h cli/connection: export read_connection_properties() 2016-06-29 20:28:42 +02:00
devices.c cli/device: allow completion of the "wifi" command name 2016-06-29 20:49:34 +02:00
devices.h cli: add nmcli monitor 2015-12-05 12:16:23 +01:00
general.c build: avoid compiler warnings about non-constant format strings (-Wformat-nonliteral) 2016-06-05 12:22:01 +02:00
general.h cli: add nmcli monitor 2015-12-05 12:16:23 +01:00
Makefile.am build: disable deprecation checks for internal compilation 2016-04-05 22:22:58 +02:00
nmcli-completion cli/device: add modify command 2016-06-29 20:28:42 +02:00
nmcli.c cli/device: add device name completion 2016-06-29 20:28:42 +02:00
nmcli.h nmcli: enable connection autocompletion for 802.1x properties 2016-06-21 16:28:48 +02:00
polkit-agent.c all: cleanup includes and let "nm-default.h" include "config.h" 2016-02-19 17:53:25 +01:00
polkit-agent.h cli: add 'nmcli agent' command (bgo #739568) 2014-11-07 11:58:25 +01:00
settings-docs.xsl clients: reorganize source tree, put all the installed clients together 2014-07-30 15:56:19 -04:00
settings.c all: make MAC address randomization algorithm configurable 2016-06-30 08:32:50 +02:00
settings.h cli: refactor property to string conversion 2015-06-05 12:26:48 +02:00
utils.c build: avoid compiler warnings about non-constant format strings (-Wformat-nonliteral) 2016-06-05 12:22:01 +02:00
utils.h macros: add macro _nm_printf() for function attribute 2016-06-05 12:22:01 +02:00