diff options
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | clients/cli/connections.c | 1 | ||||
-rw-r--r-- | clients/common/nm-meta-setting-desc.c | 78 | ||||
-rw-r--r-- | clients/common/settings-docs.h.in | 1 | ||||
-rw-r--r-- | docs/libnm/libnm-docs.xml | 1 | ||||
-rw-r--r-- | libnm-core/meson.build | 2 | ||||
-rw-r--r-- | libnm-core/nm-core-internal.h | 1 | ||||
-rw-r--r-- | libnm-core/nm-core-types.h | 1 | ||||
-rw-r--r-- | libnm-core/nm-setting-match.c | 295 | ||||
-rw-r--r-- | libnm-core/nm-setting-match.h | 63 | ||||
-rw-r--r-- | libnm/NetworkManager.h | 1 | ||||
-rw-r--r-- | libnm/libnm.ver | 8 | ||||
-rw-r--r-- | shared/nm-meta-setting.c | 7 | ||||
-rw-r--r-- | shared/nm-meta-setting.h | 1 |
14 files changed, 462 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am index fe156f9284..3dec548c17 100644 --- a/Makefile.am +++ b/Makefile.am @@ -463,6 +463,7 @@ libnm_core_lib_h_pub_real = \ libnm-core/nm-setting-ip6-config.h \ libnm-core/nm-setting-macsec.h \ libnm-core/nm-setting-macvlan.h \ + libnm-core/nm-setting-match.h \ libnm-core/nm-setting-olpc-mesh.h \ libnm-core/nm-setting-ovs-bridge.h \ libnm-core/nm-setting-ovs-interface.h \ @@ -536,6 +537,7 @@ libnm_core_lib_c_settings_real = \ libnm-core/nm-setting-ip6-config.c \ libnm-core/nm-setting-macsec.c \ libnm-core/nm-setting-macvlan.c \ + libnm-core/nm-setting-match.c \ libnm-core/nm-setting-olpc-mesh.c \ libnm-core/nm-setting-ovs-bridge.c \ libnm-core/nm-setting-ovs-interface.c \ diff --git a/clients/cli/connections.c b/clients/cli/connections.c index f4d19ee39c..3808b86dd2 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -734,6 +734,7 @@ const NmcMetaGenericInfo *const metagen_con_active_vpn[_NMC_GENERIC_INFO_TYPE_CO /*****************************************************************************/ #define NMC_FIELDS_SETTINGS_NAMES_ALL NM_SETTING_CONNECTION_SETTING_NAME","\ + NM_SETTING_MATCH_SETTING_NAME","\ NM_SETTING_WIRED_SETTING_NAME","\ NM_SETTING_802_1X_SETTING_NAME","\ NM_SETTING_WIRELESS_SETTING_NAME","\ diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c index c041b10ec7..29eb98a775 100644 --- a/clients/common/nm-meta-setting-desc.c +++ b/clients/common/nm-meta-setting-desc.c @@ -3731,6 +3731,68 @@ DEFINE_REMOVER_INDEX_OR_VALUE (_remove_fcn_ipv6_config_routes, _validate_and_remove_ipv6_route) static gconstpointer +_get_fcn_match_interface_name (ARGS_GET_FCN) +{ + NMSettingMatch *s_match = NM_SETTING_MATCH (setting); + GString *str = NULL; + guint i, num; + + RETURN_UNSUPPORTED_GET_TYPE (); + + num = nm_setting_match_get_num_interface_names (s_match); + for (i = 0; i < num; i++) { + const char *name; + gs_free char *to_free = NULL; + + if (i == 0) + str = g_string_new (""); + else + g_string_append_c (str, ' '); + name = nm_setting_match_get_interface_name (s_match, i); + g_string_append (str, _nm_utils_escape_spaces (name, &to_free)); + } + RETURN_STR_TO_FREE (g_string_free (str, FALSE)); +} + +static gboolean +_set_fcn_match_interface_name (ARGS_SET_FCN) +{ + gs_free const char **strv = NULL; + gsize i; + + nm_assert (!error || !*error); + + strv = nm_utils_strsplit_set (value, " \t", TRUE); + if (strv) { + for (i = 0; strv[i]; i++) { + nm_setting_match_add_interface_name (NM_SETTING_MATCH (setting), + _nm_utils_unescape_spaces ((char *) strv[i])); + } + } + return TRUE; +} + +static gboolean +_validate_and_remove_match_interface_name (NMSettingMatch *setting, + const char *interface_name, + GError **error) +{ + gboolean ret; + + ret = nm_setting_match_remove_interface_name_by_value (setting, interface_name); + if (!ret) + g_set_error (error, 1, 0, + _("the property doesn't contain interface name '%s'"), + interface_name); + return ret; +} +DEFINE_REMOVER_INDEX_OR_VALUE (_remove_fcn_match_interface_name, + NM_SETTING_MATCH, + nm_setting_match_get_num_interface_names, + nm_setting_match_remove_interface_name, + _validate_and_remove_match_interface_name) + +static gconstpointer _get_fcn_olpc_mesh_ssid (ARGS_GET_FCN) { NMSettingOlpcMesh *s_olpc_mesh = NM_SETTING_OLPC_MESH (setting); @@ -6533,6 +6595,19 @@ static const NMMetaPropertyInfo *const property_infos_MACVLAN[] = { }; #undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_MATCH +static const NMMetaPropertyInfo *const property_infos_MATCH[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_MATCH_INTERFACE_NAME, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_match_interface_name, + .set_fcn = _set_fcn_match_interface_name, + .remove_fcn = _remove_fcn_match_interface_name, + ), + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE #define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_OLPC_MESH static const NMMetaPropertyInfo *const property_infos_OLPC_MESH[] = { PROPERTY_INFO_WITH_DESC (NM_SETTING_OLPC_MESH_SSID, @@ -7900,6 +7975,7 @@ _setting_init_fcn_wireless (ARGS_SETTING_INIT_FCN) #define SETTING_PRETTY_NAME_IP_TUNNEL N_("IP-tunnel settings") #define SETTING_PRETTY_NAME_MACSEC N_("MACsec connection") #define SETTING_PRETTY_NAME_MACVLAN N_("macvlan connection") +#define SETTING_PRETTY_NAME_MATCH N_("Match") #define SETTING_PRETTY_NAME_OLPC_MESH N_("OLPC Mesh connection") #define SETTING_PRETTY_NAME_OVS_BRIDGE N_("OpenVSwitch bridge settings") #define SETTING_PRETTY_NAME_OVS_INTERFACE N_("OpenVSwitch interface settings") @@ -8066,6 +8142,7 @@ const NMMetaSettingInfoEditor nm_meta_setting_infos_editor[] = { NM_META_SETTING_VALID_PART_ITEM (ETHTOOL, FALSE), ), ), + SETTING_INFO (MATCH), SETTING_INFO (OLPC_MESH, .alias = "olpc-mesh", .valid_parts = NM_META_SETTING_VALID_PARTS ( @@ -8209,6 +8286,7 @@ const NMMetaSettingValidPartItem *const nm_meta_setting_info_valid_parts_default /*****************************************************************************/ static const NMMetaSettingValidPartItem *const valid_settings_noslave[] = { + NM_META_SETTING_VALID_PART_ITEM (MATCH, FALSE), NM_META_SETTING_VALID_PART_ITEM (IP4_CONFIG, FALSE), NM_META_SETTING_VALID_PART_ITEM (IP6_CONFIG, FALSE), NM_META_SETTING_VALID_PART_ITEM (TC_CONFIG, FALSE), diff --git a/clients/common/settings-docs.h.in b/clients/common/settings-docs.h.in index d0814cd38e..b80da262cb 100644 --- a/clients/common/settings-docs.h.in +++ b/clients/common/settings-docs.h.in @@ -249,6 +249,7 @@ #define DESCRIBE_DOC_NM_SETTING_MACVLAN_PARENT N_("If given, specifies the parent interface name or parent connection UUID from which this MAC-VLAN interface should be created. If this property is not specified, the connection must contain an \"802-3-ethernet\" setting with a \"mac-address\" property.") #define DESCRIBE_DOC_NM_SETTING_MACVLAN_PROMISCUOUS N_("Whether the interface should be put in promiscuous mode.") #define DESCRIBE_DOC_NM_SETTING_MACVLAN_TAP N_("Whether the interface should be a MACVTAP.") +#define DESCRIBE_DOC_NM_SETTING_MATCH_INTERFACE_NAME N_("A list of interface names to match. Each element is a shell wildcard pattern. When an element is prefixed with exclamation mark (!) the condition is inverted. A candidate interface name is considered matching when both these conditions are satisfied: (a) any of the elements not prefixed with '!' matches or there aren't such elements; (b) none of the elements prefixed with '!' match.") #define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_FAIL_MODE N_("The bridge failure mode. One of \"secure\", \"standalone\" or empty.") #define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_MCAST_SNOOPING_ENABLE N_("Enable or disable multicast snooping.") #define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_RSTP_ENABLE N_("Enable or disable RSTP.") diff --git a/docs/libnm/libnm-docs.xml b/docs/libnm/libnm-docs.xml index 94ef406a1d..8de396c45b 100644 --- a/docs/libnm/libnm-docs.xml +++ b/docs/libnm/libnm-docs.xml @@ -212,6 +212,7 @@ print ("NetworkManager version " + client.get_version())]]></programlisting></in <xi:include href="xml/nm-setting-ip-tunnel.xml"/> <xi:include href="xml/nm-setting-macsec.xml"/> <xi:include href="xml/nm-setting-macvlan.xml"/> + <xi:include href="xml/nm-setting-match.xml"/> <xi:include href="xml/nm-setting-olpc-mesh.xml"/> <xi:include href="xml/nm-setting-ovs-bridge.xml"/> <xi:include href="xml/nm-setting-ovs-interface.xml"/> diff --git a/libnm-core/meson.build b/libnm-core/meson.build index 0a0406dfab..ab570b6b47 100644 --- a/libnm-core/meson.build +++ b/libnm-core/meson.build @@ -25,6 +25,7 @@ libnm_core_headers = files( 'nm-setting-ip6-config.h', 'nm-setting-macsec.h', 'nm-setting-macvlan.h', + 'nm-setting-match.h', 'nm-setting-olpc-mesh.h', 'nm-setting-ovs-bridge.h', 'nm-setting-ovs-interface.h', @@ -79,6 +80,7 @@ libnm_core_settings_sources = files( 'nm-setting-ip6-config.c', 'nm-setting-macsec.c', 'nm-setting-macvlan.c', + 'nm-setting-match.c', 'nm-setting-olpc-mesh.c', 'nm-setting-ovs-bridge.c', 'nm-setting-ovs-interface.c', diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h index 0c999c8c84..337018485d 100644 --- a/libnm-core/nm-core-internal.h +++ b/libnm-core/nm-core-internal.h @@ -57,6 +57,7 @@ #include "nm-setting-ip6-config.h" #include "nm-setting-macsec.h" #include "nm-setting-macvlan.h" +#include "nm-setting-match.h" #include "nm-setting-olpc-mesh.h" #include "nm-setting-ovs-bridge.h" #include "nm-setting-ovs-interface.h" diff --git a/libnm-core/nm-core-types.h b/libnm-core/nm-core-types.h index 4282fdfe5c..89d99579e5 100644 --- a/libnm-core/nm-core-types.h +++ b/libnm-core/nm-core-types.h @@ -51,6 +51,7 @@ typedef struct _NMSettingIP4Config NMSettingIP4Config; typedef struct _NMSettingIP6Config NMSettingIP6Config; typedef struct _NMSettingMacsec NMSettingMacsec; typedef struct _NMSettingMacvlan NMSettingMacvlan; +typedef struct _NMSettingMatch NMSettingMatch; typedef struct _NMSettingOlpcMesh NMSettingOlpcMesh; typedef struct _NMSettingOvsBridge NMSettingOvsBridge; typedef struct _NMSettingOvsInterface NMSettingOvsInterface; diff --git a/libnm-core/nm-setting-match.c b/libnm-core/nm-setting-match.c new file mode 100644 index 0000000000..0964c64471 --- /dev/null +++ b/libnm-core/nm-setting-match.c @@ -0,0 +1,295 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/>. + * + * Copyright 2018 Red Hat, Inc. + */ + +#include "nm-default.h" + +#include "nm-setting-match.h" +#include "nm-setting-private.h" +#include "nm-utils-private.h" + +/** + * SECTION:nm-setting-match + * @short_description: Properties to match a connection with a device. + * @include: nm-setting-match.h + **/ + +/** + * NMSettingMatch: + * + * Match settings. + * + * Since: 1.14 + */ +struct _NMSettingMatch { + NMSetting parent; + GPtrArray *interface_name; +}; + +struct _NMSettingMatchClass { + NMSettingClass parent; +}; + +G_DEFINE_TYPE (NMSettingMatch, nm_setting_match, NM_TYPE_SETTING) + +NM_GOBJECT_PROPERTIES_DEFINE (NMSettingMatch, + PROP_INTERFACE_NAME, +); + +/*****************************************************************************/ + +/** + * nm_setting_match_get_num_interface_names: + * @setting: the #NMSettingMatch + * + * Returns: the number of configured interface names + * + * Since: 1.14 + **/ +guint +nm_setting_match_get_num_interface_names (NMSettingMatch *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_MATCH (setting), 0); + + return setting->interface_name->len; +} + +/** + * nm_setting_match_get_interface_name: + * @setting: the #NMSettingMatch + * @idx: index number of the DNS search domain to return + * + * Returns: the interface name at index @idx + * + * Since: 1.14 + **/ +const char * +nm_setting_match_get_interface_name (NMSettingMatch *setting, int idx) +{ + g_return_val_if_fail (NM_IS_SETTING_MATCH (setting), NULL); + + g_return_val_if_fail (idx >= 0 && idx < setting->interface_name->len, NULL); + + return setting->interface_name->pdata[idx]; +} + +/** + * nm_setting_match_add_interface_name: + * @setting: the #NMSettingMatch + * @interface_name: the interface name to add + * + * Adds a new interface name to the setting. + * + * Since: 1.14 + **/ +void +nm_setting_match_add_interface_name (NMSettingMatch *setting, + const char *interface_name) +{ + g_return_if_fail (NM_IS_SETTING_MATCH (setting)); + g_return_if_fail (interface_name != NULL); + g_return_if_fail (interface_name[0] != '\0'); + + g_ptr_array_add (setting->interface_name, g_strdup (interface_name)); + _notify (setting, PROP_INTERFACE_NAME); +} + +/** + * nm_setting_match_remove_interface_name: + * @setting: the #NMSettingMatch + * @idx: index number of the interface name + * + * Removes the interface name at index @idx. + * + * Since: 1.14 + **/ +void +nm_setting_match_remove_interface_name (NMSettingMatch *setting, int idx) +{ + g_return_if_fail (NM_IS_SETTING_MATCH (setting)); + + g_return_if_fail (idx >= 0 && idx < setting->interface_name->len); + + g_ptr_array_remove_index (setting->interface_name, idx); + _notify (setting, PROP_INTERFACE_NAME); +} + +/** + * nm_setting_match_remove_interface_name_by_value: + * @setting: the #NMSettingMatch + * @interface_name: the interface name to remove + * + * Removes @interface_name. + * + * Returns: %TRUE if the interface name was found and removed; %FALSE if it was not. + * + * Since: 1.14 + **/ +gboolean +nm_setting_match_remove_interface_name_by_value (NMSettingMatch *setting, + const char *interface_name) +{ + guint i; + + g_return_val_if_fail (NM_IS_SETTING_MATCH (setting), FALSE); + g_return_val_if_fail (interface_name != NULL, FALSE); + g_return_val_if_fail (interface_name[0] != '\0', FALSE); + + for (i = 0; i < setting->interface_name->len; i++) { + if (nm_streq (interface_name, setting->interface_name->pdata[i])) { + g_ptr_array_remove_index (setting->interface_name, i); + _notify (setting, PROP_INTERFACE_NAME); + return TRUE; + } + } + return FALSE; +} + +/** + * nm_setting_match_clear_interface_names: + * @setting: the #NMSettingMatch + * + * Removes all configured interface names. + * + * Since: 1.14 + **/ +void +nm_setting_match_clear_interface_names (NMSettingMatch *setting) +{ + g_return_if_fail (NM_IS_SETTING_MATCH (setting)); + + if (setting->interface_name->len != 0) { + g_ptr_array_set_size (setting->interface_name, 0); + _notify (setting, PROP_INTERFACE_NAME); + } +} + +/** + * nm_setting_match_get_interface_names: + * @setting: the #NMSettingMatch + * + * Returns all the interface names. + * + * Returns: (transfer none): the configured interface names. + * + * Since: 1.14 + **/ +const char *const * +nm_setting_match_get_interface_names (NMSettingMatch *setting, guint *length) +{ + g_return_val_if_fail (NM_IS_SETTING_MATCH (setting), NULL); + g_return_val_if_fail (length, NULL); + + NM_SET_OUT (length, setting->interface_name->len); + return (const char *const *) setting->interface_name->pdata; +} + +static void +get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec) +{ + NMSettingMatch *self = NM_SETTING_MATCH (object); + + switch (prop_id) { + case PROP_INTERFACE_NAME: + g_value_take_boxed (value, _nm_utils_ptrarray_to_strv (self->interface_name)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +set_property (GObject *object, guint prop_id, + const GValue *value, GParamSpec *pspec) +{ + NMSettingMatch *self = NM_SETTING_MATCH (object); + + switch (prop_id) { + case PROP_INTERFACE_NAME: + g_ptr_array_unref (self->interface_name); + self->interface_name = _nm_utils_strv_to_ptrarray (g_value_get_boxed (value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +nm_setting_match_init (NMSettingMatch *setting) +{ + setting->interface_name = g_ptr_array_new_with_free_func (g_free); +} + +/** + * nm_setting_match_new: + * + * Creates a new #NMSettingMatch object with default values. + * + * Returns: (transfer full): the new empty #NMSettingMatch object + * + * Since: 1.14 + **/ +NMSetting * +nm_setting_match_new (void) +{ + return (NMSetting *) g_object_new (NM_TYPE_SETTING_MATCH, NULL); +} + +static void +finalize (GObject *object) +{ + NMSettingMatch *self = NM_SETTING_MATCH (object); + + g_ptr_array_unref (self->interface_name); + + G_OBJECT_CLASS (nm_setting_match_parent_class)->finalize (object); +} + +static void +nm_setting_match_class_init (NMSettingMatchClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + NMSettingClass *setting_class = NM_SETTING_CLASS (klass); + + object_class->finalize = finalize; + object_class->get_property = get_property; + object_class->set_property = set_property; + + /** + * NMSettingMatch:interface-name + * + * A list of interface names to match. Each element is a shell wildcard + * pattern. When an element is prefixed with exclamation mark (!) the + * condition is inverted. + * + * A candidate interface name is considered matching when both these + * conditions are satisfied: (a) any of the elements not prefixed with '!' + * matches or there aren't such elements; (b) none of the elements + * prefixed with '!' match. + * + * Since: 1.14 + **/ + obj_properties[PROP_INTERFACE_NAME] = + g_param_spec_boxed (NM_SETTING_MATCH_INTERFACE_NAME, "", "", + G_TYPE_STRV, + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); + + _nm_setting_class_commit (setting_class, NM_META_SETTING_TYPE_MATCH); +} diff --git a/libnm-core/nm-setting-match.h b/libnm-core/nm-setting-match.h new file mode 100644 index 0000000000..a39feca2f1 --- /dev/null +++ b/libnm-core/nm-setting-match.h @@ -0,0 +1,63 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/>. + * + * Copyright 2018 Red Hat, Inc. + */ + +#ifndef NM_SETTING_MATCH_H +#define NM_SETTING_MATCH_H + +#if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION) +#error "Only <NetworkManager.h> can be included directly." +#endif + +#include "nm-setting.h" + +G_BEGIN_DECLS + +#define NM_TYPE_SETTING_MATCH (nm_setting_match_get_type ()) +#define NM_SETTING_MATCH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_MATCH, NMSettingMatch)) +#define NM_SETTING_MATCH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_MATCH, NMSettingMatchClass)) +#define NM_IS_SETTING_MATCH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_MATCH)) +#define NM_IS_SETTING_MATCH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_MATCH)) +#define NM_SETTING_MATCH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_MATCH, NMSettingMatchClass)) + +#define NM_SETTING_MATCH_SETTING_NAME "match" + +#define NM_SETTING_MATCH_INTERFACE_NAME "interface-name" + +typedef struct _NMSettingMatchClass NMSettingMatchClass; + + +NM_AVAILABLE_IN_1_14 +GType nm_setting_match_get_type (void); +NM_AVAILABLE_IN_1_14 +NMSetting *nm_setting_match_new (void); + +NM_AVAILABLE_IN_1_14 +guint nm_setting_match_get_num_interface_names (NMSettingMatch *setting); +NM_AVAILABLE_IN_1_14 +const char *nm_setting_match_get_interface_name (NMSettingMatch *setting, int idx); +NM_AVAILABLE_IN_1_14 +void nm_setting_match_remove_interface_name (NMSettingMatch *setting, int idx); +NM_AVAILABLE_IN_1_14 +gboolean nm_setting_match_remove_interface_name_by_value (NMSettingMatch *setting, + const char *interface_name); +NM_AVAILABLE_IN_1_14 +void nm_setting_match_add_interface_name (NMSettingMatch *setting, + const char *interface_name); +NM_AVAILABLE_IN_1_14 +void nm_setting_match_clear_interface_names (NMSettingMatch *setting); +NM_AVAILABLE_IN_1_14 +const char *const *nm_setting_match_get_interface_names (NMSettingMatch *setting, guint *length); +G_END_DECLS + +#endif /* NM_SETTING_MATCH_H */ diff --git a/libnm/NetworkManager.h b/libnm/NetworkManager.h index a4af9b0d8e..759a413187 100644 --- a/libnm/NetworkManager.h +++ b/libnm/NetworkManager.h @@ -82,6 +82,7 @@ #include "nm-setting-ip-tunnel.h" #include "nm-setting-macsec.h" #include "nm-setting-macvlan.h" +#include "nm-setting-match.h" #include "nm-setting-olpc-mesh.h" #include "nm-setting-ovs-bridge.h" #include "nm-setting-ovs-interface.h" diff --git a/libnm/libnm.ver b/libnm/libnm.ver index 042453daa4..77ac0eed50 100644 --- a/libnm/libnm.ver +++ b/libnm/libnm.ver @@ -1399,6 +1399,14 @@ global: nm_setting_ethtool_get_type; nm_setting_ethtool_new; nm_setting_ethtool_set_feature; + nm_setting_match_add_interface_name; + nm_setting_match_clear_interface_names; + nm_setting_match_get_interface_name; + nm_setting_match_get_interface_names; + nm_setting_match_get_num_interface_names; + nm_setting_match_get_type; + nm_setting_match_remove_interface_name; + nm_setting_match_remove_interface_name_by_value; nm_setting_sriov_add_vf; nm_setting_sriov_clear_vfs; nm_setting_sriov_get_autoprobe_drivers; diff --git a/shared/nm-meta-setting.c b/shared/nm-meta-setting.c index c565e55f38..3e79747fba 100644 --- a/shared/nm-meta-setting.c +++ b/shared/nm-meta-setting.c @@ -44,6 +44,7 @@ #include "nm-setting-ip-tunnel.h" #include "nm-setting-macsec.h" #include "nm-setting-macvlan.h" +#include "nm-setting-match.h" #include "nm-setting-olpc-mesh.h" #include "nm-setting-ovs-bridge.h" #include "nm-setting-ovs-interface.h" @@ -268,6 +269,12 @@ const NMMetaSettingInfo nm_meta_setting_infos[] = { .setting_name = NM_SETTING_MACVLAN_SETTING_NAME, .get_setting_gtype = nm_setting_macvlan_get_type, }, + [NM_META_SETTING_TYPE_MATCH] = { + .meta_type = NM_META_SETTING_TYPE_MATCH, + .setting_priority = NM_SETTING_PRIORITY_AUX, + .setting_name = NM_SETTING_MATCH_SETTING_NAME, + .get_setting_gtype = nm_setting_match_get_type, + }, [NM_META_SETTING_TYPE_OLPC_MESH] = { .meta_type = NM_META_SETTING_TYPE_OLPC_MESH, .setting_priority = NM_SETTING_PRIORITY_HW_BASE, diff --git a/shared/nm-meta-setting.h b/shared/nm-meta-setting.h index c76a4b7008..26c29beaa7 100644 --- a/shared/nm-meta-setting.h +++ b/shared/nm-meta-setting.h @@ -127,6 +127,7 @@ typedef enum { NM_META_SETTING_TYPE_IP6_CONFIG, NM_META_SETTING_TYPE_MACSEC, NM_META_SETTING_TYPE_MACVLAN, + NM_META_SETTING_TYPE_MATCH, NM_META_SETTING_TYPE_OVS_BRIDGE, NM_META_SETTING_TYPE_OVS_INTERFACE, NM_META_SETTING_TYPE_OVS_PATCH, |