diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2015-10-07 11:48:30 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2015-10-12 14:44:19 +0200 |
commit | c364ef0b97f0a74bfa6d037e3075c6e8565a718c (patch) | |
tree | 0d46aaab6f88d7d7219cbf786f508fb48ca73525 | |
parent | 237030ce2bc23f39ccb4f72f94b3c98e2232ded4 (diff) | |
download | NetworkManager-c364ef0b97f0a74bfa6d037e3075c6e8565a718c.tar.gz |
libnm: add 'lldp' property to NMSettingConnection
Add the 'lldp' property to NMSettingConnection, which specifies
whether the reception and parsing of LLDP frames to discover neighbor
devices should be enabled.
-rw-r--r-- | libnm-core/nm-setting-connection.c | 42 | ||||
-rw-r--r-- | libnm-core/nm-setting-connection.h | 16 | ||||
-rw-r--r-- | libnm-core/tests/test-general.c | 1 | ||||
-rw-r--r-- | libnm/libnm.ver | 2 | ||||
-rw-r--r-- | man/NetworkManager.conf.xml.in | 3 |
5 files changed, 64 insertions, 0 deletions
diff --git a/libnm-core/nm-setting-connection.c b/libnm-core/nm-setting-connection.c index 0217c358c1..af67c64c71 100644 --- a/libnm-core/nm-setting-connection.c +++ b/libnm-core/nm-setting-connection.c @@ -77,6 +77,7 @@ typedef struct { GSList *secondaries; /* secondary connections to activate with the base connection */ guint gateway_ping_timeout; NMMetered metered; + NMSettingConnectionLldp lldp; } NMSettingConnectionPrivate; enum { @@ -97,6 +98,7 @@ enum { PROP_SECONDARIES, PROP_GATEWAY_PING_TIMEOUT, PROP_METERED, + PROP_LLDP, LAST_PROP }; @@ -786,6 +788,24 @@ NM_BACKPORT_SYMBOL (libnm_1_0_6, NMMetered, nm_setting_connection_get_metered, ( NM_BACKPORT_SYMBOL (libnm_1_0_6, GType, nm_metered_get_type, (void), ()); +/** + * nm_setting_connection_get_lldp: + * @setting: the #NMSettingConnection + * + * Returns the #NMSettingConnection:lldp property of the connection. + * + * Returns: a %NMSettingConnectionLldp which indicates whether LLDP must be + * enabled for the connection. + * + * Since: 1.2 + **/ +NMSettingConnectionLldp +nm_setting_connection_get_lldp (NMSettingConnection *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_CONNECTION (setting), NM_SETTING_CONNECTION_LLDP_DEFAULT); + + return NM_SETTING_CONNECTION_GET_PRIVATE (setting)->lldp; +} static void _set_error_missing_base_setting (GError **error, const char *type) @@ -1196,6 +1216,9 @@ set_property (GObject *object, guint prop_id, case PROP_METERED: priv->metered = g_value_get_enum (value); break; + case PROP_LLDP: + priv->lldp = g_value_get_int (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -1272,6 +1295,9 @@ get_property (GObject *object, guint prop_id, case PROP_METERED: g_value_set_enum (value, priv->metered); break; + case PROP_LLDP: + g_value_set_int (value, priv->lldp); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -1702,4 +1728,20 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) G_PARAM_READWRITE | NM_SETTING_PARAM_REAPPLY_IMMEDIATELY | G_PARAM_STATIC_STRINGS)); + + /** + * NMSettingConnection:lldp: + * + * Whether LLDP is enabled for the connection. + * + * Since: 1.2 + **/ + g_object_class_install_property + (object_class, PROP_LLDP, + g_param_spec_int (NM_SETTING_CONNECTION_LLDP, "", "", + G_MININT32, G_MAXINT32, NM_SETTING_CONNECTION_LLDP_DEFAULT, + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); } diff --git a/libnm-core/nm-setting-connection.h b/libnm-core/nm-setting-connection.h index 0f502c955e..0d4966f05a 100644 --- a/libnm-core/nm-setting-connection.h +++ b/libnm-core/nm-setting-connection.h @@ -60,6 +60,7 @@ G_BEGIN_DECLS #define NM_SETTING_CONNECTION_SECONDARIES "secondaries" #define NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT "gateway-ping-timeout" #define NM_SETTING_CONNECTION_METERED "metered" +#define NM_SETTING_CONNECTION_LLDP "lldp" /* Types for property values */ /** @@ -79,6 +80,19 @@ typedef enum { NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_YES = 1, } NMSettingConnectionAutoconnectSlaves; +/** + * NMSettingConnectionLldp: + * @NM_SETTING_CONNECTION_LLDP_DEFAULT: default value + * @NM_SETTING_CONNECTION_LLDP_DISABLE: disable LLDP + * @NM_SETTING_CONNECTION_LLDP_ENABLE_RX: enable reception of LLDP frames + * + * #NMSettingConnectionLldp values indicate whether LLDP should be enabled. + */ +typedef enum { + NM_SETTING_CONNECTION_LLDP_DEFAULT = -1, + NM_SETTING_CONNECTION_LLDP_DISABLE = 0, + NM_SETTING_CONNECTION_LLDP_ENABLE_RX = 1, +} NMSettingConnectionLldp; /** * NMSettingConnection: @@ -144,6 +158,8 @@ gboolean nm_setting_connection_remove_secondary_by_value (NMSettingConnection guint32 nm_setting_connection_get_gateway_ping_timeout (NMSettingConnection *setting); NM_AVAILABLE_IN_1_2 NMMetered nm_setting_connection_get_metered (NMSettingConnection *setting); +NM_AVAILABLE_IN_1_2 +NMSettingConnectionLldp nm_setting_connection_get_lldp (NMSettingConnection *setting); G_END_DECLS diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c index bb2d6cb66d..7bd488b4e8 100644 --- a/libnm-core/tests/test-general.c +++ b/libnm-core/tests/test-general.c @@ -1972,6 +1972,7 @@ test_connection_diff_a_only (void) { NM_SETTING_CONNECTION_SECONDARIES, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_CONNECTION_METERED, NM_SETTING_DIFF_RESULT_IN_A }, + { NM_SETTING_CONNECTION_LLDP, NM_SETTING_DIFF_RESULT_IN_A }, { NULL, NM_SETTING_DIFF_RESULT_UNKNOWN } } }, { NM_SETTING_WIRED_SETTING_NAME, { diff --git a/libnm/libnm.ver b/libnm/libnm.ver index 2e58887d06..c720760a8f 100644 --- a/libnm/libnm.ver +++ b/libnm/libnm.ver @@ -869,7 +869,9 @@ global: nm_setting_bridge_get_multicast_snooping; nm_setting_connection_autoconnect_slaves_get_type; nm_setting_connection_get_autoconnect_slaves; + nm_setting_connection_get_lldp; nm_setting_connection_get_metered; + nm_setting_connection_lldp_get_type; nm_setting_ip4_config_get_dhcp_timeout; nm_setting_ip_config_add_dns_option; nm_setting_ip_config_clear_dns_options; diff --git a/man/NetworkManager.conf.xml.in b/man/NetworkManager.conf.xml.in index f7bcd1a359..9bf1388bea 100644 --- a/man/NetworkManager.conf.xml.in +++ b/man/NetworkManager.conf.xml.in @@ -575,6 +575,9 @@ ipv6.ip6-privacy=1 <term><varname>connection.autoconnect-slaves</varname></term> </varlistentry> <varlistentry> + <term><varname>connection.lldp</varname></term> + </varlistentry> + <varlistentry> <term><varname>ethernet.wake-on-lan</varname></term> </varlistentry> <varlistentry> |