mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 11:40:18 +01:00
libnm,clients: add 'parent' property to PPPoE setting
When the property is set, it specifies the device on which PPPoE is to be started. The ppp interface will be named as the connection.interface-name property. When the property is not set the previous behavior will be retained, i.e. the PPPoE connection will be started on connection.interface-name and the PPP interface will have a random name.
This commit is contained in:
parent
c521cffd7b
commit
f83e56ec6d
5 changed files with 66 additions and 0 deletions
|
|
@ -5789,6 +5789,12 @@ static const NMMetaPropertyInfo *const property_infos_OLPC_MESH[] = {
|
|||
#undef _CURRENT_NM_META_SETTING_TYPE
|
||||
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_PPPOE
|
||||
static const NMMetaPropertyInfo *const property_infos_PPPOE[] = {
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPPOE_PARENT,
|
||||
.is_cli_option = TRUE,
|
||||
.property_alias = "parent",
|
||||
.prompt = N_("PPPoE parent device"),
|
||||
.property_type = &_pt_gobject_string,
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_PPPOE_SERVICE,
|
||||
.is_cli_option = TRUE,
|
||||
.property_alias = "service",
|
||||
|
|
|
|||
|
|
@ -280,6 +280,7 @@
|
|||
#define DESCRIBE_DOC_NM_SETTING_PPP_REQUIRE_MPPE N_("If TRUE, MPPE (Microsoft Point-to-Point Encryption) will be required for the PPP session. If either 64-bit or 128-bit MPPE is not available the session will fail. Note that MPPE is not used on mobile broadband connections.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPP_REQUIRE_MPPE_128 N_("If TRUE, 128-bit MPPE (Microsoft Point-to-Point Encryption) will be required for the PPP session, and the \"require-mppe\" property must also be set to TRUE. If 128-bit MPPE is not available the session will fail.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPPOE_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPPOE_PARENT N_("If given, specifies the parent interface name on which this PPPoE connection should be created. If this property is not specified, the connection is activated on the interface specified in \"interface-name\" of NMSettingConnection.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPPOE_PASSWORD N_("Password used to authenticate with the PPPoE service.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPPOE_PASSWORD_FLAGS N_("Flags indicating how to handle the \"password\" property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_PPPOE_SERVICE N_("If specified, instruct PPPoE to only initiate sessions with access concentrators that provide the specified service. For most providers, this should be left blank. It is only required if there are multiple access concentrators or a specific service is known to be required.")
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ NM_SETTING_REGISTER_TYPE (NM_TYPE_SETTING_PPPOE)
|
|||
#define NM_SETTING_PPPOE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_PPPOE, NMSettingPppoePrivate))
|
||||
|
||||
typedef struct {
|
||||
char *parent;
|
||||
char *service;
|
||||
char *username;
|
||||
char *password;
|
||||
|
|
@ -53,6 +54,7 @@ typedef struct {
|
|||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_PARENT,
|
||||
PROP_SERVICE,
|
||||
PROP_USERNAME,
|
||||
PROP_PASSWORD,
|
||||
|
|
@ -74,6 +76,22 @@ nm_setting_pppoe_new (void)
|
|||
return (NMSetting *) g_object_new (NM_TYPE_SETTING_PPPOE, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_pppoe_get_parent:
|
||||
* @setting: the #NMSettingPppoe
|
||||
*
|
||||
* Returns: the #NMSettingPppoe:parent property of the setting
|
||||
*
|
||||
* Since: 1.10
|
||||
**/
|
||||
const char *
|
||||
nm_setting_pppoe_get_parent (NMSettingPppoe *setting)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_SETTING_PPPOE (setting), NULL);
|
||||
|
||||
return NM_SETTING_PPPOE_GET_PRIVATE (setting)->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_pppoe_get_service:
|
||||
* @setting: the #NMSettingPppoe
|
||||
|
|
@ -134,6 +152,7 @@ static gboolean
|
|||
verify (NMSetting *setting, NMConnection *connection, GError **error)
|
||||
{
|
||||
NMSettingPppoePrivate *priv = NM_SETTING_PPPOE_GET_PRIVATE (setting);
|
||||
gs_free_error GError *local_error = NULL;
|
||||
|
||||
if (!priv->username) {
|
||||
g_set_error_literal (error,
|
||||
|
|
@ -160,6 +179,16 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if ( priv->parent
|
||||
&& !nm_utils_is_valid_iface_name (priv->parent, &local_error)) {
|
||||
g_set_error (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
"'%s': %s", priv->parent, local_error->message);
|
||||
g_prefix_error (error, "%s.%s: ", NM_SETTING_PPPOE_SETTING_NAME, NM_SETTING_PPPOE_PARENT);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -192,6 +221,10 @@ set_property (GObject *object, guint prop_id,
|
|||
NMSettingPppoePrivate *priv = NM_SETTING_PPPOE_GET_PRIVATE (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_PARENT:
|
||||
g_free (priv->parent);
|
||||
priv->parent = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_SERVICE:
|
||||
g_free (priv->service);
|
||||
priv->service = g_value_dup_string (value);
|
||||
|
|
@ -220,6 +253,9 @@ get_property (GObject *object, guint prop_id,
|
|||
NMSettingPppoe *setting = NM_SETTING_PPPOE (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_PARENT:
|
||||
g_value_set_string (value, nm_setting_pppoe_get_parent (setting));
|
||||
break;
|
||||
case PROP_SERVICE:
|
||||
g_value_set_string (value, nm_setting_pppoe_get_service (setting));
|
||||
break;
|
||||
|
|
@ -266,6 +302,25 @@ nm_setting_pppoe_class_init (NMSettingPppoeClass *setting_class)
|
|||
parent_class->need_secrets = need_secrets;
|
||||
|
||||
/* Properties */
|
||||
/**
|
||||
* NMSettingPppoe:parent:
|
||||
*
|
||||
* If given, specifies the parent interface name on which this PPPoE
|
||||
* connection should be created. If this property is not specified,
|
||||
* the connection is activated on the interface specified in
|
||||
* #NMSettingConnection:interface-name of #NMSettingConnection.
|
||||
*
|
||||
* Since: 1.10
|
||||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_PARENT,
|
||||
g_param_spec_string (NM_SETTING_PPPOE_PARENT, "", "",
|
||||
NULL,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT |
|
||||
NM_SETTING_PARAM_INFERRABLE |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* NMSettingPppoe:service:
|
||||
*
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ G_BEGIN_DECLS
|
|||
|
||||
#define NM_SETTING_PPPOE_SETTING_NAME "pppoe"
|
||||
|
||||
#define NM_SETTING_PPPOE_PARENT "parent"
|
||||
#define NM_SETTING_PPPOE_SERVICE "service"
|
||||
#define NM_SETTING_PPPOE_USERNAME "username"
|
||||
#define NM_SETTING_PPPOE_PASSWORD "password"
|
||||
|
|
@ -64,6 +65,8 @@ typedef struct {
|
|||
GType nm_setting_pppoe_get_type (void);
|
||||
|
||||
NMSetting *nm_setting_pppoe_new (void);
|
||||
NM_AVAILABLE_IN_1_10
|
||||
const char *nm_setting_pppoe_get_parent (NMSettingPppoe *setting);
|
||||
const char *nm_setting_pppoe_get_service (NMSettingPppoe *setting);
|
||||
const char *nm_setting_pppoe_get_username (NMSettingPppoe *setting);
|
||||
const char *nm_setting_pppoe_get_password (NMSettingPppoe *setting);
|
||||
|
|
|
|||
|
|
@ -1182,6 +1182,7 @@ libnm_1_10_0 {
|
|||
global:
|
||||
nm_device_dummy_get_hw_address;
|
||||
nm_setting_bridge_get_group_forward_mask;
|
||||
nm_setting_pppoe_get_parent;
|
||||
nm_setting_wireless_security_get_pmf;
|
||||
nm_setting_wireless_security_get_wps_method;
|
||||
nm_setting_wireless_security_pmf_get_type;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue