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.
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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, {
|
||||
|
@@ -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;
|
||||
|
@@ -574,6 +574,9 @@ ipv6.ip6-privacy=1
|
||||
<varlistentry>
|
||||
<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>
|
||||
|
Reference in New Issue
Block a user