mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-20 11:40:14 +01:00
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:
parent
237030ce2b
commit
c364ef0b97
5 changed files with 64 additions and 0 deletions
|
|
@ -77,6 +77,7 @@ typedef struct {
|
||||||
GSList *secondaries; /* secondary connections to activate with the base connection */
|
GSList *secondaries; /* secondary connections to activate with the base connection */
|
||||||
guint gateway_ping_timeout;
|
guint gateway_ping_timeout;
|
||||||
NMMetered metered;
|
NMMetered metered;
|
||||||
|
NMSettingConnectionLldp lldp;
|
||||||
} NMSettingConnectionPrivate;
|
} NMSettingConnectionPrivate;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
@ -97,6 +98,7 @@ enum {
|
||||||
PROP_SECONDARIES,
|
PROP_SECONDARIES,
|
||||||
PROP_GATEWAY_PING_TIMEOUT,
|
PROP_GATEWAY_PING_TIMEOUT,
|
||||||
PROP_METERED,
|
PROP_METERED,
|
||||||
|
PROP_LLDP,
|
||||||
|
|
||||||
LAST_PROP
|
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_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
|
static void
|
||||||
_set_error_missing_base_setting (GError **error, const char *type)
|
_set_error_missing_base_setting (GError **error, const char *type)
|
||||||
|
|
@ -1196,6 +1216,9 @@ set_property (GObject *object, guint prop_id,
|
||||||
case PROP_METERED:
|
case PROP_METERED:
|
||||||
priv->metered = g_value_get_enum (value);
|
priv->metered = g_value_get_enum (value);
|
||||||
break;
|
break;
|
||||||
|
case PROP_LLDP:
|
||||||
|
priv->lldp = g_value_get_int (value);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
|
@ -1272,6 +1295,9 @@ get_property (GObject *object, guint prop_id,
|
||||||
case PROP_METERED:
|
case PROP_METERED:
|
||||||
g_value_set_enum (value, priv->metered);
|
g_value_set_enum (value, priv->metered);
|
||||||
break;
|
break;
|
||||||
|
case PROP_LLDP:
|
||||||
|
g_value_set_int (value, priv->lldp);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
|
@ -1702,4 +1728,20 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class)
|
||||||
G_PARAM_READWRITE |
|
G_PARAM_READWRITE |
|
||||||
NM_SETTING_PARAM_REAPPLY_IMMEDIATELY |
|
NM_SETTING_PARAM_REAPPLY_IMMEDIATELY |
|
||||||
G_PARAM_STATIC_STRINGS));
|
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_SECONDARIES "secondaries"
|
||||||
#define NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT "gateway-ping-timeout"
|
#define NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT "gateway-ping-timeout"
|
||||||
#define NM_SETTING_CONNECTION_METERED "metered"
|
#define NM_SETTING_CONNECTION_METERED "metered"
|
||||||
|
#define NM_SETTING_CONNECTION_LLDP "lldp"
|
||||||
|
|
||||||
/* Types for property values */
|
/* Types for property values */
|
||||||
/**
|
/**
|
||||||
|
|
@ -79,6 +80,19 @@ typedef enum {
|
||||||
NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_YES = 1,
|
NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_YES = 1,
|
||||||
} NMSettingConnectionAutoconnectSlaves;
|
} 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:
|
* NMSettingConnection:
|
||||||
|
|
@ -144,6 +158,8 @@ gboolean nm_setting_connection_remove_secondary_by_value (NMSettingConnection
|
||||||
guint32 nm_setting_connection_get_gateway_ping_timeout (NMSettingConnection *setting);
|
guint32 nm_setting_connection_get_gateway_ping_timeout (NMSettingConnection *setting);
|
||||||
NM_AVAILABLE_IN_1_2
|
NM_AVAILABLE_IN_1_2
|
||||||
NMMetered nm_setting_connection_get_metered (NMSettingConnection *setting);
|
NMMetered nm_setting_connection_get_metered (NMSettingConnection *setting);
|
||||||
|
NM_AVAILABLE_IN_1_2
|
||||||
|
NMSettingConnectionLldp nm_setting_connection_get_lldp (NMSettingConnection *setting);
|
||||||
|
|
||||||
G_END_DECLS
|
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_SECONDARIES, NM_SETTING_DIFF_RESULT_IN_A },
|
||||||
{ NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT, 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_METERED, NM_SETTING_DIFF_RESULT_IN_A },
|
||||||
|
{ NM_SETTING_CONNECTION_LLDP, NM_SETTING_DIFF_RESULT_IN_A },
|
||||||
{ NULL, NM_SETTING_DIFF_RESULT_UNKNOWN }
|
{ NULL, NM_SETTING_DIFF_RESULT_UNKNOWN }
|
||||||
} },
|
} },
|
||||||
{ NM_SETTING_WIRED_SETTING_NAME, {
|
{ NM_SETTING_WIRED_SETTING_NAME, {
|
||||||
|
|
|
||||||
|
|
@ -869,7 +869,9 @@ global:
|
||||||
nm_setting_bridge_get_multicast_snooping;
|
nm_setting_bridge_get_multicast_snooping;
|
||||||
nm_setting_connection_autoconnect_slaves_get_type;
|
nm_setting_connection_autoconnect_slaves_get_type;
|
||||||
nm_setting_connection_get_autoconnect_slaves;
|
nm_setting_connection_get_autoconnect_slaves;
|
||||||
|
nm_setting_connection_get_lldp;
|
||||||
nm_setting_connection_get_metered;
|
nm_setting_connection_get_metered;
|
||||||
|
nm_setting_connection_lldp_get_type;
|
||||||
nm_setting_ip4_config_get_dhcp_timeout;
|
nm_setting_ip4_config_get_dhcp_timeout;
|
||||||
nm_setting_ip_config_add_dns_option;
|
nm_setting_ip_config_add_dns_option;
|
||||||
nm_setting_ip_config_clear_dns_options;
|
nm_setting_ip_config_clear_dns_options;
|
||||||
|
|
|
||||||
|
|
@ -574,6 +574,9 @@ ipv6.ip6-privacy=1
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><varname>connection.autoconnect-slaves</varname></term>
|
<term><varname>connection.autoconnect-slaves</varname></term>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term><varname>connection.lldp</varname></term>
|
||||||
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><varname>ethernet.wake-on-lan</varname></term>
|
<term><varname>ethernet.wake-on-lan</varname></term>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue