mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-01 11:28:02 +02:00
merge: branch 'bg/conf-check-rh1541013'
Warn about unknown/erroneous configuration options in NetworkManager.conf. https://bugzilla.redhat.com/show_bug.cgi?id=1541013 https://github.com/NetworkManager/NetworkManager/pull/251
This commit is contained in:
commit
ba6c2211e8
25 changed files with 773 additions and 232 deletions
|
|
@ -1486,6 +1486,11 @@ noinst_LTLIBRARIES += \
|
|||
src/libNetworkManager.la \
|
||||
src/libsystemd-nm.la
|
||||
|
||||
check-config-options:
|
||||
$(srcdir)/tools/check-config-options.sh "$(srcdir)"
|
||||
|
||||
check_local += check-config-options
|
||||
|
||||
###############################################################################
|
||||
|
||||
src_libsystemd_nm_la_cppflags = \
|
||||
|
|
@ -3521,6 +3526,7 @@ $(src_tests_config_test_config_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
|
|||
|
||||
EXTRA_DIST += \
|
||||
src/tests/config/NetworkManager.conf \
|
||||
src/tests/config/NetworkManager-warn.conf \
|
||||
src/tests/config/NetworkManager.state \
|
||||
src/tests/config/bad.conf \
|
||||
src/tests/config/global-dns-invalid.conf \
|
||||
|
|
@ -5157,6 +5163,7 @@ EXTRA_DIST += \
|
|||
shared/nm-version-macros.h.in \
|
||||
shared/meson.build \
|
||||
\
|
||||
tools/check-config-options.sh \
|
||||
tools/check-docs.sh \
|
||||
tools/check-exports.sh \
|
||||
tools/create-exports-NetworkManager.sh \
|
||||
|
|
|
|||
|
|
@ -5187,8 +5187,6 @@ static const NMMetaPropertyType _pt_ethtool = {
|
|||
#define PROPERTY_INFO_WITH_DESC(name, ...) \
|
||||
PROPERTY_INFO (name, DESCRIBE_DOC_##name, ##__VA_ARGS__)
|
||||
|
||||
#define VALUES_STATIC(...) (((const char *[]) { __VA_ARGS__, NULL }))
|
||||
|
||||
#define ENUM_VALUE_INFOS(...) (((const NMUtilsEnumValueInfo []) { __VA_ARGS__, { 0 } }))
|
||||
#define INT_VALUE_INFOS(...) (((const NMMetaUtilsIntValueInfo []) { __VA_ARGS__, { 0 } }))
|
||||
|
||||
|
|
@ -5247,7 +5245,7 @@ static const NMMetaPropertyInfo *const property_infos_802_1X[] = {
|
|||
.remove_fcn = _remove_fcn_802_1x_eap,
|
||||
),
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC ("leap", "md5", "tls", "peap", "ttls", "sim", "fast", "pwd"),
|
||||
.values_static = NM_MAKE_STRV ("leap", "md5", "tls", "peap", "ttls", "sim", "fast", "pwd"),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_IDENTITY,
|
||||
|
|
@ -5314,19 +5312,19 @@ static const NMMetaPropertyInfo *const property_infos_802_1X[] = {
|
|||
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE1_PEAPVER,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC ("0", "1"),
|
||||
.values_static = NM_MAKE_STRV ("0", "1"),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE1_PEAPLABEL,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC ("0", "1"),
|
||||
.values_static = NM_MAKE_STRV ("0", "1"),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC ("0", "1", "2", "3"),
|
||||
.values_static = NM_MAKE_STRV ("0", "1", "2", "3"),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE1_AUTH_FLAGS,
|
||||
|
|
@ -5341,13 +5339,13 @@ static const NMMetaPropertyInfo *const property_infos_802_1X[] = {
|
|||
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_AUTH,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC ("pap", "chap", "mschap", "mschapv2", "gtc", "otp", "md5", "tls"),
|
||||
.values_static = NM_MAKE_STRV ("pap", "chap", "mschap", "mschapv2", "gtc", "otp", "md5", "tls"),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_AUTHEAP,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC ("md5", "mschapv2", "otp", "gtc", "tls"),
|
||||
.values_static = NM_MAKE_STRV ("md5", "mschapv2", "otp", "gtc", "tls"),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_CA_CERT,
|
||||
|
|
@ -5509,9 +5507,9 @@ static const NMMetaPropertyInfo *const property_infos_ADSL[] = {
|
|||
.def_hint = NM_META_TEXT_PROMPT_ADSL_PROTO_CHOICES,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC (NM_SETTING_ADSL_PROTOCOL_PPPOA,
|
||||
NM_SETTING_ADSL_PROTOCOL_PPPOE,
|
||||
NM_SETTING_ADSL_PROTOCOL_IPOATM),
|
||||
.values_static = NM_MAKE_STRV (NM_SETTING_ADSL_PROTOCOL_PPPOA,
|
||||
NM_SETTING_ADSL_PROTOCOL_PPPOE,
|
||||
NM_SETTING_ADSL_PROTOCOL_IPOATM),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_ADSL_ENCAPSULATION,
|
||||
|
|
@ -5521,8 +5519,8 @@ static const NMMetaPropertyInfo *const property_infos_ADSL[] = {
|
|||
.def_hint = NM_META_TEXT_PROMPT_ADSL_ENCAP_CHOICES,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC (NM_SETTING_ADSL_ENCAPSULATION_VCMUX,
|
||||
NM_SETTING_ADSL_ENCAPSULATION_LLC),
|
||||
.values_static = NM_MAKE_STRV (NM_SETTING_ADSL_ENCAPSULATION_VCMUX,
|
||||
NM_SETTING_ADSL_ENCAPSULATION_LLC),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_ADSL_VPI,
|
||||
|
|
@ -5550,9 +5548,9 @@ static const NMMetaPropertyInfo *const property_infos_BLUETOOTH[] = {
|
|||
.def_hint = NM_META_TEXT_PROMPT_BT_TYPE_CHOICES,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC (NM_SETTING_BLUETOOTH_TYPE_DUN,
|
||||
NM_SETTING_BLUETOOTH_TYPE_PANU,
|
||||
NM_SETTING_BLUETOOTH_TYPE_NAP),
|
||||
.values_static = NM_MAKE_STRV (NM_SETTING_BLUETOOTH_TYPE_DUN,
|
||||
NM_SETTING_BLUETOOTH_TYPE_PANU,
|
||||
NM_SETTING_BLUETOOTH_TYPE_NAP),
|
||||
),
|
||||
),
|
||||
NULL
|
||||
|
|
@ -5805,11 +5803,11 @@ static const NMMetaPropertyInfo *const property_infos_CONNECTION[] = {
|
|||
.inf_flags = NM_META_PROPERTY_INF_FLAG_DONT_ASK,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC (NM_SETTING_BOND_SETTING_NAME,
|
||||
NM_SETTING_BRIDGE_SETTING_NAME,
|
||||
NM_SETTING_OVS_BRIDGE_SETTING_NAME,
|
||||
NM_SETTING_OVS_PORT_SETTING_NAME,
|
||||
NM_SETTING_TEAM_SETTING_NAME),
|
||||
.values_static = NM_MAKE_STRV (NM_SETTING_BOND_SETTING_NAME,
|
||||
NM_SETTING_BRIDGE_SETTING_NAME,
|
||||
NM_SETTING_OVS_BRIDGE_SETTING_NAME,
|
||||
NM_SETTING_OVS_PORT_SETTING_NAME,
|
||||
NM_SETTING_TEAM_SETTING_NAME),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES,
|
||||
|
|
@ -5844,7 +5842,7 @@ static const NMMetaPropertyInfo *const property_infos_CONNECTION[] = {
|
|||
.set_fcn = _set_fcn_connection_metered,
|
||||
),
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC ("yes", "no", "unknown"),
|
||||
.values_static = NM_MAKE_STRV ("yes", "no", "unknown"),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_LLDP,
|
||||
|
|
@ -5897,7 +5895,7 @@ static const NMMetaPropertyInfo *const property_infos_DCB[] = {
|
|||
PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_APP_FCOE_MODE,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC (NM_SETTING_DCB_FCOE_MODE_FABRIC,
|
||||
.values_static = NM_MAKE_STRV (NM_SETTING_DCB_FCOE_MODE_FABRIC,
|
||||
NM_SETTING_DCB_FCOE_MODE_VN2VN),
|
||||
),
|
||||
),
|
||||
|
|
@ -6127,7 +6125,7 @@ static const NMMetaPropertyInfo *const property_infos_INFINIBAND[] = {
|
|||
.def_hint = NM_META_TEXT_PROMPT_IB_MODE_CHOICES,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC ("datagram", "connected"),
|
||||
.values_static = NM_MAKE_STRV ("datagram", "connected"),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_INFINIBAND_P_KEY,
|
||||
|
|
@ -6727,7 +6725,7 @@ static const NMMetaPropertyInfo *const property_infos_OVS_BRIDGE[] = {
|
|||
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_BRIDGE_FAIL_MODE,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC ("secure", "standalone"),
|
||||
.values_static = NM_MAKE_STRV ("secure", "standalone"),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_BRIDGE_MCAST_SNOOPING_ENABLE,
|
||||
|
|
@ -6748,7 +6746,7 @@ static const NMMetaPropertyInfo *const property_infos_OVS_INTERFACE[] = {
|
|||
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_INTERFACE_TYPE,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC ("internal", "patch"),
|
||||
.values_static = NM_MAKE_STRV ("internal", "patch"),
|
||||
),
|
||||
),
|
||||
NULL
|
||||
|
|
@ -6769,7 +6767,7 @@ static const NMMetaPropertyInfo *const property_infos_OVS_PORT[] = {
|
|||
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_PORT_VLAN_MODE,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC ("access", "native-tagged", "native-untagged", "trunk"),
|
||||
.values_static = NM_MAKE_STRV ("access", "native-tagged", "native-untagged", "trunk"),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_PORT_TAG,
|
||||
|
|
@ -6778,13 +6776,13 @@ static const NMMetaPropertyInfo *const property_infos_OVS_PORT[] = {
|
|||
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_PORT_LACP,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC ("active", "off", "passive"),
|
||||
.values_static = NM_MAKE_STRV ("active", "off", "passive"),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_PORT_BOND_MODE,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC ("active-backup", "balance-slb", "balance-tcp"),
|
||||
.values_static = NM_MAKE_STRV ("active-backup", "balance-slb", "balance-tcp"),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_PORT_BOND_UPDELAY,
|
||||
|
|
@ -6980,20 +6978,20 @@ static const NMMetaPropertyInfo *const property_infos_TEAM[] = {
|
|||
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_RUNNER,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC (NM_SETTING_TEAM_RUNNER_BROADCAST,
|
||||
NM_SETTING_TEAM_RUNNER_ROUNDROBIN,
|
||||
NM_SETTING_TEAM_RUNNER_RANDOM,
|
||||
NM_SETTING_TEAM_RUNNER_ACTIVEBACKUP,
|
||||
NM_SETTING_TEAM_RUNNER_LOADBALANCE,
|
||||
NM_SETTING_TEAM_RUNNER_LACP),
|
||||
.values_static = NM_MAKE_STRV (NM_SETTING_TEAM_RUNNER_BROADCAST,
|
||||
NM_SETTING_TEAM_RUNNER_ROUNDROBIN,
|
||||
NM_SETTING_TEAM_RUNNER_RANDOM,
|
||||
NM_SETTING_TEAM_RUNNER_ACTIVEBACKUP,
|
||||
NM_SETTING_TEAM_RUNNER_LOADBALANCE,
|
||||
NM_SETTING_TEAM_RUNNER_LACP),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_RUNNER_HWADDR_POLICY,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC (NM_SETTING_TEAM_RUNNER_HWADDR_POLICY_SAME_ALL,
|
||||
NM_SETTING_TEAM_RUNNER_HWADDR_POLICY_BY_ACTIVE,
|
||||
NM_SETTING_TEAM_RUNNER_HWADDR_POLICY_ONLY_ACTIVE),
|
||||
.values_static = NM_MAKE_STRV (NM_SETTING_TEAM_RUNNER_HWADDR_POLICY_SAME_ALL,
|
||||
NM_SETTING_TEAM_RUNNER_HWADDR_POLICY_BY_ACTIVE,
|
||||
NM_SETTING_TEAM_RUNNER_HWADDR_POLICY_ONLY_ACTIVE),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_RUNNER_TX_HASH,
|
||||
|
|
@ -7006,7 +7004,7 @@ static const NMMetaPropertyInfo *const property_infos_TEAM[] = {
|
|||
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_RUNNER_TX_BALANCER,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC ("basic"),
|
||||
.values_static = NM_MAKE_STRV ("basic"),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_RUNNER_TX_BALANCER_INTERVAL,
|
||||
|
|
@ -7051,11 +7049,11 @@ static const NMMetaPropertyInfo *const property_infos_TEAM[] = {
|
|||
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC (NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_LACP_PRIO,
|
||||
NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_LACP_PRIO_STABLE,
|
||||
NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_BANDWIDTH,
|
||||
NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_COUNT,
|
||||
NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_PORT_CONFIG),
|
||||
.values_static = NM_MAKE_STRV (NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_LACP_PRIO,
|
||||
NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_LACP_PRIO_STABLE,
|
||||
NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_BANDWIDTH,
|
||||
NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_COUNT,
|
||||
NM_SETTING_TEAM_RUNNER_AGG_SELECT_POLICY_PORT_CONFIG),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_LINK_WATCHERS,
|
||||
|
|
@ -7466,7 +7464,7 @@ static const NMMetaPropertyInfo *const property_infos_WIRED[] = {
|
|||
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_DUPLEX,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC ("half", "full"),
|
||||
.values_static = NM_MAKE_STRV ("half", "full"),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_AUTO_NEGOTIATE,
|
||||
|
|
@ -7518,7 +7516,7 @@ static const NMMetaPropertyInfo *const property_infos_WIRED[] = {
|
|||
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_S390_NETTYPE,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC ("qeth", "lcs", "ctc"),
|
||||
.values_static = NM_MAKE_STRV ("qeth", "lcs", "ctc"),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_S390_OPTIONS,
|
||||
|
|
@ -7580,15 +7578,15 @@ static const NMMetaPropertyInfo *const property_infos_WIRELESS[] = {
|
|||
.def_hint = NM_META_TEXT_PROMPT_WIFI_MODE_CHOICES,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC (NM_SETTING_WIRELESS_MODE_INFRA,
|
||||
NM_SETTING_WIRELESS_MODE_ADHOC,
|
||||
NM_SETTING_WIRELESS_MODE_AP),
|
||||
.values_static = NM_MAKE_STRV (NM_SETTING_WIRELESS_MODE_INFRA,
|
||||
NM_SETTING_WIRELESS_MODE_ADHOC,
|
||||
NM_SETTING_WIRELESS_MODE_AP),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_BAND,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC ("a", "bg"),
|
||||
.values_static = NM_MAKE_STRV ("a", "bg"),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_CHANNEL,
|
||||
|
|
@ -7690,7 +7688,7 @@ static const NMMetaPropertyInfo *const property_infos_WIRELESS_SECURITY[] = {
|
|||
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_KEY_MGMT,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC ("none", "ieee8021x", "wpa-none", "wpa-psk", "wpa-eap"),
|
||||
.values_static = NM_MAKE_STRV ("none", "ieee8021x", "wpa-none", "wpa-psk", "wpa-eap"),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX,
|
||||
|
|
@ -7699,7 +7697,7 @@ static const NMMetaPropertyInfo *const property_infos_WIRELESS_SECURITY[] = {
|
|||
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_AUTH_ALG,
|
||||
.property_type = &_pt_gobject_string,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA (
|
||||
.values_static = VALUES_STATIC ("open", "shared", "leap"),
|
||||
.values_static = NM_MAKE_STRV ("open", "shared", "leap"),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_PROTO,
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ struct IsoLangToEncodings
|
|||
const char *const *encodings;
|
||||
};
|
||||
|
||||
#define LANG_ENCODINGS(l, ...) { .lang = l, .encodings = (const char *[]) { __VA_ARGS__, NULL }}
|
||||
#define LANG_ENCODINGS(l, ...) { .lang = l, .encodings = NM_MAKE_STRV (__VA_ARGS__), }
|
||||
|
||||
/* 5-letter language codes */
|
||||
static const struct IsoLangToEncodings isoLangEntries5[] =
|
||||
|
|
|
|||
|
|
@ -421,20 +421,17 @@ create_bond_connection (NMConnection **con, NMSettingBond **s_bond)
|
|||
}
|
||||
|
||||
#define test_verify_options(exp, ...) \
|
||||
G_STMT_START { \
|
||||
const char *__opts[] = { __VA_ARGS__ , NULL }; \
|
||||
\
|
||||
_test_verify_options (__opts, exp); \
|
||||
} G_STMT_END
|
||||
_test_verify_options (NM_MAKE_STRV (__VA_ARGS__), exp)
|
||||
|
||||
static void
|
||||
_test_verify_options (const char **options, gboolean expected_result)
|
||||
_test_verify_options (const char *const *options,
|
||||
gboolean expected_result)
|
||||
{
|
||||
gs_unref_object NMConnection *con = NULL;
|
||||
NMSettingBond *s_bond;
|
||||
GError *error = NULL;
|
||||
gboolean success;
|
||||
const char **option;
|
||||
const char *const *option;
|
||||
|
||||
create_bond_connection (&con, &s_bond);
|
||||
|
||||
|
|
|
|||
|
|
@ -672,7 +672,15 @@ ipv6.ip6-privacy=0
|
|||
(see <link linkend='nm-settings'><citerefentry><refentrytitle>nm-settings</refentrytitle><manvolnum>5</manvolnum></citerefentry></link> for details).
|
||||
A default value is only consulted if the corresponding per-connection value
|
||||
explicitly allows for that.
|
||||
<!-- The following comment is used by check-config-options.sh, don't remove it. -->
|
||||
<!-- start connection defaults -->
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><varname>802-1x.auth-timeout</varname></term>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>cdma.mtu</varname></term>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>connection.auth-retries</varname></term>
|
||||
<listitem><para>If left unspecified, the default value is 3 tries before failing the connection.
|
||||
|
|
@ -707,6 +715,9 @@ ipv6.ip6-privacy=0
|
|||
<varlistentry>
|
||||
<term><varname>ethernet.wake-on-lan</varname></term>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>gsm.mtu</varname></term>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>infiniband.mtu</varname></term>
|
||||
<listitem><para>If configured explicitly to 0, the MTU is not reconfigured during device activation unless it is required due to IPv6 constraints. If left unspecified, a DHCP/IPv6 SLAAC provided value is used or the MTU is left unspecified on activation.</para></listitem>
|
||||
|
|
@ -811,7 +822,12 @@ ipv6.ip6-privacy=0
|
|||
<listitem><para>If left unspecified, the default value
|
||||
"<literal>optional</literal>" will be used.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>wifi.wake-on-wlan</varname></term>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<!-- The following comment is used by check-config-options.sh, don't remove it. -->
|
||||
<!-- end connection defaults -->
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
|
|
|
|||
|
|
@ -32,19 +32,21 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define _nm_packed __attribute__ ((packed))
|
||||
#define _nm_unused __attribute__ ((unused))
|
||||
#define _nm_pure __attribute__ ((pure))
|
||||
#define _nm_const __attribute__ ((const))
|
||||
#define _nm_packed __attribute__ ((__packed__))
|
||||
#define _nm_unused __attribute__ ((__unused__))
|
||||
#define _nm_used __attribute__ ((__used__))
|
||||
#define _nm_pure __attribute__ ((__pure__))
|
||||
#define _nm_const __attribute__ ((__const__))
|
||||
#define _nm_printf(a,b) __attribute__ ((__format__ (__printf__, a, b)))
|
||||
#define _nm_align(s) __attribute__ ((aligned (s)))
|
||||
#define _nm_align(s) __attribute__ ((__aligned__ (s)))
|
||||
#define _nm_section(s) __attribute__ ((__section__ (s)))
|
||||
#define _nm_alignof(type) __alignof (type)
|
||||
#define _nm_alignas(type) _nm_align (_nm_alignof (type))
|
||||
#define nm_auto(fcn) __attribute__ ((cleanup(fcn)))
|
||||
#define nm_auto(fcn) __attribute__ ((__cleanup__(fcn)))
|
||||
|
||||
|
||||
#if __GNUC__ >= 7
|
||||
#define _nm_fallthrough __attribute__ ((fallthrough))
|
||||
#define _nm_fallthrough __attribute__ ((__fallthrough__))
|
||||
#else
|
||||
#define _nm_fallthrough
|
||||
#endif
|
||||
|
|
@ -639,8 +641,11 @@ NM_G_ERROR_MSG (GError *error)
|
|||
#define NM_PROPAGATE_CONST(test_expr, ptr) (ptr)
|
||||
#endif
|
||||
|
||||
/* with the way it is implemented, the caller may or may not pass a trailing
|
||||
* ',' and it will work. However, this makes the macro unsuitable for initializing
|
||||
* an array. */
|
||||
#define NM_MAKE_STRV(...) \
|
||||
((const char *const[]) { __VA_ARGS__, NULL })
|
||||
((const char *const[(sizeof (((const char *const[]) { __VA_ARGS__ })) / sizeof (const char *)) + 1]) { __VA_ARGS__ })
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,46 @@ test_nmhash (void)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
static const char *
|
||||
_make_strv_foo (void)
|
||||
{
|
||||
return "foo";
|
||||
}
|
||||
|
||||
static const char *const*const _tst_make_strv_1 = NM_MAKE_STRV ("1", "2");
|
||||
|
||||
static void
|
||||
test_make_strv (void)
|
||||
{
|
||||
const char *const*v1a = NM_MAKE_STRV ("a");
|
||||
const char *const*v1b = NM_MAKE_STRV ("a", );
|
||||
const char *const*v2a = NM_MAKE_STRV ("a", "b");
|
||||
const char *const*v2b = NM_MAKE_STRV ("a", "b", );
|
||||
const char *const v3[] = { "a", "b", };
|
||||
const char *const*v4b = NM_MAKE_STRV ("a", _make_strv_foo (), );
|
||||
|
||||
g_assert (NM_PTRARRAY_LEN (v1a) == 1);
|
||||
g_assert (NM_PTRARRAY_LEN (v1b) == 1);
|
||||
g_assert (NM_PTRARRAY_LEN (v2a) == 2);
|
||||
g_assert (NM_PTRARRAY_LEN (v2b) == 2);
|
||||
|
||||
g_assert (NM_PTRARRAY_LEN (_tst_make_strv_1) == 2);
|
||||
g_assert_cmpstr (_tst_make_strv_1[0], ==, "1");
|
||||
g_assert_cmpstr (_tst_make_strv_1[1], ==, "2");
|
||||
/* writing the static read-only variable leads to crash .*/
|
||||
//((char **) _tst_make_strv_1)[0] = NULL;
|
||||
//((char **) _tst_make_strv_1)[2] = "c";
|
||||
|
||||
G_STATIC_ASSERT_EXPR (G_N_ELEMENTS (v3) == 2);
|
||||
|
||||
g_assert (NM_PTRARRAY_LEN (v4b) == 2);
|
||||
|
||||
G_STATIC_ASSERT_EXPR (G_N_ELEMENTS (NM_MAKE_STRV ("a", "b" )) == 3);
|
||||
G_STATIC_ASSERT_EXPR (G_N_ELEMENTS (NM_MAKE_STRV ("a", "b", )) == 3);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
NMTST_DEFINE ();
|
||||
|
||||
int main (int argc, char **argv)
|
||||
|
|
@ -70,6 +110,7 @@ int main (int argc, char **argv)
|
|||
|
||||
g_test_add_func ("/general/test_monotonic_timestamp", test_monotonic_timestamp);
|
||||
g_test_add_func ("/general/test_nmhash", test_nmhash);
|
||||
g_test_add_func ("/general/test_nm_make_strv", test_make_strv);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1216,7 +1216,7 @@ wake_on_lan_enable (NMDevice *device)
|
|||
}
|
||||
|
||||
wol = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
|
||||
"ethernet.wake-on-lan",
|
||||
NM_CON_DEFAULT ("ethernet.wake-on-lan"),
|
||||
device,
|
||||
NM_SETTING_WIRED_WAKE_ON_LAN_NONE,
|
||||
G_MAXINT32,
|
||||
|
|
|
|||
|
|
@ -147,9 +147,9 @@ void nm_device_commit_mtu (NMDevice *self);
|
|||
)
|
||||
|
||||
gboolean _nm_device_hash_check_invalid_keys (GHashTable *hash, const char *setting_name,
|
||||
GError **error, const char **whitelist);
|
||||
GError **error, const char *const*whitelist);
|
||||
#define nm_device_hash_check_invalid_keys(hash, setting_name, error, ...) \
|
||||
_nm_device_hash_check_invalid_keys (hash, setting_name, error, ((const char *[]) { __VA_ARGS__, NULL }))
|
||||
_nm_device_hash_check_invalid_keys (hash, setting_name, error, NM_MAKE_STRV (__VA_ARGS__))
|
||||
|
||||
gboolean nm_device_match_parent (NMDevice *device, const char *parent);
|
||||
gboolean nm_device_match_parent_hwaddr (NMDevice *device,
|
||||
|
|
|
|||
|
|
@ -1120,8 +1120,8 @@ init_ip_config_dns_priority (NMDevice *self, NMIPConfig *config)
|
|||
int priority;
|
||||
|
||||
property = (nm_ip_config_get_addr_family (config) == AF_INET)
|
||||
? "ipv4.dns-priority"
|
||||
: "ipv6.dns-priority";
|
||||
? NM_CON_DEFAULT ("ipv4.dns-priority")
|
||||
: NM_CON_DEFAULT ("ipv6.dns-priority");
|
||||
|
||||
priority = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
|
||||
property,
|
||||
|
|
@ -1279,7 +1279,7 @@ _get_stable_id (NMDevice *self,
|
|||
|
||||
if (!stable_id) {
|
||||
default_id = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
|
||||
"connection.stable-id",
|
||||
NM_CON_DEFAULT ("connection.stable-id"),
|
||||
self);
|
||||
stable_id = default_id;
|
||||
}
|
||||
|
|
@ -2165,7 +2165,9 @@ nm_device_get_route_metric (NMDevice *self,
|
|||
/* use the current NMConfigData, which makes this configuration reloadable.
|
||||
* Note that that means that the route-metric might change between SIGHUP.
|
||||
* You must cache the returned value if that is a problem. */
|
||||
property = addr_family == AF_INET ? "ipv4.route-metric" : "ipv6.route-metric";
|
||||
property = addr_family == AF_INET
|
||||
? NM_CON_DEFAULT ("ipv4.route-metric")
|
||||
: NM_CON_DEFAULT ("ipv6.route-metric");
|
||||
route_metric = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
|
||||
property,
|
||||
self,
|
||||
|
|
@ -2195,7 +2197,7 @@ _get_mdns (NMDevice *self)
|
|||
return mdns;
|
||||
|
||||
return nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
|
||||
"connection.mdns",
|
||||
NM_CON_DEFAULT ("connection.mdns"),
|
||||
self,
|
||||
NM_SETTING_CONNECTION_MDNS_NO,
|
||||
NM_SETTING_CONNECTION_MDNS_YES,
|
||||
|
|
@ -2217,7 +2219,7 @@ _get_llmnr (NMDevice *self)
|
|||
return llmnr;
|
||||
|
||||
return nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
|
||||
"connection.llmnr",
|
||||
NM_CON_DEFAULT ("connection.llmnr"),
|
||||
self,
|
||||
NM_SETTING_CONNECTION_LLMNR_NO,
|
||||
NM_SETTING_CONNECTION_LLMNR_YES,
|
||||
|
|
@ -2266,7 +2268,9 @@ nm_device_get_route_table (NMDevice *self,
|
|||
if (route_table == 0) {
|
||||
const char *property;
|
||||
|
||||
property = addr_family == AF_INET ? "ipv4.route-table" : "ipv6.route-table";
|
||||
property = addr_family == AF_INET
|
||||
? NM_CON_DEFAULT ("ipv4.route-table")
|
||||
: NM_CON_DEFAULT ("ipv6.route-table");
|
||||
route_table = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
|
||||
property,
|
||||
self,
|
||||
|
|
@ -6150,7 +6154,7 @@ lldp_rx_enabled (NMDevice *self)
|
|||
lldp = nm_setting_connection_get_lldp (s_con);
|
||||
if (lldp == NM_SETTING_CONNECTION_LLDP_DEFAULT) {
|
||||
lldp = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
|
||||
"connection.lldp",
|
||||
NM_CON_DEFAULT ("connection.lldp"),
|
||||
self,
|
||||
NM_SETTING_CONNECTION_LLDP_DEFAULT,
|
||||
NM_SETTING_CONNECTION_LLDP_ENABLE_RX,
|
||||
|
|
@ -6254,7 +6258,7 @@ act_stage1_prepare (NMDevice *self, NMDeviceStateReason *out_failure_reason)
|
|||
autoprobe = nm_setting_sriov_get_autoprobe_drivers (s_sriov);
|
||||
if (autoprobe == NM_TERNARY_DEFAULT) {
|
||||
autoprobe = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
|
||||
"sriov.autoprobe-drivers",
|
||||
NM_CON_DEFAULT ("sriov.autoprobe-drivers"),
|
||||
self,
|
||||
NM_TERNARY_FALSE,
|
||||
NM_TERNARY_TRUE,
|
||||
|
|
@ -6624,7 +6628,7 @@ get_ipv4_dad_timeout (NMDevice *self)
|
|||
return timeout;
|
||||
|
||||
return nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
|
||||
"ipv4.dad-timeout",
|
||||
NM_CON_DEFAULT ("ipv4.dad-timeout"),
|
||||
self,
|
||||
0,
|
||||
NM_SETTING_IP_CONFIG_DAD_TIMEOUT_MAX,
|
||||
|
|
@ -7489,8 +7493,8 @@ get_dhcp_timeout (NMDevice *self, int addr_family)
|
|||
|
||||
timeout = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
|
||||
addr_family == AF_INET
|
||||
? "ipv4.dhcp-timeout"
|
||||
: "ipv6.dhcp-timeout",
|
||||
? NM_CON_DEFAULT ("ipv4.dhcp-timeout")
|
||||
: NM_CON_DEFAULT ("ipv6.dhcp-timeout"),
|
||||
self,
|
||||
0, G_MAXINT32, 0);
|
||||
if (timeout)
|
||||
|
|
@ -7536,7 +7540,8 @@ dhcp4_get_client_id (NMDevice *self,
|
|||
|
||||
if (!client_id) {
|
||||
client_id_default = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
|
||||
"ipv4.dhcp-client-id", self);
|
||||
NM_CON_DEFAULT ("ipv4.dhcp-client-id"),
|
||||
self);
|
||||
if (client_id_default && client_id_default[0]) {
|
||||
/* a non-empty client-id is always valid, see nm_dhcp_utils_client_id_string_to_bytes(). */
|
||||
client_id = client_id_default;
|
||||
|
|
@ -8352,7 +8357,8 @@ dhcp6_get_duid (NMDevice *self, NMConnection *connection, GBytes *hwaddr, gboole
|
|||
|
||||
if (!duid) {
|
||||
duid_default = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
|
||||
"ipv6.dhcp-duid", self);
|
||||
NM_CON_DEFAULT ("ipv6.dhcp-duid"),
|
||||
self);
|
||||
duid = duid_default;
|
||||
if (!duid)
|
||||
duid = "lease";
|
||||
|
|
@ -8913,19 +8919,19 @@ nm_device_get_configured_mtu_from_connection (NMDevice *self,
|
|||
if (setting_type == NM_TYPE_SETTING_WIRED) {
|
||||
if (setting)
|
||||
mtu = nm_setting_wired_get_mtu (NM_SETTING_WIRED (setting));
|
||||
global_property_name = "ethernet.mtu";
|
||||
global_property_name = NM_CON_DEFAULT ("ethernet.mtu");
|
||||
} else if (setting_type == NM_TYPE_SETTING_WIRELESS) {
|
||||
if (setting)
|
||||
mtu = nm_setting_wireless_get_mtu (NM_SETTING_WIRELESS (setting));
|
||||
global_property_name = "wifi.mtu";
|
||||
global_property_name = NM_CON_DEFAULT ("wifi.mtu");
|
||||
} else if (setting_type == NM_TYPE_SETTING_INFINIBAND) {
|
||||
if (setting)
|
||||
mtu = nm_setting_infiniband_get_mtu (NM_SETTING_INFINIBAND (setting));
|
||||
global_property_name = "infiniband.mtu";
|
||||
global_property_name = NM_CON_DEFAULT ("infiniband.mtu");
|
||||
} else if (setting_type == NM_TYPE_SETTING_IP_TUNNEL) {
|
||||
if (setting)
|
||||
mtu = nm_setting_ip_tunnel_get_mtu (NM_SETTING_IP_TUNNEL (setting));
|
||||
global_property_name = "ip-tunnel.mtu";
|
||||
global_property_name = NM_CON_DEFAULT ("ip-tunnel.mtu");
|
||||
} else
|
||||
g_return_val_if_reached (0);
|
||||
|
||||
|
|
@ -9606,7 +9612,7 @@ _ip6_privacy_get (NMDevice *self)
|
|||
|
||||
/* 2.) use the default value from the configuration. */
|
||||
ip6_privacy = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
|
||||
"ipv6.ip6-privacy",
|
||||
NM_CON_DEFAULT ("ipv6.ip6-privacy"),
|
||||
self,
|
||||
NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN,
|
||||
NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR,
|
||||
|
|
@ -10757,8 +10763,10 @@ _cleanup_ip_pre (NMDevice *self, int addr_family, CleanupType cleanup_type)
|
|||
}
|
||||
|
||||
gboolean
|
||||
_nm_device_hash_check_invalid_keys (GHashTable *hash, const char *setting_name,
|
||||
GError **error, const char **whitelist)
|
||||
_nm_device_hash_check_invalid_keys (GHashTable *hash,
|
||||
const char *setting_name,
|
||||
GError **error,
|
||||
const char *const*whitelist)
|
||||
{
|
||||
guint found_whitelisted_keys = 0;
|
||||
guint i;
|
||||
|
|
@ -15296,7 +15304,9 @@ _get_cloned_mac_address_setting (NMDevice *self, NMConnection *connection, gbool
|
|||
gs_free char *a = NULL;
|
||||
|
||||
a = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
|
||||
is_wifi ? "wifi.cloned-mac-address" : "ethernet.cloned-mac-address",
|
||||
is_wifi
|
||||
? NM_CON_DEFAULT ("wifi.cloned-mac-address")
|
||||
: NM_CON_DEFAULT ("ethernet.cloned-mac-address"),
|
||||
self);
|
||||
|
||||
addr = NM_CLONED_MAC_PRESERVE;
|
||||
|
|
@ -15307,7 +15317,7 @@ _get_cloned_mac_address_setting (NMDevice *self, NMConnection *connection, gbool
|
|||
|
||||
/* for backward compatibility, read the deprecated wifi.mac-address-randomization setting. */
|
||||
a = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
|
||||
"wifi." NM_SETTING_WIRELESS_MAC_ADDRESS_RANDOMIZATION,
|
||||
NM_CON_DEFAULT ("wifi.mac-address-randomization"),
|
||||
self);
|
||||
v = _nm_utils_ascii_str_to_int64 (a, 10,
|
||||
NM_SETTING_MAC_RANDOMIZATION_DEFAULT,
|
||||
|
|
@ -15344,7 +15354,9 @@ _get_generate_mac_address_mask_setting (NMDevice *self, NMConnection *connection
|
|||
}
|
||||
|
||||
a = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA,
|
||||
is_wifi ? "wifi.generate-mac-address-mask" : "ethernet.generate-mac-mac-address-mask",
|
||||
is_wifi
|
||||
? NM_CON_DEFAULT ("wifi.generate-mac-address-mask")
|
||||
: NM_CON_DEFAULT ("ethernet.generate-mac-address-mask"),
|
||||
self);
|
||||
if (!a)
|
||||
return NULL;
|
||||
|
|
@ -15862,7 +15874,7 @@ nm_device_get_supplicant_timeout (NMDevice *self)
|
|||
}
|
||||
|
||||
return nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
|
||||
"802-1x.auth-timeout",
|
||||
NM_CON_DEFAULT ("802-1x.auth-timeout"),
|
||||
self,
|
||||
1,
|
||||
G_MAXINT32,
|
||||
|
|
@ -15890,7 +15902,7 @@ nm_device_auth_retries_try_next (NMDevice *self)
|
|||
|
||||
if (auth_retries == -1) {
|
||||
auth_retries = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
|
||||
"connection.auth-retries",
|
||||
NM_CON_DEFAULT ("connection.auth-retries"),
|
||||
self,
|
||||
-1, G_MAXINT32, -1);
|
||||
}
|
||||
|
|
@ -16947,3 +16959,11 @@ nm_device_class_init (NMDeviceClass *klass)
|
|||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
}
|
||||
|
||||
/* Connection defaults from plugins */
|
||||
NM_CON_DEFAULT_NOP ("cdma.mtu");
|
||||
NM_CON_DEFAULT_NOP ("gsm.mtu");
|
||||
NM_CON_DEFAULT_NOP ("wifi.powersave");
|
||||
NM_CON_DEFAULT_NOP ("wifi.wake-on-wlan");
|
||||
NM_CON_DEFAULT_NOP ("wifi-sec.pmf");
|
||||
NM_CON_DEFAULT_NOP ("wifi-sec.fils");
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ nm_main_config_reload (int signal)
|
|||
*
|
||||
* Hence, a NMConfig singleton instance must always be
|
||||
* available. */
|
||||
nm_config_reload (nm_config_get (), reload_flags);
|
||||
nm_config_reload (nm_config_get (), reload_flags, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -232,6 +232,7 @@ main (int argc, char *argv[])
|
|||
NMConfigCmdLineOptions *config_cli;
|
||||
guint sd_id = 0;
|
||||
GError *error_invalid_logging_config = NULL;
|
||||
const char *const *warnings;
|
||||
|
||||
/* Known to cause a possible deadlock upon GDBus initialization:
|
||||
* https://bugzilla.gnome.org/show_bug.cgi?id=674885 */
|
||||
|
|
@ -376,6 +377,11 @@ main (int argc, char *argv[])
|
|||
nm_clear_g_free (&bad_domains);
|
||||
}
|
||||
|
||||
warnings = nm_config_get_warnings (config);
|
||||
for ( ; warnings && *warnings; warnings++)
|
||||
nm_log_warn (LOGD_CORE, "config: %s", *warnings);
|
||||
nm_config_clear_warnings (config);
|
||||
|
||||
/* the first access to State causes the file to be read (and possibly print a warning) */
|
||||
nm_config_state_get (config);
|
||||
|
||||
|
|
|
|||
|
|
@ -309,3 +309,9 @@ if enable_tests
|
|||
env: ['LD_BIND_NOW=1', 'LD_PRELOAD=' + plugin.full_path()])
|
||||
endforeach
|
||||
endif
|
||||
|
||||
test(
|
||||
'check-config-options',
|
||||
find_program(join_paths(meson.source_root(), 'tools', 'check-config-options.sh')),
|
||||
args: [meson.source_root()]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ init_auditd (NMAuditManager *self)
|
|||
NMConfigData *data = nm_config_get_data (priv->config);
|
||||
|
||||
if (nm_config_data_get_value_boolean (data, NM_CONFIG_KEYFILE_GROUP_LOGGING,
|
||||
NM_CONFIG_KEYFILE_KEY_AUDIT,
|
||||
NM_CONFIG_KEYFILE_KEY_LOGGING_AUDIT,
|
||||
NM_CONFIG_DEFAULT_LOGGING_AUDIT_BOOL)) {
|
||||
if (priv->auditd_fd < 0) {
|
||||
priv->auditd_fd = audit_open ();
|
||||
|
|
|
|||
|
|
@ -922,7 +922,10 @@ load_global_dns (GKeyFile *keyfile, gboolean internal)
|
|||
dns_config->domains = g_hash_table_new_full (nm_str_hash, g_str_equal,
|
||||
g_free, (GDestroyNotify) global_dns_domain_free);
|
||||
|
||||
strv = g_key_file_get_string_list (keyfile, group, "searches", NULL, NULL);
|
||||
strv = g_key_file_get_string_list (keyfile,
|
||||
group,
|
||||
NM_CONFIG_KEYFILE_KEY_GLOBAL_DNS_SEARCHES,
|
||||
NULL, NULL);
|
||||
if (strv) {
|
||||
_nm_utils_strv_cleanup (strv, TRUE, TRUE, TRUE);
|
||||
if (!strv[0])
|
||||
|
|
@ -931,7 +934,10 @@ load_global_dns (GKeyFile *keyfile, gboolean internal)
|
|||
dns_config->searches = strv;
|
||||
}
|
||||
|
||||
strv = g_key_file_get_string_list (keyfile, group, "options", NULL, NULL);
|
||||
strv = g_key_file_get_string_list (keyfile,
|
||||
group,
|
||||
NM_CONFIG_KEYFILE_KEY_GLOBAL_DNS_OPTIONS,
|
||||
NULL, NULL);
|
||||
if (strv) {
|
||||
_nm_utils_strv_cleanup (strv, TRUE, TRUE, TRUE);
|
||||
for (i = 0, j = 0; strv[i]; i++) {
|
||||
|
|
@ -958,7 +964,10 @@ load_global_dns (GKeyFile *keyfile, gboolean internal)
|
|||
|| !groups[g][domain_prefix_len])
|
||||
continue;
|
||||
|
||||
strv = g_key_file_get_string_list (keyfile, groups[g], "servers", NULL, NULL);
|
||||
strv = g_key_file_get_string_list (keyfile,
|
||||
groups[g],
|
||||
NM_CONFIG_KEYFILE_KEY_GLOBAL_DNS_DOMAIN_SERVERS,
|
||||
NULL, NULL);
|
||||
if (strv) {
|
||||
_nm_utils_strv_cleanup (strv, TRUE, TRUE, TRUE);
|
||||
for (i = 0, j = 0; strv[i]; i++) {
|
||||
|
|
@ -979,7 +988,10 @@ load_global_dns (GKeyFile *keyfile, gboolean internal)
|
|||
if (!servers)
|
||||
continue;
|
||||
|
||||
strv = g_key_file_get_string_list (keyfile, groups[g], "options", NULL, NULL);
|
||||
strv = g_key_file_get_string_list (keyfile,
|
||||
groups[g],
|
||||
NM_CONFIG_KEYFILE_KEY_GLOBAL_DNS_DOMAIN_OPTIONS,
|
||||
NULL, NULL);
|
||||
if (strv) {
|
||||
options = _nm_utils_strv_cleanup (strv, TRUE, TRUE, TRUE);
|
||||
if (!options[0])
|
||||
|
|
@ -1374,6 +1386,19 @@ nm_config_data_get_connection_default (const NMConfigData *self,
|
|||
|
||||
priv = NM_CONFIG_DATA_GET_PRIVATE (self);
|
||||
|
||||
#if NM_MORE_ASSERTS > 10
|
||||
{
|
||||
const char **ptr;
|
||||
|
||||
for (ptr = __start_connection_defaults; ptr < __stop_connection_defaults; ptr++) {
|
||||
if (nm_streq (property, *ptr))
|
||||
break;
|
||||
}
|
||||
|
||||
nm_assert (ptr < __stop_connection_defaults);
|
||||
}
|
||||
#endif
|
||||
|
||||
_match_section_infos_lookup (&priv->connection_infos[0],
|
||||
priv->keyfile,
|
||||
property,
|
||||
|
|
@ -1406,9 +1431,12 @@ _get_connection_info_init (MatchSectionInfo *connection_info, GKeyFile *keyfile,
|
|||
|
||||
connection_info->match_device.spec = nm_config_get_match_spec (keyfile,
|
||||
group,
|
||||
"match-device",
|
||||
NM_CONFIG_KEYFILE_KEY_MATCH_DEVICE,
|
||||
&connection_info->match_device.has);
|
||||
connection_info->stop_match = nm_config_keyfile_get_boolean (keyfile, group, "stop-match", FALSE);
|
||||
connection_info->stop_match = nm_config_keyfile_get_boolean (keyfile,
|
||||
group,
|
||||
NM_CONFIG_KEYFILE_KEY_STOP_MATCH,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1651,28 +1679,58 @@ constructed (GObject *object)
|
|||
priv->connection_infos = _match_section_infos_construct (priv->keyfile, NM_CONFIG_KEYFILE_GROUPPREFIX_CONNECTION);
|
||||
priv->device_infos = _match_section_infos_construct (priv->keyfile, NM_CONFIG_KEYFILE_GROUPPREFIX_DEVICE);
|
||||
|
||||
priv->connectivity.enabled = nm_config_keyfile_get_boolean (priv->keyfile, NM_CONFIG_KEYFILE_GROUP_CONNECTIVITY, "enabled", TRUE);
|
||||
priv->connectivity.uri = nm_strstrip (g_key_file_get_string (priv->keyfile, NM_CONFIG_KEYFILE_GROUP_CONNECTIVITY, "uri", NULL));
|
||||
priv->connectivity.response = g_key_file_get_string (priv->keyfile, NM_CONFIG_KEYFILE_GROUP_CONNECTIVITY, "response", NULL);
|
||||
|
||||
str = nm_config_keyfile_get_value (priv->keyfile, NM_CONFIG_KEYFILE_GROUP_MAIN, NM_CONFIG_KEYFILE_KEY_MAIN_AUTOCONNECT_RETRIES_DEFAULT, NM_CONFIG_GET_VALUE_NONE);
|
||||
priv->connectivity.enabled = nm_config_keyfile_get_boolean (priv->keyfile,
|
||||
NM_CONFIG_KEYFILE_GROUP_CONNECTIVITY,
|
||||
NM_CONFIG_KEYFILE_KEY_CONNECTIVITY_ENABLED,
|
||||
TRUE);
|
||||
priv->connectivity.uri = nm_strstrip (g_key_file_get_string (priv->keyfile,
|
||||
NM_CONFIG_KEYFILE_GROUP_CONNECTIVITY,
|
||||
NM_CONFIG_KEYFILE_KEY_CONNECTIVITY_URI,
|
||||
NULL));
|
||||
priv->connectivity.response = g_key_file_get_string (priv->keyfile,
|
||||
NM_CONFIG_KEYFILE_GROUP_CONNECTIVITY,
|
||||
NM_CONFIG_KEYFILE_KEY_CONNECTIVITY_RESPONSE,
|
||||
NULL);
|
||||
str = nm_config_keyfile_get_value (priv->keyfile,
|
||||
NM_CONFIG_KEYFILE_GROUP_MAIN,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_AUTOCONNECT_RETRIES_DEFAULT,
|
||||
NM_CONFIG_GET_VALUE_NONE);
|
||||
priv->autoconnect_retries_default = _nm_utils_ascii_str_to_int64 (str, 10, 0, G_MAXINT32, 4);
|
||||
g_free (str);
|
||||
|
||||
/* On missing config value, fallback to 300. On invalid value, disable connectivity checking by setting
|
||||
* the interval to zero. */
|
||||
str = g_key_file_get_string (priv->keyfile, NM_CONFIG_KEYFILE_GROUP_CONNECTIVITY, "interval", NULL);
|
||||
str = g_key_file_get_string (priv->keyfile,
|
||||
NM_CONFIG_KEYFILE_GROUP_CONNECTIVITY,
|
||||
NM_CONFIG_KEYFILE_KEY_CONNECTIVITY_INTERVAL,
|
||||
NULL);
|
||||
priv->connectivity.interval = _nm_utils_ascii_str_to_int64 (str, 10, 0, G_MAXUINT, NM_CONFIG_DEFAULT_CONNECTIVITY_INTERVAL);
|
||||
g_free (str);
|
||||
|
||||
priv->dns_mode = nm_strstrip (g_key_file_get_string (priv->keyfile, NM_CONFIG_KEYFILE_GROUP_MAIN, "dns", NULL));
|
||||
priv->rc_manager = nm_strstrip (g_key_file_get_string (priv->keyfile, NM_CONFIG_KEYFILE_GROUP_MAIN, "rc-manager", NULL));
|
||||
priv->systemd_resolved = nm_config_keyfile_get_boolean (priv->keyfile, NM_CONFIG_KEYFILE_GROUP_MAIN, "systemd-resolved", TRUE);
|
||||
|
||||
priv->ignore_carrier = nm_config_get_match_spec (priv->keyfile, NM_CONFIG_KEYFILE_GROUP_MAIN, "ignore-carrier", NULL);
|
||||
priv->assume_ipv6ll_only = nm_config_get_match_spec (priv->keyfile, NM_CONFIG_KEYFILE_GROUP_MAIN, "assume-ipv6ll-only", NULL);
|
||||
|
||||
priv->no_auto_default.specs_config = nm_config_get_match_spec (priv->keyfile, NM_CONFIG_KEYFILE_GROUP_MAIN, "no-auto-default", NULL);
|
||||
priv->dns_mode = nm_strstrip (g_key_file_get_string (priv->keyfile,
|
||||
NM_CONFIG_KEYFILE_GROUP_MAIN,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_DNS,
|
||||
NULL));
|
||||
priv->rc_manager = nm_strstrip (g_key_file_get_string (priv->keyfile,
|
||||
NM_CONFIG_KEYFILE_GROUP_MAIN,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_RC_MANAGER,
|
||||
NULL));
|
||||
priv->systemd_resolved = nm_config_keyfile_get_boolean (priv->keyfile,
|
||||
NM_CONFIG_KEYFILE_GROUP_MAIN,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_SYSTEMD_RESOLVED,
|
||||
TRUE);
|
||||
priv->ignore_carrier = nm_config_get_match_spec (priv->keyfile,
|
||||
NM_CONFIG_KEYFILE_GROUP_MAIN,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_IGNORE_CARRIER,
|
||||
NULL);
|
||||
priv->assume_ipv6ll_only = nm_config_get_match_spec (priv->keyfile,
|
||||
NM_CONFIG_KEYFILE_GROUP_MAIN,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_ASSUME_IPV6LL_ONLY,
|
||||
NULL);
|
||||
priv->no_auto_default.specs_config = nm_config_get_match_spec (priv->keyfile,
|
||||
NM_CONFIG_KEYFILE_GROUP_MAIN,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_NO_AUTO_DEFAULT,
|
||||
NULL);
|
||||
|
||||
priv->global_dns = load_global_dns (priv->keyfile_user, FALSE);
|
||||
if (!priv->global_dns)
|
||||
|
|
|
|||
|
|
@ -178,6 +178,21 @@ int nm_config_data_get_sriov_num_vfs (const NMConfigData *self, NMDevice *d
|
|||
|
||||
NMGlobalDnsConfig *nm_config_data_get_global_dns_config (const NMConfigData *self);
|
||||
|
||||
extern const char *__start_connection_defaults[];
|
||||
extern const char *__stop_connection_defaults[];
|
||||
|
||||
#define NM_CON_DEFAULT_NOP(name) \
|
||||
static const char *NM_UNIQ_T (connection_default, NM_UNIQ) \
|
||||
_nm_used _nm_section ("connection_defaults") = "" name
|
||||
|
||||
#define NM_CON_DEFAULT(name) \
|
||||
({ \
|
||||
static const char *__con_default_prop \
|
||||
_nm_used _nm_section ("connection_defaults") = "" name; \
|
||||
\
|
||||
name; \
|
||||
})
|
||||
|
||||
char *nm_config_data_get_connection_default (const NMConfigData *self,
|
||||
const char *property,
|
||||
NMDevice *device);
|
||||
|
|
|
|||
281
src/nm-config.c
281
src/nm-config.c
|
|
@ -130,6 +130,8 @@ typedef struct {
|
|||
* that they are changed outside of NM (at least not while NM is running).
|
||||
* Hence, we read them once, that's it. */
|
||||
GHashTable *device_states;
|
||||
|
||||
char **warnings;
|
||||
} NMConfigPrivate;
|
||||
|
||||
struct _NMConfig {
|
||||
|
|
@ -281,6 +283,18 @@ nm_config_keyfile_set_string_list (GKeyFile *keyfile,
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
const char *const*
|
||||
nm_config_get_warnings (NMConfig *config)
|
||||
{
|
||||
return (const char *const *) NM_CONFIG_GET_PRIVATE (config)->warnings;
|
||||
}
|
||||
|
||||
void
|
||||
nm_config_clear_warnings (NMConfig *config)
|
||||
{
|
||||
g_clear_pointer (&NM_CONFIG_GET_PRIVATE (config)->warnings, g_strfreev);
|
||||
}
|
||||
|
||||
NMConfigData *
|
||||
nm_config_get_data (NMConfig *config)
|
||||
{
|
||||
|
|
@ -704,26 +718,184 @@ static gboolean
|
|||
_setting_is_device_spec (const char *group, const char *key)
|
||||
{
|
||||
#define _IS(group_v, key_v) (strcmp (group, (""group_v)) == 0 && strcmp (key, (""key_v)) == 0)
|
||||
return _IS (NM_CONFIG_KEYFILE_GROUP_MAIN, "no-auto-default")
|
||||
|| _IS (NM_CONFIG_KEYFILE_GROUP_MAIN, "ignore-carrier")
|
||||
|| _IS (NM_CONFIG_KEYFILE_GROUP_MAIN, "assume-ipv6ll-only")
|
||||
|| _IS (NM_CONFIG_KEYFILE_GROUP_KEYFILE, "unmanaged-devices")
|
||||
|| (g_str_has_prefix (group, NM_CONFIG_KEYFILE_GROUPPREFIX_CONNECTION) && !strcmp (key, "match-device"))
|
||||
|| (g_str_has_prefix (group, NM_CONFIG_KEYFILE_GROUPPREFIX_DEVICE ) && !strcmp (key, "match-device"));
|
||||
return _IS (NM_CONFIG_KEYFILE_GROUP_MAIN, NM_CONFIG_KEYFILE_KEY_MAIN_NO_AUTO_DEFAULT)
|
||||
|| _IS (NM_CONFIG_KEYFILE_GROUP_MAIN, NM_CONFIG_KEYFILE_KEY_MAIN_IGNORE_CARRIER)
|
||||
|| _IS (NM_CONFIG_KEYFILE_GROUP_MAIN, NM_CONFIG_KEYFILE_KEY_MAIN_ASSUME_IPV6LL_ONLY)
|
||||
|| _IS (NM_CONFIG_KEYFILE_GROUP_KEYFILE, NM_CONFIG_KEYFILE_KEY_KEYFILE_UNMANAGED_DEVICES)
|
||||
|| (g_str_has_prefix (group, NM_CONFIG_KEYFILE_GROUPPREFIX_CONNECTION) && !strcmp (key, NM_CONFIG_KEYFILE_KEY_MATCH_DEVICE))
|
||||
|| (g_str_has_prefix (group, NM_CONFIG_KEYFILE_GROUPPREFIX_DEVICE ) && !strcmp (key, NM_CONFIG_KEYFILE_KEY_MATCH_DEVICE));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_setting_is_string_list (const char *group, const char *key)
|
||||
{
|
||||
return _IS (NM_CONFIG_KEYFILE_GROUP_MAIN, "plugins")
|
||||
return _IS (NM_CONFIG_KEYFILE_GROUP_MAIN, NM_CONFIG_KEYFILE_KEY_MAIN_PLUGINS)
|
||||
|| _IS (NM_CONFIG_KEYFILE_GROUP_MAIN, NM_CONFIG_KEYFILE_KEY_MAIN_DEBUG)
|
||||
|| _IS (NM_CONFIG_KEYFILE_GROUP_LOGGING, "domains")
|
||||
|| _IS (NM_CONFIG_KEYFILE_GROUP_LOGGING, NM_CONFIG_KEYFILE_KEY_LOGGING_DOMAINS)
|
||||
|| g_str_has_prefix (group, NM_CONFIG_KEYFILE_GROUPPREFIX_TEST_APPEND_STRINGLIST);
|
||||
#undef _IS
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
char *group;
|
||||
const char *const *keys;
|
||||
bool is_prefix:1;
|
||||
bool is_connection:1;
|
||||
} ConfigGroup;
|
||||
|
||||
/* The following comment is used by check-config-options.sh, don't remove it. */
|
||||
/* START OPTION LIST */
|
||||
|
||||
static const ConfigGroup config_groups[] = {
|
||||
{
|
||||
.group = NM_CONFIG_KEYFILE_GROUP_MAIN,
|
||||
.keys = NM_MAKE_STRV (
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_ASSUME_IPV6LL_ONLY,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_AUTH_POLKIT,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_AUTOCONNECT_RETRIES_DEFAULT,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_CONFIGURE_AND_QUIT,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_DEBUG,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_DHCP,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_DNS,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_HOSTNAME_MODE,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_IGNORE_CARRIER,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_MONITOR_CONNECTION_FILES,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_NO_AUTO_DEFAULT,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_PLUGINS,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_RC_MANAGER,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_SLAVES_ORDER,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_SYSTEMD_RESOLVED,
|
||||
),
|
||||
},
|
||||
{
|
||||
.group = NM_CONFIG_KEYFILE_GROUP_LOGGING,
|
||||
.keys = NM_MAKE_STRV (
|
||||
NM_CONFIG_KEYFILE_KEY_LOGGING_AUDIT,
|
||||
NM_CONFIG_KEYFILE_KEY_LOGGING_BACKEND,
|
||||
NM_CONFIG_KEYFILE_KEY_LOGGING_DOMAINS,
|
||||
NM_CONFIG_KEYFILE_KEY_LOGGING_LEVEL,
|
||||
),
|
||||
},
|
||||
{
|
||||
.group = NM_CONFIG_KEYFILE_GROUP_CONNECTIVITY,
|
||||
.keys = NM_MAKE_STRV (
|
||||
NM_CONFIG_KEYFILE_KEY_CONNECTIVITY_ENABLED,
|
||||
NM_CONFIG_KEYFILE_KEY_CONNECTIVITY_INTERVAL,
|
||||
NM_CONFIG_KEYFILE_KEY_CONNECTIVITY_RESPONSE,
|
||||
NM_CONFIG_KEYFILE_KEY_CONNECTIVITY_URI,
|
||||
),
|
||||
},
|
||||
{
|
||||
.group = NM_CONFIG_KEYFILE_GROUP_KEYFILE,
|
||||
.keys = NM_MAKE_STRV (
|
||||
NM_CONFIG_KEYFILE_KEY_KEYFILE_HOSTNAME,
|
||||
NM_CONFIG_KEYFILE_KEY_KEYFILE_PATH,
|
||||
NM_CONFIG_KEYFILE_KEY_KEYFILE_UNMANAGED_DEVICES,
|
||||
),
|
||||
},
|
||||
{
|
||||
.group = NM_CONFIG_KEYFILE_GROUP_IFUPDOWN,
|
||||
.keys = NM_MAKE_STRV (
|
||||
NM_CONFIG_KEYFILE_KEY_IFUPDOWN_MANAGED,
|
||||
),
|
||||
},
|
||||
{
|
||||
.group = NM_CONFIG_KEYFILE_GROUPPREFIX_DEVICE,
|
||||
.is_prefix = TRUE,
|
||||
.keys = NM_MAKE_STRV (
|
||||
NM_CONFIG_KEYFILE_KEY_DEVICE_CARRIER_WAIT_TIMEOUT,
|
||||
NM_CONFIG_KEYFILE_KEY_DEVICE_IGNORE_CARRIER,
|
||||
NM_CONFIG_KEYFILE_KEY_DEVICE_MANAGED,
|
||||
NM_CONFIG_KEYFILE_KEY_DEVICE_SRIOV_NUM_VFS,
|
||||
NM_CONFIG_KEYFILE_KEY_DEVICE_WIFI_BACKEND,
|
||||
NM_CONFIG_KEYFILE_KEY_DEVICE_WIFI_SCAN_RAND_MAC_ADDRESS,
|
||||
NM_CONFIG_KEYFILE_KEY_MATCH_DEVICE,
|
||||
NM_CONFIG_KEYFILE_KEY_STOP_MATCH,
|
||||
),
|
||||
},
|
||||
{
|
||||
.group = NM_CONFIG_KEYFILE_GROUP_GLOBAL_DNS,
|
||||
.keys = NM_MAKE_STRV (
|
||||
NM_CONFIG_KEYFILE_KEY_GLOBAL_DNS_OPTIONS,
|
||||
NM_CONFIG_KEYFILE_KEY_GLOBAL_DNS_SEARCHES,
|
||||
),
|
||||
},
|
||||
{
|
||||
.group = NM_CONFIG_KEYFILE_GROUPPREFIX_GLOBAL_DNS_DOMAIN,
|
||||
.is_prefix = TRUE,
|
||||
.keys = NM_MAKE_STRV (
|
||||
NM_CONFIG_KEYFILE_KEY_GLOBAL_DNS_DOMAIN_SERVERS,
|
||||
NM_CONFIG_KEYFILE_KEY_GLOBAL_DNS_DOMAIN_OPTIONS,
|
||||
),
|
||||
},
|
||||
{
|
||||
.group = NM_CONFIG_KEYFILE_GROUPPREFIX_CONNECTION,
|
||||
.is_prefix = TRUE,
|
||||
.is_connection = TRUE,
|
||||
.keys = NM_MAKE_STRV (
|
||||
NM_CONFIG_KEYFILE_KEY_MATCH_DEVICE,
|
||||
NM_CONFIG_KEYFILE_KEY_STOP_MATCH,
|
||||
),
|
||||
},
|
||||
{ } /* sentinel */
|
||||
};
|
||||
|
||||
/* The following comment is used by check-config-options.sh, don't remove it. */
|
||||
/* END OPTION LIST */
|
||||
|
||||
static gboolean
|
||||
read_config (GKeyFile *keyfile, gboolean is_base_config, const char *dirname, const char *path, GError **error)
|
||||
check_config_key (const char *group, const char *key)
|
||||
{
|
||||
const ConfigGroup *g;
|
||||
const char *const *k;
|
||||
const char **ptr;
|
||||
|
||||
#if NM_MORE_ASSERTS > 10
|
||||
{
|
||||
static gboolean checked = FALSE;
|
||||
const char **ptr1, **ptr2;
|
||||
|
||||
/* check for duplicate elements in the static list */
|
||||
|
||||
if (!checked) {
|
||||
for (ptr1 = __start_connection_defaults; ptr1 < __stop_connection_defaults; ptr1++) {
|
||||
for (ptr2 = ptr1 + 1; ptr2 < __stop_connection_defaults; ptr2++)
|
||||
nm_assert (!nm_streq (*ptr1, *ptr2));
|
||||
}
|
||||
checked = TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for (g = config_groups; g->group; g++) {
|
||||
if ( (!g->is_prefix && nm_streq (group, g->group))
|
||||
|| (g->is_prefix && g_str_has_prefix (group, g->group)))
|
||||
break;
|
||||
}
|
||||
|
||||
if (!g->group)
|
||||
return FALSE;
|
||||
|
||||
for (k = g->keys; *k; k++) {
|
||||
if (nm_streq (key, *k))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g->is_connection) {
|
||||
for (ptr = __start_connection_defaults; ptr < __stop_connection_defaults; ptr++) {
|
||||
if (nm_streq (key, *ptr))
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
read_config (GKeyFile *keyfile, gboolean is_base_config,
|
||||
const char *dirname, const char *path,
|
||||
GPtrArray *warnings, GError **error)
|
||||
{
|
||||
GKeyFile *kf;
|
||||
char **groups, **keys;
|
||||
|
|
@ -892,6 +1064,12 @@ read_config (GKeyFile *keyfile, gboolean is_base_config, const char *dirname, co
|
|||
|
||||
new_value = g_key_file_get_value (kf, group, key, NULL);
|
||||
g_key_file_set_value (keyfile, group, key, new_value);
|
||||
|
||||
if (!check_config_key (group, key)) {
|
||||
g_ptr_array_add (warnings,
|
||||
g_strdup_printf ("unknown key '%s' in section [%s] of file '%s'",
|
||||
key, group, path));
|
||||
}
|
||||
g_free (new_value);
|
||||
}
|
||||
g_strfreev (keys);
|
||||
|
|
@ -906,6 +1084,7 @@ static gboolean
|
|||
read_base_config (GKeyFile *keyfile,
|
||||
const char *cli_config_main_file,
|
||||
char **out_config_main_file,
|
||||
GPtrArray *warnings,
|
||||
GError **error)
|
||||
{
|
||||
GError *my_error = NULL;
|
||||
|
|
@ -917,7 +1096,7 @@ read_base_config (GKeyFile *keyfile,
|
|||
/* Try a user-specified config file first */
|
||||
if (cli_config_main_file) {
|
||||
/* Bad user-specific config file path is a hard error */
|
||||
if (read_config (keyfile, TRUE, NULL, cli_config_main_file, error)) {
|
||||
if (read_config (keyfile, TRUE, NULL, cli_config_main_file, warnings, error)) {
|
||||
*out_config_main_file = g_strdup (cli_config_main_file);
|
||||
return TRUE;
|
||||
} else
|
||||
|
|
@ -932,7 +1111,7 @@ read_base_config (GKeyFile *keyfile,
|
|||
*/
|
||||
|
||||
/* Try deprecated nm-system-settings.conf first */
|
||||
if (read_config (keyfile, TRUE, NULL, DEFAULT_CONFIG_MAIN_FILE_OLD, &my_error)) {
|
||||
if (read_config (keyfile, TRUE, NULL, DEFAULT_CONFIG_MAIN_FILE_OLD, warnings, &my_error)) {
|
||||
*out_config_main_file = g_strdup (DEFAULT_CONFIG_MAIN_FILE_OLD);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -944,7 +1123,7 @@ read_base_config (GKeyFile *keyfile,
|
|||
g_clear_error (&my_error);
|
||||
|
||||
/* Try the standard config file location next */
|
||||
if (read_config (keyfile, TRUE, NULL, DEFAULT_CONFIG_MAIN_FILE, &my_error)) {
|
||||
if (read_config (keyfile, TRUE, NULL, DEFAULT_CONFIG_MAIN_FILE, warnings, &my_error)) {
|
||||
*out_config_main_file = g_strdup (DEFAULT_CONFIG_MAIN_FILE);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -1022,6 +1201,7 @@ read_entire_config (const NMConfigCmdLineOptions *cli,
|
|||
const char *system_config_dir,
|
||||
char **out_config_main_file,
|
||||
char **out_config_description,
|
||||
char ***out_warnings,
|
||||
GError **error)
|
||||
{
|
||||
gs_unref_keyfile GKeyFile *keyfile = NULL;
|
||||
|
|
@ -1031,12 +1211,14 @@ read_entire_config (const NMConfigCmdLineOptions *cli,
|
|||
guint i;
|
||||
gs_free char *o_config_main_file = NULL;
|
||||
const char *run_config_dir = "";
|
||||
gs_unref_ptrarray GPtrArray *warnings = NULL;
|
||||
|
||||
g_return_val_if_fail (config_dir, NULL);
|
||||
g_return_val_if_fail (system_config_dir, NULL);
|
||||
g_return_val_if_fail (!out_config_main_file || !*out_config_main_file, FALSE);
|
||||
g_return_val_if_fail (!out_config_description || !*out_config_description, NULL);
|
||||
g_return_val_if_fail (!error || !*error, FALSE);
|
||||
g_return_val_if_fail (out_warnings && !*out_warnings, FALSE);
|
||||
|
||||
if ( (""RUN_CONFIG_DIR)[0] == '/'
|
||||
&& !nm_streq (RUN_CONFIG_DIR, system_config_dir)
|
||||
|
|
@ -1045,6 +1227,7 @@ read_entire_config (const NMConfigCmdLineOptions *cli,
|
|||
|
||||
/* create a default configuration file. */
|
||||
keyfile = nm_config_create_keyfile ();
|
||||
warnings = g_ptr_array_new_with_free_func (g_free);
|
||||
|
||||
system_confs = _get_config_dir_files (system_config_dir);
|
||||
confs = _get_config_dir_files (config_dir);
|
||||
|
|
@ -1060,7 +1243,7 @@ read_entire_config (const NMConfigCmdLineOptions *cli,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!read_config (keyfile, FALSE, system_config_dir, filename, error))
|
||||
if (!read_config (keyfile, FALSE, system_config_dir, filename, warnings, error))
|
||||
return NULL;
|
||||
i++;
|
||||
}
|
||||
|
|
@ -1074,19 +1257,19 @@ read_entire_config (const NMConfigCmdLineOptions *cli,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!read_config (keyfile, FALSE, run_config_dir, filename, error))
|
||||
if (!read_config (keyfile, FALSE, run_config_dir, filename, warnings, error))
|
||||
return NULL;
|
||||
i++;
|
||||
}
|
||||
|
||||
/* First read the base config file */
|
||||
if (!read_base_config (keyfile, cli ? cli->config_main_file : NULL, &o_config_main_file, error))
|
||||
if (!read_base_config (keyfile, cli ? cli->config_main_file : NULL, &o_config_main_file, warnings, error))
|
||||
return NULL;
|
||||
|
||||
g_assert (o_config_main_file);
|
||||
|
||||
for (i = 0; i < confs->len; i++) {
|
||||
if (!read_config (keyfile, FALSE, config_dir, confs->pdata[i], error))
|
||||
if (!read_config (keyfile, FALSE, config_dir, confs->pdata[i], warnings, error))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -1133,6 +1316,11 @@ read_entire_config (const NMConfigCmdLineOptions *cli,
|
|||
*out_config_description = g_string_free (str, FALSE);
|
||||
}
|
||||
NM_SET_OUT (out_config_main_file, g_steal_pointer (&o_config_main_file));
|
||||
|
||||
g_ptr_array_add (warnings, NULL);
|
||||
*out_warnings = (char **) g_ptr_array_free (warnings, warnings->len == 1);
|
||||
g_steal_pointer (&warnings);
|
||||
|
||||
return g_steal_pointer (&keyfile);
|
||||
}
|
||||
|
||||
|
|
@ -1657,11 +1845,13 @@ nm_config_set_global_dns (NMConfig *self, NMGlobalDnsConfig *global_dns, GError
|
|||
|
||||
/* Set new values */
|
||||
nm_config_keyfile_set_string_list (keyfile, NM_CONFIG_KEYFILE_GROUP_INTERN_GLOBAL_DNS,
|
||||
"searches", nm_global_dns_config_get_searches (global_dns),
|
||||
NM_CONFIG_KEYFILE_KEY_GLOBAL_DNS_SEARCHES,
|
||||
nm_global_dns_config_get_searches (global_dns),
|
||||
-1);
|
||||
|
||||
nm_config_keyfile_set_string_list (keyfile, NM_CONFIG_KEYFILE_GROUP_INTERN_GLOBAL_DNS,
|
||||
"options", nm_global_dns_config_get_options (global_dns),
|
||||
NM_CONFIG_KEYFILE_KEY_GLOBAL_DNS_OPTIONS,
|
||||
nm_global_dns_config_get_options (global_dns),
|
||||
-1);
|
||||
|
||||
for (i = 0; i < nm_global_dns_config_get_num_domains (global_dns); i++) {
|
||||
|
|
@ -1671,9 +1861,9 @@ nm_config_set_global_dns (NMConfig *self, NMGlobalDnsConfig *global_dns, GError
|
|||
group_name = g_strdup_printf (NM_CONFIG_KEYFILE_GROUPPREFIX_INTERN_GLOBAL_DNS_DOMAIN "%s",
|
||||
nm_global_dns_domain_get_name (domain));
|
||||
|
||||
nm_config_keyfile_set_string_list (keyfile, group_name, "servers",
|
||||
nm_config_keyfile_set_string_list (keyfile, group_name, NM_CONFIG_KEYFILE_KEY_GLOBAL_DNS_DOMAIN_SERVERS,
|
||||
nm_global_dns_domain_get_servers (domain), -1);
|
||||
nm_config_keyfile_set_string_list (keyfile, group_name, "options",
|
||||
nm_config_keyfile_set_string_list (keyfile, group_name, NM_CONFIG_KEYFILE_KEY_GLOBAL_DNS_DOMAIN_OPTIONS,
|
||||
nm_global_dns_domain_get_options (domain), -1);
|
||||
}
|
||||
|
||||
|
|
@ -2354,7 +2544,7 @@ nm_config_device_state_get (NMConfig *self,
|
|||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
nm_config_reload (NMConfig *self, NMConfigChangeFlags reload_flags)
|
||||
nm_config_reload (NMConfig *self, NMConfigChangeFlags reload_flags, gboolean emit_warnings)
|
||||
{
|
||||
NMConfigPrivate *priv;
|
||||
GError *error = NULL;
|
||||
|
|
@ -2364,6 +2554,8 @@ nm_config_reload (NMConfig *self, NMConfigChangeFlags reload_flags)
|
|||
char *config_description = NULL;
|
||||
gs_strfreev char **no_auto_default = NULL;
|
||||
gboolean intern_config_needs_rewrite;
|
||||
gs_strfreev char **warnings = NULL;
|
||||
guint i;
|
||||
|
||||
g_return_if_fail (NM_IS_CONFIG (self));
|
||||
g_return_if_fail ( reload_flags
|
||||
|
|
@ -2388,6 +2580,7 @@ nm_config_reload (NMConfig *self, NMConfigChangeFlags reload_flags)
|
|||
priv->system_config_dir,
|
||||
&config_main_file,
|
||||
&config_description,
|
||||
&warnings,
|
||||
&error);
|
||||
if (!keyfile) {
|
||||
_LOGE ("Failed to reload the configuration: %s", error->message);
|
||||
|
|
@ -2396,6 +2589,11 @@ nm_config_reload (NMConfig *self, NMConfigChangeFlags reload_flags)
|
|||
return;
|
||||
}
|
||||
|
||||
if (emit_warnings && warnings) {
|
||||
for (i = 0; warnings[i]; i++)
|
||||
_LOGW ("%s", warnings[i]);
|
||||
}
|
||||
|
||||
no_auto_default = no_auto_default_from_file (priv->no_auto_default_file);
|
||||
|
||||
keyfile_intern = intern_config_read (priv->intern_config_file,
|
||||
|
|
@ -2557,10 +2755,12 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
|
|||
{
|
||||
NMConfig *self = NM_CONFIG (initable);
|
||||
NMConfigPrivate *priv = NM_CONFIG_GET_PRIVATE (self);
|
||||
GKeyFile *keyfile, *keyfile_intern;
|
||||
char *config_main_file = NULL;
|
||||
char *config_description = NULL;
|
||||
gs_unref_keyfile GKeyFile *keyfile = NULL;
|
||||
gs_unref_keyfile GKeyFile *keyfile_intern = NULL;
|
||||
gs_free char *config_main_file = NULL;
|
||||
gs_free char *config_description = NULL;
|
||||
gs_strfreev char **no_auto_default = NULL;
|
||||
gs_strfreev char **warnings = NULL;
|
||||
gs_free char *configure_and_quit = NULL;
|
||||
gboolean intern_config_needs_rewrite;
|
||||
const char *s;
|
||||
|
|
@ -2592,23 +2792,34 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
|
|||
priv->system_config_dir,
|
||||
&config_main_file,
|
||||
&config_description,
|
||||
&warnings,
|
||||
error);
|
||||
if (!keyfile)
|
||||
return FALSE;
|
||||
|
||||
/* Initialize read only private members */
|
||||
/* Initialize read-only private members */
|
||||
|
||||
if (priv->cli.no_auto_default_file)
|
||||
priv->no_auto_default_file = g_strdup (priv->cli.no_auto_default_file);
|
||||
else
|
||||
priv->no_auto_default_file = g_strdup (DEFAULT_NO_AUTO_DEFAULT_FILE);
|
||||
|
||||
priv->monitor_connection_files = nm_config_keyfile_get_boolean (keyfile, NM_CONFIG_KEYFILE_GROUP_MAIN, "monitor-connection-files", FALSE);
|
||||
|
||||
priv->log_level = nm_strstrip (g_key_file_get_string (keyfile, NM_CONFIG_KEYFILE_GROUP_LOGGING, "level", NULL));
|
||||
priv->log_domains = nm_strstrip (g_key_file_get_string (keyfile, NM_CONFIG_KEYFILE_GROUP_LOGGING, "domains", NULL));
|
||||
|
||||
configure_and_quit = nm_strstrip (g_key_file_get_string (keyfile, NM_CONFIG_KEYFILE_GROUP_MAIN, "configure-and-quit", NULL));
|
||||
priv->monitor_connection_files = nm_config_keyfile_get_boolean (keyfile,
|
||||
NM_CONFIG_KEYFILE_GROUP_MAIN,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_MONITOR_CONNECTION_FILES,
|
||||
FALSE);
|
||||
priv->log_level = nm_strstrip (g_key_file_get_string (keyfile,
|
||||
NM_CONFIG_KEYFILE_GROUP_LOGGING,
|
||||
NM_CONFIG_KEYFILE_KEY_LOGGING_LEVEL,
|
||||
NULL));
|
||||
priv->log_domains = nm_strstrip (g_key_file_get_string (keyfile,
|
||||
NM_CONFIG_KEYFILE_GROUP_LOGGING,
|
||||
NM_CONFIG_KEYFILE_KEY_LOGGING_DOMAINS,
|
||||
NULL));
|
||||
configure_and_quit = nm_strstrip (g_key_file_get_string (keyfile,
|
||||
NM_CONFIG_KEYFILE_GROUP_MAIN,
|
||||
NM_CONFIG_KEYFILE_KEY_MAIN_CONFIGURE_AND_QUIT,
|
||||
NULL));
|
||||
priv->configure_and_quit = string_to_configure_and_quit (configure_and_quit, error);
|
||||
if (priv->configure_and_quit == NM_CONFIG_CONFIGURE_AND_QUIT_INVALID)
|
||||
return FALSE;
|
||||
|
|
@ -2632,12 +2843,7 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
|
|||
keyfile_intern);
|
||||
|
||||
priv->config_data = g_object_ref (priv->config_data_orig);
|
||||
|
||||
g_free (config_main_file);
|
||||
g_free (config_description);
|
||||
g_key_file_unref (keyfile);
|
||||
if (keyfile_intern)
|
||||
g_key_file_unref (keyfile_intern);
|
||||
priv->warnings = g_steal_pointer (&warnings);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -2673,6 +2879,7 @@ finalize (GObject *gobject)
|
|||
g_free (priv->log_level);
|
||||
g_free (priv->log_domains);
|
||||
g_strfreev (priv->atomic_section_prefixes);
|
||||
g_strfreev (priv->warnings);
|
||||
|
||||
_nm_config_cmd_line_options_clear (&priv->cli);
|
||||
|
||||
|
|
|
|||
|
|
@ -52,28 +52,48 @@
|
|||
#define NM_CONFIG_KEYFILE_GROUP_MAIN "main"
|
||||
#define NM_CONFIG_KEYFILE_GROUP_LOGGING "logging"
|
||||
#define NM_CONFIG_KEYFILE_GROUP_CONNECTIVITY "connectivity"
|
||||
#define NM_CONFIG_KEYFILE_GROUP_KEYFILE "keyfile"
|
||||
#define NM_CONFIG_KEYFILE_GROUP_IFUPDOWN "ifupdown"
|
||||
#define NM_CONFIG_KEYFILE_GROUP_GLOBAL_DNS "global-dns"
|
||||
#define NM_CONFIG_KEYFILE_GROUP_CONFIG ".config"
|
||||
|
||||
#define NM_CONFIG_KEYFILE_GROUP_KEYFILE "keyfile"
|
||||
#define NM_CONFIG_KEYFILE_GROUP_IFUPDOWN "ifupdown"
|
||||
|
||||
#define NM_CONFIG_KEYFILE_KEY_MAIN_ASSUME_IPV6LL_ONLY "assume-ipv6ll-only"
|
||||
#define NM_CONFIG_KEYFILE_KEY_MAIN_AUTH_POLKIT "auth-polkit"
|
||||
#define NM_CONFIG_KEYFILE_KEY_MAIN_AUTOCONNECT_RETRIES_DEFAULT "autoconnect-retries-default"
|
||||
#define NM_CONFIG_KEYFILE_KEY_MAIN_DHCP "dhcp"
|
||||
#define NM_CONFIG_KEYFILE_KEY_MAIN_CONFIGURE_AND_QUIT "configure-and-quit"
|
||||
#define NM_CONFIG_KEYFILE_KEY_MAIN_DEBUG "debug"
|
||||
#define NM_CONFIG_KEYFILE_KEY_MAIN_DHCP "dhcp"
|
||||
#define NM_CONFIG_KEYFILE_KEY_MAIN_DNS "dns"
|
||||
#define NM_CONFIG_KEYFILE_KEY_MAIN_HOSTNAME_MODE "hostname-mode"
|
||||
#define NM_CONFIG_KEYFILE_KEY_MAIN_IGNORE_CARRIER "ignore-carrier"
|
||||
#define NM_CONFIG_KEYFILE_KEY_MAIN_MONITOR_CONNECTION_FILES "monitor-connection-files"
|
||||
#define NM_CONFIG_KEYFILE_KEY_MAIN_NO_AUTO_DEFAULT "no-auto-default"
|
||||
#define NM_CONFIG_KEYFILE_KEY_MAIN_PLUGINS "plugins"
|
||||
#define NM_CONFIG_KEYFILE_KEY_MAIN_RC_MANAGER "rc-manager"
|
||||
#define NM_CONFIG_KEYFILE_KEY_MAIN_SLAVES_ORDER "slaves-order"
|
||||
#define NM_CONFIG_KEYFILE_KEY_MAIN_SYSTEMD_RESOLVED "systemd-resolved"
|
||||
|
||||
#define NM_CONFIG_KEYFILE_KEY_LOGGING_AUDIT "audit"
|
||||
#define NM_CONFIG_KEYFILE_KEY_LOGGING_BACKEND "backend"
|
||||
#define NM_CONFIG_KEYFILE_KEY_CONFIG_ENABLE "enable"
|
||||
#define NM_CONFIG_KEYFILE_KEY_ATOMIC_SECTION_WAS ".was"
|
||||
#define NM_CONFIG_KEYFILE_KEY_LOGGING_DOMAINS "domains"
|
||||
#define NM_CONFIG_KEYFILE_KEY_LOGGING_LEVEL "level"
|
||||
|
||||
#define NM_CONFIG_KEYFILE_KEY_CONNECTIVITY_ENABLED "enabled"
|
||||
#define NM_CONFIG_KEYFILE_KEY_CONNECTIVITY_INTERVAL "interval"
|
||||
#define NM_CONFIG_KEYFILE_KEY_CONNECTIVITY_RESPONSE "response"
|
||||
#define NM_CONFIG_KEYFILE_KEY_CONNECTIVITY_URI "uri"
|
||||
|
||||
#define NM_CONFIG_KEYFILE_KEY_KEYFILE_PATH "path"
|
||||
#define NM_CONFIG_KEYFILE_KEY_KEYFILE_UNMANAGED_DEVICES "unmanaged-devices"
|
||||
#define NM_CONFIG_KEYFILE_KEY_KEYFILE_HOSTNAME "hostname"
|
||||
#define NM_CONFIG_KEYFILE_KEY_IFNET_AUTO_REFRESH "auto_refresh"
|
||||
#define NM_CONFIG_KEYFILE_KEY_IFNET_MANAGED "managed"
|
||||
|
||||
#define NM_CONFIG_KEYFILE_KEY_IFUPDOWN_MANAGED "managed"
|
||||
#define NM_CONFIG_KEYFILE_KEY_AUDIT "audit"
|
||||
|
||||
#define NM_CONFIG_KEYFILE_KEY_GLOBAL_DNS_SEARCHES "searches"
|
||||
#define NM_CONFIG_KEYFILE_KEY_GLOBAL_DNS_OPTIONS "options"
|
||||
|
||||
#define NM_CONFIG_KEYFILE_KEY_GLOBAL_DNS_DOMAIN_SERVERS "servers"
|
||||
#define NM_CONFIG_KEYFILE_KEY_GLOBAL_DNS_DOMAIN_OPTIONS "options"
|
||||
|
||||
#define NM_CONFIG_KEYFILE_KEY_DEVICE_MANAGED "managed"
|
||||
#define NM_CONFIG_KEYFILE_KEY_DEVICE_IGNORE_CARRIER "ignore-carrier"
|
||||
|
|
@ -82,6 +102,12 @@
|
|||
#define NM_CONFIG_KEYFILE_KEY_DEVICE_WIFI_SCAN_RAND_MAC_ADDRESS "wifi.scan-rand-mac-address"
|
||||
#define NM_CONFIG_KEYFILE_KEY_DEVICE_CARRIER_WAIT_TIMEOUT "carrier-wait-timeout"
|
||||
|
||||
#define NM_CONFIG_KEYFILE_KEY_MATCH_DEVICE "match-device"
|
||||
#define NM_CONFIG_KEYFILE_KEY_STOP_MATCH "stop-match"
|
||||
|
||||
#define NM_CONFIG_KEYFILE_KEY_ATOMIC_SECTION_WAS ".was" /* check-config-options skip */
|
||||
#define NM_CONFIG_KEYFILE_KEY_CONFIG_ENABLE "enable" /* check-config-options skip */
|
||||
|
||||
#define NM_CONFIG_KEYFILE_KEYPREFIX_WAS ".was."
|
||||
#define NM_CONFIG_KEYFILE_KEYPREFIX_SET ".set."
|
||||
|
||||
|
|
@ -155,7 +181,7 @@ void nm_config_set_no_auto_default_for_device (NMConfig *config, NMDevice *devi
|
|||
|
||||
NMConfig *nm_config_new (const NMConfigCmdLineOptions *cli, char **atomic_section_prefixes, GError **error);
|
||||
NMConfig *nm_config_setup (const NMConfigCmdLineOptions *cli, char **atomic_section_prefixes, GError **error);
|
||||
void nm_config_reload (NMConfig *config, NMConfigChangeFlags reload_flags);
|
||||
void nm_config_reload (NMConfig *config, NMConfigChangeFlags reload_flags, gboolean emit_warnings);
|
||||
|
||||
const NMConfigState *nm_config_state_get (NMConfig *config);
|
||||
|
||||
|
|
@ -252,6 +278,9 @@ const GHashTable *nm_config_device_state_get_all (NMConfig *self);
|
|||
const NMConfigDeviceStateData *nm_config_device_state_get (NMConfig *self,
|
||||
int ifindex);
|
||||
|
||||
const char *const *nm_config_get_warnings (NMConfig *config);
|
||||
void nm_config_clear_warnings (NMConfig *config);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif /* __NETWORKMANAGER_CONFIG_H__ */
|
||||
|
|
|
|||
|
|
@ -1181,7 +1181,7 @@ _reload_auth_cb (NMAuthChain *chain,
|
|||
goto out;
|
||||
}
|
||||
|
||||
nm_config_reload (priv->config, reload_type);
|
||||
nm_config_reload (priv->config, reload_type, TRUE);
|
||||
g_dbus_method_invocation_return_value (context, NULL);
|
||||
|
||||
out:
|
||||
|
|
@ -4110,7 +4110,7 @@ should_connect_slaves (NMConnection *connection, NMDevice *device)
|
|||
goto out;
|
||||
|
||||
val = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
|
||||
"connection.autoconnect-slaves",
|
||||
NM_CON_DEFAULT ("connection.autoconnect-slaves"),
|
||||
device,
|
||||
0, 1, -1);
|
||||
|
||||
|
|
|
|||
26
src/tests/config/NetworkManager-warn.conf
Normal file
26
src/tests/config/NetworkManager-warn.conf
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
[main]
|
||||
dhcp=dhclient
|
||||
plugin=foo,bar,baz
|
||||
no-auto-default=11:11:11:11:11:11
|
||||
rc-managed=unmanaged
|
||||
dns=none
|
||||
|
||||
[logging]
|
||||
level=INFO
|
||||
|
||||
[connectivity]
|
||||
uri=http://example.com
|
||||
interval=100
|
||||
response=Hello
|
||||
audit=true
|
||||
|
||||
[connection]
|
||||
ipv4.route-metric=50
|
||||
ipv4.addresses=1.2.3.4
|
||||
ipv4.dad-timeout=100
|
||||
|
||||
[connection-wifi]
|
||||
match-device=type:wifi
|
||||
wifi.powersave=2
|
||||
ipv6.ip6-privacy=1
|
||||
wifi.tx-power=99
|
||||
|
|
@ -19,8 +19,8 @@ extra-key=some value
|
|||
[connection]
|
||||
ipv4.route-metric=50
|
||||
ipv6.ip6_privacy=0
|
||||
dummy.test1=no
|
||||
dummy.test2=no
|
||||
ethernet.mtu=1400
|
||||
ipv4.dns-priority=60
|
||||
|
||||
ord.key00=A-0.0.00
|
||||
ord.key01=A-0.0.01
|
||||
|
|
@ -37,7 +37,7 @@ ord.key09=A-0.0.09
|
|||
match-device=mac:00:00:00:00:00:51
|
||||
stop-match=yes
|
||||
ipv4.route-metric=51
|
||||
dummy.test1=yes
|
||||
ethernet.mtu=9000
|
||||
|
||||
[connection.dev52]
|
||||
match-device=mac:00:00:00:00:00:52
|
||||
|
|
|
|||
|
|
@ -206,20 +206,20 @@ test_config_simple (void)
|
|||
g_assert_cmpstr (value, ==, "52");
|
||||
g_free (value);
|
||||
|
||||
value = nm_config_data_get_connection_default (nm_config_get_data_orig (config), "dummy.test1", dev51);
|
||||
g_assert_cmpstr (value, ==, "yes");
|
||||
value = nm_config_data_get_connection_default (nm_config_get_data_orig (config), "ethernet.mtu", dev51);
|
||||
g_assert_cmpstr (value, ==, "9000");
|
||||
g_free (value);
|
||||
|
||||
value = nm_config_data_get_connection_default (nm_config_get_data_orig (config), "dummy.test1", dev50);
|
||||
g_assert_cmpstr (value, ==, "no");
|
||||
value = nm_config_data_get_connection_default (nm_config_get_data_orig (config), "ethernet.mtu", dev50);
|
||||
g_assert_cmpstr (value, ==, "1400");
|
||||
g_free (value);
|
||||
|
||||
value = nm_config_data_get_connection_default (nm_config_get_data_orig (config), "dummy.test2", dev51);
|
||||
value = nm_config_data_get_connection_default (nm_config_get_data_orig (config), "ipv4.dns-priority", dev51);
|
||||
g_assert_cmpstr (value, ==, NULL);
|
||||
g_free (value);
|
||||
|
||||
value = nm_config_data_get_connection_default (nm_config_get_data_orig (config), "dummy.test2", dev50);
|
||||
g_assert_cmpstr (value, ==, "no");
|
||||
value = nm_config_data_get_connection_default (nm_config_get_data_orig (config), "ipv4.dns-priority", dev50);
|
||||
g_assert_cmpstr (value, ==, "60");
|
||||
g_free (value);
|
||||
}
|
||||
|
||||
|
|
@ -506,17 +506,17 @@ test_config_confdir (void)
|
|||
gs_free char *_value = nm_config_data_get_connection_default (nm_config_get_data_orig (xconfig), (xname), NULL); \
|
||||
g_assert_cmpstr (_value, ==, (xvalue)); \
|
||||
} G_STMT_END
|
||||
ASSERT_GET_CONN_DEFAULT (config, "ord.key00", "A-0.0.00");
|
||||
ASSERT_GET_CONN_DEFAULT (config, "ord.key01", "A-0.3.01");
|
||||
ASSERT_GET_CONN_DEFAULT (config, "ord.key02", "A-0.2.02");
|
||||
ASSERT_GET_CONN_DEFAULT (config, "ord.key03", "A-0.1.03");
|
||||
ASSERT_GET_CONN_DEFAULT (config, "ord.key04", "B-1.3.04");
|
||||
ASSERT_GET_CONN_DEFAULT (config, "ord.key05", "B-1.2.05");
|
||||
ASSERT_GET_CONN_DEFAULT (config, "ord.key06", "B-1.1.06");
|
||||
ASSERT_GET_CONN_DEFAULT (config, "ord.key07", "C-2.3.07");
|
||||
ASSERT_GET_CONN_DEFAULT (config, "ord.key08", "C-2.2.08");
|
||||
ASSERT_GET_CONN_DEFAULT (config, "ord.key09", "C-2.1.09");
|
||||
ASSERT_GET_CONN_DEFAULT (config, "ord.ovw01", "C-0.1.ovw01");
|
||||
ASSERT_GET_CONN_DEFAULT (config, NM_CON_DEFAULT ("ord.key00"), "A-0.0.00");
|
||||
ASSERT_GET_CONN_DEFAULT (config, NM_CON_DEFAULT ("ord.key01"), "A-0.3.01");
|
||||
ASSERT_GET_CONN_DEFAULT (config, NM_CON_DEFAULT ("ord.key02"), "A-0.2.02");
|
||||
ASSERT_GET_CONN_DEFAULT (config, NM_CON_DEFAULT ("ord.key03"), "A-0.1.03");
|
||||
ASSERT_GET_CONN_DEFAULT (config, NM_CON_DEFAULT ("ord.key04"), "B-1.3.04");
|
||||
ASSERT_GET_CONN_DEFAULT (config, NM_CON_DEFAULT ("ord.key05"), "B-1.2.05");
|
||||
ASSERT_GET_CONN_DEFAULT (config, NM_CON_DEFAULT ("ord.key06"), "B-1.1.06");
|
||||
ASSERT_GET_CONN_DEFAULT (config, NM_CON_DEFAULT ("ord.key07"), "C-2.3.07");
|
||||
ASSERT_GET_CONN_DEFAULT (config, NM_CON_DEFAULT ("ord.key08"), "C-2.2.08");
|
||||
ASSERT_GET_CONN_DEFAULT (config, NM_CON_DEFAULT ("ord.key09"), "C-2.1.09");
|
||||
ASSERT_GET_CONN_DEFAULT (config, NM_CON_DEFAULT ("ord.ovw01"), "C-0.1.ovw01");
|
||||
|
||||
value = nm_config_data_get_value (nm_config_get_data_orig (config), NM_CONFIG_KEYFILE_GROUPPREFIX_TEST_APPEND_STRINGLIST".1", "val1", NM_CONFIG_GET_VALUE_NONE);
|
||||
g_assert_cmpstr (value, ==, "a,c");
|
||||
|
|
@ -552,6 +552,36 @@ test_config_confdir_parse_error (void)
|
|||
g_clear_error (&error);
|
||||
}
|
||||
|
||||
static void
|
||||
test_config_warnings (void)
|
||||
{
|
||||
gs_unref_object NMConfig *config = NULL;
|
||||
const char *const *warnings;
|
||||
|
||||
config = setup_config (NULL, TEST_DIR "/NetworkManager-warn.conf", "", NULL, "/no/such/dir", "", NULL);
|
||||
|
||||
warnings = nm_config_get_warnings (config);
|
||||
|
||||
#define check_warning(str, group, key) \
|
||||
{ \
|
||||
gs_free char *expected = NULL; \
|
||||
\
|
||||
expected = g_strdup_printf ("unknown key '%s' in section [%s] of file '" TEST_DIR "/NetworkManager-warn.conf'", \
|
||||
key, group); \
|
||||
g_assert_cmpstr (str, ==, expected); \
|
||||
}
|
||||
|
||||
g_assert (warnings);
|
||||
g_assert_cmpint (g_strv_length ((char **) warnings), ==, 5);
|
||||
check_warning (warnings[0], "main", "plugin");
|
||||
check_warning (warnings[1], "main", "rc-managed");
|
||||
check_warning (warnings[2], "connectivity", "audit");
|
||||
check_warning (warnings[3], "connection-wifi", "wifi.tx-power");
|
||||
check_warning (warnings[4], "connection", "ipv4.addresses");
|
||||
|
||||
#undef check_warning
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef void (*TestSetValuesUserSetFcn) (NMConfig *config, gboolean is_user, GKeyFile *keyfile_user, NMConfigChangeFlags *out_expected_changes);
|
||||
|
|
@ -622,7 +652,7 @@ _set_values_user (NMConfig *config,
|
|||
else
|
||||
NMTST_EXPECT_NM_INFO ("config: signal: SIGHUP (no changes from disk)*");
|
||||
|
||||
nm_config_reload (config, NM_CONFIG_CHANGE_CAUSE_SIGHUP);
|
||||
nm_config_reload (config, NM_CONFIG_CHANGE_CAUSE_SIGHUP, FALSE);
|
||||
|
||||
g_test_assert_expected_messages ();
|
||||
|
||||
|
|
@ -926,15 +956,15 @@ test_config_signal (void)
|
|||
|
||||
expected = NM_CONFIG_CHANGE_CAUSE_SIGUSR1;
|
||||
NMTST_EXPECT_NM_INFO ("config: signal: SIGUSR1");
|
||||
nm_config_reload (config, expected);
|
||||
nm_config_reload (config, expected, FALSE);
|
||||
|
||||
expected = NM_CONFIG_CHANGE_CAUSE_SIGUSR2;
|
||||
NMTST_EXPECT_NM_INFO ("config: signal: SIGUSR2");
|
||||
nm_config_reload (config, expected);
|
||||
nm_config_reload (config, expected, FALSE);
|
||||
|
||||
expected = NM_CONFIG_CHANGE_CAUSE_SIGHUP;
|
||||
NMTST_EXPECT_NM_INFO ("config: signal: SIGHUP (no changes from disk)*");
|
||||
nm_config_reload (config, expected);
|
||||
nm_config_reload (config, expected, FALSE);
|
||||
|
||||
/* test with subscribing two signals...
|
||||
*
|
||||
|
|
@ -946,7 +976,7 @@ test_config_signal (void)
|
|||
&expected);
|
||||
expected = NM_CONFIG_CHANGE_CAUSE_SIGUSR2;
|
||||
NMTST_EXPECT_NM_INFO ("config: signal: SIGUSR2");
|
||||
nm_config_reload (config, NM_CONFIG_CHANGE_CAUSE_SIGUSR2);
|
||||
nm_config_reload (config, NM_CONFIG_CHANGE_CAUSE_SIGUSR2, FALSE);
|
||||
g_signal_handlers_disconnect_by_func (config, _test_signal_config_changed_cb2, &expected);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (config, _test_signal_config_changed_cb, &expected);
|
||||
|
|
@ -1064,6 +1094,7 @@ main (int argc, char **argv)
|
|||
g_test_add_func ("/config/no-auto-default", test_config_no_auto_default);
|
||||
g_test_add_func ("/config/confdir", test_config_confdir);
|
||||
g_test_add_func ("/config/confdir-parse-error", test_config_confdir_parse_error);
|
||||
g_test_add_func ("/config/warnings", test_config_warnings);
|
||||
|
||||
g_test_add_func ("/config/set-values", test_config_set_values);
|
||||
g_test_add_func ("/config/global-dns", test_config_global_dns);
|
||||
|
|
|
|||
|
|
@ -1115,7 +1115,10 @@ _test_match_spec_device (const GSList *specs, const char *match_str)
|
|||
}
|
||||
|
||||
static void
|
||||
_do_test_match_spec_device (const char *spec_str, const char **matches, const char **no_matches, const char **neg_matches)
|
||||
_do_test_match_spec_device (const char *spec_str,
|
||||
const char *const *matches,
|
||||
const char *const *no_matches,
|
||||
const char *const *neg_matches)
|
||||
{
|
||||
GSList *specs, *specs_randperm = NULL, *specs_resplit, *specs_i, *specs_j;
|
||||
guint i;
|
||||
|
|
@ -1187,98 +1190,96 @@ _do_test_match_spec_device (const char *spec_str, const char **matches, const ch
|
|||
static void
|
||||
test_match_spec_device (void)
|
||||
{
|
||||
#define S(...) ((const char *[]) { __VA_ARGS__, NULL } )
|
||||
_do_test_match_spec_device ("em1",
|
||||
S ("em1"),
|
||||
NM_MAKE_STRV ("em1"),
|
||||
NULL,
|
||||
NULL);
|
||||
_do_test_match_spec_device ("em1,em2",
|
||||
S ("em1", "em2"),
|
||||
NM_MAKE_STRV ("em1", "em2"),
|
||||
NULL,
|
||||
NULL);
|
||||
_do_test_match_spec_device ("em1,em2,interface-name:em2",
|
||||
S ("em1", "em2"),
|
||||
NM_MAKE_STRV ("em1", "em2"),
|
||||
NULL,
|
||||
NULL);
|
||||
_do_test_match_spec_device ("interface-name:em1",
|
||||
S ("em1"),
|
||||
NM_MAKE_STRV ("em1"),
|
||||
NULL,
|
||||
NULL);
|
||||
_do_test_match_spec_device ("interface-name:em*",
|
||||
S ("em", "em*", "em\\", "em\\*", "em\\1", "em\\11", "em\\2", "em1", "em11", "em2", "em3"),
|
||||
NM_MAKE_STRV ("em", "em*", "em\\", "em\\*", "em\\1", "em\\11", "em\\2", "em1", "em11", "em2", "em3"),
|
||||
NULL,
|
||||
NULL);
|
||||
_do_test_match_spec_device ("interface-name:em\\*",
|
||||
S ("em\\", "em\\*", "em\\1", "em\\11", "em\\2"),
|
||||
NM_MAKE_STRV ("em\\", "em\\*", "em\\1", "em\\11", "em\\2"),
|
||||
NULL,
|
||||
NULL);
|
||||
_do_test_match_spec_device ("interface-name:~em\\*",
|
||||
S ("em\\", "em\\*", "em\\1", "em\\11", "em\\2"),
|
||||
NM_MAKE_STRV ("em\\", "em\\*", "em\\1", "em\\11", "em\\2"),
|
||||
NULL,
|
||||
NULL);
|
||||
_do_test_match_spec_device ("except:*",
|
||||
NULL,
|
||||
S (NULL),
|
||||
S ("a"));
|
||||
NM_MAKE_STRV (NULL),
|
||||
NM_MAKE_STRV ("a"));
|
||||
_do_test_match_spec_device ("interface-name:=em*",
|
||||
S ("em*"),
|
||||
NM_MAKE_STRV ("em*"),
|
||||
NULL,
|
||||
NULL);
|
||||
_do_test_match_spec_device ("interface-name:em*,except:interface-name:em1*",
|
||||
S ("em", "em*", "em\\", "em\\*", "em\\1", "em\\11", "em\\2", "em2", "em3"),
|
||||
NM_MAKE_STRV ("em", "em*", "em\\", "em\\*", "em\\1", "em\\11", "em\\2", "em2", "em3"),
|
||||
NULL,
|
||||
S ("em1", "em11"));
|
||||
NM_MAKE_STRV ("em1", "em11"));
|
||||
_do_test_match_spec_device ("interface-name:em*,except:interface-name:=em*",
|
||||
S ("em", "em\\", "em\\*", "em\\1", "em\\11", "em\\2", "em1", "em11", "em2", "em3"),
|
||||
NM_MAKE_STRV ("em", "em\\", "em\\*", "em\\1", "em\\11", "em\\2", "em1", "em11", "em2", "em3"),
|
||||
NULL,
|
||||
S ("em*"));
|
||||
NM_MAKE_STRV ("em*"));
|
||||
_do_test_match_spec_device ("aa,bb,cc\\,dd,e,,",
|
||||
S ("aa", "bb", "cc,dd", "e"),
|
||||
NM_MAKE_STRV ("aa", "bb", "cc,dd", "e"),
|
||||
NULL,
|
||||
NULL);
|
||||
_do_test_match_spec_device ("aa;bb;cc\\;dd;e,;",
|
||||
S ("aa", "bb", "cc;dd", "e"),
|
||||
NM_MAKE_STRV ("aa", "bb", "cc;dd", "e"),
|
||||
NULL,
|
||||
NULL);
|
||||
_do_test_match_spec_device ("interface-name:em\\;1,em\\,2,\\,,\\\\,,em\\\\x",
|
||||
S ("em;1", "em,2", ",", "\\", "em\\x"),
|
||||
NM_MAKE_STRV ("em;1", "em,2", ",", "\\", "em\\x"),
|
||||
NULL,
|
||||
NULL);
|
||||
_do_test_match_spec_device ("\\s\\s,\\sinterface-name:a,\\s,",
|
||||
S (" ", " ", " interface-name:a"),
|
||||
NM_MAKE_STRV (" ", " ", " interface-name:a"),
|
||||
NULL,
|
||||
NULL);
|
||||
_do_test_match_spec_device (" aa ; bb ; cc\\;dd ;e , ; \t\\t , ",
|
||||
S ("aa", "bb", "cc;dd", "e", "\t"),
|
||||
NM_MAKE_STRV ("aa", "bb", "cc;dd", "e", "\t"),
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
_do_test_match_spec_device ("s390-subchannels:0.0.1000\\,0.0.1001",
|
||||
S (MATCH_S390"0.0.1000", MATCH_S390"0.0.1000,deadbeef", MATCH_S390"0.0.1000,0.0.1001", MATCH_S390"0.0.1000,0.0.1002"),
|
||||
S (MATCH_S390"0.0.1001"),
|
||||
NM_MAKE_STRV (MATCH_S390"0.0.1000", MATCH_S390"0.0.1000,deadbeef", MATCH_S390"0.0.1000,0.0.1001", MATCH_S390"0.0.1000,0.0.1002"),
|
||||
NM_MAKE_STRV (MATCH_S390"0.0.1001"),
|
||||
NULL);
|
||||
_do_test_match_spec_device ("*,except:s390-subchannels:0.0.1000\\,0.0.1001",
|
||||
NULL,
|
||||
S (NULL),
|
||||
S (MATCH_S390"0.0.1000", MATCH_S390"0.0.1000,deadbeef", MATCH_S390"0.0.1000,0.0.1001", MATCH_S390"0.0.1000,0.0.1002"));
|
||||
NM_MAKE_STRV (NULL),
|
||||
NM_MAKE_STRV (MATCH_S390"0.0.1000", MATCH_S390"0.0.1000,deadbeef", MATCH_S390"0.0.1000,0.0.1001", MATCH_S390"0.0.1000,0.0.1002"));
|
||||
|
||||
_do_test_match_spec_device ("driver:DRV",
|
||||
S (MATCH_DRIVER"DRV", MATCH_DRIVER"DRV|1.6"),
|
||||
S (MATCH_DRIVER"DR", MATCH_DRIVER"DR*"),
|
||||
NM_MAKE_STRV (MATCH_DRIVER"DRV", MATCH_DRIVER"DRV|1.6"),
|
||||
NM_MAKE_STRV (MATCH_DRIVER"DR", MATCH_DRIVER"DR*"),
|
||||
NULL);
|
||||
_do_test_match_spec_device ("driver:DRV//",
|
||||
S (MATCH_DRIVER"DRV/"),
|
||||
S (MATCH_DRIVER"DRV/|1.6", MATCH_DRIVER"DR", MATCH_DRIVER"DR*"),
|
||||
NM_MAKE_STRV (MATCH_DRIVER"DRV/"),
|
||||
NM_MAKE_STRV (MATCH_DRIVER"DRV/|1.6", MATCH_DRIVER"DR", MATCH_DRIVER"DR*"),
|
||||
NULL);
|
||||
_do_test_match_spec_device ("driver:DRV//*",
|
||||
S (MATCH_DRIVER"DRV/", MATCH_DRIVER"DRV/|1.6"),
|
||||
S (MATCH_DRIVER"DR", MATCH_DRIVER"DR*"),
|
||||
NM_MAKE_STRV (MATCH_DRIVER"DRV/", MATCH_DRIVER"DRV/|1.6"),
|
||||
NM_MAKE_STRV (MATCH_DRIVER"DR", MATCH_DRIVER"DR*"),
|
||||
NULL);
|
||||
_do_test_match_spec_device ("driver:DRV//1.5*",
|
||||
S (MATCH_DRIVER"DRV/|1.5", MATCH_DRIVER"DRV/|1.5.2"),
|
||||
S (MATCH_DRIVER"DRV/", MATCH_DRIVER"DRV/|1.6", MATCH_DRIVER"DR", MATCH_DRIVER"DR*"),
|
||||
NM_MAKE_STRV (MATCH_DRIVER"DRV/|1.5", MATCH_DRIVER"DRV/|1.5.2"),
|
||||
NM_MAKE_STRV (MATCH_DRIVER"DRV/", MATCH_DRIVER"DRV/|1.6", MATCH_DRIVER"DR", MATCH_DRIVER"DR*"),
|
||||
NULL);
|
||||
#undef S
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -64,10 +64,10 @@ _do_test_hw_addr (NMUtilsStableType stable_type,
|
|||
const char *ifname,
|
||||
const char *current_mac_address,
|
||||
const char *generate_mac_address_mask,
|
||||
const char **expected)
|
||||
const char *const *expected)
|
||||
{
|
||||
gs_free char *generated = NULL;
|
||||
const char **e;
|
||||
const char *const *e;
|
||||
gboolean found = FALSE;
|
||||
|
||||
for (e = expected; *e; e++) {
|
||||
|
|
@ -95,7 +95,13 @@ _do_test_hw_addr (NMUtilsStableType stable_type,
|
|||
g_assert (found);
|
||||
}
|
||||
#define do_test_hw_addr(stable_type, stable_id, secret_key, ifname, current_mac_address, generate_mac_address_mask, ...) \
|
||||
_do_test_hw_addr ((stable_type), (stable_id), (const guint8 *) ""secret_key"", NM_STRLEN (secret_key), (ifname), ""current_mac_address"", generate_mac_address_mask, (const char *[]) { __VA_ARGS__, NULL })
|
||||
_do_test_hw_addr ((stable_type), \
|
||||
(stable_id), \
|
||||
(const guint8 *) ""secret_key"", \
|
||||
NM_STRLEN (secret_key), (ifname), \
|
||||
""current_mac_address"", \
|
||||
generate_mac_address_mask, \
|
||||
NM_MAKE_STRV (__VA_ARGS__))
|
||||
|
||||
static void
|
||||
test_hw_addr_gen_stable_eth (void)
|
||||
|
|
|
|||
|
|
@ -1878,7 +1878,7 @@ connect_success (NMVpnConnection *self)
|
|||
timeout = nm_setting_vpn_get_timeout (s_vpn);
|
||||
if (timeout == 0) {
|
||||
timeout = nm_config_data_get_connection_default_int64 (NM_CONFIG_GET_DATA,
|
||||
"vpn.timeout",
|
||||
NM_CON_DEFAULT ("vpn.timeout"),
|
||||
NULL,
|
||||
1, G_MAXUINT32, 60);
|
||||
}
|
||||
|
|
|
|||
72
tools/check-config-options.sh
Executable file
72
tools/check-config-options.sh
Executable file
|
|
@ -0,0 +1,72 @@
|
|||
#!/bin/bash
|
||||
|
||||
srcdir=${1:-.}
|
||||
ret=0
|
||||
|
||||
get_supported_options()
|
||||
{
|
||||
awk '/START OPTION LIST/{flag=1;next}/END OPTION LIST/{flag=0}flag' "$srcdir/src/nm-config.c" |
|
||||
grep -o 'NM_CONFIG_KEYFILE_KEY_\w*'
|
||||
}
|
||||
|
||||
get_missing_options()
|
||||
{
|
||||
grep -v '/\* check-config-options skip \*/' "$srcdir/src/nm-config.h" |
|
||||
grep -o 'NM_CONFIG_KEYFILE_KEY_\w*' |
|
||||
grep -v -Fx -f <(get_supported_options)
|
||||
}
|
||||
|
||||
get_src_con_defaults()
|
||||
{
|
||||
sed -ne 's/.*\<NM_CON_DEFAULT\s*("\([^"]*\)").*/\1/p' $(find "$srcdir/src/" -name \*.c ! -name test\*.c)
|
||||
sed -ne 's/.*\<NM_CON_DEFAULT_NOP\s*("\([^"]*\)").*/\1/p' $(find "$srcdir/src/" -name \*.c ! -name test\*.c)
|
||||
}
|
||||
|
||||
get_man_con_defaults()
|
||||
{
|
||||
awk '/start connection defaults/{flag=1;next}/end connection defaults/{flag=0}flag' "$srcdir/man/NetworkManager.conf.xml" |
|
||||
sed -ne 's#.*<varname>\([^<]*\)</varname>.*#\1#p'
|
||||
}
|
||||
|
||||
get_missing_con_defaults()
|
||||
{
|
||||
get_src_con_defaults | grep -v -Fx -f <(get_man_con_defaults)
|
||||
}
|
||||
|
||||
get_missing_con_defaults2()
|
||||
{
|
||||
get_man_con_defaults | grep -v -Fx -f <(get_src_con_defaults)
|
||||
}
|
||||
|
||||
missing=$(get_missing_options)
|
||||
|
||||
if [ -n "$missing" ]; then
|
||||
echo "***"
|
||||
echo "*** Error: the following configuration options are defined but not present in the list of supported options"
|
||||
echo "***"
|
||||
echo "$missing"
|
||||
echo
|
||||
ret=1
|
||||
fi
|
||||
|
||||
missing_con_defaults=$(get_missing_con_defaults)
|
||||
if [ -n "$missing_con_defaults" ]; then
|
||||
echo "***"
|
||||
echo "*** Error: the following connection defaults are present in source files but not in the NetworkManager.conf man page:"
|
||||
echo "***"
|
||||
echo "$missing_con_defaults"
|
||||
echo
|
||||
ret=1
|
||||
fi
|
||||
|
||||
missing_con_defaults2=$(get_missing_con_defaults2)
|
||||
if [ -n "$missing_con_defaults2" ]; then
|
||||
echo "***"
|
||||
echo "*** Error: the following connection defaults are present in the NetworkManager.conf man page but not in source files:"
|
||||
echo "***"
|
||||
echo "$missing_con_defaults2"
|
||||
echo
|
||||
ret=1
|
||||
fi
|
||||
|
||||
exit $ret
|
||||
Loading…
Add table
Reference in a new issue