2020-09-29 16:42:22 +02:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
2014-07-24 08:53:33 -04:00
|
|
|
/*
|
2019-10-01 09:20:35 +02:00
|
|
|
* Copyright (C) 2007 - 2014 Red Hat, Inc.
|
|
|
|
|
* Copyright (C) 2007 - 2008 Novell, Inc.
|
2014-07-24 08:53:33 -04:00
|
|
|
*/
|
|
|
|
|
|
2016-02-12 14:44:52 +01:00
|
|
|
#include "nm-default.h"
|
2016-02-19 14:57:48 +01:00
|
|
|
|
2016-02-12 14:44:52 +01:00
|
|
|
#include "nm-setting-wired.h"
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
#include <net/ethernet.h>
|
|
|
|
|
|
|
|
|
|
#include "nm-utils.h"
|
shared: build helper "libnm-libnm-core-{intern|aux}.la" library for libnm-core
"libnm-core" implements common functionality for "NetworkManager" and
"libnm".
Note that clients like "nmcli" cannot access the internal API provided
by "libnm-core". So, if nmcli wants to do something that is also done by
"libnm-core", , "libnm", or "NetworkManager", the code would have to be
duplicated.
Instead, such code can be in "libnm-libnm-core-{intern|aux}.la".
Note that:
0) "libnm-libnm-core-intern.la" is used by libnm-core itsself.
On the other hand, "libnm-libnm-core-aux.la" is not used by
libnm-core, but provides utilities on top of it.
1) they both extend "libnm-core" with utlities that are not public
API of libnm itself. Maybe part of the code should one day become
public API of libnm. On the other hand, this is code for which
we may not want to commit to a stable interface or which we
don't want to provide as part of the API.
2) "libnm-libnm-core-intern.la" is statically linked by "libnm-core"
and thus directly available to "libnm" and "NetworkManager".
On the other hand, "libnm-libnm-core-aux.la" may be used by "libnm"
and "NetworkManager".
Both libraries may be statically linked by libnm clients (like
nmcli).
3) it must only use glib, libnm-glib-aux.la, and the public API
of libnm-core.
This is important: it must not use "libnm-core/nm-core-internal.h"
nor "libnm-core/nm-utils-private.h" so the static library is usable
by nmcli which couldn't access these.
Note that "shared/nm-meta-setting.c" is an entirely different case,
because it behaves differently depending on whether linking against
"libnm-core" or the client programs. As such, this file must be compiled
twice.
(cherry picked from commit af07ed01c04867e281cc3982a7ab0d244d4f8e2e)
2019-04-15 09:26:53 +02:00
|
|
|
#include "nm-libnm-core-intern/nm-common-macros.h"
|
2014-07-24 08:53:33 -04:00
|
|
|
#include "nm-utils-private.h"
|
|
|
|
|
#include "nm-setting-private.h"
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SECTION:nm-setting-wired
|
|
|
|
|
* @short_description: Describes connection properties for Ethernet-based networks
|
|
|
|
|
*
|
|
|
|
|
* The #NMSettingWired object is a #NMSetting subclass that describes properties
|
|
|
|
|
* necessary for connection to Ethernet networks.
|
|
|
|
|
**/
|
|
|
|
|
|
2019-01-11 08:32:54 +01:00
|
|
|
/*****************************************************************************/
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2019-02-22 09:47:59 +01:00
|
|
|
G_STATIC_ASSERT(NM_SETTING_WIRED_WAKE_ON_LAN_EXCLUSIVE_FLAGS
|
|
|
|
|
== (NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT | NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE));
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-01-11 08:32:54 +01:00
|
|
|
NM_GOBJECT_PROPERTIES_DEFINE(NMSettingWired,
|
|
|
|
|
PROP_PORT,
|
|
|
|
|
PROP_SPEED,
|
|
|
|
|
PROP_DUPLEX,
|
|
|
|
|
PROP_AUTO_NEGOTIATE,
|
|
|
|
|
PROP_MAC_ADDRESS,
|
|
|
|
|
PROP_CLONED_MAC_ADDRESS,
|
|
|
|
|
PROP_GENERATE_MAC_ADDRESS_MASK,
|
|
|
|
|
PROP_MAC_ADDRESS_BLACKLIST,
|
|
|
|
|
PROP_MTU,
|
|
|
|
|
PROP_S390_SUBCHANNELS,
|
|
|
|
|
PROP_S390_NETTYPE,
|
|
|
|
|
PROP_S390_OPTIONS,
|
|
|
|
|
PROP_WAKE_ON_LAN,
|
|
|
|
|
PROP_WAKE_ON_LAN_PASSWORD, );
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
typedef struct {
|
2019-12-12 11:51:21 +01:00
|
|
|
struct {
|
|
|
|
|
NMUtilsNamedValue *arr;
|
|
|
|
|
guint len;
|
|
|
|
|
guint n_alloc;
|
|
|
|
|
} s390_options;
|
|
|
|
|
GArray * mac_address_blacklist;
|
|
|
|
|
char ** s390_subchannels;
|
2014-07-24 08:53:33 -04:00
|
|
|
char * port;
|
|
|
|
|
char * duplex;
|
2014-07-30 10:57:45 -04:00
|
|
|
char * device_mac_address;
|
|
|
|
|
char * cloned_mac_address;
|
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-22 20:31:39 +02:00
|
|
|
char * generate_mac_address_mask;
|
2014-07-24 08:53:33 -04:00
|
|
|
char * s390_nettype;
|
2015-05-11 21:59:51 +02:00
|
|
|
char * wol_password;
|
2019-12-12 11:51:21 +01:00
|
|
|
NMSettingWiredWakeOnLan wol;
|
|
|
|
|
guint32 speed;
|
|
|
|
|
guint32 mtu;
|
|
|
|
|
bool auto_negotiate : 1;
|
2014-07-24 08:53:33 -04:00
|
|
|
} NMSettingWiredPrivate;
|
|
|
|
|
|
2019-01-11 08:32:54 +01:00
|
|
|
G_DEFINE_TYPE(NMSettingWired, nm_setting_wired, NM_TYPE_SETTING)
|
|
|
|
|
|
|
|
|
|
#define NM_SETTING_WIRED_GET_PRIVATE(o) \
|
|
|
|
|
(G_TYPE_INSTANCE_GET_PRIVATE((o), NM_TYPE_SETTING_WIRED, NMSettingWiredPrivate))
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
static const char *valid_s390_opts[] = {
|
2019-04-24 09:24:15 +02:00
|
|
|
"broadcast_mode",
|
|
|
|
|
"buffer_count",
|
|
|
|
|
"canonical_macaddr",
|
|
|
|
|
"checksumming",
|
|
|
|
|
"ctcprot",
|
|
|
|
|
"fake_broadcast",
|
|
|
|
|
"inter",
|
|
|
|
|
"inter_jumbo",
|
|
|
|
|
"ipato_add4",
|
|
|
|
|
"ipato_add6",
|
|
|
|
|
"ipato_enable",
|
|
|
|
|
"ipato_invert4",
|
|
|
|
|
"ipato_invert6",
|
|
|
|
|
"isolation",
|
|
|
|
|
"lancmd_timeout",
|
|
|
|
|
"large_send",
|
|
|
|
|
"layer2",
|
|
|
|
|
"portname",
|
|
|
|
|
"portno",
|
|
|
|
|
"priority_queueing",
|
|
|
|
|
"protocol",
|
|
|
|
|
"route4",
|
|
|
|
|
"route6",
|
|
|
|
|
"rxip_add4",
|
|
|
|
|
"rxip_add6",
|
|
|
|
|
"sniffer",
|
|
|
|
|
"total",
|
|
|
|
|
"vipa_add4",
|
|
|
|
|
"vipa_add6",
|
|
|
|
|
NULL,
|
2014-07-24 08:53:33 -04:00
|
|
|
};
|
|
|
|
|
|
2019-04-24 09:24:15 +02:00
|
|
|
static gboolean
|
|
|
|
|
valid_s390_opts_check(const char *option)
|
|
|
|
|
{
|
|
|
|
|
#if NM_MORE_ASSERTS > 5
|
|
|
|
|
nm_assert(NM_PTRARRAY_LEN(valid_s390_opts) + 1 == G_N_ELEMENTS(valid_s390_opts));
|
|
|
|
|
{
|
|
|
|
|
gsize i;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-04-24 09:24:15 +02:00
|
|
|
for (i = 0; i < G_N_ELEMENTS(valid_s390_opts); i++) {
|
|
|
|
|
if (i == G_N_ELEMENTS(valid_s390_opts) - 1)
|
|
|
|
|
nm_assert(!valid_s390_opts[i]);
|
|
|
|
|
else {
|
|
|
|
|
nm_assert(valid_s390_opts[i]);
|
|
|
|
|
nm_assert(valid_s390_opts[i][0] != '\0');
|
|
|
|
|
if (i > 0)
|
|
|
|
|
g_assert(strcmp(valid_s390_opts[i - 1], valid_s390_opts[i]) < 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return option
|
|
|
|
|
&& (nm_utils_array_find_binary_search(valid_s390_opts,
|
|
|
|
|
sizeof(const char *),
|
|
|
|
|
G_N_ELEMENTS(valid_s390_opts) - 1,
|
|
|
|
|
&option,
|
|
|
|
|
nm_strcmp_p_with_data,
|
|
|
|
|
NULL)
|
|
|
|
|
>= 0);
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_get_port:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingWired:port property of the setting
|
|
|
|
|
**/
|
|
|
|
|
const char *
|
|
|
|
|
nm_setting_wired_get_port(NMSettingWired *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NULL);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRED_GET_PRIVATE(setting)->port;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_get_speed:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingWired:speed property of the setting
|
|
|
|
|
**/
|
|
|
|
|
guint32
|
|
|
|
|
nm_setting_wired_get_speed(NMSettingWired *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), 0);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRED_GET_PRIVATE(setting)->speed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_get_duplex:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingWired:duplex property of the setting
|
|
|
|
|
**/
|
|
|
|
|
const char *
|
|
|
|
|
nm_setting_wired_get_duplex(NMSettingWired *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NULL);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRED_GET_PRIVATE(setting)->duplex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_get_auto_negotiate:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingWired:auto-negotiate property of the setting
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
nm_setting_wired_get_auto_negotiate(NMSettingWired *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), FALSE);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRED_GET_PRIVATE(setting)->auto_negotiate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_get_mac_address:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingWired:mac-address property of the setting
|
|
|
|
|
**/
|
2014-07-30 10:57:45 -04:00
|
|
|
const char *
|
2014-07-24 08:53:33 -04:00
|
|
|
nm_setting_wired_get_mac_address(NMSettingWired *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NULL);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRED_GET_PRIVATE(setting)->device_mac_address;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_get_cloned_mac_address:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingWired:cloned-mac-address property of the setting
|
|
|
|
|
**/
|
2014-07-30 10:57:45 -04:00
|
|
|
const char *
|
2014-07-24 08:53:33 -04:00
|
|
|
nm_setting_wired_get_cloned_mac_address(NMSettingWired *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NULL);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRED_GET_PRIVATE(setting)->cloned_mac_address;
|
|
|
|
|
}
|
|
|
|
|
|
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-22 20:31:39 +02:00
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_get_generate_mac_address_mask:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingWired:generate-mac-address-mask property of the setting
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.4
|
|
|
|
|
**/
|
|
|
|
|
const char *
|
|
|
|
|
nm_setting_wired_get_generate_mac_address_mask(NMSettingWired *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NULL);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRED_GET_PRIVATE(setting)->generate_mac_address_mask;
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_get_mac_address_blacklist:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
*
|
2014-10-22 12:31:31 -04:00
|
|
|
* Returns: the #NMSettingWired:mac-address-blacklist property of the setting
|
2014-07-24 08:53:33 -04:00
|
|
|
**/
|
2014-10-22 12:31:31 -04:00
|
|
|
const char *const *
|
2014-07-24 08:53:33 -04:00
|
|
|
nm_setting_wired_get_mac_address_blacklist(NMSettingWired *setting)
|
|
|
|
|
{
|
2014-10-22 12:31:31 -04:00
|
|
|
NMSettingWiredPrivate *priv;
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NULL);
|
|
|
|
|
|
2014-10-22 12:31:31 -04:00
|
|
|
priv = NM_SETTING_WIRED_GET_PRIVATE(setting);
|
|
|
|
|
return (const char *const *) priv->mac_address_blacklist->data;
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_get_num_mac_blacklist_items:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
*
|
|
|
|
|
* Returns: the number of blacklisted MAC addresses
|
|
|
|
|
**/
|
|
|
|
|
guint32
|
|
|
|
|
nm_setting_wired_get_num_mac_blacklist_items(NMSettingWired *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), 0);
|
|
|
|
|
|
2014-10-22 12:31:31 -04:00
|
|
|
return NM_SETTING_WIRED_GET_PRIVATE(setting)->mac_address_blacklist->len;
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_get_mac_blacklist_item:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
* @idx: the zero-based index of the MAC address entry
|
|
|
|
|
*
|
|
|
|
|
* Returns: the blacklisted MAC address string (hex-digits-and-colons notation)
|
|
|
|
|
* at index @idx
|
|
|
|
|
**/
|
|
|
|
|
const char *
|
|
|
|
|
nm_setting_wired_get_mac_blacklist_item(NMSettingWired *setting, guint32 idx)
|
|
|
|
|
{
|
|
|
|
|
NMSettingWiredPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NULL);
|
|
|
|
|
|
|
|
|
|
priv = NM_SETTING_WIRED_GET_PRIVATE(setting);
|
2014-10-22 12:31:31 -04:00
|
|
|
g_return_val_if_fail(idx <= priv->mac_address_blacklist->len, NULL);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2014-10-22 12:31:31 -04:00
|
|
|
return g_array_index(priv->mac_address_blacklist, const char *, idx);
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_add_mac_blacklist_item:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
* @mac: the MAC address string (hex-digits-and-colons notation) to blacklist
|
|
|
|
|
*
|
|
|
|
|
* Adds a new MAC address to the #NMSettingWired:mac-address-blacklist property.
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if the MAC address was added; %FALSE if the MAC address
|
|
|
|
|
* is invalid or was already present
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
nm_setting_wired_add_mac_blacklist_item(NMSettingWired *setting, const char *mac)
|
|
|
|
|
{
|
|
|
|
|
NMSettingWiredPrivate *priv;
|
2014-10-28 08:56:07 -04:00
|
|
|
const char * candidate;
|
2014-10-22 12:31:31 -04:00
|
|
|
int i;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), FALSE);
|
|
|
|
|
g_return_val_if_fail(mac != NULL, FALSE);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-04 15:59:19 -04:00
|
|
|
if (!nm_utils_hwaddr_valid(mac, ETH_ALEN))
|
2014-07-24 08:53:33 -04:00
|
|
|
return FALSE;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
priv = NM_SETTING_WIRED_GET_PRIVATE(setting);
|
2014-10-22 12:31:31 -04:00
|
|
|
for (i = 0; i < priv->mac_address_blacklist->len; i++) {
|
2014-10-28 08:56:07 -04:00
|
|
|
candidate = g_array_index(priv->mac_address_blacklist, char *, i);
|
|
|
|
|
if (nm_utils_hwaddr_matches(mac, -1, candidate, -1))
|
2014-07-24 08:53:33 -04:00
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-10-28 08:56:07 -04:00
|
|
|
mac = nm_utils_hwaddr_canonical(mac, ETH_ALEN);
|
2014-10-22 12:31:31 -04:00
|
|
|
g_array_append_val(priv->mac_address_blacklist, mac);
|
2019-01-11 08:28:26 +01:00
|
|
|
_notify(setting, PROP_MAC_ADDRESS_BLACKLIST);
|
2014-07-24 08:53:33 -04:00
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_remove_mac_blacklist_item:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
* @idx: index number of the MAC address
|
|
|
|
|
*
|
|
|
|
|
* Removes the MAC address at index @idx from the blacklist.
|
|
|
|
|
**/
|
|
|
|
|
void
|
|
|
|
|
nm_setting_wired_remove_mac_blacklist_item(NMSettingWired *setting, guint32 idx)
|
|
|
|
|
{
|
|
|
|
|
NMSettingWiredPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail(NM_IS_SETTING_WIRED(setting));
|
|
|
|
|
|
|
|
|
|
priv = NM_SETTING_WIRED_GET_PRIVATE(setting);
|
2014-10-22 12:31:31 -04:00
|
|
|
g_return_if_fail(idx < priv->mac_address_blacklist->len);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2014-10-22 12:31:31 -04:00
|
|
|
g_array_remove_index(priv->mac_address_blacklist, idx);
|
2019-01-11 08:28:26 +01:00
|
|
|
_notify(setting, PROP_MAC_ADDRESS_BLACKLIST);
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_remove_mac_blacklist_item_by_value:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
* @mac: the MAC address string (hex-digits-and-colons notation) to remove from
|
|
|
|
|
* the blacklist
|
|
|
|
|
*
|
|
|
|
|
* Removes the MAC address @mac from the blacklist.
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if the MAC address was found and removed; %FALSE if it was not.
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
nm_setting_wired_remove_mac_blacklist_item_by_value(NMSettingWired *setting, const char *mac)
|
|
|
|
|
{
|
|
|
|
|
NMSettingWiredPrivate *priv;
|
2014-10-28 08:56:07 -04:00
|
|
|
const char * candidate;
|
2014-10-22 12:31:31 -04:00
|
|
|
int i;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), FALSE);
|
|
|
|
|
g_return_val_if_fail(mac != NULL, FALSE);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
priv = NM_SETTING_WIRED_GET_PRIVATE(setting);
|
2014-10-22 12:31:31 -04:00
|
|
|
for (i = 0; i < priv->mac_address_blacklist->len; i++) {
|
2014-10-28 08:56:07 -04:00
|
|
|
candidate = g_array_index(priv->mac_address_blacklist, char *, i);
|
|
|
|
|
if (!nm_utils_hwaddr_matches(mac, -1, candidate, -1)) {
|
2014-10-22 12:31:31 -04:00
|
|
|
g_array_remove_index(priv->mac_address_blacklist, i);
|
2019-01-11 08:28:26 +01:00
|
|
|
_notify(setting, PROP_MAC_ADDRESS_BLACKLIST);
|
2014-07-24 08:53:33 -04:00
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_clear_mac_blacklist_items:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
*
|
|
|
|
|
* Removes all blacklisted MAC addresses.
|
|
|
|
|
**/
|
|
|
|
|
void
|
|
|
|
|
nm_setting_wired_clear_mac_blacklist_items(NMSettingWired *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail(NM_IS_SETTING_WIRED(setting));
|
|
|
|
|
|
2014-10-22 12:31:31 -04:00
|
|
|
g_array_set_size(NM_SETTING_WIRED_GET_PRIVATE(setting)->mac_address_blacklist, 0);
|
2019-01-11 08:28:26 +01:00
|
|
|
_notify(setting, PROP_MAC_ADDRESS_BLACKLIST);
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_get_mtu:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingWired:mtu property of the setting
|
|
|
|
|
**/
|
|
|
|
|
guint32
|
|
|
|
|
nm_setting_wired_get_mtu(NMSettingWired *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), 0);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRED_GET_PRIVATE(setting)->mtu;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_get_s390_subchannels:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
*
|
|
|
|
|
* Return the list of s390 subchannels that identify the device that this
|
|
|
|
|
* connection is applicable to. The connection should only be used in
|
|
|
|
|
* conjunction with that device.
|
|
|
|
|
*
|
2014-08-21 13:19:53 -04:00
|
|
|
* Returns: (transfer none) (element-type utf8): array of strings, each specifying
|
|
|
|
|
* one subchannel the s390 device uses to communicate to the host.
|
2014-07-24 08:53:33 -04:00
|
|
|
**/
|
2014-08-21 13:19:53 -04:00
|
|
|
const char *const *
|
2014-07-24 08:53:33 -04:00
|
|
|
nm_setting_wired_get_s390_subchannels(NMSettingWired *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NULL);
|
|
|
|
|
|
2014-08-21 13:19:53 -04:00
|
|
|
return (const char *const *) NM_SETTING_WIRED_GET_PRIVATE(setting)->s390_subchannels;
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_get_s390_nettype:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
*
|
|
|
|
|
* Returns the s390 device type this connection should apply to. Will be one
|
|
|
|
|
* of 'qeth', 'lcs', or 'ctc'.
|
|
|
|
|
*
|
|
|
|
|
* Returns: the s390 device type
|
|
|
|
|
**/
|
|
|
|
|
const char *
|
|
|
|
|
nm_setting_wired_get_s390_nettype(NMSettingWired *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NULL);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRED_GET_PRIVATE(setting)->s390_nettype;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_get_num_s390_options:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
*
|
|
|
|
|
* Returns the number of s390-specific options that should be set for this
|
|
|
|
|
* device when it is activated. This can be used to retrieve each s390
|
|
|
|
|
* option individually using nm_setting_wired_get_s390_option().
|
|
|
|
|
*
|
|
|
|
|
* Returns: the number of s390-specific device options
|
|
|
|
|
**/
|
|
|
|
|
guint32
|
|
|
|
|
nm_setting_wired_get_num_s390_options(NMSettingWired *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), 0);
|
|
|
|
|
|
2019-04-24 09:24:15 +02:00
|
|
|
return NM_SETTING_WIRED_GET_PRIVATE(setting)->s390_options.len;
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_get_s390_option:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
* @idx: index of the desired option, from 0 to
|
|
|
|
|
* nm_setting_wired_get_num_s390_options() - 1
|
2014-11-13 14:14:11 -05:00
|
|
|
* @out_key: (out) (transfer none): on return, the key name of the s390 specific
|
|
|
|
|
* option; this value is owned by the setting and should not be modified
|
|
|
|
|
* @out_value: (out) (transfer none): on return, the value of the key of the
|
|
|
|
|
* s390 specific option; this value is owned by the setting and should not be
|
|
|
|
|
* modified
|
2014-07-24 08:53:33 -04:00
|
|
|
*
|
|
|
|
|
* Given an index, return the value of the s390 option at that index. indexes
|
|
|
|
|
* are *not* guaranteed to be static across modifications to options done by
|
|
|
|
|
* nm_setting_wired_add_s390_option() and nm_setting_wired_remove_s390_option(),
|
|
|
|
|
* and should not be used to refer to options except for short periods of time
|
|
|
|
|
* such as during option iteration.
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE on success if the index was valid and an option was found,
|
|
|
|
|
* %FALSE if the index was invalid (ie, greater than the number of options
|
|
|
|
|
* currently held by the setting)
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
nm_setting_wired_get_s390_option(NMSettingWired *setting,
|
|
|
|
|
guint32 idx,
|
|
|
|
|
const char ** out_key,
|
|
|
|
|
const char ** out_value)
|
|
|
|
|
{
|
2019-04-24 09:24:15 +02:00
|
|
|
NMSettingWiredPrivate *priv;
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2020-08-12 14:01:21 +02:00
|
|
|
/* with LTO and optimization, the compiler complains that the
|
|
|
|
|
* output variables are not initialized. In practice, the function
|
|
|
|
|
* only sets the output on success. But make the compiler happy.
|
|
|
|
|
*/
|
|
|
|
|
NM_SET_OUT(out_key, NULL);
|
|
|
|
|
NM_SET_OUT(out_value, NULL);
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), FALSE);
|
|
|
|
|
|
2019-04-24 09:24:15 +02:00
|
|
|
priv = NM_SETTING_WIRED_GET_PRIVATE(setting);
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail(idx < priv->s390_options.len, FALSE);
|
|
|
|
|
|
|
|
|
|
NM_SET_OUT(out_key, priv->s390_options.arr[idx].name);
|
|
|
|
|
NM_SET_OUT(out_value, priv->s390_options.arr[idx].value_str);
|
|
|
|
|
return TRUE;
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_get_s390_option_by_key:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
* @key: the key for which to retrieve the value
|
|
|
|
|
*
|
|
|
|
|
* Returns the value associated with the s390-specific option specified by
|
|
|
|
|
* @key, if it exists.
|
|
|
|
|
*
|
|
|
|
|
* Returns: the value, or %NULL if the key/value pair was never added to the
|
|
|
|
|
* setting; the value is owned by the setting and must not be modified
|
|
|
|
|
**/
|
|
|
|
|
const char *
|
|
|
|
|
nm_setting_wired_get_s390_option_by_key(NMSettingWired *setting, const char *key)
|
|
|
|
|
{
|
2019-04-24 09:24:15 +02:00
|
|
|
NMSettingWiredPrivate *priv;
|
|
|
|
|
gssize idx;
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NULL);
|
2019-03-16 21:21:43 +01:00
|
|
|
g_return_val_if_fail(key && key[0], NULL);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2019-04-24 09:24:15 +02:00
|
|
|
priv = NM_SETTING_WIRED_GET_PRIVATE(setting);
|
|
|
|
|
|
|
|
|
|
idx = nm_utils_named_value_list_find(priv->s390_options.arr, priv->s390_options.len, key, TRUE);
|
|
|
|
|
if (idx < 0)
|
|
|
|
|
return NULL;
|
|
|
|
|
return priv->s390_options.arr[idx].value_str;
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_add_s390_option:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
* @key: key name for the option
|
|
|
|
|
* @value: value for the option
|
|
|
|
|
*
|
|
|
|
|
* Add an option to the table. The option is compared to an internal list
|
|
|
|
|
* of allowed options. Key names may contain only alphanumeric characters
|
|
|
|
|
* (ie [a-zA-Z0-9]). Adding a new key replaces any existing key/value pair that
|
|
|
|
|
* may already exist.
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if the option was valid and was added to the internal option
|
|
|
|
|
* list, %FALSE if it was not.
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
nm_setting_wired_add_s390_option(NMSettingWired *setting, const char *key, const char *value)
|
|
|
|
|
{
|
2019-04-24 09:24:15 +02:00
|
|
|
NMSettingWiredPrivate *priv;
|
|
|
|
|
gssize idx;
|
|
|
|
|
NMUtilsNamedValue * v;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), FALSE);
|
2019-04-24 09:24:15 +02:00
|
|
|
g_return_val_if_fail(value, FALSE);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-04-24 09:24:15 +02:00
|
|
|
if (!valid_s390_opts_check(key)) {
|
|
|
|
|
g_return_val_if_fail(key, FALSE);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-04-24 09:24:15 +02:00
|
|
|
priv = NM_SETTING_WIRED_GET_PRIVATE(setting);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-04-24 09:24:15 +02:00
|
|
|
idx = nm_utils_named_value_list_find(priv->s390_options.arr, priv->s390_options.len, key, TRUE);
|
|
|
|
|
if (idx < 0) {
|
|
|
|
|
gsize dst_idx = ~idx;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-04-24 09:24:15 +02:00
|
|
|
if (priv->s390_options.n_alloc < priv->s390_options.len + 1) {
|
|
|
|
|
priv->s390_options.n_alloc = NM_MAX(4, (priv->s390_options.len + 1) * 2);
|
|
|
|
|
priv->s390_options.arr =
|
|
|
|
|
g_realloc(priv->s390_options.arr,
|
|
|
|
|
priv->s390_options.n_alloc * sizeof(NMUtilsNamedValue));
|
|
|
|
|
}
|
|
|
|
|
if (dst_idx < priv->s390_options.len) {
|
|
|
|
|
memmove(&priv->s390_options.arr[dst_idx + 1],
|
|
|
|
|
&priv->s390_options.arr[dst_idx],
|
|
|
|
|
(priv->s390_options.len - dst_idx) * sizeof(NMUtilsNamedValue));
|
|
|
|
|
}
|
|
|
|
|
priv->s390_options.arr[dst_idx] = (NMUtilsNamedValue){
|
|
|
|
|
.name = g_strdup(key),
|
|
|
|
|
.value_str = g_strdup(value),
|
|
|
|
|
};
|
|
|
|
|
priv->s390_options.len++;
|
|
|
|
|
} else {
|
|
|
|
|
v = &priv->s390_options.arr[idx];
|
|
|
|
|
if (nm_streq(value, v->value_str))
|
|
|
|
|
return TRUE;
|
|
|
|
|
g_free((char *) v->value_str);
|
|
|
|
|
v->value_str = g_strdup(value);
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-01-11 08:28:26 +01:00
|
|
|
_notify(setting, PROP_S390_OPTIONS);
|
2014-07-24 08:53:33 -04:00
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_remove_s390_option:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
* @key: key name for the option to remove
|
|
|
|
|
*
|
|
|
|
|
* Remove the s390-specific option referenced by @key from the internal option
|
|
|
|
|
* list.
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if the option was found and removed from the internal option
|
|
|
|
|
* list, %FALSE if it was not.
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
nm_setting_wired_remove_s390_option(NMSettingWired *setting, const char *key)
|
|
|
|
|
{
|
2019-04-24 09:24:15 +02:00
|
|
|
NMSettingWiredPrivate *priv;
|
|
|
|
|
gsize dst_idx;
|
|
|
|
|
gssize idx;
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), FALSE);
|
2019-04-24 09:24:15 +02:00
|
|
|
g_return_val_if_fail(key, FALSE);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2019-04-24 09:24:15 +02:00
|
|
|
priv = NM_SETTING_WIRED_GET_PRIVATE(setting);
|
|
|
|
|
|
|
|
|
|
idx = nm_utils_named_value_list_find(priv->s390_options.arr, priv->s390_options.len, key, TRUE);
|
|
|
|
|
if (idx < 0)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
dst_idx = idx;
|
|
|
|
|
|
|
|
|
|
g_free((char *) priv->s390_options.arr[dst_idx].name);
|
|
|
|
|
g_free((char *) priv->s390_options.arr[dst_idx].value_str);
|
|
|
|
|
if (dst_idx + 1 != priv->s390_options.len) {
|
|
|
|
|
memmove(&priv->s390_options.arr[dst_idx],
|
|
|
|
|
&priv->s390_options.arr[dst_idx + 1],
|
|
|
|
|
(priv->s390_options.len - dst_idx - 1) * sizeof(NMUtilsNamedValue));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
priv->s390_options.len--;
|
|
|
|
|
|
|
|
|
|
_notify(setting, PROP_S390_OPTIONS);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
_s390_options_clear(NMSettingWiredPrivate *priv)
|
|
|
|
|
{
|
|
|
|
|
guint i;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-04-24 09:24:15 +02:00
|
|
|
for (i = 0; i < priv->s390_options.len; i++) {
|
|
|
|
|
g_free((char *) priv->s390_options.arr[i].name);
|
|
|
|
|
g_free((char *) priv->s390_options.arr[i].value_str);
|
|
|
|
|
}
|
|
|
|
|
nm_clear_g_free(&priv->s390_options.arr);
|
|
|
|
|
priv->s390_options.len = 0;
|
|
|
|
|
priv->s390_options.n_alloc = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_nm_setting_wired_clear_s390_options(NMSettingWired *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail(NM_IS_SETTING_WIRED(setting));
|
|
|
|
|
|
|
|
|
|
_s390_options_clear(NM_SETTING_WIRED_GET_PRIVATE(setting));
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_get_valid_s390_options:
|
2019-04-24 09:24:15 +02:00
|
|
|
* @setting: (allow-none): the #NMSettingWired. This argument is unused
|
|
|
|
|
* and you may pass %NULL.
|
2014-07-24 08:53:33 -04:00
|
|
|
*
|
|
|
|
|
* Returns a list of valid s390 options.
|
|
|
|
|
*
|
2017-03-27 17:07:28 +02:00
|
|
|
* The @setting argument is unused and %NULL may be passed instead.
|
|
|
|
|
*
|
2014-07-24 08:53:33 -04:00
|
|
|
* Returns: (transfer none): a %NULL-terminated array of strings of valid s390 options.
|
|
|
|
|
**/
|
|
|
|
|
const char **
|
|
|
|
|
nm_setting_wired_get_valid_s390_options(NMSettingWired *setting)
|
|
|
|
|
{
|
|
|
|
|
return valid_s390_opts;
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-11 21:59:51 +02:00
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_get_wake_on_lan:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
*
|
|
|
|
|
* Returns the Wake-on-LAN options enabled for the connection
|
|
|
|
|
*
|
|
|
|
|
* Returns: the Wake-on-LAN options
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
*/
|
|
|
|
|
NMSettingWiredWakeOnLan
|
|
|
|
|
nm_setting_wired_get_wake_on_lan(NMSettingWired *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NM_SETTING_WIRED_WAKE_ON_LAN_NONE);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRED_GET_PRIVATE(setting)->wol;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_get_wake_on_lan_password:
|
|
|
|
|
* @setting: the #NMSettingWired
|
|
|
|
|
*
|
|
|
|
|
* Returns the Wake-on-LAN password. This only applies to
|
|
|
|
|
* %NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC.
|
|
|
|
|
*
|
|
|
|
|
* Returns: the Wake-on-LAN setting password, or %NULL if there is no password.
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
*/
|
|
|
|
|
const char *
|
|
|
|
|
nm_setting_wired_get_wake_on_lan_password(NMSettingWired *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NULL);
|
|
|
|
|
|
|
|
|
|
return NM_SETTING_WIRED_GET_PRIVATE(setting)->wol_password;
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
static gboolean
|
2014-10-21 22:30:31 -04:00
|
|
|
verify(NMSetting *setting, NMConnection *connection, GError **error)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
|
|
|
|
NMSettingWiredPrivate *priv = NM_SETTING_WIRED_GET_PRIVATE(setting);
|
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-22 20:31:39 +02:00
|
|
|
GError * local = NULL;
|
2019-04-24 09:24:15 +02:00
|
|
|
guint i;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2016-11-22 12:29:37 +01:00
|
|
|
if (!NM_IN_STRSET(priv->port, NULL, "tp", "aui", "bnc", "mii")) {
|
2014-07-24 08:53:33 -04:00
|
|
|
g_set_error(error,
|
libnm-core: merge NMSetting*Error into NMConnectionError
Each setting type was defining its own error type, but most of them
had exactly the same three errors ("unknown", "missing property", and
"invalid property"), and none of the other values was of much use
programmatically anyway.
So, this commit merges NMSettingError, NMSettingAdslError, etc, all
into NMConnectionError. (The reason for merging into NMConnectionError
rather than NMSettingError is that we also already have
"NMSettingsError", for errors related to the settings service, so
"NMConnectionError" is a less-confusable name for settings/connection
errors than "NMSettingError".)
Also, make sure that all of the affected error messages are localized,
and (where appropriate) prefix them with the relevant property name.
Renamed error codes:
NM_SETTING_ERROR_PROPERTY_NOT_FOUND -> NM_CONNECTION_ERROR_PROPERTY_NOT_FOUND
NM_SETTING_ERROR_PROPERTY_NOT_SECRET -> NM_CONNECTION_ERROR_PROPERTY_NOT_SECRET
Remapped error codes:
NM_SETTING_*_ERROR_MISSING_PROPERTY -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_*_ERROR_INVALID_PROPERTY -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BLUETOOTH_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_INVALID_SETTING
NM_SETTING_BOND_ERROR_INVALID_OPTION -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BOND_ERROR_MISSING_OPTION -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_CONNECTION_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_CONNECTION_ERROR_SLAVE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_VLAN_ERROR_INVALID_PARENT -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_802_1X_SETTING -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_802_1X -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_SHARED_KEY_REQUIRES_WEP -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_ERROR_CHANNEL_REQUIRES_BAND -> NM_CONNECTION_ERROR_MISSING_PROPERTY
Dropped error codes (were previously defined but unused):
NM_SETTING_CDMA_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED
NM_SETTING_GSM_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_PPP_ERROR_REQUIRE_MPPE_NOT_ALLOWED
NM_SETTING_PPPOE_ERROR_MISSING_PPP_SETTING
NM_SETTING_SERIAL_ERROR_MISSING_PPP_SETTING
NM_SETTING_WIRELESS_ERROR_MISSING_SECURITY_SETTING
2014-10-20 13:52:23 -04:00
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
2014-07-24 08:53:33 -04:00
|
|
|
_("'%s' is not a valid Ethernet port value"),
|
|
|
|
|
priv->port);
|
|
|
|
|
g_prefix_error(error, "%s.%s: ", NM_SETTING_WIRED_SETTING_NAME, NM_SETTING_WIRED_PORT);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2016-11-22 12:29:37 +01:00
|
|
|
if (!NM_IN_STRSET(priv->duplex, NULL, "half", "full")) {
|
2014-07-24 08:53:33 -04:00
|
|
|
g_set_error(error,
|
libnm-core: merge NMSetting*Error into NMConnectionError
Each setting type was defining its own error type, but most of them
had exactly the same three errors ("unknown", "missing property", and
"invalid property"), and none of the other values was of much use
programmatically anyway.
So, this commit merges NMSettingError, NMSettingAdslError, etc, all
into NMConnectionError. (The reason for merging into NMConnectionError
rather than NMSettingError is that we also already have
"NMSettingsError", for errors related to the settings service, so
"NMConnectionError" is a less-confusable name for settings/connection
errors than "NMSettingError".)
Also, make sure that all of the affected error messages are localized,
and (where appropriate) prefix them with the relevant property name.
Renamed error codes:
NM_SETTING_ERROR_PROPERTY_NOT_FOUND -> NM_CONNECTION_ERROR_PROPERTY_NOT_FOUND
NM_SETTING_ERROR_PROPERTY_NOT_SECRET -> NM_CONNECTION_ERROR_PROPERTY_NOT_SECRET
Remapped error codes:
NM_SETTING_*_ERROR_MISSING_PROPERTY -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_*_ERROR_INVALID_PROPERTY -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BLUETOOTH_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_INVALID_SETTING
NM_SETTING_BOND_ERROR_INVALID_OPTION -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BOND_ERROR_MISSING_OPTION -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_CONNECTION_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_CONNECTION_ERROR_SLAVE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_VLAN_ERROR_INVALID_PARENT -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_802_1X_SETTING -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_802_1X -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_SHARED_KEY_REQUIRES_WEP -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_ERROR_CHANNEL_REQUIRES_BAND -> NM_CONNECTION_ERROR_MISSING_PROPERTY
Dropped error codes (were previously defined but unused):
NM_SETTING_CDMA_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED
NM_SETTING_GSM_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_PPP_ERROR_REQUIRE_MPPE_NOT_ALLOWED
NM_SETTING_PPPOE_ERROR_MISSING_PPP_SETTING
NM_SETTING_SERIAL_ERROR_MISSING_PPP_SETTING
NM_SETTING_WIRELESS_ERROR_MISSING_SECURITY_SETTING
2014-10-20 13:52:23 -04:00
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
2014-07-24 08:53:33 -04:00
|
|
|
_("'%s' is not a valid duplex value"),
|
|
|
|
|
priv->duplex);
|
|
|
|
|
g_prefix_error(error, "%s.%s: ", NM_SETTING_WIRED_SETTING_NAME, NM_SETTING_WIRED_DUPLEX);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-30 10:57:45 -04:00
|
|
|
if (priv->device_mac_address && !nm_utils_hwaddr_valid(priv->device_mac_address, ETH_ALEN)) {
|
2019-07-02 15:58:56 +02:00
|
|
|
g_set_error(error,
|
|
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
|
|
|
|
_("'%s' is not a valid MAC address"),
|
|
|
|
|
priv->device_mac_address);
|
2014-07-24 08:53:33 -04:00
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRED_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRED_MAC_ADDRESS);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-10-22 12:31:31 -04:00
|
|
|
for (i = 0; i < priv->mac_address_blacklist->len; i++) {
|
|
|
|
|
const char *mac = g_array_index(priv->mac_address_blacklist, const char *, i);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-10-22 12:31:31 -04:00
|
|
|
if (!nm_utils_hwaddr_valid(mac, ETH_ALEN)) {
|
2014-07-24 08:53:33 -04:00
|
|
|
g_set_error(error,
|
libnm-core: merge NMSetting*Error into NMConnectionError
Each setting type was defining its own error type, but most of them
had exactly the same three errors ("unknown", "missing property", and
"invalid property"), and none of the other values was of much use
programmatically anyway.
So, this commit merges NMSettingError, NMSettingAdslError, etc, all
into NMConnectionError. (The reason for merging into NMConnectionError
rather than NMSettingError is that we also already have
"NMSettingsError", for errors related to the settings service, so
"NMConnectionError" is a less-confusable name for settings/connection
errors than "NMSettingError".)
Also, make sure that all of the affected error messages are localized,
and (where appropriate) prefix them with the relevant property name.
Renamed error codes:
NM_SETTING_ERROR_PROPERTY_NOT_FOUND -> NM_CONNECTION_ERROR_PROPERTY_NOT_FOUND
NM_SETTING_ERROR_PROPERTY_NOT_SECRET -> NM_CONNECTION_ERROR_PROPERTY_NOT_SECRET
Remapped error codes:
NM_SETTING_*_ERROR_MISSING_PROPERTY -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_*_ERROR_INVALID_PROPERTY -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BLUETOOTH_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_INVALID_SETTING
NM_SETTING_BOND_ERROR_INVALID_OPTION -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BOND_ERROR_MISSING_OPTION -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_CONNECTION_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_CONNECTION_ERROR_SLAVE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_VLAN_ERROR_INVALID_PARENT -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_802_1X_SETTING -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_802_1X -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_SHARED_KEY_REQUIRES_WEP -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_ERROR_CHANNEL_REQUIRES_BAND -> NM_CONNECTION_ERROR_MISSING_PROPERTY
Dropped error codes (were previously defined but unused):
NM_SETTING_CDMA_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED
NM_SETTING_GSM_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_PPP_ERROR_REQUIRE_MPPE_NOT_ALLOWED
NM_SETTING_PPPOE_ERROR_MISSING_PPP_SETTING
NM_SETTING_SERIAL_ERROR_MISSING_PPP_SETTING
NM_SETTING_WIRELESS_ERROR_MISSING_SECURITY_SETTING
2014-10-20 13:52:23 -04:00
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
2014-07-24 08:53:33 -04:00
|
|
|
_("'%s' is not a valid MAC address"),
|
2014-10-22 12:31:31 -04:00
|
|
|
mac);
|
2014-07-24 08:53:33 -04:00
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRED_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRED_MAC_ADDRESS_BLACKLIST);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-08-21 13:19:53 -04:00
|
|
|
if (priv->s390_subchannels) {
|
2019-09-27 08:04:33 +02:00
|
|
|
guint len = g_strv_length(priv->s390_subchannels);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-08-21 13:19:53 -04:00
|
|
|
if (len != 2 && len != 3) {
|
|
|
|
|
g_set_error_literal(error,
|
libnm-core: merge NMSetting*Error into NMConnectionError
Each setting type was defining its own error type, but most of them
had exactly the same three errors ("unknown", "missing property", and
"invalid property"), and none of the other values was of much use
programmatically anyway.
So, this commit merges NMSettingError, NMSettingAdslError, etc, all
into NMConnectionError. (The reason for merging into NMConnectionError
rather than NMSettingError is that we also already have
"NMSettingsError", for errors related to the settings service, so
"NMConnectionError" is a less-confusable name for settings/connection
errors than "NMSettingError".)
Also, make sure that all of the affected error messages are localized,
and (where appropriate) prefix them with the relevant property name.
Renamed error codes:
NM_SETTING_ERROR_PROPERTY_NOT_FOUND -> NM_CONNECTION_ERROR_PROPERTY_NOT_FOUND
NM_SETTING_ERROR_PROPERTY_NOT_SECRET -> NM_CONNECTION_ERROR_PROPERTY_NOT_SECRET
Remapped error codes:
NM_SETTING_*_ERROR_MISSING_PROPERTY -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_*_ERROR_INVALID_PROPERTY -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BLUETOOTH_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_INVALID_SETTING
NM_SETTING_BOND_ERROR_INVALID_OPTION -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BOND_ERROR_MISSING_OPTION -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_CONNECTION_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_CONNECTION_ERROR_SLAVE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_VLAN_ERROR_INVALID_PARENT -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_802_1X_SETTING -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_802_1X -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_SHARED_KEY_REQUIRES_WEP -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_ERROR_CHANNEL_REQUIRES_BAND -> NM_CONNECTION_ERROR_MISSING_PROPERTY
Dropped error codes (were previously defined but unused):
NM_SETTING_CDMA_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED
NM_SETTING_GSM_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_PPP_ERROR_REQUIRE_MPPE_NOT_ALLOWED
NM_SETTING_PPPOE_ERROR_MISSING_PPP_SETTING
NM_SETTING_SERIAL_ERROR_MISSING_PPP_SETTING
NM_SETTING_WIRELESS_ERROR_MISSING_SECURITY_SETTING
2014-10-20 13:52:23 -04:00
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
2014-08-21 13:19:53 -04:00
|
|
|
_("property is invalid"));
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRED_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRED_S390_SUBCHANNELS);
|
|
|
|
|
return FALSE;
|
2020-09-28 16:03:33 +02:00
|
|
|
}
|
2014-08-21 13:19:53 -04:00
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2016-11-22 12:29:37 +01:00
|
|
|
if (!NM_IN_STRSET(priv->s390_nettype, NULL, "qeth", "lcs", "ctc")) {
|
2014-07-24 08:53:33 -04:00
|
|
|
g_set_error_literal(error,
|
libnm-core: merge NMSetting*Error into NMConnectionError
Each setting type was defining its own error type, but most of them
had exactly the same three errors ("unknown", "missing property", and
"invalid property"), and none of the other values was of much use
programmatically anyway.
So, this commit merges NMSettingError, NMSettingAdslError, etc, all
into NMConnectionError. (The reason for merging into NMConnectionError
rather than NMSettingError is that we also already have
"NMSettingsError", for errors related to the settings service, so
"NMConnectionError" is a less-confusable name for settings/connection
errors than "NMSettingError".)
Also, make sure that all of the affected error messages are localized,
and (where appropriate) prefix them with the relevant property name.
Renamed error codes:
NM_SETTING_ERROR_PROPERTY_NOT_FOUND -> NM_CONNECTION_ERROR_PROPERTY_NOT_FOUND
NM_SETTING_ERROR_PROPERTY_NOT_SECRET -> NM_CONNECTION_ERROR_PROPERTY_NOT_SECRET
Remapped error codes:
NM_SETTING_*_ERROR_MISSING_PROPERTY -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_*_ERROR_INVALID_PROPERTY -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BLUETOOTH_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_INVALID_SETTING
NM_SETTING_BOND_ERROR_INVALID_OPTION -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BOND_ERROR_MISSING_OPTION -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_CONNECTION_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_CONNECTION_ERROR_SLAVE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_VLAN_ERROR_INVALID_PARENT -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_802_1X_SETTING -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_802_1X -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_SHARED_KEY_REQUIRES_WEP -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_ERROR_CHANNEL_REQUIRES_BAND -> NM_CONNECTION_ERROR_MISSING_PROPERTY
Dropped error codes (were previously defined but unused):
NM_SETTING_CDMA_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED
NM_SETTING_GSM_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_PPP_ERROR_REQUIRE_MPPE_NOT_ALLOWED
NM_SETTING_PPPOE_ERROR_MISSING_PPP_SETTING
NM_SETTING_SERIAL_ERROR_MISSING_PPP_SETTING
NM_SETTING_WIRELESS_ERROR_MISSING_SECURITY_SETTING
2014-10-20 13:52:23 -04:00
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
2014-07-24 08:53:33 -04:00
|
|
|
_("property is invalid"));
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRED_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRED_S390_NETTYPE);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-04-24 09:24:15 +02:00
|
|
|
for (i = 0; i < priv->s390_options.len; i++) {
|
|
|
|
|
const NMUtilsNamedValue *v = &priv->s390_options.arr[i];
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-04-24 09:24:15 +02:00
|
|
|
nm_assert(v->name);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-04-24 09:24:15 +02:00
|
|
|
if (!valid_s390_opts_check(v->name) || v->value_str[0] == '\0'
|
|
|
|
|
|| strlen(v->value_str) > 200) {
|
2014-07-24 08:53:33 -04:00
|
|
|
g_set_error(error,
|
libnm-core: merge NMSetting*Error into NMConnectionError
Each setting type was defining its own error type, but most of them
had exactly the same three errors ("unknown", "missing property", and
"invalid property"), and none of the other values was of much use
programmatically anyway.
So, this commit merges NMSettingError, NMSettingAdslError, etc, all
into NMConnectionError. (The reason for merging into NMConnectionError
rather than NMSettingError is that we also already have
"NMSettingsError", for errors related to the settings service, so
"NMConnectionError" is a less-confusable name for settings/connection
errors than "NMSettingError".)
Also, make sure that all of the affected error messages are localized,
and (where appropriate) prefix them with the relevant property name.
Renamed error codes:
NM_SETTING_ERROR_PROPERTY_NOT_FOUND -> NM_CONNECTION_ERROR_PROPERTY_NOT_FOUND
NM_SETTING_ERROR_PROPERTY_NOT_SECRET -> NM_CONNECTION_ERROR_PROPERTY_NOT_SECRET
Remapped error codes:
NM_SETTING_*_ERROR_MISSING_PROPERTY -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_*_ERROR_INVALID_PROPERTY -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BLUETOOTH_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_INVALID_SETTING
NM_SETTING_BOND_ERROR_INVALID_OPTION -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_BOND_ERROR_MISSING_OPTION -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_CONNECTION_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_CONNECTION_ERROR_SLAVE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_VLAN_ERROR_INVALID_PARENT -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_802_1X_SETTING -> NM_CONNECTION_ERROR_MISSING_SETTING
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_802_1X -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME -> NM_CONNECTION_ERROR_MISSING_PROPERTY
NM_SETTING_WIRELESS_SECURITY_ERROR_SHARED_KEY_REQUIRES_WEP -> NM_CONNECTION_ERROR_INVALID_PROPERTY
NM_SETTING_WIRELESS_ERROR_CHANNEL_REQUIRES_BAND -> NM_CONNECTION_ERROR_MISSING_PROPERTY
Dropped error codes (were previously defined but unused):
NM_SETTING_CDMA_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED
NM_SETTING_GSM_ERROR_MISSING_SERIAL_SETTING
NM_SETTING_PPP_ERROR_REQUIRE_MPPE_NOT_ALLOWED
NM_SETTING_PPPOE_ERROR_MISSING_PPP_SETTING
NM_SETTING_SERIAL_ERROR_MISSING_PPP_SETTING
NM_SETTING_WIRELESS_ERROR_MISSING_SECURITY_SETTING
2014-10-20 13:52:23 -04:00
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
2014-07-24 08:53:33 -04:00
|
|
|
_("invalid '%s' or its value '%s'"),
|
2019-04-24 09:24:15 +02:00
|
|
|
v->name,
|
|
|
|
|
v->value_str);
|
2014-07-24 08:53:33 -04:00
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRED_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRED_S390_OPTIONS);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
}
|
|
|
|
|
|
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 1b49f941a69af910b0e68530be7339e8053068e5.
"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-05-24 15:57:16 +02:00
|
|
|
if (priv->cloned_mac_address && !NM_CLONED_MAC_IS_SPECIAL(priv->cloned_mac_address)
|
|
|
|
|
&& !nm_utils_hwaddr_valid(priv->cloned_mac_address, ETH_ALEN)) {
|
2019-07-02 15:58:56 +02:00
|
|
|
g_set_error(error,
|
|
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
|
|
|
|
_("'%s' is not a valid MAC address"),
|
|
|
|
|
priv->cloned_mac_address);
|
2014-07-24 08:53:33 -04:00
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRED_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRED_CLONED_MAC_ADDRESS);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
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-22 20:31:39 +02:00
|
|
|
/* generate-mac-address-mask only makes sense with cloned-mac-address "random" or
|
|
|
|
|
* "stable". Still, let's not be so strict about that and accept the value
|
|
|
|
|
* even if it is unused. */
|
|
|
|
|
if (!_nm_utils_generate_mac_address_mask_parse(priv->generate_mac_address_mask,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
&local)) {
|
|
|
|
|
g_set_error_literal(error,
|
|
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
|
|
|
|
local->message);
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRED_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRED_GENERATE_MAC_ADDRESS_MASK);
|
|
|
|
|
g_error_free(local);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2015-09-21 18:24:07 +02:00
|
|
|
if (NM_FLAGS_ANY(priv->wol, NM_SETTING_WIRED_WAKE_ON_LAN_EXCLUSIVE_FLAGS)
|
|
|
|
|
&& !nm_utils_is_power_of_two(priv->wol)) {
|
2015-05-11 21:59:51 +02:00
|
|
|
g_set_error_literal(error,
|
|
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
2015-09-21 18:24:07 +02:00
|
|
|
_("Wake-on-LAN mode 'default' and 'ignore' are exclusive flags"));
|
2015-05-11 21:59:51 +02:00
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRED_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRED_WAKE_ON_LAN);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2015-05-11 21:59:51 +02:00
|
|
|
if (priv->wol_password && !NM_FLAGS_HAS(priv->wol, NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC)) {
|
|
|
|
|
g_set_error_literal(error,
|
|
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
|
|
|
|
_("Wake-on-LAN password can only be used with magic packet mode"));
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRED_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2015-05-11 21:59:51 +02:00
|
|
|
if (priv->wol_password && !nm_utils_hwaddr_valid(priv->wol_password, ETH_ALEN)) {
|
2019-07-02 15:58:56 +02:00
|
|
|
g_set_error(error,
|
|
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
|
|
|
|
_("'%s' is not a valid MAC address"),
|
|
|
|
|
priv->wol_password);
|
2015-05-11 21:59:51 +02:00
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_WIRED_SETTING_NAME,
|
|
|
|
|
NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2016-11-25 18:05:03 +01:00
|
|
|
/* Normalizable properties - just return NM_SETTING_VERIFY_NORMALIZABLE for compatibility
|
|
|
|
|
* with legacy nm-connection-editor which used to save "full" duplex connection as default
|
|
|
|
|
*/
|
2016-09-14 17:48:13 +02:00
|
|
|
|
2018-06-07 19:12:20 +02:00
|
|
|
if (((priv->speed) && (!priv->duplex)) || ((!priv->speed) && (priv->duplex))) {
|
|
|
|
|
g_set_error_literal(
|
|
|
|
|
error,
|
2018-06-27 13:18:15 +02:00
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
2018-06-07 19:12:20 +02:00
|
|
|
priv->auto_negotiate
|
|
|
|
|
? _("both speed and duplex should have a valid value or both should be unset")
|
|
|
|
|
: _("both speed and duplex are required for static link configuration"));
|
|
|
|
|
return NM_SETTING_VERIFY_NORMALIZABLE;
|
2016-09-14 17:48:13 +02:00
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
libnm: rework compare_property() implementation for NMSetting
NMSetting's compare_property() has and had two callers:
nm_setting_compare() and nm_setting_diff().
compare_property() accepts a NMSettingCompareFlags argument, but
at the same time, both callers have another complex (and
inconsistent!) set of pre-checks for shortcuting the call of
compare_property(): should_compare_prop().
Merge should_compare_prop() into compare_property(). This way,
nm_setting_compare() and nm_setting_diff() has less additional
code, and are simpler to follow. Especially nm_setting_compare()
is now trivial. And nm_setting_diff() is still complicated, but
not related to the question how the property compares or whether
it should be compared at all.
If you want to know whether it should be compared, all you need to do
now is follow NMSettingClass.compare_property().
This changes function pointer NMSettingClass.compare_property(),
which is public API. However, no user can actually use this (and shall
not!), because _nm_setting_class_commit_full() etc. is private API. A
user outside of libnm-core cannot create his/her own subclasses of
NMSetting, and never could in the past. So, this API/ABI change doesn't
matter.
2019-01-09 09:08:39 +01:00
|
|
|
static NMTernary
|
|
|
|
|
compare_property(const NMSettInfoSetting *sett_info,
|
|
|
|
|
guint property_idx,
|
2019-04-25 10:17:47 +02:00
|
|
|
NMConnection * con_a,
|
|
|
|
|
NMSetting * set_a,
|
|
|
|
|
NMConnection * con_b,
|
|
|
|
|
NMSetting * set_b,
|
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 1b49f941a69af910b0e68530be7339e8053068e5.
"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-05-24 15:57:16 +02:00
|
|
|
NMSettingCompareFlags flags)
|
|
|
|
|
{
|
libnm: rework compare_property() implementation for NMSetting
NMSetting's compare_property() has and had two callers:
nm_setting_compare() and nm_setting_diff().
compare_property() accepts a NMSettingCompareFlags argument, but
at the same time, both callers have another complex (and
inconsistent!) set of pre-checks for shortcuting the call of
compare_property(): should_compare_prop().
Merge should_compare_prop() into compare_property(). This way,
nm_setting_compare() and nm_setting_diff() has less additional
code, and are simpler to follow. Especially nm_setting_compare()
is now trivial. And nm_setting_diff() is still complicated, but
not related to the question how the property compares or whether
it should be compared at all.
If you want to know whether it should be compared, all you need to do
now is follow NMSettingClass.compare_property().
This changes function pointer NMSettingClass.compare_property(),
which is public API. However, no user can actually use this (and shall
not!), because _nm_setting_class_commit_full() etc. is private API. A
user outside of libnm-core cannot create his/her own subclasses of
NMSetting, and never could in the past. So, this API/ABI change doesn't
matter.
2019-01-09 09:08:39 +01:00
|
|
|
if (nm_streq(sett_info->property_infos[property_idx].name,
|
|
|
|
|
NM_SETTING_WIRED_CLONED_MAC_ADDRESS)) {
|
2019-04-25 10:17:47 +02:00
|
|
|
return !set_b
|
|
|
|
|
|| nm_streq0(NM_SETTING_WIRED_GET_PRIVATE(set_a)->cloned_mac_address,
|
|
|
|
|
NM_SETTING_WIRED_GET_PRIVATE(set_b)->cloned_mac_address);
|
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 1b49f941a69af910b0e68530be7339e8053068e5.
"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-05-24 15:57:16 +02:00
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
libnm: rework compare_property() implementation for NMSetting
NMSetting's compare_property() has and had two callers:
nm_setting_compare() and nm_setting_diff().
compare_property() accepts a NMSettingCompareFlags argument, but
at the same time, both callers have another complex (and
inconsistent!) set of pre-checks for shortcuting the call of
compare_property(): should_compare_prop().
Merge should_compare_prop() into compare_property(). This way,
nm_setting_compare() and nm_setting_diff() has less additional
code, and are simpler to follow. Especially nm_setting_compare()
is now trivial. And nm_setting_diff() is still complicated, but
not related to the question how the property compares or whether
it should be compared at all.
If you want to know whether it should be compared, all you need to do
now is follow NMSettingClass.compare_property().
This changes function pointer NMSettingClass.compare_property(),
which is public API. However, no user can actually use this (and shall
not!), because _nm_setting_class_commit_full() etc. is private API. A
user outside of libnm-core cannot create his/her own subclasses of
NMSetting, and never could in the past. So, this API/ABI change doesn't
matter.
2019-01-09 09:08:39 +01:00
|
|
|
return NM_SETTING_CLASS(nm_setting_wired_parent_class)
|
|
|
|
|
->compare_property(sett_info, property_idx, con_a, set_a, con_b, set_b, flags);
|
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 1b49f941a69af910b0e68530be7339e8053068e5.
"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-05-24 15:57:16 +02:00
|
|
|
}
|
|
|
|
|
|
2016-09-14 17:48:13 +02:00
|
|
|
static GVariant *
|
2019-04-24 17:41:32 +02:00
|
|
|
_override_autoneg_get(const NMSettInfoSetting * sett_info,
|
|
|
|
|
guint property_idx,
|
|
|
|
|
NMConnection * connection,
|
|
|
|
|
NMSetting * setting,
|
2019-06-27 09:07:16 +02:00
|
|
|
NMConnectionSerializationFlags flags,
|
|
|
|
|
const NMConnectionSerializationOptions *options)
|
2016-09-14 17:48:13 +02:00
|
|
|
{
|
|
|
|
|
return g_variant_new_boolean(nm_setting_wired_get_auto_negotiate((NMSettingWired *) setting));
|
|
|
|
|
}
|
|
|
|
|
|
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 1b49f941a69af910b0e68530be7339e8053068e5.
"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-05-24 15:57:16 +02:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2014-10-22 12:31:31 -04:00
|
|
|
static void
|
|
|
|
|
clear_blacklist_item(char **item_p)
|
|
|
|
|
{
|
|
|
|
|
g_free(*item_p);
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-11 08:32:54 +01:00
|
|
|
/*****************************************************************************/
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
static void
|
2019-01-11 08:32:54 +01:00
|
|
|
get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
2019-01-11 08:32:54 +01:00
|
|
|
NMSettingWired * setting = NM_SETTING_WIRED(object);
|
|
|
|
|
NMSettingWiredPrivate *priv = NM_SETTING_WIRED_GET_PRIVATE(setting);
|
2019-04-24 09:24:15 +02:00
|
|
|
GHashTable * hash;
|
|
|
|
|
guint i;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-01-11 08:32:54 +01:00
|
|
|
switch (prop_id) {
|
|
|
|
|
case PROP_PORT:
|
|
|
|
|
g_value_set_string(value, nm_setting_wired_get_port(setting));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_SPEED:
|
|
|
|
|
g_value_set_uint(value, nm_setting_wired_get_speed(setting));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_DUPLEX:
|
|
|
|
|
g_value_set_string(value, nm_setting_wired_get_duplex(setting));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_AUTO_NEGOTIATE:
|
|
|
|
|
g_value_set_boolean(value, nm_setting_wired_get_auto_negotiate(setting));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_MAC_ADDRESS:
|
|
|
|
|
g_value_set_string(value, nm_setting_wired_get_mac_address(setting));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_CLONED_MAC_ADDRESS:
|
|
|
|
|
g_value_set_string(value, nm_setting_wired_get_cloned_mac_address(setting));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_GENERATE_MAC_ADDRESS_MASK:
|
|
|
|
|
g_value_set_string(value, nm_setting_wired_get_generate_mac_address_mask(setting));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_MAC_ADDRESS_BLACKLIST:
|
|
|
|
|
g_value_set_boxed(value, (char **) priv->mac_address_blacklist->data);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_MTU:
|
|
|
|
|
g_value_set_uint(value, nm_setting_wired_get_mtu(setting));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_S390_SUBCHANNELS:
|
|
|
|
|
g_value_set_boxed(value, priv->s390_subchannels);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_S390_NETTYPE:
|
|
|
|
|
g_value_set_string(value, nm_setting_wired_get_s390_nettype(setting));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_S390_OPTIONS:
|
2019-04-24 09:24:15 +02:00
|
|
|
hash = g_hash_table_new_full(nm_str_hash, g_str_equal, g_free, g_free);
|
|
|
|
|
for (i = 0; i < priv->s390_options.len; i++) {
|
|
|
|
|
g_hash_table_insert(hash,
|
|
|
|
|
g_strdup(priv->s390_options.arr[i].name),
|
|
|
|
|
g_strdup(priv->s390_options.arr[i].value_str));
|
|
|
|
|
}
|
|
|
|
|
g_value_take_boxed(value, hash);
|
2019-01-11 08:32:54 +01:00
|
|
|
break;
|
|
|
|
|
case PROP_WAKE_ON_LAN:
|
|
|
|
|
g_value_set_uint(value, priv->wol);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_WAKE_ON_LAN_PASSWORD:
|
|
|
|
|
g_value_set_string(value, priv->wol_password);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
NMSettingWiredPrivate *priv = NM_SETTING_WIRED_GET_PRIVATE(object);
|
2014-10-28 08:56:07 -04:00
|
|
|
const char *const * blacklist;
|
|
|
|
|
const char * mac;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
switch (prop_id) {
|
|
|
|
|
case PROP_PORT:
|
|
|
|
|
g_free(priv->port);
|
|
|
|
|
priv->port = g_value_dup_string(value);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_SPEED:
|
|
|
|
|
priv->speed = g_value_get_uint(value);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_DUPLEX:
|
|
|
|
|
g_free(priv->duplex);
|
|
|
|
|
priv->duplex = g_value_dup_string(value);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_AUTO_NEGOTIATE:
|
|
|
|
|
priv->auto_negotiate = g_value_get_boolean(value);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_MAC_ADDRESS:
|
2014-07-30 10:57:45 -04:00
|
|
|
g_free(priv->device_mac_address);
|
2014-10-28 08:56:07 -04:00
|
|
|
priv->device_mac_address =
|
|
|
|
|
_nm_utils_hwaddr_canonical_or_invalid(g_value_get_string(value), ETH_ALEN);
|
2014-07-24 08:53:33 -04:00
|
|
|
break;
|
|
|
|
|
case PROP_CLONED_MAC_ADDRESS:
|
2014-07-30 10:57:45 -04:00
|
|
|
g_free(priv->cloned_mac_address);
|
2014-10-28 08:56:07 -04:00
|
|
|
priv->cloned_mac_address =
|
|
|
|
|
_nm_utils_hwaddr_canonical_or_invalid(g_value_get_string(value), ETH_ALEN);
|
2014-07-24 08:53:33 -04:00
|
|
|
break;
|
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-22 20:31:39 +02:00
|
|
|
case PROP_GENERATE_MAC_ADDRESS_MASK:
|
|
|
|
|
g_free(priv->generate_mac_address_mask);
|
|
|
|
|
priv->generate_mac_address_mask = g_value_dup_string(value);
|
|
|
|
|
break;
|
2014-07-24 08:53:33 -04:00
|
|
|
case PROP_MAC_ADDRESS_BLACKLIST:
|
2014-10-28 08:56:07 -04:00
|
|
|
blacklist = g_value_get_boxed(value);
|
2014-10-22 12:31:31 -04:00
|
|
|
g_array_set_size(priv->mac_address_blacklist, 0);
|
2014-10-28 08:56:07 -04:00
|
|
|
if (blacklist && *blacklist) {
|
2019-04-24 09:24:15 +02:00
|
|
|
guint i;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-10-28 08:56:07 -04:00
|
|
|
for (i = 0; blacklist[i]; i++) {
|
|
|
|
|
mac = _nm_utils_hwaddr_canonical_or_invalid(blacklist[i], ETH_ALEN);
|
|
|
|
|
g_array_append_val(priv->mac_address_blacklist, mac);
|
|
|
|
|
}
|
2014-10-22 12:31:31 -04:00
|
|
|
}
|
2014-07-24 08:53:33 -04:00
|
|
|
break;
|
|
|
|
|
case PROP_MTU:
|
|
|
|
|
priv->mtu = g_value_get_uint(value);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_S390_SUBCHANNELS:
|
2014-08-21 13:19:53 -04:00
|
|
|
if (priv->s390_subchannels)
|
|
|
|
|
g_strfreev(priv->s390_subchannels);
|
2014-07-24 08:53:33 -04:00
|
|
|
priv->s390_subchannels = g_value_dup_boxed(value);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_S390_NETTYPE:
|
|
|
|
|
g_free(priv->s390_nettype);
|
|
|
|
|
priv->s390_nettype = g_value_dup_string(value);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_S390_OPTIONS:
|
2019-04-24 09:24:15 +02:00
|
|
|
{
|
|
|
|
|
GHashTable *hash;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-04-24 09:24:15 +02:00
|
|
|
_s390_options_clear(priv);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-04-24 09:24:15 +02:00
|
|
|
hash = g_value_get_boxed(value);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-04-24 09:24:15 +02:00
|
|
|
priv->s390_options.n_alloc = hash ? g_hash_table_size(hash) : 0u;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-04-24 09:24:15 +02:00
|
|
|
if (priv->s390_options.n_alloc > 0) {
|
|
|
|
|
gboolean invalid_content = FALSE;
|
|
|
|
|
GHashTableIter iter;
|
|
|
|
|
const char * key;
|
|
|
|
|
const char * val;
|
|
|
|
|
guint i, j;
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-04-24 09:24:15 +02:00
|
|
|
priv->s390_options.arr = g_new(NMUtilsNamedValue, priv->s390_options.n_alloc);
|
|
|
|
|
g_hash_table_iter_init(&iter, hash);
|
|
|
|
|
while (g_hash_table_iter_next(&iter, (gpointer *) &key, (gpointer *) &val)) {
|
|
|
|
|
if (!key || !val) {
|
|
|
|
|
invalid_content = TRUE;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
nm_assert(priv->s390_options.len < priv->s390_options.n_alloc);
|
|
|
|
|
priv->s390_options.arr[priv->s390_options.len] = (NMUtilsNamedValue){
|
|
|
|
|
.name = g_strdup(key),
|
|
|
|
|
.value_str = g_strdup(val),
|
|
|
|
|
};
|
|
|
|
|
priv->s390_options.len++;
|
|
|
|
|
}
|
|
|
|
|
if (priv->s390_options.len > 1) {
|
|
|
|
|
nm_utils_named_value_list_sort(priv->s390_options.arr,
|
|
|
|
|
priv->s390_options.len,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL);
|
|
|
|
|
/* prune duplicate keys. This is only possible if @hash does not use
|
|
|
|
|
* g_str_equal() as compare function (which would be a bug).
|
|
|
|
|
* Still, handle this, because we use later binary sort and rely
|
|
|
|
|
* on unique names. One bug here, should not bork the remainder
|
|
|
|
|
* of the program. */
|
|
|
|
|
j = 1;
|
|
|
|
|
for (i = 1; i < priv->s390_options.len; i++) {
|
|
|
|
|
if (nm_streq(priv->s390_options.arr[j - 1].name,
|
|
|
|
|
priv->s390_options.arr[i].name)) {
|
|
|
|
|
g_free((char *) priv->s390_options.arr[i].name);
|
|
|
|
|
g_free((char *) priv->s390_options.arr[i].value_str);
|
|
|
|
|
invalid_content = TRUE;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
priv->s390_options.arr[j++] = priv->s390_options.arr[i];
|
|
|
|
|
}
|
|
|
|
|
priv->s390_options.len = j;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-04-24 09:24:15 +02:00
|
|
|
g_return_if_fail(!invalid_content);
|
|
|
|
|
}
|
2014-07-24 08:53:33 -04:00
|
|
|
} break;
|
2015-05-11 21:59:51 +02:00
|
|
|
case PROP_WAKE_ON_LAN:
|
|
|
|
|
priv->wol = g_value_get_uint(value);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_WAKE_ON_LAN_PASSWORD:
|
|
|
|
|
g_free(priv->wol_password);
|
|
|
|
|
priv->wol_password = g_value_dup_string(value);
|
|
|
|
|
break;
|
2014-07-24 08:53:33 -04:00
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-11 08:32:54 +01:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
static void
|
2019-01-11 08:32:54 +01:00
|
|
|
nm_setting_wired_init(NMSettingWired *setting)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
|
|
|
|
NMSettingWiredPrivate *priv = NM_SETTING_WIRED_GET_PRIVATE(setting);
|
|
|
|
|
|
2019-01-11 08:32:54 +01:00
|
|
|
/* We use GArray rather than GPtrArray so it will automatically be NULL-terminated */
|
|
|
|
|
priv->mac_address_blacklist = g_array_new(TRUE, FALSE, sizeof(char *));
|
|
|
|
|
g_array_set_clear_func(priv->mac_address_blacklist, (GDestroyNotify) clear_blacklist_item);
|
2019-12-12 11:52:11 +01:00
|
|
|
|
|
|
|
|
priv->wol = NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT;
|
2019-01-11 08:32:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_wired_new:
|
|
|
|
|
*
|
|
|
|
|
* Creates a new #NMSettingWired object with default values.
|
|
|
|
|
*
|
|
|
|
|
* Returns: (transfer full): the new empty #NMSettingWired object
|
|
|
|
|
**/
|
|
|
|
|
NMSetting *
|
|
|
|
|
nm_setting_wired_new(void)
|
|
|
|
|
{
|
2020-11-12 15:57:06 +01:00
|
|
|
return g_object_new(NM_TYPE_SETTING_WIRED, NULL);
|
2019-01-11 08:32:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
finalize(GObject *object)
|
|
|
|
|
{
|
|
|
|
|
NMSettingWiredPrivate *priv = NM_SETTING_WIRED_GET_PRIVATE(object);
|
|
|
|
|
|
|
|
|
|
g_free(priv->port);
|
|
|
|
|
g_free(priv->duplex);
|
|
|
|
|
g_free(priv->s390_nettype);
|
|
|
|
|
|
2019-04-24 09:24:15 +02:00
|
|
|
_s390_options_clear(priv);
|
2019-01-11 08:32:54 +01:00
|
|
|
|
|
|
|
|
g_free(priv->device_mac_address);
|
|
|
|
|
g_free(priv->cloned_mac_address);
|
|
|
|
|
g_free(priv->generate_mac_address_mask);
|
|
|
|
|
g_array_unref(priv->mac_address_blacklist);
|
|
|
|
|
|
|
|
|
|
if (priv->s390_subchannels)
|
|
|
|
|
g_strfreev(priv->s390_subchannels);
|
|
|
|
|
|
|
|
|
|
g_free(priv->wol_password);
|
|
|
|
|
|
|
|
|
|
G_OBJECT_CLASS(nm_setting_wired_parent_class)->finalize(object);
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
libnm/trivial: cleanup variable names in settings' class-init functions
- Don't use @parent_class name. This local variable (and @object_class) is
the class instance up-cast to the pointer types of the parents. The point
here is not that it is the direct parent. The point is, that it's the
NMSettingClass type.
Also, it can only be used inconsistently, in face of NMSettingIP4Config,
who's parent type is NMSettingIPConfig. Clearly, inside
nm-setting-ip4-config.c we wouldn't want to use the "parent_class"
name. Consistently rename @parent_class to @setting_class.
- Also rename the pointer to the own class to @klass. "setting_class" is also the
wrong name for that, because the right name would be something like
"setting_6lowpan_class".
However, "klass" is preferred over the latter, because we commonly create new
GObject implementations by copying an existing one. Generic names like "klass"
and "self" inside a type implementation make that simpler.
- drop useless comments like
/* virtual functions */
/* Properties */
It's better to logically and visually structure the code, and avoid trival
remarks about that. They only end up being used inconsistently. If you
even need a stronger visual separator, then an 80 char /****/ line
should be preferred.
2018-07-28 10:43:21 +02:00
|
|
|
nm_setting_wired_class_init(NMSettingWiredClass *klass)
|
2014-07-24 08:53:33 -04:00
|
|
|
{
|
libnm/trivial: cleanup variable names in settings' class-init functions
- Don't use @parent_class name. This local variable (and @object_class) is
the class instance up-cast to the pointer types of the parents. The point
here is not that it is the direct parent. The point is, that it's the
NMSettingClass type.
Also, it can only be used inconsistently, in face of NMSettingIP4Config,
who's parent type is NMSettingIPConfig. Clearly, inside
nm-setting-ip4-config.c we wouldn't want to use the "parent_class"
name. Consistently rename @parent_class to @setting_class.
- Also rename the pointer to the own class to @klass. "setting_class" is also the
wrong name for that, because the right name would be something like
"setting_6lowpan_class".
However, "klass" is preferred over the latter, because we commonly create new
GObject implementations by copying an existing one. Generic names like "klass"
and "self" inside a type implementation make that simpler.
- drop useless comments like
/* virtual functions */
/* Properties */
It's better to logically and visually structure the code, and avoid trival
remarks about that. They only end up being used inconsistently. If you
even need a stronger visual separator, then an 80 char /****/ line
should be preferred.
2018-07-28 10:43:21 +02:00
|
|
|
GObjectClass * object_class = G_OBJECT_CLASS(klass);
|
|
|
|
|
NMSettingClass *setting_class = NM_SETTING_CLASS(klass);
|
libnm: rework setting metadata for property handling
NMSetting internally already tracked a list of all proper GObject properties
and D-Bus-only properties.
Rework the tracking of the list, so that:
- instead of attaching the data to the GType of the setting via
g_type_set_qdata(), it is tracked in a static array indexed by
NMMetaSettingType. This allows to find the setting-data by simple
pointer arithmetic, instead of taking a look and iterating (like
g_type_set_qdata() does).
Note, that this is still thread safe, because the static table entry is
initialized in the class-init function with _nm_setting_class_commit().
And it only accessed by following a NMSettingClass instance, thus
the class constructor already ran (maybe not for all setting classes,
but for the particular one that we look up).
I think this makes initialization of the metadata simpler to
understand.
Previously, in a first phase each class would attach the metadata
to the GType as setting_property_overrides_quark(). Then during
nm_setting_class_ensure_properties() it would merge them and
set as setting_properties_quark(). Now, during the first phase,
we only incrementally build a properties_override GArray, which
we finally hand over during nm_setting_class_commit().
- sort the property infos by name and do binary search.
Also expose this meta data types as internal API in nm-setting-private.h.
While not accessed yet, it can prove beneficial, to have direct (internal)
access to these structures.
Also, rename NMSettingProperty to NMSettInfoProperty to use a distinct
naming scheme. We already have 40+ subclasses of NMSetting that are called
NMSetting*. Likewise, NMMetaSetting* is heavily used already. So, choose a
new, distinct name.
2018-07-28 15:26:03 +02:00
|
|
|
GArray * properties_override = _nm_sett_info_property_override_create_array();
|
2014-07-24 08:53:33 -04:00
|
|
|
|
libnm/trivial: cleanup variable names in settings' class-init functions
- Don't use @parent_class name. This local variable (and @object_class) is
the class instance up-cast to the pointer types of the parents. The point
here is not that it is the direct parent. The point is, that it's the
NMSettingClass type.
Also, it can only be used inconsistently, in face of NMSettingIP4Config,
who's parent type is NMSettingIPConfig. Clearly, inside
nm-setting-ip4-config.c we wouldn't want to use the "parent_class"
name. Consistently rename @parent_class to @setting_class.
- Also rename the pointer to the own class to @klass. "setting_class" is also the
wrong name for that, because the right name would be something like
"setting_6lowpan_class".
However, "klass" is preferred over the latter, because we commonly create new
GObject implementations by copying an existing one. Generic names like "klass"
and "self" inside a type implementation make that simpler.
- drop useless comments like
/* virtual functions */
/* Properties */
It's better to logically and visually structure the code, and avoid trival
remarks about that. They only end up being used inconsistently. If you
even need a stronger visual separator, then an 80 char /****/ line
should be preferred.
2018-07-28 10:43:21 +02:00
|
|
|
g_type_class_add_private(klass, sizeof(NMSettingWiredPrivate));
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
object_class->get_property = get_property;
|
2019-01-11 08:32:54 +01:00
|
|
|
object_class->set_property = set_property;
|
2014-07-24 08:53:33 -04:00
|
|
|
object_class->finalize = finalize;
|
libnm/trivial: cleanup variable names in settings' class-init functions
- Don't use @parent_class name. This local variable (and @object_class) is
the class instance up-cast to the pointer types of the parents. The point
here is not that it is the direct parent. The point is, that it's the
NMSettingClass type.
Also, it can only be used inconsistently, in face of NMSettingIP4Config,
who's parent type is NMSettingIPConfig. Clearly, inside
nm-setting-ip4-config.c we wouldn't want to use the "parent_class"
name. Consistently rename @parent_class to @setting_class.
- Also rename the pointer to the own class to @klass. "setting_class" is also the
wrong name for that, because the right name would be something like
"setting_6lowpan_class".
However, "klass" is preferred over the latter, because we commonly create new
GObject implementations by copying an existing one. Generic names like "klass"
and "self" inside a type implementation make that simpler.
- drop useless comments like
/* virtual functions */
/* Properties */
It's better to logically and visually structure the code, and avoid trival
remarks about that. They only end up being used inconsistently. If you
even need a stronger visual separator, then an 80 char /****/ line
should be preferred.
2018-07-28 10:43:21 +02:00
|
|
|
|
|
|
|
|
setting_class->verify = verify;
|
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 1b49f941a69af910b0e68530be7339e8053068e5.
"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-05-24 15:57:16 +02:00
|
|
|
setting_class->compare_property = compare_property;
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* NMSettingWired:port:
|
|
|
|
|
*
|
2017-07-02 11:09:42 +03:00
|
|
|
* Specific port type to use if the device supports multiple
|
2014-07-24 08:53:33 -04:00
|
|
|
* attachment methods. One of "tp" (Twisted Pair), "aui" (Attachment Unit
|
2017-07-02 11:09:42 +03:00
|
|
|
* Interface), "bnc" (Thin Ethernet) or "mii" (Media Independent Interface).
|
2014-07-24 08:53:33 -04:00
|
|
|
* If the device supports only one port type, this setting is ignored.
|
|
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---ifcfg-rh---
|
|
|
|
|
* property: port
|
|
|
|
|
* variable: (none)
|
|
|
|
|
* description: The property is not saved by the plugin.
|
|
|
|
|
* ---end---
|
|
|
|
|
*/
|
2019-01-11 08:28:26 +01:00
|
|
|
obj_properties[PROP_PORT] = g_param_spec_string(NM_SETTING_WIRED_PORT,
|
|
|
|
|
"",
|
|
|
|
|
"",
|
|
|
|
|
NULL,
|
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* NMSettingWired:speed:
|
|
|
|
|
*
|
2019-09-03 11:43:12 +02:00
|
|
|
* When a value greater than 0 is set, configures the device to use
|
2018-06-07 19:12:20 +02:00
|
|
|
* the specified speed. If "auto-negotiate" is "yes" the specified
|
|
|
|
|
* speed will be the only one advertised during link negotiation:
|
|
|
|
|
* this works only for BASE-T 802.3 specifications and is useful for
|
|
|
|
|
* enforcing gigabit speeds, as in this case link negotiation is
|
|
|
|
|
* mandatory.
|
|
|
|
|
* If the value is unset (0, the default), the link configuration will be
|
|
|
|
|
* either skipped (if "auto-negotiate" is "no", the default) or will
|
|
|
|
|
* be auto-negotiated (if "auto-negotiate" is "yes") and the local device
|
|
|
|
|
* will advertise all the supported speeds.
|
2016-11-24 16:26:10 +01:00
|
|
|
* In Mbit/s, ie 100 == 100Mbit/s.
|
|
|
|
|
* Must be set together with the "duplex" property when non-zero.
|
2016-11-30 16:49:36 +01:00
|
|
|
* Before specifying a speed value be sure your device supports it.
|
2014-07-24 08:53:33 -04:00
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---ifcfg-rh---
|
|
|
|
|
* property: speed
|
2016-09-14 17:48:13 +02:00
|
|
|
* variable: ETHTOOL_OPTS
|
|
|
|
|
* description: Fixed speed for the ethernet link. It is added as "speed"
|
|
|
|
|
* parameter in the ETHTOOL_OPTS variable.
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
* ---end---
|
|
|
|
|
*/
|
2019-01-11 08:28:26 +01:00
|
|
|
obj_properties[PROP_SPEED] = g_param_spec_uint(NM_SETTING_WIRED_SPEED,
|
|
|
|
|
"",
|
|
|
|
|
"",
|
|
|
|
|
0,
|
|
|
|
|
G_MAXUINT32,
|
|
|
|
|
0,
|
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/**
|
|
|
|
|
* NMSettingWired:duplex:
|
|
|
|
|
*
|
2018-06-07 19:12:20 +02:00
|
|
|
* When a value is set, either "half" or "full", configures the device
|
|
|
|
|
* to use the specified duplex mode. If "auto-negotiate" is "yes" the
|
|
|
|
|
* specified duplex mode will be the only one advertised during link
|
|
|
|
|
* negotiation: this works only for BASE-T 802.3 specifications and is
|
|
|
|
|
* useful for enforcing gigabits modes, as in these cases link negotiation
|
|
|
|
|
* is mandatory.
|
|
|
|
|
* If the value is unset (the default), the link configuration will be
|
|
|
|
|
* either skipped (if "auto-negotiate" is "no", the default) or will
|
|
|
|
|
* be auto-negotiated (if "auto-negotiate" is "yes") and the local device
|
|
|
|
|
* will advertise all the supported duplex modes.
|
2016-11-24 16:26:10 +01:00
|
|
|
* Must be set together with the "speed" property if specified.
|
2016-11-30 16:49:36 +01:00
|
|
|
* Before specifying a duplex mode be sure your device supports it.
|
2014-07-24 08:53:33 -04:00
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---ifcfg-rh---
|
|
|
|
|
* property: duplex
|
2016-09-14 17:48:13 +02:00
|
|
|
* variable: ETHTOOL_OPTS
|
|
|
|
|
* description: Fixed duplex mode for the ethernet link. It is added as
|
|
|
|
|
* "duplex" parameter in the ETHOOL_OPTS variable.
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
* ---end---
|
|
|
|
|
*/
|
2019-01-11 08:28:26 +01:00
|
|
|
obj_properties[PROP_DUPLEX] = g_param_spec_string(NM_SETTING_WIRED_DUPLEX,
|
|
|
|
|
"",
|
|
|
|
|
"",
|
|
|
|
|
NULL,
|
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* NMSettingWired:auto-negotiate:
|
|
|
|
|
*
|
2018-06-07 19:12:20 +02:00
|
|
|
* When %TRUE, enforce auto-negotiation of speed and duplex mode.
|
|
|
|
|
* If "speed" and "duplex" properties are both specified, only that
|
|
|
|
|
* single mode will be advertised and accepted during the link
|
|
|
|
|
* auto-negotiation process: this works only for BASE-T 802.3 specifications
|
|
|
|
|
* and is useful for enforcing gigabits modes, as in these cases link
|
|
|
|
|
* negotiation is mandatory.
|
|
|
|
|
* When %FALSE, "speed" and "duplex" properties should be both set or
|
|
|
|
|
* link configuration will be skipped.
|
2014-07-24 08:53:33 -04:00
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---ifcfg-rh---
|
|
|
|
|
* property: auto-negotiate
|
2016-09-14 17:48:13 +02:00
|
|
|
* variable: ETHTOOL_OPTS
|
2016-09-08 14:19:25 +02:00
|
|
|
* description: Whether link speed and duplex autonegotiation is enabled.
|
2016-09-14 17:48:13 +02:00
|
|
|
* It is not saved only if disabled and no values are provided for the
|
|
|
|
|
* "speed" and "duplex" parameters (skips link configuration).
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
* ---end---
|
|
|
|
|
*/
|
2019-01-11 08:28:26 +01:00
|
|
|
obj_properties[PROP_AUTO_NEGOTIATE] =
|
|
|
|
|
g_param_spec_boolean(NM_SETTING_WIRED_AUTO_NEGOTIATE,
|
|
|
|
|
"",
|
|
|
|
|
"",
|
|
|
|
|
FALSE,
|
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
2019-09-22 15:32:04 +02:00
|
|
|
_nm_properties_override_gobj(properties_override,
|
|
|
|
|
obj_properties[PROP_AUTO_NEGOTIATE],
|
|
|
|
|
NM_SETT_INFO_PROPERT_TYPE(.dbus_type = G_VARIANT_TYPE_BOOLEAN,
|
|
|
|
|
.to_dbus_fcn = _override_autoneg_get, ));
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/**
|
|
|
|
|
* NMSettingWired:mac-address:
|
|
|
|
|
*
|
|
|
|
|
* If specified, this connection will only apply to the Ethernet device
|
|
|
|
|
* whose permanent MAC address matches. This property does not change the
|
|
|
|
|
* MAC address of the device (i.e. MAC spoofing).
|
|
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---keyfile---
|
|
|
|
|
* property: mac-address
|
2016-03-30 12:00:54 +02:00
|
|
|
* format: usual hex-digits-and-colons notation
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
* description: MAC address in traditional hex-digits-and-colons notation
|
|
|
|
|
* (e.g. 00:22:68:12:79:A2), or semicolon separated list of 6 bytes (obsolete)
|
|
|
|
|
* (e.g. 0;34;104;18;121;162)
|
|
|
|
|
* ---end---
|
|
|
|
|
* ---ifcfg-rh---
|
|
|
|
|
* property: mac-address
|
|
|
|
|
* variable: HWADDR
|
|
|
|
|
* description: Hardware address of the device in traditional hex-digits-and-colons
|
|
|
|
|
* notation (e.g. 00:22:68:14:5A:05).
|
2016-11-10 14:08:16 +01:00
|
|
|
* Note that for initscripts this is the current MAC address of the device as found
|
|
|
|
|
* during ifup. For NetworkManager this is the permanent MAC address. Or in case no
|
|
|
|
|
* permanent MAC address exists, the MAC address initially configured on the device.
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
* ---end---
|
|
|
|
|
*/
|
2020-03-19 16:57:56 +01:00
|
|
|
obj_properties[PROP_MAC_ADDRESS] = g_param_spec_string(
|
|
|
|
|
NM_SETTING_WIRED_MAC_ADDRESS,
|
2020-09-28 16:03:33 +02:00
|
|
|
"",
|
|
|
|
|
"",
|
|
|
|
|
NULL,
|
2020-03-19 16:57:56 +01:00
|
|
|
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
|
|
|
|
|
_nm_properties_override_gobj(properties_override,
|
|
|
|
|
obj_properties[PROP_MAC_ADDRESS],
|
|
|
|
|
&nm_sett_info_propert_type_mac_address);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/**
|
|
|
|
|
* NMSettingWired:cloned-mac-address:
|
|
|
|
|
*
|
2016-09-01 16:18:34 +02:00
|
|
|
* If specified, request that the device use this MAC address instead.
|
|
|
|
|
* This is known as MAC cloning or spoofing.
|
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 1b49f941a69af910b0e68530be7339e8053068e5.
"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-05-24 15:57:16 +02:00
|
|
|
*
|
2017-05-28 17:34:31 +03:00
|
|
|
* Beside explicitly specifying a MAC address, the special values "preserve", "permanent",
|
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 1b49f941a69af910b0e68530be7339e8053068e5.
"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-05-24 15:57:16 +02:00
|
|
|
* "random" and "stable" are supported.
|
|
|
|
|
* "preserve" means not to touch the MAC address on activation.
|
2017-07-25 10:37:14 +02:00
|
|
|
* "permanent" means to use the permanent hardware address if the device
|
|
|
|
|
* has one (otherwise this is treated as "preserve").
|
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 1b49f941a69af910b0e68530be7339e8053068e5.
"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-05-24 15:57:16 +02:00
|
|
|
* "random" creates a random MAC address on each connect.
|
2016-12-18 13:54:26 +01:00
|
|
|
* "stable" creates a hashed MAC address based on connection.stable-id and a
|
|
|
|
|
* machine dependent key.
|
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 1b49f941a69af910b0e68530be7339e8053068e5.
"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-05-24 15:57:16 +02:00
|
|
|
*
|
|
|
|
|
* If unspecified, the value can be overwritten via global defaults, see manual
|
2016-09-01 16:18:34 +02:00
|
|
|
* of NetworkManager.conf. If still unspecified, it defaults to "preserve"
|
|
|
|
|
* (older versions of NetworkManager may use a different default value).
|
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 1b49f941a69af910b0e68530be7339e8053068e5.
"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-05-24 15:57:16 +02:00
|
|
|
*
|
|
|
|
|
* On D-Bus, this field is expressed as "assigned-mac-address" or the deprecated
|
|
|
|
|
* "cloned-mac-address".
|
2014-07-24 08:53:33 -04:00
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---keyfile---
|
|
|
|
|
* property: cloned-mac-address
|
2016-03-30 12:00:54 +02:00
|
|
|
* format: usual hex-digits-and-colons notation
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
* description: Cloned MAC address in traditional hex-digits-and-colons notation
|
|
|
|
|
* (e.g. 00:22:68:12:79:B2), or semicolon separated list of 6 bytes (obsolete)
|
|
|
|
|
* (e.g. 0;34;104;18;121;178).
|
|
|
|
|
* ---end---
|
|
|
|
|
* ---ifcfg-rh---
|
|
|
|
|
* property: cloned-mac-address
|
|
|
|
|
* variable: MACADDR
|
|
|
|
|
* description: Cloned (spoofed) MAC address in traditional hex-digits-and-colons
|
|
|
|
|
* notation (e.g. 00:22:68:14:5A:99).
|
|
|
|
|
* ---end---
|
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 1b49f941a69af910b0e68530be7339e8053068e5.
"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-05-24 15:57:16 +02:00
|
|
|
* ---dbus---
|
|
|
|
|
* property: cloned-mac-address
|
|
|
|
|
* format: byte array
|
|
|
|
|
* description: This D-Bus field is deprecated in favor of "assigned-mac-address"
|
|
|
|
|
* which is more flexible and allows specifying special variants like "random".
|
2016-08-30 14:32:10 +02:00
|
|
|
* For libnm and nmcli, this field is called "cloned-mac-address".
|
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 1b49f941a69af910b0e68530be7339e8053068e5.
"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-05-24 15:57:16 +02:00
|
|
|
* ---end---
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
*/
|
2019-09-22 15:32:04 +02:00
|
|
|
obj_properties[PROP_CLONED_MAC_ADDRESS] = g_param_spec_string(
|
|
|
|
|
NM_SETTING_WIRED_CLONED_MAC_ADDRESS,
|
2020-09-28 16:03:33 +02:00
|
|
|
"",
|
|
|
|
|
"",
|
|
|
|
|
NULL,
|
2019-09-22 15:32:04 +02:00
|
|
|
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
|
|
|
|
|
_nm_properties_override_gobj(properties_override,
|
|
|
|
|
obj_properties[PROP_CLONED_MAC_ADDRESS],
|
|
|
|
|
&nm_sett_info_propert_type_cloned_mac_address);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
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 1b49f941a69af910b0e68530be7339e8053068e5.
"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-05-24 15:57:16 +02:00
|
|
|
/* ---dbus---
|
|
|
|
|
* property: assigned-mac-address
|
|
|
|
|
* format: string
|
|
|
|
|
* description: The new field for the cloned MAC address. It can be either
|
|
|
|
|
* a hardware address in ASCII representation, or one of the special values
|
2016-07-11 21:13:17 +02:00
|
|
|
* "preserve", "permanent", "random" or "stable".
|
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 1b49f941a69af910b0e68530be7339e8053068e5.
"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-05-24 15:57:16 +02:00
|
|
|
* This field replaces the deprecated "cloned-mac-address" on D-Bus, which
|
2018-09-15 07:20:54 -04:00
|
|
|
* can only contain explicit hardware addresses. Note that this property
|
2016-08-30 14:32:10 +02:00
|
|
|
* only exists in D-Bus API. libnm and nmcli continue to call this property
|
|
|
|
|
* "cloned-mac-address".
|
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 1b49f941a69af910b0e68530be7339e8053068e5.
"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-05-24 15:57:16 +02:00
|
|
|
* ---end---
|
|
|
|
|
*/
|
2019-09-22 15:32:04 +02:00
|
|
|
_nm_properties_override_dbus(properties_override,
|
|
|
|
|
"assigned-mac-address",
|
|
|
|
|
&nm_sett_info_propert_type_assigned_mac_address);
|
2014-07-30 10:57:45 -04:00
|
|
|
|
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-22 20:31:39 +02:00
|
|
|
/**
|
|
|
|
|
* NMSettingWired:generate-mac-address-mask:
|
|
|
|
|
*
|
|
|
|
|
* With #NMSettingWired:cloned-mac-address setting "random" or "stable",
|
|
|
|
|
* by default all bits of the MAC address are scrambled and a locally-administered,
|
|
|
|
|
* unicast MAC address is created. This property allows to specify that certain bits
|
|
|
|
|
* are fixed. Note that the least significant bit of the first MAC address will
|
|
|
|
|
* always be unset to create a unicast MAC address.
|
|
|
|
|
*
|
|
|
|
|
* If the property is %NULL, it is eligible to be overwritten by a default
|
|
|
|
|
* connection setting. If the value is still %NULL or an empty string, the
|
|
|
|
|
* default is to create a locally-administered, unicast MAC address.
|
|
|
|
|
*
|
|
|
|
|
* If the value contains one MAC address, this address is used as mask. The set
|
|
|
|
|
* bits of the mask are to be filled with the current MAC address of the device,
|
|
|
|
|
* while the unset bits are subject to randomization.
|
|
|
|
|
* Setting "FE:FF:FF:00:00:00" means to preserve the OUI of the current MAC address
|
|
|
|
|
* and only randomize the lower 3 bytes using the "random" or "stable" algorithm.
|
|
|
|
|
*
|
|
|
|
|
* If the value contains one additional MAC address after the mask,
|
|
|
|
|
* this address is used instead of the current MAC address to fill the bits
|
|
|
|
|
* that shall not be randomized. For example, a value of
|
|
|
|
|
* "FE:FF:FF:00:00:00 68:F7:28:00:00:00" will set the OUI of the MAC address
|
|
|
|
|
* to 68:F7:28, while the lower bits are randomized. A value of
|
|
|
|
|
* "02:00:00:00:00:00 00:00:00:00:00:00" will create a fully scrambled
|
|
|
|
|
* globally-administered, burned-in MAC address.
|
|
|
|
|
*
|
2017-08-11 11:05:12 +02:00
|
|
|
* If the value contains more than one additional MAC addresses, one of
|
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-22 20:31:39 +02:00
|
|
|
* them is chosen randomly. For example, "02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00"
|
|
|
|
|
* will create a fully scrambled MAC address, randomly locally or globally
|
|
|
|
|
* administered.
|
|
|
|
|
**/
|
|
|
|
|
/* ---ifcfg-rh---
|
|
|
|
|
* property: generate-mac-address-mask
|
2016-12-09 22:19:48 +01:00
|
|
|
* variable: GENERATE_MAC_ADDRESS_MASK(+)
|
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-22 20:31:39 +02:00
|
|
|
* description: the MAC address mask for generating randomized and stable
|
|
|
|
|
* cloned-mac-address.
|
|
|
|
|
* ---end---
|
|
|
|
|
*/
|
2019-01-11 08:28:26 +01:00
|
|
|
obj_properties[PROP_GENERATE_MAC_ADDRESS_MASK] = g_param_spec_string(
|
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-22 20:31:39 +02:00
|
|
|
NM_SETTING_WIRED_GENERATE_MAC_ADDRESS_MASK,
|
|
|
|
|
"",
|
|
|
|
|
"",
|
|
|
|
|
NULL,
|
|
|
|
|
G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE | G_PARAM_STATIC_STRINGS);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/**
|
|
|
|
|
* NMSettingWired:mac-address-blacklist:
|
|
|
|
|
*
|
|
|
|
|
* If specified, this connection will never apply to the Ethernet device
|
|
|
|
|
* whose permanent MAC address matches an address in the list. Each MAC
|
|
|
|
|
* address is in the standard hex-digits-and-colons notation
|
|
|
|
|
* (00:11:22:33:44:55).
|
|
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---keyfile---
|
|
|
|
|
* property: mac-address-blacklist
|
|
|
|
|
* format: list of MACs (separated with semicolons)
|
|
|
|
|
* description: MAC address blacklist.
|
|
|
|
|
* example: mac-address-blacklist= 00:22:68:12:79:A6;00:22:68:12:79:78
|
|
|
|
|
* ---end---
|
|
|
|
|
* ---ifcfg-rh---
|
|
|
|
|
* property: mac-address-blacklist
|
|
|
|
|
* variable: HWADDR_BLACKLIST(+)
|
|
|
|
|
* description: It denies usage of the connection for any device whose address
|
|
|
|
|
* is listed.
|
|
|
|
|
* example: HWADDR_BLACKLIST="00:22:68:11:69:08 00:11:22:11:44:55"
|
|
|
|
|
* ---end---
|
|
|
|
|
*/
|
2019-01-11 08:28:26 +01:00
|
|
|
obj_properties[PROP_MAC_ADDRESS_BLACKLIST] = g_param_spec_boxed(
|
|
|
|
|
NM_SETTING_WIRED_MAC_ADDRESS_BLACKLIST,
|
|
|
|
|
"",
|
|
|
|
|
"",
|
|
|
|
|
G_TYPE_STRV,
|
|
|
|
|
G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE | G_PARAM_STATIC_STRINGS);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/**
|
|
|
|
|
* NMSettingWired:mtu:
|
|
|
|
|
*
|
|
|
|
|
* If non-zero, only transmit packets of the specified size or smaller,
|
|
|
|
|
* breaking larger packets up into multiple Ethernet frames.
|
|
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---ifcfg-rh---
|
|
|
|
|
* property: mtu
|
|
|
|
|
* variable: MTU
|
|
|
|
|
* description: MTU of the interface.
|
|
|
|
|
* ---end---
|
|
|
|
|
*/
|
2019-01-11 08:28:26 +01:00
|
|
|
obj_properties[PROP_MTU] = g_param_spec_uint(NM_SETTING_WIRED_MTU,
|
|
|
|
|
"",
|
|
|
|
|
"",
|
|
|
|
|
0,
|
|
|
|
|
G_MAXUINT32,
|
|
|
|
|
0,
|
|
|
|
|
G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE
|
|
|
|
|
| G_PARAM_STATIC_STRINGS);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/**
|
|
|
|
|
* NMSettingWired:s390-subchannels:
|
|
|
|
|
*
|
|
|
|
|
* Identifies specific subchannels that this network device uses for
|
|
|
|
|
* communication with z/VM or s390 host. Like the
|
|
|
|
|
* #NMSettingWired:mac-address property for non-z/VM devices, this property
|
|
|
|
|
* can be used to ensure this connection only applies to the network device
|
|
|
|
|
* that uses these subchannels. The list should contain exactly 3 strings,
|
|
|
|
|
* and each string may only be composed of hexadecimal characters and the
|
|
|
|
|
* period (.) character.
|
|
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---ifcfg-rh---
|
|
|
|
|
* property: s390-subchannels
|
|
|
|
|
* variable: SUBCHANNELS
|
|
|
|
|
* description: Subchannels for IBM S390 hosts.
|
|
|
|
|
* example: SUBCHANNELS=0.0.b00a,0.0.b00b,0.0.b00c
|
|
|
|
|
* ---end---
|
|
|
|
|
*/
|
2019-01-11 08:28:26 +01:00
|
|
|
obj_properties[PROP_S390_SUBCHANNELS] = g_param_spec_boxed(
|
|
|
|
|
NM_SETTING_WIRED_S390_SUBCHANNELS,
|
|
|
|
|
"",
|
|
|
|
|
"",
|
|
|
|
|
G_TYPE_STRV,
|
|
|
|
|
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/**
|
|
|
|
|
* NMSettingWired:s390-nettype:
|
|
|
|
|
*
|
|
|
|
|
* s390 network device type; one of "qeth", "lcs", or "ctc", representing
|
|
|
|
|
* the different types of virtual network devices available on s390 systems.
|
|
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---ifcfg-rh---
|
|
|
|
|
* property: s390-nettype
|
|
|
|
|
* variable: NETTYPE
|
|
|
|
|
* values: "qeth", "lcs" or "ctc"
|
|
|
|
|
* description: Network type of the S390 host.
|
|
|
|
|
* example: NETTYPE=qeth
|
|
|
|
|
* ---end---
|
|
|
|
|
*/
|
2019-01-11 08:28:26 +01:00
|
|
|
obj_properties[PROP_S390_NETTYPE] = g_param_spec_string(
|
|
|
|
|
NM_SETTING_WIRED_S390_NETTYPE,
|
|
|
|
|
"",
|
|
|
|
|
"",
|
|
|
|
|
NULL,
|
|
|
|
|
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
/**
|
2015-02-10 12:24:25 +01:00
|
|
|
* NMSettingWired:s390-options: (type GHashTable(utf8,utf8)):
|
2014-07-24 08:53:33 -04:00
|
|
|
*
|
|
|
|
|
* Dictionary of key/value pairs of s390-specific device options. Both keys
|
|
|
|
|
* and values must be strings. Allowed keys include "portno", "layer2",
|
|
|
|
|
* "portname", "protocol", among others. Key names must contain only
|
|
|
|
|
* alphanumeric characters (ie, [a-zA-Z0-9]).
|
|
|
|
|
**/
|
libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.
With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).
The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...
(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-10-28 09:58:25 -04:00
|
|
|
/* ---ifcfg-rh---
|
|
|
|
|
* property: s390-options
|
|
|
|
|
* variable: OPTIONS and PORTNAME, CTCPROTO,
|
|
|
|
|
* description: S390 device options. All options go to OPTIONS, except for
|
|
|
|
|
* "portname" and "ctcprot" that have their own variables.
|
|
|
|
|
* ---end---
|
|
|
|
|
*/
|
2019-01-11 08:28:26 +01:00
|
|
|
obj_properties[PROP_S390_OPTIONS] = g_param_spec_boxed(
|
|
|
|
|
NM_SETTING_WIRED_S390_OPTIONS,
|
|
|
|
|
"",
|
|
|
|
|
"",
|
|
|
|
|
G_TYPE_HASH_TABLE,
|
|
|
|
|
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
|
2019-09-22 15:32:04 +02:00
|
|
|
_nm_properties_override_gobj(properties_override,
|
|
|
|
|
obj_properties[PROP_S390_OPTIONS],
|
|
|
|
|
&nm_sett_info_propert_type_strdict);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2015-05-11 21:59:51 +02:00
|
|
|
/**
|
|
|
|
|
* NMSettingWired:wake-on-lan:
|
|
|
|
|
*
|
|
|
|
|
* The #NMSettingWiredWakeOnLan options to enable. Not all devices support all options.
|
|
|
|
|
* May be any combination of %NM_SETTING_WIRED_WAKE_ON_LAN_PHY,
|
|
|
|
|
* %NM_SETTING_WIRED_WAKE_ON_LAN_UNICAST, %NM_SETTING_WIRED_WAKE_ON_LAN_MULTICAST,
|
|
|
|
|
* %NM_SETTING_WIRED_WAKE_ON_LAN_BROADCAST, %NM_SETTING_WIRED_WAKE_ON_LAN_ARP,
|
2015-09-21 18:24:07 +02:00
|
|
|
* %NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC or the special values
|
|
|
|
|
* %NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT (to use global settings) and
|
|
|
|
|
* %NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE (to disable management of Wake-on-LAN in
|
|
|
|
|
* NetworkManager).
|
2015-05-11 21:59:51 +02:00
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
2019-01-11 08:28:26 +01:00
|
|
|
obj_properties[PROP_WAKE_ON_LAN] =
|
|
|
|
|
g_param_spec_uint(NM_SETTING_WIRED_WAKE_ON_LAN,
|
|
|
|
|
"",
|
|
|
|
|
"",
|
|
|
|
|
0,
|
|
|
|
|
G_MAXUINT32,
|
|
|
|
|
NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT,
|
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2015-05-11 21:59:51 +02:00
|
|
|
/**
|
|
|
|
|
* NMSettingWired:wake-on-lan-password:
|
|
|
|
|
*
|
|
|
|
|
* If specified, the password used with magic-packet-based
|
|
|
|
|
* Wake-on-LAN, represented as an Ethernet MAC address. If %NULL,
|
|
|
|
|
* no password will be required.
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
2019-01-11 08:28:26 +01:00
|
|
|
obj_properties[PROP_WAKE_ON_LAN_PASSWORD] =
|
|
|
|
|
g_param_spec_string(NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD,
|
|
|
|
|
"",
|
|
|
|
|
"",
|
|
|
|
|
NULL,
|
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2019-01-11 08:28:26 +01:00
|
|
|
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
libnm: rework setting metadata for property handling
NMSetting internally already tracked a list of all proper GObject properties
and D-Bus-only properties.
Rework the tracking of the list, so that:
- instead of attaching the data to the GType of the setting via
g_type_set_qdata(), it is tracked in a static array indexed by
NMMetaSettingType. This allows to find the setting-data by simple
pointer arithmetic, instead of taking a look and iterating (like
g_type_set_qdata() does).
Note, that this is still thread safe, because the static table entry is
initialized in the class-init function with _nm_setting_class_commit().
And it only accessed by following a NMSettingClass instance, thus
the class constructor already ran (maybe not for all setting classes,
but for the particular one that we look up).
I think this makes initialization of the metadata simpler to
understand.
Previously, in a first phase each class would attach the metadata
to the GType as setting_property_overrides_quark(). Then during
nm_setting_class_ensure_properties() it would merge them and
set as setting_properties_quark(). Now, during the first phase,
we only incrementally build a properties_override GArray, which
we finally hand over during nm_setting_class_commit().
- sort the property infos by name and do binary search.
Also expose this meta data types as internal API in nm-setting-private.h.
While not accessed yet, it can prove beneficial, to have direct (internal)
access to these structures.
Also, rename NMSettingProperty to NMSettInfoProperty to use a distinct
naming scheme. We already have 40+ subclasses of NMSetting that are called
NMSetting*. Likewise, NMMetaSetting* is heavily used already. So, choose a
new, distinct name.
2018-07-28 15:26:03 +02:00
|
|
|
_nm_setting_class_commit_full(setting_class,
|
|
|
|
|
NM_META_SETTING_TYPE_WIRED,
|
|
|
|
|
NULL,
|
|
|
|
|
properties_override);
|
2014-07-24 08:53:33 -04:00
|
|
|
}
|