|
|
ab7d06 |
From b46ed879198e911521373391c27982034699dfe5 Mon Sep 17 00:00:00 2001
|
|
|
ab7d06 |
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
|
|
|
ab7d06 |
Date: Tue, 10 Feb 2015 15:33:35 +0100
|
|
|
ab7d06 |
Subject: [PATCH] nmcli: allow adding 'generic' connections via nmcli
|
|
|
ab7d06 |
connection add
|
|
|
ab7d06 |
MIME-Version: 1.0
|
|
|
ab7d06 |
Content-Type: text/plain; charset=UTF-8
|
|
|
ab7d06 |
Content-Transfer-Encoding: 8bit
|
|
|
ab7d06 |
|
|
|
ab7d06 |
'nmcli connection edit' already allows adding and editing generic connections
|
|
|
ab7d06 |
(added by 2a2af5825a6db62e7a88bb249cf7876551ed7fa3).
|
|
|
ab7d06 |
|
|
|
ab7d06 |
(cherry picked from commit 0ff9b75387b7ac2fd0235b23699990834426c467)
|
|
|
ab7d06 |
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
|
|
|
ab7d06 |
---
|
|
|
ab7d06 |
clients/cli/connections.c | 5 +++++
|
|
|
ab7d06 |
1 file changed, 5 insertions(+)
|
|
|
ab7d06 |
|
|
|
ab7d06 |
diff --git a/clients/cli/connections.c b/clients/cli/connections.c
|
|
|
ab7d06 |
index 8d138bd..3c95c03 100644
|
|
|
ab7d06 |
--- a/clients/cli/connections.c
|
|
|
ab7d06 |
+++ b/clients/cli/connections.c
|
|
|
ab7d06 |
@@ -4006,6 +4006,7 @@ complete_connection_by_type (NMConnection *connection,
|
|
|
ab7d06 |
GError **error)
|
|
|
ab7d06 |
{
|
|
|
ab7d06 |
NMSettingConnection *s_con;
|
|
|
ab7d06 |
+ NMSettingGeneric *s_generic;
|
|
|
ab7d06 |
NMSettingWired *s_wired;
|
|
|
ab7d06 |
NMSettingInfiniband *s_infiniband;
|
|
|
ab7d06 |
NMSettingWireless *s_wifi;
|
|
|
ab7d06 |
@@ -5232,6 +5233,10 @@ cleanup_olpc:
|
|
|
ab7d06 |
if (!success)
|
|
|
ab7d06 |
return FALSE;
|
|
|
ab7d06 |
|
|
|
ab7d06 |
+ } else if (!strcmp (con_type, NM_SETTING_GENERIC_SETTING_NAME)) {
|
|
|
ab7d06 |
+ /* Add 'generic' setting */
|
|
|
ab7d06 |
+ s_generic = (NMSettingGeneric *) nm_setting_generic_new ();
|
|
|
ab7d06 |
+ nm_connection_add_setting (connection, NM_SETTING (s_generic));
|
|
|
ab7d06 |
} else {
|
|
|
ab7d06 |
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
|
|
|
ab7d06 |
_("Error: '%s' is not a valid connection type."),
|
|
|
ab7d06 |
--
|
|
|
ab7d06 |
2.1.0
|
|
|
ab7d06 |
|
|
|
ab7d06 |
|
|
|
ab7d06 |
From 1f7be4951900ca3004cb258225bc924f49deefd2 Mon Sep 17 00:00:00 2001
|
|
|
ab7d06 |
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
|
|
|
ab7d06 |
Date: Fri, 18 Sep 2015 10:42:10 +0200
|
|
|
ab7d06 |
Subject: [PATCH 1/3] libnm-core/libnm-util: fix an assertion in adsl setting
|
|
|
ab7d06 |
MIME-Version: 1.0
|
|
|
ab7d06 |
Content-Type: text/plain; charset=UTF-8
|
|
|
ab7d06 |
Content-Transfer-Encoding: 8bit
|
|
|
ab7d06 |
|
|
|
ab7d06 |
(process:7799): GLib-CRITICAL **: g_ascii_strdown: assertion 'str != NULL' failed
|
|
|
ab7d06 |
|
|
|
ab7d06 |
(cherry picked from commit 3d64d45d16d761802e92cc3d83a89e3dd572d36d)
|
|
|
ab7d06 |
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
|
|
|
ab7d06 |
---
|
|
|
ab7d06 |
libnm-core/nm-setting-adsl.c | 7 +++++--
|
|
|
ab7d06 |
libnm-util/nm-setting-adsl.c | 7 +++++--
|
|
|
ab7d06 |
2 files changed, 10 insertions(+), 4 deletions(-)
|
|
|
ab7d06 |
|
|
|
ab7d06 |
diff --git a/libnm-core/nm-setting-adsl.c b/libnm-core/nm-setting-adsl.c
|
|
|
ab7d06 |
index 2e71f8e..7d78f06 100644
|
|
|
ab7d06 |
--- a/libnm-core/nm-setting-adsl.c
|
|
|
ab7d06 |
+++ b/libnm-core/nm-setting-adsl.c
|
|
|
ab7d06 |
@@ -267,6 +267,7 @@ set_property (GObject *object, guint prop_id,
|
|
|
ab7d06 |
const GValue *value, GParamSpec *pspec)
|
|
|
ab7d06 |
{
|
|
|
ab7d06 |
NMSettingAdslPrivate *priv = NM_SETTING_ADSL_GET_PRIVATE (object);
|
|
|
ab7d06 |
+ const char *str;
|
|
|
ab7d06 |
|
|
|
ab7d06 |
switch (prop_id) {
|
|
|
ab7d06 |
case PROP_USERNAME:
|
|
|
ab7d06 |
@@ -282,11 +283,13 @@ set_property (GObject *object, guint prop_id,
|
|
|
ab7d06 |
break;
|
|
|
ab7d06 |
case PROP_PROTOCOL:
|
|
|
ab7d06 |
g_free (priv->protocol);
|
|
|
ab7d06 |
- priv->protocol = g_ascii_strdown (g_value_get_string (value), -1);
|
|
|
ab7d06 |
+ str = g_value_get_string (value);
|
|
|
ab7d06 |
+ priv->protocol = str ? g_ascii_strdown (str, -1) : NULL;
|
|
|
ab7d06 |
break;
|
|
|
ab7d06 |
case PROP_ENCAPSULATION:
|
|
|
ab7d06 |
g_free (priv->encapsulation);
|
|
|
ab7d06 |
- priv->encapsulation = g_ascii_strdown (g_value_get_string (value), -1);
|
|
|
ab7d06 |
+ str = g_value_get_string (value);
|
|
|
ab7d06 |
+ priv->encapsulation = str ? g_ascii_strdown (str, -1) : NULL;
|
|
|
ab7d06 |
break;
|
|
|
ab7d06 |
case PROP_VPI:
|
|
|
ab7d06 |
priv->vpi = g_value_get_uint (value);
|
|
|
ab7d06 |
diff --git a/libnm-util/nm-setting-adsl.c b/libnm-util/nm-setting-adsl.c
|
|
|
ab7d06 |
index 5355011..51560a7 100644
|
|
|
ab7d06 |
--- a/libnm-util/nm-setting-adsl.c
|
|
|
ab7d06 |
+++ b/libnm-util/nm-setting-adsl.c
|
|
|
ab7d06 |
@@ -287,6 +287,7 @@ set_property (GObject *object, guint prop_id,
|
|
|
ab7d06 |
const GValue *value, GParamSpec *pspec)
|
|
|
ab7d06 |
{
|
|
|
ab7d06 |
NMSettingAdslPrivate *priv = NM_SETTING_ADSL_GET_PRIVATE (object);
|
|
|
ab7d06 |
+ const char *str;
|
|
|
ab7d06 |
|
|
|
ab7d06 |
switch (prop_id) {
|
|
|
ab7d06 |
case PROP_USERNAME:
|
|
|
ab7d06 |
@@ -302,11 +303,13 @@ set_property (GObject *object, guint prop_id,
|
|
|
ab7d06 |
break;
|
|
|
ab7d06 |
case PROP_PROTOCOL:
|
|
|
ab7d06 |
g_free (priv->protocol);
|
|
|
ab7d06 |
- priv->protocol = g_ascii_strdown (g_value_get_string (value), -1);
|
|
|
ab7d06 |
+ str = g_value_get_string (value);
|
|
|
ab7d06 |
+ priv->protocol = str ? g_ascii_strdown (str, -1) : NULL;
|
|
|
ab7d06 |
break;
|
|
|
ab7d06 |
case PROP_ENCAPSULATION:
|
|
|
ab7d06 |
g_free (priv->encapsulation);
|
|
|
ab7d06 |
- priv->encapsulation = g_ascii_strdown (g_value_get_string (value), -1);
|
|
|
ab7d06 |
+ str = g_value_get_string (value);
|
|
|
ab7d06 |
+ priv->encapsulation = str ? g_ascii_strdown (str, -1) : NULL;
|
|
|
ab7d06 |
break;
|
|
|
ab7d06 |
case PROP_VPI:
|
|
|
ab7d06 |
priv->vpi = g_value_get_uint (value);
|
|
|
ab7d06 |
--
|
|
|
ab7d06 |
2.1.0
|
|
|
ab7d06 |
|
|
|
ab7d06 |
|
|
|
ab7d06 |
From 9bca3b7a37f00b94e3feec0ab400cfa5dfe60831 Mon Sep 17 00:00:00 2001
|
|
|
ab7d06 |
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
|
|
|
ab7d06 |
Date: Fri, 18 Sep 2015 11:08:28 +0200
|
|
|
ab7d06 |
Subject: [PATCH 2/3] cli: initialize adsl.protocol in editor when creating a
|
|
|
ab7d06 |
new connection
|
|
|
ab7d06 |
MIME-Version: 1.0
|
|
|
ab7d06 |
Content-Type: text/plain; charset=UTF-8
|
|
|
ab7d06 |
Content-Transfer-Encoding: 8bit
|
|
|
ab7d06 |
|
|
|
ab7d06 |
The protocol is required and it is nice to have a valid initial value for
|
|
|
ab7d06 |
the property.
|
|
|
ab7d06 |
|
|
|
ab7d06 |
(cherry picked from commit 5502d8691a0e1b7174a0be85951f155fa587e400)
|
|
|
ab7d06 |
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
|
|
|
ab7d06 |
---
|
|
|
ab7d06 |
clients/cli/connections.c | 8 ++++++++
|
|
|
ab7d06 |
1 file changed, 8 insertions(+)
|
|
|
ab7d06 |
|
|
|
ab7d06 |
diff --git a/clients/cli/connections.c b/clients/cli/connections.c
|
|
|
ab7d06 |
index 3c95c03..e8391ea 100644
|
|
|
ab7d06 |
--- a/clients/cli/connections.c
|
|
|
ab7d06 |
+++ b/clients/cli/connections.c
|
|
|
ab7d06 |
@@ -8378,6 +8378,14 @@ editor_init_new_connection (NmCli *nmc, NMConnection *connection)
|
|
|
ab7d06 |
nmc_setting_custom_init (base_setting);
|
|
|
ab7d06 |
}
|
|
|
ab7d06 |
|
|
|
ab7d06 |
+ /* ADSL */
|
|
|
ab7d06 |
+ if (g_strcmp0 (con_type, NM_SETTING_ADSL_SETTING_NAME) == 0) {
|
|
|
ab7d06 |
+ /* Initialize a protocol */
|
|
|
ab7d06 |
+ g_object_set (NM_SETTING_ADSL (base_setting),
|
|
|
ab7d06 |
+ NM_SETTING_ADSL_PROTOCOL, NM_SETTING_ADSL_PROTOCOL_PPPOE,
|
|
|
ab7d06 |
+ NULL);
|
|
|
ab7d06 |
+ }
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
/* Always add IPv4 and IPv6 settings for non-slave connections */
|
|
|
ab7d06 |
setting = nm_setting_ip4_config_new ();
|
|
|
ab7d06 |
nmc_setting_custom_init (setting);
|
|
|
ab7d06 |
--
|
|
|
ab7d06 |
2.1.0
|
|
|
ab7d06 |
|
|
|
ab7d06 |
|
|
|
ab7d06 |
From b590a318398decb31c9b21f481dbc7e28e0ecc8e Mon Sep 17 00:00:00 2001
|
|
|
ab7d06 |
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
|
|
|
ab7d06 |
Date: Fri, 18 Sep 2015 12:05:49 +0200
|
|
|
ab7d06 |
Subject: [PATCH 3/3] cli: allow creating ADSL connections with 'nmcli
|
|
|
ab7d06 |
connection add' (rh #1264089)
|
|
|
ab7d06 |
MIME-Version: 1.0
|
|
|
ab7d06 |
Content-Type: text/plain; charset=UTF-8
|
|
|
ab7d06 |
Content-Transfer-Encoding: 8bit
|
|
|
ab7d06 |
|
|
|
ab7d06 |
https://bugzilla.redhat.com/show_bug.cgi?id=1264089
|
|
|
ab7d06 |
|
|
|
ab7d06 |
(cherry picked from commit 290c1626b9788aa90861ca423c0dffb59fe29876)
|
|
|
ab7d06 |
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
|
|
|
ab7d06 |
---
|
|
|
ab7d06 |
clients/cli/connections.c | 141 +++++++++++++++++++++++++++++++++++++++++++
|
|
|
ab7d06 |
clients/cli/nmcli-completion | 19 +++++-
|
|
|
ab7d06 |
man/nmcli.1.in | 12 ++++
|
|
|
ab7d06 |
3 files changed, 171 insertions(+), 1 deletion(-)
|
|
|
ab7d06 |
|
|
|
ab7d06 |
diff --git a/clients/cli/connections.c b/clients/cli/connections.c
|
|
|
ab7d06 |
index e8391ea..b6614ae 100644
|
|
|
ab7d06 |
--- a/clients/cli/connections.c
|
|
|
ab7d06 |
+++ b/clients/cli/connections.c
|
|
|
ab7d06 |
@@ -397,6 +397,10 @@ usage_connection_add (void)
|
|
|
ab7d06 |
" olpc-mesh: ssid <SSID>\n"
|
|
|
ab7d06 |
" [channel <1-13>]\n"
|
|
|
ab7d06 |
" [dhcp-anycast <MAC address>]\n\n"
|
|
|
ab7d06 |
+ " adsl: username <username>\n"
|
|
|
ab7d06 |
+ " protocol pppoa|pppoe|ipoatm\n"
|
|
|
ab7d06 |
+ " [password <password>]\n"
|
|
|
ab7d06 |
+ " [encapsulation vcmux|llc]\n\n"
|
|
|
ab7d06 |
" IP_OPTIONS:\n"
|
|
|
ab7d06 |
" [ip4 <IPv4 address>] [gw4 <IPv4 gateway>]\n"
|
|
|
ab7d06 |
" [ip6 <IPv6 address>] [gw6 <IPv6 gateway>]\n\n"));
|
|
|
ab7d06 |
@@ -2904,6 +2908,29 @@ check_infiniband_mode (char **mode, GError **error)
|
|
|
ab7d06 |
return check_valid_enumeration (mode, modes, "mode", _("InfiniBand transport mode"), error);
|
|
|
ab7d06 |
}
|
|
|
ab7d06 |
|
|
|
ab7d06 |
+/* Checks ADSL protocol */
|
|
|
ab7d06 |
+static gboolean
|
|
|
ab7d06 |
+check_adsl_protocol (char **protocol, GError **error)
|
|
|
ab7d06 |
+{
|
|
|
ab7d06 |
+ const char *protos[] = { NM_SETTING_ADSL_PROTOCOL_PPPOA,
|
|
|
ab7d06 |
+ NM_SETTING_ADSL_PROTOCOL_PPPOE,
|
|
|
ab7d06 |
+ NM_SETTING_ADSL_PROTOCOL_IPOATM,
|
|
|
ab7d06 |
+ NULL };
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
+ return check_valid_enumeration (protocol, protos, "protocol", _("ADSL protocol"), error);
|
|
|
ab7d06 |
+}
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
+/* Checks ADSL encapsulation */
|
|
|
ab7d06 |
+static gboolean
|
|
|
ab7d06 |
+check_adsl_encapsulation (char **encapsulation, GError **error)
|
|
|
ab7d06 |
+{
|
|
|
ab7d06 |
+ const char *modes[] = { NM_SETTING_ADSL_ENCAPSULATION_VCMUX,
|
|
|
ab7d06 |
+ NM_SETTING_ADSL_ENCAPSULATION_LLC,
|
|
|
ab7d06 |
+ NULL };
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
+ return check_valid_enumeration (encapsulation, modes, "encapsulation", _("ADSL encapsulation"), error);
|
|
|
ab7d06 |
+}
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
static gboolean
|
|
|
ab7d06 |
check_and_convert_vlan_flags (const char *flags, guint32 *flags_int, GError **error)
|
|
|
ab7d06 |
{
|
|
|
ab7d06 |
@@ -3871,6 +3898,33 @@ do_questionnaire_olpc (char **channel, char **dhcp_anycast)
|
|
|
ab7d06 |
}
|
|
|
ab7d06 |
}
|
|
|
ab7d06 |
|
|
|
ab7d06 |
+#define PROMPT_ADSL_ENCAP "(" NM_SETTING_ADSL_ENCAPSULATION_VCMUX "/" NM_SETTING_ADSL_ENCAPSULATION_LLC ") [none]: "
|
|
|
ab7d06 |
+static void
|
|
|
ab7d06 |
+do_questionnaire_adsl (char **password, char **encapsulation)
|
|
|
ab7d06 |
+{
|
|
|
ab7d06 |
+ gboolean once_more;
|
|
|
ab7d06 |
+ GError *error = NULL;
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
+ /* Ask for optional 'adsl' arguments. */
|
|
|
ab7d06 |
+ if (!want_provide_opt_args (_("ADSL"), 2))
|
|
|
ab7d06 |
+ return;
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
+ if (!*password)
|
|
|
ab7d06 |
+ *password = nmc_readline (_("Password [none]: "));
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
+ if (!*encapsulation) {
|
|
|
ab7d06 |
+ do {
|
|
|
ab7d06 |
+ *encapsulation = nmc_readline (_("ADSL encapsulation %s"), PROMPT_ADSL_ENCAP);
|
|
|
ab7d06 |
+ once_more = !check_adsl_encapsulation (encapsulation, &error);
|
|
|
ab7d06 |
+ if (once_more) {
|
|
|
ab7d06 |
+ g_print ("%s\n", error->message);
|
|
|
ab7d06 |
+ g_clear_error (&error);
|
|
|
ab7d06 |
+ g_free (*encapsulation);
|
|
|
ab7d06 |
+ }
|
|
|
ab7d06 |
+ } while (once_more);
|
|
|
ab7d06 |
+ }
|
|
|
ab7d06 |
+}
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
static gboolean
|
|
|
ab7d06 |
split_address (char* str, char **ip, char **rest)
|
|
|
ab7d06 |
{
|
|
|
ab7d06 |
@@ -4023,6 +4077,7 @@ complete_connection_by_type (NMConnection *connection,
|
|
|
ab7d06 |
NMSettingBridgePort *s_bridge_port;
|
|
|
ab7d06 |
NMSettingVpn *s_vpn;
|
|
|
ab7d06 |
NMSettingOlpcMesh *s_olpc_mesh;
|
|
|
ab7d06 |
+ NMSettingAdsl *s_adsl;
|
|
|
ab7d06 |
|
|
|
ab7d06 |
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
|
|
ab7d06 |
|
|
|
ab7d06 |
@@ -5233,6 +5288,74 @@ cleanup_olpc:
|
|
|
ab7d06 |
if (!success)
|
|
|
ab7d06 |
return FALSE;
|
|
|
ab7d06 |
|
|
|
ab7d06 |
+ } else if (!strcmp (con_type, NM_SETTING_ADSL_SETTING_NAME)) {
|
|
|
ab7d06 |
+ /* Build up the settings required for 'adsl' */
|
|
|
ab7d06 |
+ gboolean success = FALSE;
|
|
|
ab7d06 |
+ char *username_ask = NULL;
|
|
|
ab7d06 |
+ const char *username = NULL;
|
|
|
ab7d06 |
+ char *protocol_ask = NULL;
|
|
|
ab7d06 |
+ const char *protocol = NULL;
|
|
|
ab7d06 |
+ const char *password_c = NULL;
|
|
|
ab7d06 |
+ char *password = NULL;
|
|
|
ab7d06 |
+ const char *encapsulation_c = NULL;
|
|
|
ab7d06 |
+ char *encapsulation = NULL;
|
|
|
ab7d06 |
+ nmc_arg_t exp_args[] = { {"username", TRUE, &username, !ask},
|
|
|
ab7d06 |
+ {"protocol", TRUE, &protocol, !ask},
|
|
|
ab7d06 |
+ {"password", TRUE, &password_c, FALSE},
|
|
|
ab7d06 |
+ {"encapsulation", TRUE, &encapsulation_c, FALSE},
|
|
|
ab7d06 |
+ {NULL} };
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
+ if (!nmc_parse_args (exp_args, FALSE, &argc, &argv, error))
|
|
|
ab7d06 |
+ return FALSE;
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
+ if (!username && ask)
|
|
|
ab7d06 |
+ username = username_ask = nmc_readline (_("Username: "));
|
|
|
ab7d06 |
+ if (!username) {
|
|
|
ab7d06 |
+ g_set_error_literal (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
|
|
|
ab7d06 |
+ _("Error: 'username' is required."));
|
|
|
ab7d06 |
+ goto cleanup_adsl;
|
|
|
ab7d06 |
+ }
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
+#define PROMPT_ADSL_PROTO "(" NM_SETTING_ADSL_PROTOCOL_PPPOA "/" NM_SETTING_ADSL_PROTOCOL_PPPOE "/" NM_SETTING_ADSL_PROTOCOL_IPOATM "): "
|
|
|
ab7d06 |
+ if (!protocol && ask)
|
|
|
ab7d06 |
+ protocol = protocol_ask = nmc_readline (_("Protocol %s"), PROMPT_ADSL_PROTO);
|
|
|
ab7d06 |
+ if (!protocol) {
|
|
|
ab7d06 |
+ g_set_error_literal (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
|
|
|
ab7d06 |
+ _("Error: 'protocol' is required."));
|
|
|
ab7d06 |
+ goto cleanup_adsl;
|
|
|
ab7d06 |
+ }
|
|
|
ab7d06 |
+ if (!check_adsl_protocol (&protocol_ask, error))
|
|
|
ab7d06 |
+ goto cleanup_adsl;
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
+ /* Also ask for all optional arguments if '--ask' is specified. */
|
|
|
ab7d06 |
+ password = g_strdup (password_c);
|
|
|
ab7d06 |
+ encapsulation = g_strdup (encapsulation_c);
|
|
|
ab7d06 |
+ if (ask)
|
|
|
ab7d06 |
+ do_questionnaire_adsl (&password, &encapsulation);
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
+ if (!check_adsl_encapsulation (&encapsulation, error))
|
|
|
ab7d06 |
+ goto cleanup_adsl;
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
+ /* Add ADSL setting */
|
|
|
ab7d06 |
+ s_adsl = (NMSettingAdsl *) nm_setting_adsl_new ();
|
|
|
ab7d06 |
+ nm_connection_add_setting (connection, NM_SETTING (s_adsl));
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
+ g_object_set (s_adsl,
|
|
|
ab7d06 |
+ NM_SETTING_ADSL_USERNAME, username,
|
|
|
ab7d06 |
+ NM_SETTING_ADSL_PROTOCOL, protocol,
|
|
|
ab7d06 |
+ NM_SETTING_ADSL_PASSWORD, password,
|
|
|
ab7d06 |
+ NM_SETTING_ADSL_ENCAPSULATION, encapsulation,
|
|
|
ab7d06 |
+ NULL);
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
+ success = TRUE;
|
|
|
ab7d06 |
+cleanup_adsl:
|
|
|
ab7d06 |
+ g_free (username_ask);
|
|
|
ab7d06 |
+ g_free (password);
|
|
|
ab7d06 |
+ g_free (protocol_ask);
|
|
|
ab7d06 |
+ g_free (encapsulation);
|
|
|
ab7d06 |
+ if (!success)
|
|
|
ab7d06 |
+ return FALSE;
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
} else if (!strcmp (con_type, NM_SETTING_GENERIC_SETTING_NAME)) {
|
|
|
ab7d06 |
/* Add 'generic' setting */
|
|
|
ab7d06 |
s_generic = (NMSettingGeneric *) nm_setting_generic_new ();
|
|
|
ab7d06 |
@@ -5470,6 +5593,20 @@ gen_func_bond_mon_mode (const char *text, int state)
|
|
|
ab7d06 |
}
|
|
|
ab7d06 |
|
|
|
ab7d06 |
static char *
|
|
|
ab7d06 |
+gen_func_adsl_proto (const char *text, int state)
|
|
|
ab7d06 |
+{
|
|
|
ab7d06 |
+ const char *words[] = { "pppoe", "pppoa", "ipoatm", NULL };
|
|
|
ab7d06 |
+ return nmc_rl_gen_func_basic (text, state, words);
|
|
|
ab7d06 |
+}
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
+static char *
|
|
|
ab7d06 |
+gen_func_adsl_encap (const char *text, int state)
|
|
|
ab7d06 |
+{
|
|
|
ab7d06 |
+ const char *words[] = { "vcmux", "llc", NULL };
|
|
|
ab7d06 |
+ return nmc_rl_gen_func_basic (text, state, words);
|
|
|
ab7d06 |
+}
|
|
|
ab7d06 |
+
|
|
|
ab7d06 |
+static char *
|
|
|
ab7d06 |
gen_func_master_ifnames (const char *text, int state)
|
|
|
ab7d06 |
{
|
|
|
ab7d06 |
int i;
|
|
|
ab7d06 |
@@ -5557,6 +5694,10 @@ nmcli_con_add_tab_completion (const char *text, int start, int end)
|
|
|
ab7d06 |
generator_func = gen_func_bond_mode;
|
|
|
ab7d06 |
else if (g_str_has_suffix (rl_prompt, PROMPT_BOND_MON_MODE))
|
|
|
ab7d06 |
generator_func = gen_func_bond_mon_mode;
|
|
|
ab7d06 |
+ else if (g_str_has_suffix (rl_prompt, PROMPT_ADSL_PROTO))
|
|
|
ab7d06 |
+ generator_func = gen_func_adsl_proto;
|
|
|
ab7d06 |
+ else if (g_str_has_suffix (rl_prompt, PROMPT_ADSL_ENCAP))
|
|
|
ab7d06 |
+ generator_func = gen_func_adsl_encap;
|
|
|
ab7d06 |
|
|
|
ab7d06 |
if (generator_func)
|
|
|
ab7d06 |
match_array = rl_completion_matches (text, generator_func);
|
|
|
ab7d06 |
diff --git a/clients/cli/nmcli-completion b/clients/cli/nmcli-completion
|
|
|
ab7d06 |
index 4146eae..9f34b83 100644
|
|
|
ab7d06 |
--- a/clients/cli/nmcli-completion
|
|
|
ab7d06 |
+++ b/clients/cli/nmcli-completion
|
|
|
ab7d06 |
@@ -353,7 +353,7 @@ _nmcli_compl_ARGS()
|
|
|
ab7d06 |
# user friendly. Only complete them, if the current word already starts with an "8".
|
|
|
ab7d06 |
_nmcli_list "802-3-ethernet 802-11-wireless 802-11-olpc-mesh"
|
|
|
ab7d06 |
else
|
|
|
ab7d06 |
- _nmcli_list "ethernet wifi wimax gsm cdma infiniband bluetooth vpn olpc-mesh vlan bond bond-slave bridge bridge-slave team team-slave pppoe"
|
|
|
ab7d06 |
+ _nmcli_list "ethernet wifi wimax gsm cdma infiniband bluetooth vpn olpc-mesh vlan bond bond-slave bridge bridge-slave team team-slave pppoe adsl"
|
|
|
ab7d06 |
fi
|
|
|
ab7d06 |
return 0
|
|
|
ab7d06 |
fi
|
|
|
ab7d06 |
@@ -522,6 +522,18 @@ _nmcli_compl_ARGS()
|
|
|
ab7d06 |
return 0
|
|
|
ab7d06 |
fi
|
|
|
ab7d06 |
;;
|
|
|
ab7d06 |
+ encapsulation)
|
|
|
ab7d06 |
+ if [[ "${#words[@]}" -eq 2 ]]; then
|
|
|
ab7d06 |
+ _nmcli_list "vcmux llc"
|
|
|
ab7d06 |
+ return 0
|
|
|
ab7d06 |
+ fi
|
|
|
ab7d06 |
+ ;;
|
|
|
ab7d06 |
+ protocol)
|
|
|
ab7d06 |
+ if [[ "${#words[@]}" -eq 2 ]]; then
|
|
|
ab7d06 |
+ _nmcli_list "pppoa pppoe ipoatm"
|
|
|
ab7d06 |
+ return 0
|
|
|
ab7d06 |
+ fi
|
|
|
ab7d06 |
+ ;;
|
|
|
ab7d06 |
*)
|
|
|
ab7d06 |
return 1
|
|
|
ab7d06 |
;;
|
|
|
ab7d06 |
@@ -1010,6 +1022,11 @@ _nmcli()
|
|
|
ab7d06 |
OPTIONS_TYPED=(username password service mtu mac)
|
|
|
ab7d06 |
OPTIONS_MANDATORY=(username)
|
|
|
ab7d06 |
;;
|
|
|
ab7d06 |
+ a|ad|ads|adsl)
|
|
|
ab7d06 |
+ OPTIONS_TYPE=adsl
|
|
|
ab7d06 |
+ OPTIONS_TYPED=(username password protocol encapsulation)
|
|
|
ab7d06 |
+ OPTIONS_MANDATORY=(username protocol)
|
|
|
ab7d06 |
+ ;;
|
|
|
ab7d06 |
*)
|
|
|
ab7d06 |
# for an unknown connection type, we stop completion here
|
|
|
ab7d06 |
return 0
|
|
|
ab7d06 |
diff --git a/man/nmcli.1.in b/man/nmcli.1.in
|
|
|
ab7d06 |
index 6df844d..a680901 100644
|
|
|
ab7d06 |
--- a/man/nmcli.1.in
|
|
|
ab7d06 |
+++ b/man/nmcli.1.in
|
|
|
ab7d06 |
@@ -619,6 +619,18 @@ to be sent back out through the slave the frame was received on (default: yes)
|
|
|
ab7d06 |
.RE
|
|
|
ab7d06 |
.RS
|
|
|
ab7d06 |
.TP
|
|
|
ab7d06 |
+.B adsl:
|
|
|
ab7d06 |
+.IP "\fIusername <username>\fP" 42
|
|
|
ab7d06 |
+\(en ADSL user name
|
|
|
ab7d06 |
+.IP "\fIprotocol pppoa|pppoe|ipoatm\fP" 42
|
|
|
ab7d06 |
+\(en ADSL protocol
|
|
|
ab7d06 |
+.IP "\fI[password <password>]\fP" 42
|
|
|
ab7d06 |
+\(en ADSL password
|
|
|
ab7d06 |
+.IP "\fI[encapsulation vcmux|llc]\fP" 42
|
|
|
ab7d06 |
+\(en ADSL encapsulation
|
|
|
ab7d06 |
+.RE
|
|
|
ab7d06 |
+.RS
|
|
|
ab7d06 |
+.TP
|
|
|
ab7d06 |
.B IP_OPTIONS:
|
|
|
ab7d06 |
.IP "\fI[ip4 <IPv4 address>] [gw4 <IPv4 gateway>]\fP" 42
|
|
|
ab7d06 |
\(en IPv4 addresses
|
|
|
ab7d06 |
--
|
|
|
ab7d06 |
2.1.0
|
|
|
ab7d06 |
|