diff options
Diffstat (limited to 'clients')
| -rw-r--r-- | clients/Makefile.am | 2 | ||||
| -rw-r--r-- | clients/Makefile.in | 3 | ||||
| -rw-r--r-- | clients/cli/Makefile.am | 1 | ||||
| -rw-r--r-- | clients/cli/Makefile.in | 10 | ||||
| -rw-r--r-- | clients/cli/connections.c | 179 | ||||
| -rw-r--r-- | clients/cli/devices.c | 5 | ||||
| -rw-r--r-- | clients/cli/nmcli-completion | 33 | ||||
| -rw-r--r-- | clients/cli/settings-docs.c | 2 | ||||
| -rw-r--r-- | clients/cli/settings.c | 59 | ||||
| -rw-r--r-- | clients/cli/utils.c | 4 | ||||
| -rw-r--r-- | clients/nm-online.c | 2 | ||||
| -rw-r--r-- | clients/tui/Makefile.am | 1 | ||||
| -rw-r--r-- | clients/tui/Makefile.in | 2 | ||||
| -rw-r--r-- | clients/tui/newt/Makefile.in | 1 | ||||
| -rw-r--r-- | clients/tui/nmt-page-ip4.c | 6 | ||||
| -rw-r--r-- | clients/tui/nmt-page-ip6.c | 6 | ||||
| -rw-r--r-- | clients/tui/nmtui-connect.c | 10 |
17 files changed, 291 insertions, 35 deletions
diff --git a/clients/Makefile.am b/clients/Makefile.am index dea8f9e3..8316dcc0 100644 --- a/clients/Makefile.am +++ b/clients/Makefile.am @@ -1,6 +1,8 @@ SUBDIRS = cli tui AM_CPPFLAGS = \ + -I${top_srcdir}/include \ + -I$(top_builddir)/include \ -I${top_srcdir}/libnm-core \ -I${top_builddir}/libnm-core \ -I${top_srcdir}/libnm \ diff --git a/clients/Makefile.in b/clients/Makefile.in index 2d750714..a281fd13 100644 --- a/clients/Makefile.in +++ b/clients/Makefile.in @@ -349,6 +349,7 @@ LOG_DRIVER = @LOG_DRIVER@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ @@ -491,6 +492,8 @@ with_resolvconf = @with_resolvconf@ with_valgrind = @with_valgrind@ SUBDIRS = cli tui AM_CPPFLAGS = \ + -I${top_srcdir}/include \ + -I$(top_builddir)/include \ -I${top_srcdir}/libnm-core \ -I${top_builddir}/libnm-core \ -I${top_srcdir}/libnm \ diff --git a/clients/cli/Makefile.am b/clients/cli/Makefile.am index 75c00a99..eef99cba 100644 --- a/clients/cli/Makefile.am +++ b/clients/cli/Makefile.am @@ -5,6 +5,7 @@ AM_CPPFLAGS = \ -I${top_srcdir} \ -I${top_builddir} \ -I${top_srcdir}/include \ + -I$(top_builddir)/include \ -I${top_srcdir}/libnm-core \ -I${top_builddir}/libnm-core \ -I${top_srcdir}/libnm \ diff --git a/clients/cli/Makefile.in b/clients/cli/Makefile.in index 34315101..d79f0e70 100644 --- a/clients/cli/Makefile.in +++ b/clients/cli/Makefile.in @@ -324,6 +324,7 @@ LOG_DRIVER = @LOG_DRIVER@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ @@ -465,10 +466,11 @@ with_netconfig = @with_netconfig@ with_resolvconf = @with_resolvconf@ with_valgrind = @with_valgrind@ AM_CPPFLAGS = -I${top_srcdir} -I${top_builddir} \ - -I${top_srcdir}/include -I${top_srcdir}/libnm-core \ - -I${top_builddir}/libnm-core -I${top_srcdir}/libnm \ - -I${top_builddir}/libnm -I${top_srcdir}/clients/common \ - $(GLIB_CFLAGS) -DG_LOG_DOMAIN=\""nmcli"\" \ + -I${top_srcdir}/include -I$(top_builddir)/include \ + -I${top_srcdir}/libnm-core -I${top_builddir}/libnm-core \ + -I${top_srcdir}/libnm -I${top_builddir}/libnm \ + -I${top_srcdir}/clients/common $(GLIB_CFLAGS) \ + -DG_LOG_DOMAIN=\""nmcli"\" \ -DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \ -DNMCLI_LOCALEDIR=\"$(datadir)/locale\" $(am__append_1) nmcli_SOURCES = agent.c agent.h common.c common.h connections.c \ diff --git a/clients/cli/connections.c b/clients/cli/connections.c index 8d138bdf..55bde29a 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -397,6 +397,10 @@ usage_connection_add (void) " olpc-mesh: ssid <SSID>\n" " [channel <1-13>]\n" " [dhcp-anycast <MAC address>]\n\n" + " adsl: username <username>\n" + " protocol pppoa|pppoe|ipoatm\n" + " [password <password>]\n" + " [encapsulation vcmux|llc]\n\n" " IP_OPTIONS:\n" " [ip4 <IPv4 address>] [gw4 <IPv4 gateway>]\n" " [ip6 <IPv6 address>] [gw6 <IPv6 gateway>]\n\n")); @@ -2471,7 +2475,9 @@ static const NameItem nmc_gsm_settings [] = { { NM_SETTING_CONNECTION_SETTING_NAME, NULL, NULL, TRUE }, { NM_SETTING_GSM_SETTING_NAME, NULL, NULL, TRUE }, { NM_SETTING_SERIAL_SETTING_NAME, NULL, NULL, FALSE }, + { NM_SETTING_PPP_SETTING_NAME, NULL, NULL, FALSE }, { NM_SETTING_IP4_CONFIG_SETTING_NAME, NULL, NULL, FALSE }, + { NM_SETTING_IP6_CONFIG_SETTING_NAME, NULL, NULL, FALSE }, { NULL, NULL, NULL, FALSE } }; @@ -2479,7 +2485,9 @@ static const NameItem nmc_cdma_settings [] = { { NM_SETTING_CONNECTION_SETTING_NAME, NULL, NULL, TRUE }, { NM_SETTING_CDMA_SETTING_NAME, NULL, NULL, TRUE }, { NM_SETTING_SERIAL_SETTING_NAME, NULL, NULL, FALSE }, + { NM_SETTING_PPP_SETTING_NAME, NULL, NULL, FALSE }, { NM_SETTING_IP4_CONFIG_SETTING_NAME, NULL, NULL, FALSE }, + { NM_SETTING_IP6_CONFIG_SETTING_NAME, NULL, NULL, FALSE }, { NULL, NULL, NULL, FALSE } }; @@ -2904,6 +2912,29 @@ check_infiniband_mode (char **mode, GError **error) return check_valid_enumeration (mode, modes, "mode", _("InfiniBand transport mode"), error); } +/* Checks ADSL protocol */ +static gboolean +check_adsl_protocol (char **protocol, GError **error) +{ + const char *protos[] = { NM_SETTING_ADSL_PROTOCOL_PPPOA, + NM_SETTING_ADSL_PROTOCOL_PPPOE, + NM_SETTING_ADSL_PROTOCOL_IPOATM, + NULL }; + + return check_valid_enumeration (protocol, protos, "protocol", _("ADSL protocol"), error); +} + +/* Checks ADSL encapsulation */ +static gboolean +check_adsl_encapsulation (char **encapsulation, GError **error) +{ + const char *modes[] = { NM_SETTING_ADSL_ENCAPSULATION_VCMUX, + NM_SETTING_ADSL_ENCAPSULATION_LLC, + NULL }; + + return check_valid_enumeration (encapsulation, modes, "encapsulation", _("ADSL encapsulation"), error); +} + static gboolean check_and_convert_vlan_flags (const char *flags, guint32 *flags_int, GError **error) { @@ -3871,6 +3902,33 @@ do_questionnaire_olpc (char **channel, char **dhcp_anycast) } } +#define PROMPT_ADSL_ENCAP "(" NM_SETTING_ADSL_ENCAPSULATION_VCMUX "/" NM_SETTING_ADSL_ENCAPSULATION_LLC ") [none]: " +static void +do_questionnaire_adsl (char **password, char **encapsulation) +{ + gboolean once_more; + GError *error = NULL; + + /* Ask for optional 'adsl' arguments. */ + if (!want_provide_opt_args (_("ADSL"), 2)) + return; + + if (!*password) + *password = nmc_readline (_("Password [none]: ")); + + if (!*encapsulation) { + do { + *encapsulation = nmc_readline (_("ADSL encapsulation %s"), PROMPT_ADSL_ENCAP); + once_more = !check_adsl_encapsulation (encapsulation, &error); + if (once_more) { + g_print ("%s\n", error->message); + g_clear_error (&error); + g_free (*encapsulation); + } + } while (once_more); + } +} + static gboolean split_address (char* str, char **ip, char **rest) { @@ -4006,6 +4064,7 @@ complete_connection_by_type (NMConnection *connection, GError **error) { NMSettingConnection *s_con; + NMSettingGeneric *s_generic; NMSettingWired *s_wired; NMSettingInfiniband *s_infiniband; NMSettingWireless *s_wifi; @@ -4022,6 +4081,7 @@ complete_connection_by_type (NMConnection *connection, NMSettingBridgePort *s_bridge_port; NMSettingVpn *s_vpn; NMSettingOlpcMesh *s_olpc_mesh; + NMSettingAdsl *s_adsl; g_return_val_if_fail (error == NULL || *error == NULL, FALSE); @@ -5232,6 +5292,78 @@ cleanup_olpc: if (!success) return FALSE; + } else if (!strcmp (con_type, NM_SETTING_ADSL_SETTING_NAME)) { + /* Build up the settings required for 'adsl' */ + gboolean success = FALSE; + char *username_ask = NULL; + const char *username = NULL; + char *protocol_ask = NULL; + const char *protocol = NULL; + const char *password_c = NULL; + char *password = NULL; + const char *encapsulation_c = NULL; + char *encapsulation = NULL; + nmc_arg_t exp_args[] = { {"username", TRUE, &username, !ask}, + {"protocol", TRUE, &protocol, !ask}, + {"password", TRUE, &password_c, FALSE}, + {"encapsulation", TRUE, &encapsulation_c, FALSE}, + {NULL} }; + + if (!nmc_parse_args (exp_args, FALSE, &argc, &argv, error)) + return FALSE; + + if (!username && ask) + username = username_ask = nmc_readline (_("Username: ")); + if (!username) { + g_set_error_literal (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT, + _("Error: 'username' is required.")); + goto cleanup_adsl; + } + +#define PROMPT_ADSL_PROTO "(" NM_SETTING_ADSL_PROTOCOL_PPPOA "/" NM_SETTING_ADSL_PROTOCOL_PPPOE "/" NM_SETTING_ADSL_PROTOCOL_IPOATM "): " + if (!protocol && ask) + protocol = protocol_ask = nmc_readline (_("Protocol %s"), PROMPT_ADSL_PROTO); + if (!protocol) { + g_set_error_literal (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT, + _("Error: 'protocol' is required.")); + goto cleanup_adsl; + } + if (!check_adsl_protocol (&protocol_ask, error)) + goto cleanup_adsl; + + /* Also ask for all optional arguments if '--ask' is specified. */ + password = g_strdup (password_c); + encapsulation = g_strdup (encapsulation_c); + if (ask) + do_questionnaire_adsl (&password, &encapsulation); + + if (!check_adsl_encapsulation (&encapsulation, error)) + goto cleanup_adsl; + + /* Add ADSL setting */ + s_adsl = (NMSettingAdsl *) nm_setting_adsl_new (); + nm_connection_add_setting (connection, NM_SETTING (s_adsl)); + + g_object_set (s_adsl, + NM_SETTING_ADSL_USERNAME, username, + NM_SETTING_ADSL_PROTOCOL, protocol, + NM_SETTING_ADSL_PASSWORD, password, + NM_SETTING_ADSL_ENCAPSULATION, encapsulation, + NULL); + + success = TRUE; +cleanup_adsl: + g_free (username_ask); + g_free (password); + g_free (protocol_ask); + g_free (encapsulation); + if (!success) + return FALSE; + + } else if (!strcmp (con_type, NM_SETTING_GENERIC_SETTING_NAME)) { + /* Add 'generic' setting */ + s_generic = (NMSettingGeneric *) nm_setting_generic_new (); + nm_connection_add_setting (connection, NM_SETTING (s_generic)); } else { g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT, _("Error: '%s' is not a valid connection type."), @@ -5465,6 +5597,20 @@ gen_func_bond_mon_mode (const char *text, int state) } static char * +gen_func_adsl_proto (const char *text, int state) +{ + const char *words[] = { "pppoe", "pppoa", "ipoatm", NULL }; + return nmc_rl_gen_func_basic (text, state, words); +} + +static char * +gen_func_adsl_encap (const char *text, int state) +{ + const char *words[] = { "vcmux", "llc", NULL }; + return nmc_rl_gen_func_basic (text, state, words); +} + +static char * gen_func_master_ifnames (const char *text, int state) { int i; @@ -5552,6 +5698,10 @@ nmcli_con_add_tab_completion (const char *text, int start, int end) generator_func = gen_func_bond_mode; else if (g_str_has_suffix (rl_prompt, PROMPT_BOND_MON_MODE)) generator_func = gen_func_bond_mon_mode; + else if (g_str_has_suffix (rl_prompt, PROMPT_ADSL_PROTO)) + generator_func = gen_func_adsl_proto; + else if (g_str_has_suffix (rl_prompt, PROMPT_ADSL_ENCAP)) + generator_func = gen_func_adsl_encap; if (generator_func) match_array = rl_completion_matches (text, generator_func); @@ -5646,15 +5796,20 @@ do_connection_add (NmCli *nmc, int argc, char **argv) || strcmp (type, NM_SETTING_VLAN_SETTING_NAME) == 0) ifname_mandatory = FALSE; - if (!ifname && ifname_mandatory && nmc->ask) { - ifname = ifname_ask = nmc_readline (_("Interface name [*]: ")); - if (!ifname) - ifname = ifname_ask = g_strdup ("*"); - } if (!ifname && ifname_mandatory) { - g_string_printf (nmc->return_text, _("Error: 'ifname' argument is required.")); - nmc->return_value = NMC_RESULT_ERROR_USER_INPUT; - goto error; + if (nmc->ask) { + ifname = ifname_ask = nmc_readline (_("Interface name [*]: ")); + if (!ifname) + ifname = ifname_ask = g_strdup ("*"); + } else { + if (!*argv) + g_string_printf (nmc->return_text, _("Error: 'ifname' argument is required.")); + else + g_string_printf (nmc->return_text, _("Error: mandatory 'ifname' not seen before '%s'."), + *argv); + nmc->return_value = NMC_RESULT_ERROR_USER_INPUT; + goto error; + } } if (ifname) { if (!nm_utils_iface_valid_name (ifname) && strcmp (ifname, "*") != 0) { @@ -8373,6 +8528,14 @@ editor_init_new_connection (NmCli *nmc, NMConnection *connection) nmc_setting_custom_init (base_setting); } + /* ADSL */ + if (g_strcmp0 (con_type, NM_SETTING_ADSL_SETTING_NAME) == 0) { + /* Initialize a protocol */ + g_object_set (NM_SETTING_ADSL (base_setting), + NM_SETTING_ADSL_PROTOCOL, NM_SETTING_ADSL_PROTOCOL_PPPOE, + NULL); + } + /* Always add IPv4 and IPv6 settings for non-slave connections */ setting = nm_setting_ip4_config_new (); nmc_setting_custom_init (setting); diff --git a/clients/cli/devices.c b/clients/cli/devices.c index c9ff8970..70c8d5d5 100644 --- a/clients/cli/devices.c +++ b/clients/cli/devices.c @@ -2549,6 +2549,11 @@ do_device_wifi_connect_network (NmCli *nmc, int argc, char **argv) NM_SETTING_WIRELESS_HIDDEN, hidden, NULL); g_bytes_unref (ssid); + + /* Warn when the provided AP identifier looks like BSSID instead of SSID */ + if (bssid1_arr) + g_printerr (_("Warning: '%s' should be SSID for hidden APs; but it looks like a BSSID.\n"), + param_user); } } diff --git a/clients/cli/nmcli-completion b/clients/cli/nmcli-completion index 4146eae0..7bdd5255 100644 --- a/clients/cli/nmcli-completion +++ b/clients/cli/nmcli-completion @@ -41,6 +41,20 @@ _nmcli_list_nl() fi (( i++ )) done + + # Work-around bash_completion issue where bash interprets a colon + # as a separator. + # Colon is escaped here. Change "\\:" back to ":". + # See also: + # http://stackoverflow.com/questions/28479216/how-to-give-correct-suggestions-to-tab-complete-when-my-words-contains-colons + # http://stackoverflow.com/questions/2805412/bash-completion-for-maven-escapes-colon/12495727 + i=0 + for entry in ${COMPREPLY[*]} + do + entry="${entry//\\\\:/:}" + COMPREPLY[$i]=${entry} + (( i++ )) + done } _nmcli_con_show() @@ -353,7 +367,7 @@ _nmcli_compl_ARGS() # user friendly. Only complete them, if the current word already starts with an "8". _nmcli_list "802-3-ethernet 802-11-wireless 802-11-olpc-mesh" else - _nmcli_list "ethernet wifi wimax gsm cdma infiniband bluetooth vpn olpc-mesh vlan bond bond-slave bridge bridge-slave team team-slave pppoe" + _nmcli_list "ethernet wifi wimax gsm cdma infiniband bluetooth vpn olpc-mesh vlan bond bond-slave bridge bridge-slave team team-slave pppoe adsl" fi return 0 fi @@ -522,6 +536,18 @@ _nmcli_compl_ARGS() return 0 fi ;; + encapsulation) + if [[ "${#words[@]}" -eq 2 ]]; then + _nmcli_list "vcmux llc" + return 0 + fi + ;; + protocol) + if [[ "${#words[@]}" -eq 2 ]]; then + _nmcli_list "pppoa pppoe ipoatm" + return 0 + fi + ;; *) return 1 ;; @@ -1010,6 +1036,11 @@ _nmcli() OPTIONS_TYPED=(username password service mtu mac) OPTIONS_MANDATORY=(username) ;; + a|ad|ads|adsl) + OPTIONS_TYPE=adsl + OPTIONS_TYPED=(username password protocol encapsulation) + OPTIONS_MANDATORY=(username protocol) + ;; *) # for an unknown connection type, we stop completion here return 0 diff --git a/clients/cli/settings-docs.c b/clients/cli/settings-docs.c index d48d4b08..eadc5076 100644 --- a/clients/cli/settings-docs.c +++ b/clients/cli/settings-docs.c @@ -99,7 +99,7 @@ NmcPropertyDesc setting_802_3_ethernet[] = { { "s390-options", "Dictionary of key/value pairs of s390-specific device options. Both keys and values must be strings. Allowed keys include \"portno\", \"layer2\", \"portname\", \"protocol\", among others. Key names must contain only alphanumeric characters (ie, [a-zA-Z0-9])." }, { "s390-subchannels", "Identifies specific subchannels that this network device uses for communication with z/VM or s390 host. Like the \"mac-address\" property for non-z/VM devices, this property can be used to ensure this connection only applies to the network device that uses these subchannels. The list should contain exactly 3 strings, and each string may only be composed of hexadecimal characters and the period (.) character." }, { "speed", "If non-zero, request that the device use only the specified speed. In Mbit/s, ie 100 == 100Mbit/s." }, - { "wake-on-lan", "The NMSettingWiredWakeOnLan options to enable. Not all devices support all options. May be any combination of NM_SETTING_WIRED_WAKE_ON_LAN_PHY (0x2), NM_SETTING_WIRED_WAKE_ON_LAN_UNICAST (0x4), NM_SETTING_WIRED_WAKE_ON_LAN_MULTICAST (0x8), NM_SETTING_WIRED_WAKE_ON_LAN_BROADCAST (0x10), NM_SETTING_WIRED_WAKE_ON_LAN_ARP (0x20), NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC (0x40)." }, + { "wake-on-lan", "The NMSettingWiredWakeOnLan options to enable. Not all devices support all options. May be any combination of NM_SETTING_WIRED_WAKE_ON_LAN_PHY (0x2), NM_SETTING_WIRED_WAKE_ON_LAN_UNICAST (0x4), NM_SETTING_WIRED_WAKE_ON_LAN_MULTICAST (0x8), NM_SETTING_WIRED_WAKE_ON_LAN_BROADCAST (0x10), NM_SETTING_WIRED_WAKE_ON_LAN_ARP (0x20), NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC (0x40) or the special values NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT (0x1) (to use global settings) and NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE (0x8000) (to disable management of Wake-on-LAN in NetworkManager)." }, { "wake-on-lan-password", "If specified, the password used with magic-packet-based Wake-on-LAN, represented as an Ethernet MAC address. If NULL, no password will be required." }, }; diff --git a/clients/cli/settings.c b/clients/cli/settings.c index 8c4af22d..8a6b5fa8 100644 --- a/clients/cli/settings.c +++ b/clients/cli/settings.c @@ -1524,9 +1524,16 @@ nmc_property_wired_get_wake_on_lan (NMSetting *setting, NmcPropertyGetType get_t { NMSettingWired *s_wired = NM_SETTING_WIRED (setting); NMSettingWiredWakeOnLan wol; + char *tmp, *str; wol = nm_setting_wired_get_wake_on_lan (s_wired); - return nm_utils_enum_to_str (nm_setting_wired_wake_on_lan_get_type (), wol); + tmp = nm_utils_enum_to_str (nm_setting_wired_wake_on_lan_get_type (), wol); + if (get_type == NMC_PROPERTY_GET_PARSABLE) + str = g_strdup_printf ("%s", tmp && *tmp ? tmp : "none"); + else + str = g_strdup_printf ("%d (%s)", wol, tmp && *tmp ? tmp : "none"); + g_free (tmp); + return str; } static gboolean @@ -1536,21 +1543,35 @@ nmc_property_wired_set_wake_on_lan (NMSetting *setting, const char *prop, NMSettingWiredWakeOnLan wol; gs_free char *err_token = NULL; gboolean ret; + long int t; - ret = nm_utils_enum_from_str (nm_setting_wired_wake_on_lan_get_type (), val, - (int *) &wol, &err_token); - - if (!ret) { - g_set_error (error, 1, 0, _("invalid option '%s', use a combination of %s or 'default'"), - err_token, - nm_utils_enum_to_str (nm_setting_wired_wake_on_lan_get_type (), - NM_SETTING_WIRED_WAKE_ON_LAN_ALL)); - return FALSE; + if (nmc_string_to_int_base (val, 0, TRUE, 0, + NM_SETTING_WIRED_WAKE_ON_LAN_ALL + | NM_SETTING_WIRED_WAKE_ON_LAN_EXCLUSIVE_FLAGS, + &t)) + wol = (NMSettingWiredWakeOnLan) t; + else { + ret = nm_utils_enum_from_str (nm_setting_wired_wake_on_lan_get_type (), val, + (int *) &wol, &err_token); + + if (!ret) { + if ( g_ascii_strcasecmp (err_token, "none") == 0 + || g_ascii_strcasecmp (err_token, "disable") == 0 + || g_ascii_strcasecmp (err_token, "disabled") == 0) + wol = NM_SETTING_WIRED_WAKE_ON_LAN_NONE; + else { + g_set_error (error, 1, 0, _("invalid option '%s', use a combination of [%s] or 'ignore', 'default' or 'none'"), + err_token, + nm_utils_enum_to_str (nm_setting_wired_wake_on_lan_get_type (), + NM_SETTING_WIRED_WAKE_ON_LAN_ALL)); + return FALSE; + } + } } - if (NM_FLAGS_HAS (wol, NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT) && - NM_FLAGS_ANY (wol, NM_SETTING_WIRED_WAKE_ON_LAN_ALL)) { - g_set_error_literal (error, 1, 0, _("'default' is incompatible with other flags")); + if ( NM_FLAGS_ANY (wol, NM_SETTING_WIRED_WAKE_ON_LAN_EXCLUSIVE_FLAGS) + && !nm_utils_is_power_of_two (wol)) { + g_set_error_literal (error, 1, 0, _("'default' and 'ignore' are incompatible with other flags")); return FALSE; } @@ -2847,6 +2868,16 @@ nmc_property_connection_set_metered (NMSetting *setting, const char *prop, return TRUE; } +static const char * +nmc_property_connection_describe_metered (NMSetting *setting, const char *prop) +{ + return _("Enter a value which indicates whether the connection is subject to a data\n" + "quota, usage costs or other limitations. Accepted options are:\n" + "'true','yes','on' to set the connection as metered\n" + "'false','no','off' to set the connection as not metered\n" + "'unknown' to let NetworkManager choose a value using some heuristics\n"); +} + /* --- NM_SETTING_802_1X_SETTING_NAME property setter functions --- */ #define DEFINE_SETTER_STR_LIST(def_func, set_func) \ static gboolean \ @@ -5431,7 +5462,7 @@ nmc_properties_init (void) nmc_property_connection_get_metered, nmc_property_connection_set_metered, NULL, - NULL, + nmc_property_connection_describe_metered, NULL, NULL); diff --git a/clients/cli/utils.c b/clients/cli/utils.c index 3cc836d8..47cd4392 100644 --- a/clients/cli/utils.c +++ b/clients/cli/utils.c @@ -92,8 +92,8 @@ nmc_arg_is_option (const char *str, const char *opt_name) * Helper function to parse command-line arguments. * arg_arr: description of arguments to look for * last: whether these are last expected arguments - * argc: command-line argument array - * argv: command-line argument array size + * argc: command-line argument array size + * argv: command-line argument array * error: error set on a failure (when FALSE is returned) * Returns: TRUE on success, FALSE on an error and sets 'error' */ diff --git a/clients/nm-online.c b/clients/nm-online.c index bb0c9706..5a818bae 100644 --- a/clients/nm-online.c +++ b/clients/nm-online.c @@ -93,7 +93,7 @@ handle_timeout (gpointer data) progress_next_step_i = (elapsed_ms / timeout->progress_step_duration) + 1; progress_next_step_i = MIN (progress_next_step_i, PROGRESS_STEPS); - g_print (_("\rConnecting")); + g_print ("\r%s", _("Connecting")); for (i = 0; i < PROGRESS_STEPS; i++) putchar (i < progress_next_step_i ? '.' : ' '); g_print (" %4lds", (long) (MAX (0, remaining_ms) / 1000)); diff --git a/clients/tui/Makefile.am b/clients/tui/Makefile.am index ad9335da..f6d93be2 100644 --- a/clients/tui/Makefile.am +++ b/clients/tui/Makefile.am @@ -5,6 +5,7 @@ SUBDIRS = newt . AM_CPPFLAGS= \ -I$(top_srcdir) \ -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ -I$(top_srcdir)/libnm-core \ -I$(top_builddir)/libnm-core \ -I$(top_srcdir)/libnm \ diff --git a/clients/tui/Makefile.in b/clients/tui/Makefile.in index 331461a7..26f00406 100644 --- a/clients/tui/Makefile.in +++ b/clients/tui/Makefile.in @@ -415,6 +415,7 @@ LOG_DRIVER = @LOG_DRIVER@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ @@ -559,6 +560,7 @@ with_valgrind = @with_valgrind@ @BUILD_NMTUI_TRUE@AM_CPPFLAGS = \ @BUILD_NMTUI_TRUE@ -I$(top_srcdir) \ @BUILD_NMTUI_TRUE@ -I$(top_srcdir)/include \ +@BUILD_NMTUI_TRUE@ -I$(top_builddir)/include \ @BUILD_NMTUI_TRUE@ -I$(top_srcdir)/libnm-core \ @BUILD_NMTUI_TRUE@ -I$(top_builddir)/libnm-core \ @BUILD_NMTUI_TRUE@ -I$(top_srcdir)/libnm \ diff --git a/clients/tui/newt/Makefile.in b/clients/tui/newt/Makefile.in index 96131a7d..ab647863 100644 --- a/clients/tui/newt/Makefile.in +++ b/clients/tui/newt/Makefile.in @@ -319,6 +319,7 @@ LOG_DRIVER = @LOG_DRIVER@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ diff --git a/clients/tui/nmt-page-ip4.c b/clients/tui/nmt-page-ip4.c index df3f0b64..c7009e2f 100644 --- a/clients/tui/nmt-page-ip4.c +++ b/clients/tui/nmt-page-ip4.c @@ -179,6 +179,12 @@ nmt_page_ip4_constructed (GObject *object) G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); nmt_editor_grid_append (grid, NULL, widget, NULL); + widget = nmt_newt_checkbox_new (_("Ignore automatically obtained routes")); + g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, + widget, "active", + G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); + nmt_editor_grid_append (grid, NULL, widget, NULL); + nmt_editor_grid_append (grid, NULL, nmt_newt_separator_new (), NULL); widget = nmt_newt_checkbox_new (_("Require IPv4 addressing for this connection")); diff --git a/clients/tui/nmt-page-ip6.c b/clients/tui/nmt-page-ip6.c index 1513dbfa..122c37f6 100644 --- a/clients/tui/nmt-page-ip6.c +++ b/clients/tui/nmt-page-ip6.c @@ -177,6 +177,12 @@ nmt_page_ip6_constructed (GObject *object) G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); nmt_editor_grid_append (grid, NULL, widget, NULL); + widget = nmt_newt_checkbox_new (_("Ignore automatically obtained routes")); + g_object_bind_property (s_ip6, NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, + widget, "active", + G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); + nmt_editor_grid_append (grid, NULL, widget, NULL); + nmt_editor_grid_append (grid, NULL, nmt_newt_separator_new (), NULL); widget = nmt_newt_checkbox_new (_("Require IPv6 addressing for this connection")); diff --git a/clients/tui/nmtui-connect.c b/clients/tui/nmtui-connect.c index 438915d2..cacb0b44 100644 --- a/clients/tui/nmtui-connect.c +++ b/clients/tui/nmtui-connect.c @@ -30,6 +30,8 @@ #include <glib/gi18n-lib.h> +#include "gsystem-local-alloc.h" + #include "nmt-newt.h" #include "nmtui.h" @@ -132,7 +134,7 @@ activate_connection (NMConnection *connection, NMObject *specific_object) { NmtNewtForm *form; - NMSecretAgentOld *agent; + gs_unref_object NMSecretAgentOld *agent = NULL; NmtNewtWidget *label; NmtSyncOp op; const char *specific_object_path; @@ -188,7 +190,7 @@ activate_connection (NMConnection *connection, goto done; } - if (!connection) { + if (agent && !connection) { connection = NM_CONNECTION (nm_active_connection_get_connection (ac)); if (connection) { nm_secret_agent_simple_enable (NM_SECRET_AGENT_SIMPLE (agent), @@ -220,8 +222,8 @@ activate_connection (NMConnection *connection, nmt_newt_form_quit (form); g_object_unref (form); - nm_secret_agent_old_unregister (agent, NULL, NULL); - g_object_unref (agent); + if (agent) + nm_secret_agent_old_unregister (agent, NULL, NULL); } static void |