diff options
| author | Michael Biebl <biebl@debian.org> | 2023-02-10 11:50:34 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2023-02-10 11:50:34 +0100 |
| commit | 1372848511cb896b80b51ed1a3e9606bd9816631 (patch) | |
| tree | 674792b9385bdef935988894b45f06b2af39f88c /src/nmcli | |
| parent | 40ec077ea305994c1fc2130add6787ca0c73e2c6 (diff) | |
New upstream version 1.42.0 upstream/1.42.0
Diffstat (limited to 'src/nmcli')
| -rw-r--r-- | src/nmcli/agent.c | 40 | ||||
| -rw-r--r-- | src/nmcli/common.c | 104 | ||||
| -rw-r--r-- | src/nmcli/connections.c | 1139 | ||||
| -rw-r--r-- | src/nmcli/connections.h | 2 | ||||
| -rw-r--r-- | src/nmcli/devices.c | 444 | ||||
| -rw-r--r-- | src/nmcli/devices.h | 2 | ||||
| -rw-r--r-- | src/nmcli/gen-metadata-nm-settings-nmcli.c (renamed from src/nmcli/generate-docs-nm-settings-nmcli.c) | 0 | ||||
| -rw-r--r-- | src/nmcli/gen-metadata-nm-settings-nmcli.xml.in (renamed from src/nmcli/generate-docs-nm-settings-nmcli.xml) | 47 | ||||
| -rw-r--r-- | src/nmcli/general.c | 300 | ||||
| -rw-r--r-- | src/nmcli/generate-docs-nm-settings-nmcli.xml.in | 1160 | ||||
| -rw-r--r-- | src/nmcli/meson.build | 23 | ||||
| -rw-r--r-- | src/nmcli/nmcli.c | 22 | ||||
| -rw-r--r-- | src/nmcli/polkit-agent.c | 9 | ||||
| -rw-r--r-- | src/nmcli/settings.c | 39 | ||||
| -rw-r--r-- | src/nmcli/utils.c | 164 | ||||
| -rw-r--r-- | src/nmcli/utils.h | 44 |
16 files changed, 1259 insertions, 2280 deletions
diff --git a/src/nmcli/agent.c b/src/nmcli/agent.c index 6d0fcfb5..b16a3c51 100644 --- a/src/nmcli/agent.c +++ b/src/nmcli/agent.c @@ -22,36 +22,36 @@ static void usage(void) { - g_printerr(_("Usage: nmcli agent { COMMAND | help }\n\n" - "COMMAND := { secret | polkit | all }\n\n")); + nmc_printerr(_("Usage: nmcli agent { COMMAND | help }\n\n" + "COMMAND := { secret | polkit | all }\n\n")); } static void usage_agent_secret(void) { - g_printerr(_("Usage: nmcli agent secret { help }\n" - "\n" - "Runs nmcli as NetworkManager secret agent. When NetworkManager requires\n" - "a password it asks registered agents for it. This command keeps nmcli running\n" - "and if a password is required asks the user for it.\n\n")); + nmc_printerr(_("Usage: nmcli agent secret { help }\n" + "\n" + "Runs nmcli as NetworkManager secret agent. When NetworkManager requires\n" + "a password it asks registered agents for it. This command keeps nmcli running\n" + "and if a password is required asks the user for it.\n\n")); } static void usage_agent_polkit(void) { - g_printerr(_("Usage: nmcli agent polkit { help }\n" - "\n" - "Registers nmcli as a polkit action for the user session.\n" - "When a polkit daemon requires an authorization, nmcli asks the user and gives\n" - "the response back to polkit.\n\n")); + nmc_printerr(_("Usage: nmcli agent polkit { help }\n" + "\n" + "Registers nmcli as a polkit action for the user session.\n" + "When a polkit daemon requires an authorization, nmcli asks the user and gives\n" + "the response back to polkit.\n\n")); } static void usage_agent_all(void) { - g_printerr(_("Usage: nmcli agent all { help }\n" - "\n" - "Runs nmcli as both NetworkManager secret and a polkit agent.\n\n")); + nmc_printerr(_("Usage: nmcli agent all { help }\n" + "\n" + "Runs nmcli as both NetworkManager secret and a polkit agent.\n\n")); } static char *pre_input_deftext; @@ -82,7 +82,7 @@ get_secrets_from_user(const NmcConfig *nmc_config, /* Ask user for the password */ if (msg) - g_print("%s\n", msg); + nmc_print("%s\n", msg); if (secret->value) { /* Prefill the password if we have it. */ rl_startup_hook = set_deftext; @@ -138,7 +138,7 @@ do_agent_secret(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const * NM_SECRET_AGENT_SIMPLE_REQUEST_SECRETS, G_CALLBACK(secrets_requested), nmc); - g_print(_("nmcli successfully registered as a NetworkManager's secret agent.\n")); + nmc_print(_("nmcli successfully registered as a NetworkManager's secret agent.\n")); } else { g_string_printf(nmc->return_text, _("Error: secret agent initialization failed")); nmc->return_value = NMC_RESULT_ERROR_UNKNOWN; @@ -148,7 +148,7 @@ do_agent_secret(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const * static void polkit_registered(gpointer instance, gpointer user_data) { - g_print(_("nmcli successfully registered as a polkit agent.\n")); + nmc_print(_("nmcli successfully registered as a polkit agent.\n")); } static void @@ -202,14 +202,14 @@ do_agent_all(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const *arg do_agent_secret(cmd, nmc, argc, argv); r = nmc->return_value; if (r != NMC_RESULT_SUCCESS) { - g_printerr("%s\n", nmc->return_text->str); + nmc_printerr("%s\n", nmc->return_text->str); g_string_truncate(nmc->return_text, 0); nmc->return_value = NMC_RESULT_SUCCESS; } do_agent_polkit(cmd, nmc, argc, argv); if (nmc->return_value != NMC_RESULT_SUCCESS) { - g_printerr("%s\n", nmc->return_text->str); + nmc_printerr("%s\n", nmc->return_text->str); g_string_truncate(nmc->return_text, 0); } diff --git a/src/nmcli/common.c b/src/nmcli/common.c index ff4c15c3..f31d0987 100644 --- a/src/nmcli/common.c +++ b/src/nmcli/common.c @@ -354,15 +354,15 @@ print_ip_config(NMIPConfig *cfg, g_strdup_printf("IP%c.%s", nm_utils_addr_family_to_char(addr_family), one_field); } - if (!nmc_print(nmc_config, - (gpointer[]){cfg, NULL}, - NULL, - NULL, - addr_family == AF_INET - ? NMC_META_GENERIC_GROUP("IP4", metagen_ip4_config, N_("GROUP")) - : NMC_META_GENERIC_GROUP("IP6", metagen_ip6_config, N_("GROUP")), - field_str, - &error)) { + if (!nmc_print_table(nmc_config, + (gpointer[]){cfg, NULL}, + NULL, + NULL, + addr_family == AF_INET + ? NMC_META_GENERIC_GROUP("IP4", metagen_ip4_config, N_("GROUP")) + : NMC_META_GENERIC_GROUP("IP6", metagen_ip6_config, N_("GROUP")), + field_str, + &error)) { return FALSE; } return TRUE; @@ -385,15 +385,15 @@ print_dhcp_config(NMDhcpConfig *dhcp, g_strdup_printf("DHCP%c.%s", nm_utils_addr_family_to_char(addr_family), one_field); } - if (!nmc_print(nmc_config, - (gpointer[]){dhcp, NULL}, - NULL, - NULL, - addr_family == AF_INET - ? NMC_META_GENERIC_GROUP("DHCP4", metagen_dhcp_config, N_("GROUP")) - : NMC_META_GENERIC_GROUP("DHCP6", metagen_dhcp_config, N_("GROUP")), - field_str, - &error)) { + if (!nmc_print_table(nmc_config, + (gpointer[]){dhcp, NULL}, + NULL, + NULL, + addr_family == AF_INET + ? NMC_META_GENERIC_GROUP("DHCP4", metagen_dhcp_config, N_("GROUP")) + : NMC_META_GENERIC_GROUP("DHCP6", metagen_dhcp_config, N_("GROUP")), + field_str, + &error)) { return FALSE; } return TRUE; @@ -432,10 +432,13 @@ nmc_find_connection(const GPtrArray *connections, GPtrArray *result = out_result ? *out_result : NULL; const guint result_inital_len = result ? result->len : 0u; guint i, j; + gboolean must_match_uniquely; nm_assert(connections); nm_assert(filter_val); + must_match_uniquely = NM_IN_STRSET(filter_type, "uuid", "path"); + for (i = 0; i < connections->len; i++) { gboolean match_by_uuid = FALSE; NMConnection *connection; @@ -452,6 +455,12 @@ nmc_find_connection(const GPtrArray *connections, match_by_uuid = TRUE; goto found; } + if (filter_type && !nm_str_is_empty(filter_val) && g_str_has_prefix(v, filter_val)) { + /* If the selector is qualified by "uuid", prefix matches for the UUID are + * also OK. At least, if they result in a unique match. */ + nm_assert(must_match_uniquely); + goto found; + } } if (NM_IN_STRSET(filter_type, NULL, "id")) { @@ -483,14 +492,26 @@ nmc_find_connection(const GPtrArray *connections, continue; found: + + if (must_match_uniquely && (best_candidate || best_candidate_uuid)) { + /* We found duplicates. This is wrong. */ + if (out_result && *out_result) { + /* Remove the element that we added before. */ + g_ptr_array_set_size(*out_result, result_inital_len); + } + return NULL; + } + if (match_by_uuid) { if (!complete && !out_result) return connection; - best_candidate_uuid = connection; + if (!best_candidate_uuid) + best_candidate_uuid = connection; } else { if (!best_candidate) best_candidate = connection; } + if (out_result) { gboolean already_tracked = FALSE; @@ -639,16 +660,16 @@ vpn_openconnect_get_secrets(NMConnection *connection, GPtrArray *secrets) /* Interactively authenticate to OpenConnect server and get secrets */ ret = nm_vpn_openconnect_authenticate_helper(gw, &cookie, &gateway, &gwcert, &status, &error); if (!ret) { - g_printerr(_("Error: openconnect failed: %s\n"), error->message); + nmc_printerr(_("Error: openconnect failed: %s\n"), error->message); g_clear_error(&error); return FALSE; } if (WIFEXITED(status)) { if (WEXITSTATUS(status) != 0) - g_printerr(_("Error: openconnect failed with status %d\n"), WEXITSTATUS(status)); + nmc_printerr(_("Error: openconnect failed with status %d\n"), WEXITSTATUS(status)); } else if (WIFSIGNALED(status)) - g_printerr(_("Error: openconnect failed with signal %d\n"), WTERMSIG(status)); + nmc_printerr(_("Error: openconnect failed with signal %d\n"), WTERMSIG(status)); /* Append port to the host value */ if (gateway && port) { @@ -722,7 +743,7 @@ get_secrets_from_user(const NmcConfig *nmc_config, } } if (msg) - g_print("%s\n", msg); + nmc_print("%s\n", msg); echo_on = secret->is_secret ? nmc_config->show_secrets : TRUE; @@ -739,10 +760,10 @@ get_secrets_from_user(const NmcConfig *nmc_config, pwd = g_strdup(""); } else { if (msg) - g_print("%s\n", msg); - g_printerr(_("Warning: password for '%s' not given in 'passwd-file' " - "and nmcli cannot ask without '--ask' option.\n"), - secret->entry_id); + nmc_print("%s\n", msg); + nmc_printerr(_("Warning: password for '%s' not given in 'passwd-file' " + "and nmcli cannot ask without '--ask' option.\n"), + secret->entry_id); } } /* No password provided, cancel the secrets. */ @@ -874,7 +895,10 @@ static void readline_cb(char *line) { rl_got_line = TRUE; - rl_string = line; + + free(rl_string); + rl_string = line; + rl_callback_handler_remove(); } @@ -889,13 +913,15 @@ static char * nmc_readline_helper(const NmcConfig *nmc_config, const char *prompt) { GSource *io_source; + char *result; nmc_set_in_readline(TRUE); io_source = nm_g_unix_fd_add_source(STDIN_FILENO, G_IO_IN, stdin_ready_cb, NULL); read_again: - rl_string = NULL; + nm_clear_free(&rl_string); + rl_got_line = FALSE; rl_callback_handler_install(prompt, readline_cb); @@ -921,7 +947,6 @@ read_again: if (nmc_config->in_editor || (rl_string && *rl_string)) { /* In editor, or the line is not empty */ /* Call readline again to get new prompt (repeat) */ - g_free(rl_string); goto read_again; } else { /* Not in editor and line is empty, exit */ @@ -934,16 +959,19 @@ read_again: } /* Return NULL, not empty string */ - if (rl_string && *rl_string == '\0') { - g_free(rl_string); - rl_string = NULL; - } + if (rl_string && *rl_string == '\0') + nm_clear_free(&rl_string); nm_clear_g_source_inst(&io_source); nmc_set_in_readline(FALSE); - return rl_string; + if (!rl_string) + return NULL; + + result = g_strdup(rl_string); + nm_clear_free(&rl_string); + return result; } /** @@ -1014,7 +1042,7 @@ nmc_readline_echo(const NmcConfig *nmc_config, gboolean echo_on, const char *pro #if HAVE_READLINE_HISTORY nm_auto_free HISTORY_STATE *saved_history = NULL; HISTORY_STATE passwd_history = { - 0, + 0, }; #else int start, curpos; @@ -1504,7 +1532,7 @@ nmc_do_cmd(NmCli *nmc, const NMCCommand cmds[], const char *cmd, int argc, const if (argc == 1 && nmc->complete) { for (c = cmds; c->cmd; ++c) { if (!*cmd || matches(cmd, c->cmd)) - g_print("%s\n", c->cmd); + nmc_print("%s\n", c->cmd); } nmc_complete_help(cmd); g_task_return_boolean(task, TRUE); @@ -1584,7 +1612,7 @@ nmc_complete_strv(const char *prefix, gssize nargs, const char *const *args) if (prefix && !matches(prefix, candidate)) continue; - g_print("%s\n", candidate); + nmc_print("%s\n", candidate); } } diff --git a/src/nmcli/connections.c b/src/nmcli/connections.c index 8c6ebd98..36de6373 100644 --- a/src/nmcli/connections.c +++ b/src/nmcli/connections.c @@ -169,9 +169,7 @@ print_connection_done(GObject *source_object, GAsyncResult *res, gpointer user_d written = g_output_stream_write_finish(stream, res, &error); if (written == -1) { - g_string_printf(nmc->return_text, - _("Error: Error writting connection: %s"), - error->message); + g_string_printf(nmc->return_text, _("Error: Error writing connection: %s"), error->message); nmc->return_value = NMC_RESULT_ERROR_UNKNOWN; nmc->should_wait--; quit(); @@ -230,7 +228,7 @@ nmc_print_connection_and_quit(NmCli *nmc, NMConnection *connection) return; error: - g_string_printf(nmc->return_text, _("Error: Error writting connection: %s"), error->message); + g_string_printf(nmc->return_text, _("Error: Error writing connection: %s"), error->message); nmc->return_value = NMC_RESULT_ERROR_UNKNOWN; nmc->should_wait--; quit(); @@ -1086,7 +1084,7 @@ static TabCompletionInfo nmc_tab_completion; static void usage(void) { - g_printerr( + nmc_printerr( _("Usage: nmcli connection { COMMAND | help }\n\n" "COMMAND := { show | up | down | add | modify | clone | edit | delete | monitor | reload " "| load | import | export }\n\n" @@ -1112,7 +1110,7 @@ usage(void) static void usage_connection_show(void) { - g_printerr( + nmc_printerr( _("Usage: nmcli connection show { ARGUMENTS | help }\n" "\n" "ARGUMENTS := [--active] [--order <order spec>]\n" @@ -1134,171 +1132,173 @@ usage_connection_show(void) static void usage_connection_up(void) { - g_printerr(_("Usage: nmcli connection up { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [id | uuid | path] <ID> [ifname <ifname>] [ap <BSSID>] [nsp <name>] " - "[passwd-file <file with passwords>]\n" - "\n" - "Activate a connection on a device. The profile to activate is identified by its\n" - "name, UUID or D-Bus path.\n" - "\n" - "ARGUMENTS := ifname <ifname> [ap <BSSID>] [nsp <name>] [passwd-file <file with " - "passwords>]\n" - "\n" - "Activate a device with a connection. The connection profile is selected\n" - "automatically by NetworkManager.\n" - "\n" - "ifname - specifies the device to active the connection on\n" - "ap - specifies AP to connect to (only valid for Wi-Fi)\n" - "nsp - specifies NSP to connect to (only valid for WiMAX)\n" - "passwd-file - file with password(s) required to activate the connection\n\n")); + nmc_printerr( + _("Usage: nmcli connection up { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [id | uuid | path] <ID> [ifname <ifname>] [ap <BSSID>] [nsp <name>] " + "[passwd-file <file with passwords>]\n" + "\n" + "Activate a connection on a device. The profile to activate is identified by its\n" + "name, UUID or D-Bus path.\n" + "\n" + "ARGUMENTS := ifname <ifname> [ap <BSSID>] [nsp <name>] [passwd-file <file with " + "passwords>]\n" + "\n" + "Activate a device with a connection. The connection profile is selected\n" + "automatically by NetworkManager.\n" + "\n" + "ifname - specifies the device to active the connection on\n" + "ap - specifies AP to connect to (only valid for Wi-Fi)\n" + "nsp - specifies NSP to connect to (only valid for WiMAX)\n" + "passwd-file - file with password(s) required to activate the connection\n\n")); } static void usage_connection_down(void) { - g_printerr(_("Usage: nmcli connection down { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [id | uuid | path | apath] <ID> ...\n" - "\n" - "Deactivate a connection from a device (without preventing the device from\n" - "further auto-activation). The profile to deactivate is identified by its name,\n" - "UUID or D-Bus path.\n\n")); + nmc_printerr( + _("Usage: nmcli connection down { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [id | uuid | path | apath] <ID> ...\n" + "\n" + "Deactivate a connection from a device (without preventing the device from\n" + "further auto-activation). The profile to deactivate is identified by its name,\n" + "UUID or D-Bus path.\n\n")); } static void usage_connection_add(void) { - g_printerr(_("Usage: nmcli connection add { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := COMMON_OPTIONS TYPE_SPECIFIC_OPTIONS SLAVE_OPTIONS IP_OPTIONS [-- " - "([+|-]<setting>.<property> <value>)+]\n\n" - " COMMON_OPTIONS:\n" - " type <type>\n" - " ifname <interface name> | \"*\"\n" - " [con-name <connection name>]\n" - " [autoconnect yes|no]\n" - " [save yes|no]\n" - " [master <master (ifname, or connection UUID or name)>]\n" - " [slave-type <master connection type>]\n\n" - " TYPE_SPECIFIC_OPTIONS:\n" - " ethernet: [mac <MAC address>]\n" - " [cloned-mac <cloned MAC address>]\n" - " [mtu <MTU>]\n\n" - " wifi: ssid <SSID>\n" - " [mac <MAC address>]\n" - " [cloned-mac <cloned MAC address>]\n" - " [mtu <MTU>]\n" - " [mode infrastructure|ap|adhoc]\n\n" - " wimax: [mac <MAC address>]\n" - " [nsp <NSP>]\n\n" - " pppoe: username <PPPoE username>\n" - " [password <PPPoE password>]\n" - " [service <PPPoE service name>]\n" - " [mtu <MTU>]\n" - " [mac <MAC address>]\n\n" - " gsm: apn <APN>\n" - " [user <username>]\n" - " [password <password>]\n\n" - " cdma: [user <username>]\n" - " [password <password>]\n\n" - " infiniband: [mac <MAC address>]\n" - " [mtu <MTU>]\n" - " [transport-mode datagram | connected]\n" - " [parent <ifname>]\n" - " [p-key <IPoIB P_Key>]\n\n" - " bluetooth: [addr <bluetooth address>]\n" - " [bt-type panu|nap|dun-gsm|dun-cdma]\n\n" - " vlan: dev <parent device (connection UUID, ifname, or MAC)>\n" - " id <VLAN ID>\n" - " [flags <VLAN flags>]\n" - " [ingress <ingress priority mapping>]\n" - " [egress <egress priority mapping>]\n" - " [mtu <MTU>]\n\n" - " bond: [mode balance-rr (0) | active-backup (1) | balance-xor (2) | " - "broadcast (3) |\n" - " 802.3ad (4) | balance-tlb (5) | balance-alb (6)]\n" - " [primary <ifname>]\n" - " [miimon <num>]\n" - " [downdelay <num>]\n" - " [updelay <num>]\n" - " [arp-interval <num>]\n" - " [arp-ip-target <num>]\n" - " [lacp-rate slow (0) | fast (1)]\n\n" - " bond-slave: master <master (ifname, or connection UUID or name)>\n" - " [queue-id <0-65535>]\n\n" - " team: [config <file>|<raw JSON data>]\n\n" - " team-slave: master <master (ifname, or connection UUID or name)>\n" - " [config <file>|<raw JSON data>]\n\n" - " bridge: [stp yes|no]\n" - " [priority <num>]\n" - " [forward-delay <2-30>]\n" - " [hello-time <1-10>]\n" - " [max-age <6-40>]\n" - " [ageing-time <0-1000000>]\n" - " [multicast-snooping yes|no]\n" - " [mac <MAC address>]\n\n" - " bridge-slave: master <master (ifname, or connection UUID or name)>\n" - " [priority <0-63>]\n" - " [path-cost <1-65535>]\n" - " [hairpin yes|no]\n\n" - " vpn: vpn-type " - "vpnc|openvpn|pptp|openconnect|openswan|libreswan|ssh|l2tp|iodine|...\n" - " [user <username>]\n\n" - " 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" - " tun: mode tun|tap\n" - " [owner <UID>]\n" - " [group <GID>]\n" - " [pi yes|no]\n" - " [vnet-hdr yes|no]\n" - " [multi-queue yes|no]\n\n" - " ip-tunnel: mode ipip|gre|sit|isatap|vti|ip6ip6|ipip6|ip6gre|vti6\n" - " remote <remote endpoint IP>\n" - " [local <local endpoint IP>]\n" - " [dev <parent device (ifname or connection UUID)>]\n\n" - " macsec: dev <parent device (connection UUID, ifname, or MAC)>\n" - " mode <psk|eap>\n" - " [cak <key> ckn <key>]\n" - " [encrypt yes|no]\n" - " [port 1-65534]\n\n\n" - " macvlan: dev <parent device (connection UUID, ifname, or MAC)>\n" - " mode vepa|bridge|private|passthru|source\n" - " [tap yes|no]\n\n" - " vxlan: id <VXLAN ID>\n" - " [remote <IP of multicast group or remote address>]\n" - " [local <source IP>]\n" - " [dev <parent device (ifname or connection UUID)>]\n" - " [source-port-min <0-65535>]\n" - " [source-port-max <0-65535>]\n" - " [destination-port <0-65535>]\n\n" - " wpan: [short-addr <0x0000-0xffff>]\n" - " [pan-id <0x0000-0xffff>]\n" - " [page <default|0-31>]\n" - " [channel <default|0-26>]\n" - " [mac <MAC address>]\n\n" - " 6lowpan: dev <parent device (connection UUID, ifname, or MAC)>\n" - " dummy:\n\n" - " SLAVE_OPTIONS:\n" - " bridge: [priority <0-63>]\n" - " [path-cost <1-65535>]\n" - " [hairpin yes|no]\n\n" - " team: [config <file>|<raw JSON data>]\n\n" - " bond: [queue-id <0-65535>]\n\n" - " IP_OPTIONS:\n" - " [ip4 <IPv4 address>] [gw4 <IPv4 gateway>]\n" - " [ip6 <IPv6 address>] [gw6 <IPv6 gateway>]\n\n")); + nmc_printerr(_("Usage: nmcli connection add { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := COMMON_OPTIONS TYPE_SPECIFIC_OPTIONS SLAVE_OPTIONS IP_OPTIONS [-- " + "([+|-]<setting>.<property> <value>)+]\n\n" + " COMMON_OPTIONS:\n" + " type <type>\n" + " [ifname <interface name> | \"*\"]\n" + " [con-name <connection name>]\n" + " [autoconnect yes|no]\n" + " [save yes|no]\n" + " [master <master (ifname, or connection UUID or name)>]\n" + " [slave-type <master connection type>]\n\n" + " TYPE_SPECIFIC_OPTIONS:\n" + " ethernet: [mac <MAC address>]\n" + " [cloned-mac <cloned MAC address>]\n" + " [mtu <MTU>]\n\n" + " wifi: ssid <SSID>\n" + " [mac <MAC address>]\n" + " [cloned-mac <cloned MAC address>]\n" + " [mtu <MTU>]\n" + " [mode infrastructure|ap|adhoc]\n\n" + " wimax: [mac <MAC address>]\n" + " [nsp <NSP>]\n\n" + " pppoe: username <PPPoE username>\n" + " [password <PPPoE password>]\n" + " [service <PPPoE service name>]\n" + " [mtu <MTU>]\n" + " [mac <MAC address>]\n\n" + " gsm: apn <APN>\n" + " [user <username>]\n" + " [password <password>]\n\n" + " cdma: [user <username>]\n" + " [password <password>]\n\n" + " infiniband: [mac <MAC address>]\n" + " [mtu <MTU>]\n" + " [transport-mode datagram | connected]\n" + " [parent <ifname>]\n" + " [p-key <IPoIB P_Key>]\n\n" + " bluetooth: [addr <bluetooth address>]\n" + " [bt-type panu|nap|dun-gsm|dun-cdma]\n\n" + " vlan: dev <parent device (connection UUID, ifname, or MAC)>\n" + " id <VLAN ID>\n" + " [flags <VLAN flags>]\n" + " [ingress <ingress priority mapping>]\n" + " [egress <egress priority mapping>]\n" + " [mtu <MTU>]\n\n" + " bond: [mode balance-rr (0) | active-backup (1) | balance-xor (2) | " + "broadcast (3) |\n" + " 802.3ad (4) | balance-tlb (5) | balance-alb (6)]\n" + " [primary <ifname>]\n" + " [miimon <num>]\n" + " [downdelay <num>]\n" + " [updelay <num>]\n" + " [arp-interval <num>]\n" + " [arp-ip-target <num>]\n" + " [lacp-rate slow (0) | fast (1)]\n\n" + " bond-slave: master <master (ifname, or connection UUID or name)>\n" + " [queue-id <0-65535>]\n\n" + " team: [config <file>|<raw JSON data>]\n\n" + " team-slave: master <master (ifname, or connection UUID or name)>\n" + " [config <file>|<raw JSON data>]\n\n" + " bridge: [stp yes|no]\n" + " [priority <num>]\n" + " [forward-delay <2-30>]\n" + " [hello-time <1-10>]\n" + " [max-age <6-40>]\n" + " [ageing-time <0-1000000>]\n" + " [multicast-snooping yes|no]\n" + " [mac <MAC address>]\n\n" + " bridge-slave: master <master (ifname, or connection UUID or name)>\n" + " [priority <0-63>]\n" + " [path-cost <1-65535>]\n" + " [hairpin yes|no]\n\n" + " vpn: vpn-type " + "vpnc|openvpn|pptp|openconnect|openswan|libreswan|ssh|l2tp|iodine|...\n" + " [user <username>]\n\n" + " 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" + " tun: mode tun|tap\n" + " [owner <UID>]\n" + " [group <GID>]\n" + " [pi yes|no]\n" + " [vnet-hdr yes|no]\n" + " [multi-queue yes|no]\n\n" + " ip-tunnel: mode ipip|gre|sit|isatap|vti|ip6ip6|ipip6|ip6gre|vti6\n" + " remote <remote endpoint IP>\n" + " [local <local endpoint IP>]\n" + " [dev <parent device (ifname or connection UUID)>]\n\n" + " macsec: dev <parent device (connection UUID, ifname, or MAC)>\n" + " mode <psk|eap>\n" + " [cak <key> ckn <key>]\n" + " [encrypt yes|no]\n" + " [port 1-65534]\n\n\n" + " macvlan: dev <parent device (connection UUID, ifname, or MAC)>\n" + " mode vepa|bridge|private|passthru|source\n" + " [tap yes|no]\n\n" + " vxlan: id <VXLAN ID>\n" + " [remote <IP of multicast group or remote address>]\n" + " [local <source IP>]\n" + " [dev <parent device (ifname or connection UUID)>]\n" + " [source-port-min <0-65535>]\n" + " [source-port-max <0-65535>]\n" + " [destination-port <0-65535>]\n\n" + " wpan: [short-addr <0x0000-0xffff>]\n" + " [pan-id <0x0000-0xffff>]\n" + " [page <default|0-31>]\n" + " [channel <default|0-26>]\n" + " [mac <MAC address>]\n\n" + " 6lowpan: dev <parent device (connection UUID, ifname, or MAC)>\n" + " dummy:\n\n" + " SLAVE_OPTIONS:\n" + " bridge: [priority <0-63>]\n" + " [path-cost <1-65535>]\n" + " [hairpin yes|no]\n\n" + " team: [config <file>|<raw JSON data>]\n\n" + " bond: [queue-id <0-65535>]\n\n" + " IP_OPTIONS:\n" + " [ip4 <IPv4 address>] [gw4 <IPv4 gateway>]\n" + " [ip6 <IPv6 address>] [gw6 <IPv6 gateway>]\n\n")); } static void usage_connection_modify(void) { - g_printerr( + nmc_printerr( _("Usage: nmcli connection modify { ARGUMENTS | help }\n" "\n" "ARGUMENTS := [id | uuid | path] <ID> ([+|-]<setting>.<property> <value>)+\n" @@ -1327,77 +1327,78 @@ usage_connection_modify(void) static void usage_connection_clone(void) { - g_printerr(_("Usage: nmcli connection clone { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [--temporary] [id | uuid | path] <ID> <new name>\n" - "\n" - "Clone an existing connection profile. The newly created connection will be\n" - "the exact copy of the <ID>, except the uuid property (will be generated) and\n" - "id (provided as <new name> argument).\n\n")); + nmc_printerr(_("Usage: nmcli connection clone { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [--temporary] [id | uuid | path] <ID> <new name>\n" + "\n" + "Clone an existing connection profile. The newly created connection will be\n" + "the exact copy of the <ID>, except the uuid property (will be generated) and\n" + "id (provided as <new name> argument).\n\n")); } static void usage_connection_edit(void) { - g_printerr(_("Usage: nmcli connection edit { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [id | uuid | path] <ID>\n" - "\n" - "Edit an existing connection profile in an interactive editor.\n" - "The profile is identified by its name, UUID or D-Bus path\n" - "\n" - "ARGUMENTS := [type <new connection type>] [con-name <new connection name>]\n" - "\n" - "Add a new connection profile in an interactive editor.\n\n")); + nmc_printerr(_("Usage: nmcli connection edit { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [id | uuid | path] <ID>\n" + "\n" + "Edit an existing connection profile in an interactive editor.\n" + "The profile is identified by its name, UUID or D-Bus path\n" + "\n" + "ARGUMENTS := [type <new connection type>] [con-name <new connection name>]\n" + "\n" + "Add a new connection profile in an interactive editor.\n\n")); } static void usage_connection_delete(void) { - g_printerr(_("Usage: nmcli connection delete { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [id | uuid | path] <ID>, ...\n" - "\n" - "Delete connection profiles.\n" - "The profiles are identified by their name, UUID or D-Bus path.\n\n")); + nmc_printerr(_("Usage: nmcli connection delete { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [id | uuid | path] <ID>, ...\n" + "\n" + "Delete connection profiles.\n" + "The profiles are identified by their name, UUID or D-Bus path.\n\n")); } static void usage_connection_monitor(void) { - g_printerr(_("Usage: nmcli connection monitor { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [id | uuid | path] <ID> ...\n" - "\n" - "Monitor connection profile activity.\n" - "This command prints a line whenever the specified connection changes.\n" - "Monitors all connection profiles in case none is specified.\n\n")); + nmc_printerr(_("Usage: nmcli connection monitor { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [id | uuid | path] <ID> ...\n" + "\n" + "Monitor connection profile activity.\n" + "This command prints a line whenever the specified connection changes.\n" + "Monitors all connection profiles in case none is specified.\n\n")); } static void usage_connection_reload(void) { - g_printerr(_("Usage: nmcli connection reload { help }\n" - "\n" - "Reload all connection files from disk.\n\n")); + nmc_printerr(_("Usage: nmcli connection reload { help }\n" + "\n" + "Reload all connection files from disk.\n\n")); } static void usage_connection_load(void) { - g_printerr(_("Usage: nmcli connection load { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := <filename> [<filename>...]\n" - "\n" - "Load/reload one or more connection files from disk. Use this after manually\n" - "editing a connection file to ensure that NetworkManager is aware of its latest\n" - "state.\n\n")); + nmc_printerr( + _("Usage: nmcli connection load { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := <filename> [<filename>...]\n" + "\n" + "Load/reload one or more connection files from disk. Use this after manually\n" + "editing a connection file to ensure that NetworkManager is aware of its latest\n" + "state.\n\n")); } static void usage_connection_import(void) { - g_printerr( + nmc_printerr( _("Usage: nmcli connection import { ARGUMENTS | help }\n" "\n" "ARGUMENTS := [--temporary] type <type> file <file to import>\n" @@ -1411,23 +1412,24 @@ usage_connection_import(void) static void usage_connection_export(void) { - g_printerr(_("Usage: nmcli connection export { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [id | uuid | path] <ID> [<output file>]\n" - "\n" - "Export a connection. Only VPN connections are supported at the moment.\n" - "The data are directed to standard output or to a file if a name is given.\n\n")); + nmc_printerr( + _("Usage: nmcli connection export { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [id | uuid | path] <ID> [<output file>]\n" + "\n" + "Export a connection. Only VPN connections are supported at the moment.\n" + "The data are directed to standard output or to a file if a name is given.\n\n")); } static void usage_connection_migrate(void) { - g_printerr(_("Usage: nmcli connection migrate { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [--plugin <plugin>] [id | uuid | path] <ID>, ...\n" - "\n" - "Migrate connection profiles to a different settings plugin,\n" - "such as \"keyfile\" (default) or \"ifcfg-rh\".\n\n")); + nmc_printerr(_("Usage: nmcli connection migrate { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [--plugin <plugin>] [id | uuid | path] <ID>, ...\n" + "\n" + "Migrate connection profiles to a different settings plugin,\n" + "such as \"keyfile\" (default) or \"ifcfg-rh\".\n\n")); } static char * @@ -1505,9 +1507,9 @@ got_secrets(GObject *source_object, GAsyncResult *res, gpointer user_data) gs_free_error GError *error = NULL; if (!nm_connection_update_secrets(data->local, NULL, secrets, &error) && error) { - g_printerr(_("Error updating secrets for %s: %s\n"), - data->setting_name, - error->message); + nmc_printerr(_("Error updating secrets for %s: %s\n"), + data->setting_name, + error->message); } } @@ -1610,12 +1612,12 @@ nmc_connection_profile_details(NMConnection *connection, NmCli *nmc) /* Loop through the required settings and print them. */ for (i = 0; i < print_settings_array->len; i++) { NMSetting *setting; - int section_idx = g_array_index(print_settings_array, int, i); + int section_idx = nm_g_array_index(print_settings_array, int, i); const char *prop_name = (const char *) g_ptr_array_index(prop_array, i); if (NM_IN_SET(nmc->nmc_config.print_output, NMC_PRINT_NORMAL, NMC_PRINT_PRETTY) && !nmc->nmc_config.multiline_output && was_output) - g_print("\n"); /* Empty line */ + nmc_print("\n"); /* Empty line */ was_output = FALSE; @@ -1716,12 +1718,12 @@ nmc_active_connection_details(NMActiveConnection *acon, NmCli *nmc) /* Loop through the groups and print them. */ for (i = 0; i < print_groups->len; i++) { - int group_idx = g_array_index(print_groups, int, i); + int group_idx = nm_g_array_index(print_groups, int, i); char *group_fld = (char *) g_ptr_array_index(group_fields, i); if (NM_IN_SET(nmc->nmc_config.print_output, NMC_PRINT_NORMAL, NMC_PRINT_PRETTY) && !nmc->nmc_config.multiline_output && was_output) - g_print("\n"); + nmc_print("\n"); was_output = FALSE; @@ -1731,13 +1733,14 @@ nmc_active_connection_details(NMActiveConnection *acon, NmCli *nmc) if (group_fld) f = g_strdup_printf("GENERAL.%s", group_fld); - nmc_print(&nmc->nmc_config, - (gpointer[]){acon, NULL}, - NULL, - NULL, - NMC_META_GENERIC_GROUP("GENERAL", metagen_con_active_general, N_("GROUP")), - f, - NULL); + nmc_print_table( + &nmc->nmc_config, + (gpointer[]){acon, NULL}, + NULL, + NULL, + NMC_META_GENERIC_GROUP("GENERAL", metagen_con_active_general, N_("GROUP")), + f, + NULL); was_output = TRUE; continue; } @@ -1788,13 +1791,13 @@ nmc_active_connection_details(NMActiveConnection *acon, NmCli *nmc) if (nmc_fields_con_active_details_groups[group_idx]->nested == metagen_con_active_vpn) { if (NM_IS_VPN_CONNECTION(acon)) { - nmc_print(&nmc->nmc_config, - (gpointer[]){acon, NULL}, - NULL, - NULL, - NMC_META_GENERIC_GROUP("VPN", metagen_con_active_vpn, N_("NAME")), - group_fld, - NULL); + nmc_print_table(&nmc->nmc_config, + (gpointer[]){acon, NULL}, + NULL, + NULL, + NMC_META_GENERIC_GROUP("VPN", metagen_con_active_vpn, N_("NAME")), + group_fld, + NULL); was_output = TRUE; } continue; @@ -1983,7 +1986,7 @@ con_show_get_items_cmp(gconstpointer pa, gconstpointer pb, gpointer user_data) nmc_print_output_to_accessor_get_type(sort_info->nmc->nmc_config.print_output); if (sort_info->order) { - order_arr = &g_array_index(sort_info->order, NmcSortOrder, 0); + order_arr = nm_g_array_first_p(sort_info->order, NmcSortOrder); order_len = sort_info->order->len; } else { static const NmcSortOrder def[] = {NMC_SORT_ACTIVE, NMC_SORT_NAME, NMC_SORT_PATH}; @@ -2206,7 +2209,7 @@ parse_preferred_connection_order(const char *order, GError **error) /* Check for duplicates and ignore them. */ unique = TRUE; for (i = 0; i < order_arr->len; i++) { - if (abs(g_array_index(order_arr, NmcSortOrder, i)) - abs(val) == 0) { + if (abs(nm_g_array_index(order_arr, NmcSortOrder, i)) - abs(val) == 0) { unique = FALSE; break; } @@ -2369,14 +2372,14 @@ do_connections_show(const NMCCommand *cmd, NmCli *nmc, int argc, const char *con items = con_show_get_items(nmc, active_only, show_active_fields, order); g_ptr_array_add(items, NULL); - if (!nmc_print(&nmc->nmc_config, - items->pdata, - NULL, - active_only ? _("NetworkManager active profiles") - : _("NetworkManager connection profiles"), - (const NMMetaAbstractInfo *const *) metagen_con_show, - fields_str, - &err)) + if (!nmc_print_table(&nmc->nmc_config, + items->pdata, + NULL, + active_only ? _("NetworkManager active profiles") + : _("NetworkManager connection profiles"), + (const NMMetaAbstractInfo *const *) metagen_con_show, + fields_str, + &err)) goto finish; } else { gboolean new_line = FALSE; @@ -2508,7 +2511,7 @@ do_connections_show(const NMCCommand *cmd, NmCli *nmc, int argc, const char *con nm_assert(explicit_acon || con); if (new_line) - g_print("\n"); + nmc_print("\n"); new_line = TRUE; if (without_fields || profile_flds) { @@ -2533,7 +2536,7 @@ do_connections_show(const NMCCommand *cmd, NmCli *nmc, int argc, const char *con /* if there are multiple active connections, separate them with newline. * that is a bit odd, because we already separate connections with newlines, * and commonly don't separate the connection from the first active connection. */ - g_print("\n"); + nmc_print("\n"); } if (explicit_acon) @@ -2801,12 +2804,12 @@ check_activated(ActivateConnectionInfo *info) if (nmc->nmc_config.print_output == NMC_PRINT_PRETTY) nmc_terminal_erase_line(); if (reason) { - g_print(_("Connection successfully activated (%s) (D-Bus active path: %s)\n"), - reason, - nm_object_get_path(NM_OBJECT(info->active))); + nmc_print(_("Connection successfully activated (%s) (D-Bus active path: %s)\n"), + reason, + nm_object_get_path(NM_OBJECT(info->active))); } else { - g_print(_("Connection successfully activated (D-Bus active path: %s)\n"), - nm_object_get_path(NM_OBJECT(info->active))); + nmc_print(_("Connection successfully activated (D-Bus active path: %s)\n"), + nm_object_get_path(NM_OBJECT(info->active))); } activate_connection_info_finish(info); break; @@ -2956,8 +2959,8 @@ activate_connection_cb(GObject *client, GAsyncResult *result, gpointer user_data if (state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) { if (nmc->nmc_config.print_output == NMC_PRINT_PRETTY) nmc_terminal_erase_line(); - g_print(_("Connection successfully activated (D-Bus active path: %s)\n"), - nm_object_get_path(NM_OBJECT(active))); + nmc_print(_("Connection successfully activated (D-Bus active path: %s)\n"), + nm_object_get_path(NM_OBJECT(active))); } activate_connection_info_finish(info); } else { @@ -3326,9 +3329,9 @@ connection_removed_cb(NMClient *client, NMConnection *connection, ConnectionCbIn { if (!connection_cb_info_obj_list_has(info, connection)) return; - g_print(_("Connection '%s' (%s) successfully deleted.\n"), - nm_connection_get_id(connection), - nm_connection_get_uuid(connection)); + nmc_print(_("Connection '%s' (%s) successfully deleted.\n"), + nm_connection_get_id(connection), + nm_connection_get_uuid(connection)); connection_cb_info_finish(info, connection); } @@ -3342,9 +3345,9 @@ down_active_connection_state_cb(NMActiveConnection *active, if (info->nmc->nmc_config.print_output == NMC_PRINT_PRETTY) nmc_terminal_erase_line(); - g_print(_("Connection '%s' successfully deactivated (D-Bus active path: %s)\n"), - nm_active_connection_get_id(active), - nm_object_get_path(NM_OBJECT(active))); + nmc_print(_("Connection '%s' successfully deactivated (D-Bus active path: %s)\n"), + nm_active_connection_get_id(active), + nm_object_get_path(NM_OBJECT(active))); g_signal_handlers_disconnect_by_func(G_OBJECT(active), down_active_connection_state_cb, info); connection_cb_info_finish(info, active); @@ -3423,7 +3426,7 @@ do_connection_down(const NMCCommand *cmd, NmCli *nmc, int argc, const char *cons arg_num == 1 && nmc->complete); if (!active) { if (!nmc->complete) - g_printerr(_("Error: '%s' is not an active connection.\n"), *arg_ptr); + nmc_printerr(_("Error: '%s' is not an active connection.\n"), *arg_ptr); g_string_printf(nmc->return_text, _("Error: not all active connections found.")); nmc->return_value = NMC_RESULT_ERROR_NOT_FOUND; } @@ -3464,9 +3467,9 @@ do_connection_down(const NMCCommand *cmd, NmCli *nmc, int argc, const char *cons active = found_active_cons->pdata[i]; if (!nm_client_deactivate_connection(nmc->client, active, NULL, &error)) { - g_print(_("Connection '%s' deactivation failed: %s\n"), - nm_active_connection_get_id(active), - error->message); + nmc_print(_("Connection '%s' deactivation failed: %s\n"), + nm_active_connection_get_id(active), + error->message); g_clear_error(&error); if (info) { @@ -3945,7 +3948,7 @@ normalized_master_for_slave(const GPtrArray *connections, } if (!out_master) { - g_print(_("Warning: master='%s' doesn't refer to any existing profile.\n"), master); + nmc_print(_("Warning: master='%s' doesn't refer to any existing profile.\n"), master); out_master = master; if (out_type) *out_type = type; @@ -4343,8 +4346,9 @@ set_property(NMClient *client, g_set_error(error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT, - _("Error: failed to %s %s.%s: %s."), - (modifier != NM_META_ACCESSOR_MODIFIER_DEL ? "modify" : "remove a value from"), + modifier != NM_META_ACCESSOR_MODIFIER_DEL + ? _("Error: failed to modify %s.%s: %s.") + : _("Error: failed to remove a value from %s.%s: %s."), setting_name, property, local->message); @@ -4985,7 +4989,7 @@ complete_property_name(NmCli *nmc, prefix, postfix); if (word_list) - g_print("%s", word_list); + nmc_print("%s", word_list); if (modifier != NM_META_ACCESSOR_MODIFIER_SET) return; @@ -5014,7 +5018,7 @@ complete_property_name(NmCli *nmc, if (!bi->base.property_alias || !g_str_has_prefix(bi->base.property_alias, prefix)) continue; - g_print("%s\n", bi->base.property_alias); + nmc_print("%s\n", bi->base.property_alias); } } else { if (!property_info->is_cli_option) @@ -5022,7 +5026,7 @@ complete_property_name(NmCli *nmc, if (!property_info->property_alias || !g_str_has_prefix(property_info->property_alias, prefix)) continue; - g_print("%s\n", property_info->property_alias); + nmc_print("%s\n", property_info->property_alias); } } } @@ -5035,7 +5039,7 @@ run_rl_generator(rl_compentry_func_t *generator_func, const char *prefix) char *str; while ((str = generator_func(prefix, state))) { - g_print("%s\n", str); + nmc_print("%s\n", str); g_free(str); if (state == 0) state = 1; @@ -5069,7 +5073,7 @@ complete_option(NmCli *nmc, } if (values) { for (; values[0]; values++) - g_print("%s\n", values[0]); + nmc_print("%s\n", values[0]); return TRUE; } @@ -5094,11 +5098,11 @@ complete_existing_setting(NmCli *nmc, NMConnection *connection, const char *pref editor = nm_meta_setting_info_editor_find_by_setting(settings[i]); if (!prefix || g_str_has_prefix(editor->general->setting_name, prefix)) - g_print("%s\n", editor->general->setting_name); + nmc_print("%s\n", editor->general->setting_name); if (editor->alias) { if (!prefix || g_str_has_prefix(editor->alias, prefix)) - g_print("%s\n", editor->alias); + nmc_print("%s\n", editor->alias); } } } @@ -5386,7 +5390,7 @@ nmc_process_connection_properties(NmCli *nmc, if (!chosen) { if (*argc == 1 && nmc->complete) { if (allow_setting_removal && g_str_has_prefix("remove", option)) - g_print("remove\n"); + nmc_print("remove\n"); complete_property_name(nmc, connection, modifier, option, NULL); } g_set_error(error, @@ -5426,7 +5430,7 @@ connection_warnings(NmCli *nmc, NMConnection *connection) deprecated = nmc_connection_check_deprecated(NM_CONNECTION(connection)); if (deprecated) - g_printerr(_("Warning: %s.\n"), deprecated); + nmc_printerr(_("Warning: %s.\n"), deprecated); connections = nmc_get_connections(nmc); id = nm_connection_get_id(connection); @@ -5441,15 +5445,15 @@ connection_warnings(NmCli *nmc, NMConnection *connection) } if (found > 0) { - g_printerr(g_dngettext(GETTEXT_PACKAGE, - "Warning: There is another connection with the name '%1$s'. " - "Reference the connection by its uuid '%2$s'\n", - "Warning: There are %3$u other connections with the name " - "'%1$s'. Reference the connection by its uuid '%2$s'\n", - found), - id, - nm_connection_get_uuid(NM_CONNECTION(connection)), - found); + nmc_printerr(g_dngettext(GETTEXT_PACKAGE, + "Warning: There is another connection with the name '%1$s'. " + "Reference the connection by its uuid '%2$s'\n", + "Warning: There are %3$u other connections with the name " + "'%1$s'. Reference the connection by its uuid '%2$s'\n", + found), + id, + nm_connection_get_uuid(NM_CONNECTION(connection)), + found); } } @@ -5481,9 +5485,9 @@ add_connection_cb(GObject *client, GAsyncResult *result, gpointer user_data) * * This is true for many messages that the user might parse. But this one * seems in particular interesting for a user to parse. */ - g_print(_("Connection '%s' (%s) successfully added.\n"), - nm_connection_get_id(NM_CONNECTION(connection)), - nm_connection_get_uuid(NM_CONNECTION(connection))); + nmc_print(_("Connection '%s' (%s) successfully added.\n"), + nm_connection_get_id(NM_CONNECTION(connection)), + nm_connection_get_uuid(NM_CONNECTION(connection))); g_object_unref(connection); } @@ -5595,8 +5599,8 @@ next: static void ask_option(NmCli *nmc, NMConnection *connection, const NMMetaAbstractInfo *abstract_info) { - char *value; - GError *error = NULL; + gs_free char *value = NULL; + gs_free_error GError *error = NULL; gs_free char *prompt = NULL; gboolean multi; const char *setting_name, *property_name; @@ -5629,14 +5633,17 @@ ask_option(NmCli *nmc, NMConnection *connection, const NMMetaAbstractInfo *abstr multi = NM_FLAGS_HAS(inf_flags, NM_META_PROPERTY_INF_FLAG_MULTI); if (multi) - g_print(_("You can specify this option more than once. Press <Enter> when you're done.\n")); + nmc_print( + _("You can specify this option more than once. Press <Enter> when you're done.\n")); again: + nm_clear_g_free(&value); + g_clear_error(&error); + value = nmc_readline(&nmc->nmc_config, "%s", prompt); if (!set_option(nmc, connection, abstract_info, value, FALSE, &error)) { - g_printerr("%s\n", error->message); - g_clear_error(&error); + nmc_printerr("%s\n", error->message); goto again; } @@ -5738,7 +5745,7 @@ want_provide_opt_args(const NmcConfig *nmc_config, const char *type, guint num) return TRUE; /* Ask for optional arguments. */ - g_print(_("There are %d optional settings for %s.\n"), (int) num, type); + nmc_print(_("There are %d optional settings for %s.\n"), (int) num, type); answer = nmc_readline(nmc_config, _("Do you want to provide them? %s"), prompt_yes_no(TRUE, NULL)); nm_strstrip(answer); @@ -6870,7 +6877,7 @@ load_history_cmds(const char *uuid) kf = g_key_file_new(); if (!g_key_file_load_from_file(kf, filename, G_KEY_FILE_KEEP_COMMENTS, &err)) { if (g_error_matches(err, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_PARSE)) - g_print("Warning: %s parse error: %s\n", filename, err->message); + nmc_print("Warning: %s parse error: %s\n", filename, err->message); g_key_file_free(kf); g_free(filename); return; @@ -6909,7 +6916,7 @@ save_history_cmds(const char *uuid) if (!g_key_file_load_from_file(kf, filename, G_KEY_FILE_KEEP_COMMENTS, &error)) { if (!g_error_matches(error, G_FILE_ERROR, G_FILE_ERROR_NOENT) && !g_error_matches(error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)) { - g_print("Warning: %s parse error: %s\n", filename, error->message); + nmc_print("Warning: %s parse error: %s\n", filename, error->message); return; } g_clear_error(&error); @@ -6945,7 +6952,7 @@ editor_show_connection(NMConnection *connection, NmCli *nmc) static void editor_show_setting(NMSetting *setting, NmCli *nmc) { - g_print(_("['%s' setting values]\n"), nm_setting_get_name(setting)); + nmc_print(_("['%s' setting values]\n"), nm_setting_get_name(setting)); nmc->nmc_config_mutable.print_output = NMC_PRINT_NORMAL; nmc->nmc_config_mutable.multiline_output = TRUE; @@ -7052,24 +7059,24 @@ fail: static void editor_main_usage(void) { - g_print("------------------------------------------------------------------------------\n"); + nmc_print("------------------------------------------------------------------------------\n"); /* TRANSLATORS: do not translate command names and keywords before :: * However, you should translate terms enclosed in <>. */ - g_print(_("---[ Main menu ]---\n" - "goto [<setting> | <prop>] :: go to a setting or property\n" - "remove <setting>[.<prop>] | <prop> :: remove setting or reset property value\n" - "set [<setting>.<prop> <value>] :: set property value\n" - "describe [<setting>.<prop>] :: describe property\n" - "print [all | <setting>[.<prop>]] :: print the connection\n" - "verify [all | fix] :: verify the connection\n" - "save [persistent|temporary] :: save the connection\n" - "activate [<ifname>] [/<ap>|<nsp>] :: activate the connection\n" - "back :: go one level up (back)\n" - "help/? [<command>] :: print this help\n" - "nmcli <conf-option> <value> :: nmcli configuration\n" - "quit :: exit nmcli\n")); - g_print("------------------------------------------------------------------------------\n"); + nmc_print(_("---[ Main menu ]---\n" + "goto [<setting> | <prop>] :: go to a setting or property\n" + "remove <setting>[.<prop>] | <prop> :: remove setting or reset property value\n" + "set [<setting>.<prop> <value>] :: set property value\n" + "describe [<setting>.<prop>] :: describe property\n" + "print [all | <setting>[.<prop>]] :: print the connection\n" + "verify [all | fix] :: verify the connection\n" + "save [persistent|temporary] :: save the connection\n" + "activate [<ifname>] [/<ap>|<nsp>] :: activate the connection\n" + "back :: go one level up (back)\n" + "help/? [<command>] :: print this help\n" + "nmcli <conf-option> <value> :: nmcli configuration\n" + "quit :: exit nmcli\n")); + nmc_print("------------------------------------------------------------------------------\n"); } static void @@ -7083,14 +7090,15 @@ editor_main_help(const char *command) switch (cmd) { case NMC_EDITOR_MAIN_CMD_GOTO: - g_print(_("goto <setting>[.<prop>] | <prop> :: enter setting/property for editing\n\n" - "This command enters into a setting or property for editing it.\n\n" - "Examples: nmcli> goto connection\n" - " nmcli connection> goto secondaries\n" - " nmcli> goto ipv4.addresses\n")); + nmc_print( + _("goto <setting>[.<prop>] | <prop> :: enter setting/property for editing\n\n" + "This command enters into a setting or property for editing it.\n\n" + "Examples: nmcli> goto connection\n" + " nmcli connection> goto secondaries\n" + " nmcli> goto ipv4.addresses\n")); break; case NMC_EDITOR_MAIN_CMD_REMOVE: - g_print( + nmc_print( _("remove <setting>[.<prop>] :: remove setting or reset property value\n\n" "This command removes an entire setting from the connection, or if a property\n" "is given, resets that property to the default value.\n\n" @@ -7098,27 +7106,27 @@ editor_main_help(const char *command) " nmcli> remove eth.mtu\n")); break; case NMC_EDITOR_MAIN_CMD_SET: - g_print(_("set [<setting>.<prop> <value>] :: set property value\n\n" - "This command sets property value.\n\n" - "Example: nmcli> set con.id My connection\n")); + nmc_print(_("set [<setting>.<prop> <value>] :: set property value\n\n" + "This command sets property value.\n\n" + "Example: nmcli> set con.id My connection\n")); break; case NMC_EDITOR_MAIN_CMD_ADD: - g_print(_("add [<setting>.<prop> <value>] :: add property value\n\n" - "This command appends property value.\n\n" - "Example: nmcli> add ipv4.addresses 192.168.1.1/24\n")); + nmc_print(_("add [<setting>.<prop> <value>] :: add property value\n\n" + "This command appends property value.\n\n" + "Example: nmcli> add ipv4.addresses 192.168.1.1/24\n")); break; case NMC_EDITOR_MAIN_CMD_DESCRIBE: - g_print(_("describe [<setting>.<prop>] :: describe property\n\n" - "Shows property description. You can consult nm-settings(5) " - "manual page to see all NM settings and properties.\n")); + nmc_print(_("describe [<setting>.<prop>] :: describe property\n\n" + "Shows property description. You can consult nm-settings(5) " + "manual page to see all NM settings and properties.\n")); break; case NMC_EDITOR_MAIN_CMD_PRINT: - g_print(_("print [all] :: print setting or connection values\n\n" - "Shows current property or the whole connection.\n\n" - "Example: nmcli ipv4> print all\n")); + nmc_print(_("print [all] :: print setting or connection values\n\n" + "Shows current property or the whole connection.\n\n" + "Example: nmcli ipv4> print all\n")); break; case NMC_EDITOR_MAIN_CMD_VERIFY: - g_print( + nmc_print( _("verify [all | fix] :: verify setting or connection validity\n\n" "Verifies whether the setting or connection is valid and can be saved later.\n" "It indicates invalid values on error. Some errors may be fixed automatically\n" @@ -7128,7 +7136,7 @@ editor_main_help(const char *command) " nmcli bond> verify\n")); break; case NMC_EDITOR_MAIN_CMD_SAVE: - g_print( + nmc_print( _("save [persistent|temporary] :: save the connection\n\n" "Sends the connection profile to NetworkManager that either will save it\n" "persistently, or will only keep it in memory. 'save' without an argument\n" @@ -7140,48 +7148,48 @@ editor_main_help(const char *command) "profile must be deleted.\n")); break; case NMC_EDITOR_MAIN_CMD_ACTIVATE: - g_print(_("activate [<ifname>] [/<ap>|<nsp>] :: activate the connection\n\n" - "Activates the connection.\n\n" - "Available options:\n" - "<ifname> - device the connection will be activated on\n" - "/<ap>|<nsp> - AP (Wi-Fi) or NSP (WiMAX) (prepend with / when <ifname> is " - "not specified)\n")); + nmc_print(_("activate [<ifname>] [/<ap>|<nsp>] :: activate the connection\n\n" + "Activates the connection.\n\n" + "Available options:\n" + "<ifname> - device the connection will be activated on\n" + "/<ap>|<nsp> - AP (Wi-Fi) or NSP (WiMAX) (prepend with / when <ifname> is " + "not specified)\n")); break; case NMC_EDITOR_MAIN_CMD_BACK: - g_print(_("back :: go to upper menu level\n\n")); + nmc_print(_("back :: go to upper menu level\n\n")); break; case NMC_EDITOR_MAIN_CMD_HELP: - g_print(_("help/? [<command>] :: help for the nmcli commands\n\n")); + nmc_print(_("help/? [<command>] :: help for the nmcli commands\n\n")); break; case NMC_EDITOR_MAIN_CMD_NMCLI: - g_print(_("nmcli [<conf-option> <value>] :: nmcli configuration\n\n" - "Configures nmcli. The following options are available:\n" - "status-line yes | no [default: no]\n" - "save-confirmation yes | no [default: yes]\n" - "show-secrets yes | no [default: no]\n" - "prompt-color <color> | <0-8> [default: 0]\n" - "%s" /* color table description */ - "\n" - "Examples: nmcli> nmcli status-line yes\n" - " nmcli> nmcli save-confirmation no\n" - " nmcli> nmcli prompt-color 3\n"), - " 0 = normal\n" - " 1 = \33[30mblack\33[0m\n" - " 2 = \33[31mred\33[0m\n" - " 3 = \33[32mgreen\33[0m\n" - " 4 = \33[33myellow\33[0m\n" - " 5 = \33[34mblue\33[0m\n" - " 6 = \33[35mmagenta\33[0m\n" - " 7 = \33[36mcyan\33[0m\n" - " 8 = \33[37mwhite\33[0m\n"); + nmc_print(_("nmcli [<conf-option> <value>] :: nmcli configuration\n\n" + "Configures nmcli. The following options are available:\n" + "status-line yes | no [default: no]\n" + "save-confirmation yes | no [default: yes]\n" + "show-secrets yes | no [default: no]\n" + "prompt-color <color> | <0-8> [default: 0]\n" + "%s" /* color table description */ + "\n" + "Examples: nmcli> nmcli status-line yes\n" + " nmcli> nmcli save-confirmation no\n" + " nmcli> nmcli prompt-color 3\n"), + " 0 = normal\n" + " 1 = \33[30mblack\33[0m\n" + " 2 = \33[31mred\33[0m\n" + " 3 = \33[32mgreen\33[0m\n" + " 4 = \33[33myellow\33[0m\n" + " 5 = \33[34mblue\33[0m\n" + " 6 = \33[35mmagenta\33[0m\n" + " 7 = \33[36mcyan\33[0m\n" + " 8 = \33[37mwhite\33[0m\n"); break; case NMC_EDITOR_MAIN_CMD_QUIT: - g_print(_("quit :: exit nmcli\n\n" - "This command exits nmcli. When the connection being edited " - "is not saved, the user is asked to confirm the action.\n")); + nmc_print(_("quit :: exit nmcli\n\n" + "This command exits nmcli. When the connection being edited " + "is not saved, the user is asked to confirm the action.\n")); break; default: - g_print(_("Unknown command: '%s'\n"), command); + nmc_print(_("Unknown command: '%s'\n"), command); break; } } @@ -7242,21 +7250,21 @@ fail: static void editor_sub_help(void) { - g_print("------------------------------------------------------------------------------\n"); + nmc_print("------------------------------------------------------------------------------\n"); /* TRANSLATORS: do not translate command names and keywords before :: * However, you should translate terms enclosed in <>. */ - g_print(_("---[ Property menu ]---\n" - "set [<value>] :: set new value\n" - "add [<value>] :: add new option to the property\n" - "change :: change current value\n" - "remove [<index> | <option>] :: delete the value\n" - "describe :: describe property\n" - "print [setting | connection] :: print property (setting/connection) value(s)\n" - "back :: go to upper level\n" - "help/? [<command>] :: print this help or command description\n" - "quit :: exit nmcli\n")); - g_print("------------------------------------------------------------------------------\n"); + nmc_print(_("---[ Property menu ]---\n" + "set [<value>] :: set new value\n" + "add [<value>] :: add new option to the property\n" + "change :: change current value\n" + "remove [<index> | <option>] :: delete the value\n" + "describe :: describe property\n" + "print [setting | connection] :: print property (setting/connection) value(s)\n" + "back :: go to upper level\n" + "help/? [<command>] :: print this help or command description\n" + "quit :: exit nmcli\n")); + nmc_print("------------------------------------------------------------------------------\n"); } static void @@ -7270,21 +7278,21 @@ editor_sub_usage(const char *command) switch (cmdsub) { case NMC_EDITOR_SUB_CMD_SET: - g_print(_("set [<value>] :: set new value\n\n" - "This command sets provided <value> to this property\n")); + nmc_print(_("set [<value>] :: set new value\n\n" + "This command sets provided <value> to this property\n")); break; case NMC_EDITOR_SUB_CMD_ADD: - g_print(_("add [<value>] :: append new value to the property\n\n" - "This command adds provided <value> to this property, if " - "the property is of a container type. For single-valued " - "properties the property value is replaced (same as 'set').\n")); + nmc_print(_("add [<value>] :: append new value to the property\n\n" + "This command adds provided <value> to this property, if " + "the property is of a container type. For single-valued " + "properties the property value is replaced (same as 'set').\n")); break; case NMC_EDITOR_SUB_CMD_CHANGE: - g_print(_("change :: change current value\n\n" - "Displays current value and allows editing it.\n")); + nmc_print(_("change :: change current value\n\n" + "Displays current value and allows editing it.\n")); break; case NMC_EDITOR_SUB_CMD_REMOVE: - g_print(_( + nmc_print(_( "remove [<value>|<index>|<option name>] :: delete the value\n\n" "Removes the property value. For single-valued properties, this sets the\n" "property back to its default value. For container-type properties, this removes\n" @@ -7296,29 +7304,29 @@ editor_sub_usage(const char *command) " nmcli bond.options> remove downdelay\n\n")); break; case NMC_EDITOR_SUB_CMD_DESCRIBE: - g_print(_("describe :: describe property\n\n" - "Shows property description. You can consult nm-settings(5) " - "manual page to see all NM settings and properties.\n")); + nmc_print(_("describe :: describe property\n\n" + "Shows property description. You can consult nm-settings(5) " + "manual page to see all NM settings and properties.\n")); break; case NMC_EDITOR_SUB_CMD_PRINT: - g_print(_("print [property|setting|connection] :: print property (setting, " - "connection) value(s)\n\n" - "Shows property value. Providing an argument you can also display " - "values for the whole setting or connection.\n")); + nmc_print(_("print [property|setting|connection] :: print property (setting, " + "connection) value(s)\n\n" + "Shows property value. Providing an argument you can also display " + "values for the whole setting or connection.\n")); break; case NMC_EDITOR_SUB_CMD_BACK: - g_print(_("back :: go to upper menu level\n\n")); + nmc_print(_("back :: go to upper menu level\n\n")); break; case NMC_EDITOR_SUB_CMD_HELP: - g_print(_("help/? [<command>] :: help for nmcli commands\n\n")); + nmc_print(_("help/? [<command>] :: help for nmcli commands\n\n")); break; case NMC_EDITOR_SUB_CMD_QUIT: - g_print(_("quit :: exit nmcli\n\n" - "This command exits nmcli. When the connection being edited " - "is not saved, the user is asked to confirm the action.\n")); + nmc_print(_("quit :: exit nmcli\n\n" + "This command exits nmcli. When the connection being edited " + "is not saved, the user is asked to confirm the action.\n")); break; default: - g_print(_("Unknown command: '%s'\n"), command); + nmc_print(_("Unknown command: '%s'\n"), command); break; } } @@ -7396,13 +7404,13 @@ progress_activation_editor_cb(gpointer user_data) if (ac_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED || dev_state == NM_DEVICE_STATE_ACTIVATED) { nmc_terminal_erase_line(); - g_print(_("Connection successfully activated (D-Bus active path: %s)\n"), - nm_object_get_path(NM_OBJECT(ac))); + nmc_print(_("Connection successfully activated (D-Bus active path: %s)\n"), + nm_object_get_path(NM_OBJECT(ac))); goto finish; } else if (ac_state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED || dev_state == NM_DEVICE_STATE_FAILED) { nmc_terminal_erase_line(); - g_print(_("Error: Connection activation failed.\n")); + nmc_print(_("Error: Connection activation failed.\n")); goto finish; } @@ -7467,7 +7475,7 @@ print_property_description(NMSetting *setting, const char *prop_name) desc = nmc_setting_get_property_desc(setting, prop_name); if (desc) { - g_print("\n=== [%s] ===\n%s\n", prop_name, desc); + nmc_print("\n=== [%s] ===\n%s\n", prop_name, desc); g_free(desc); } } @@ -7480,7 +7488,7 @@ print_setting_description(NMSetting *setting) int i; all_props = nmc_setting_get_valid_properties(setting); - g_print(("<<< %s >>>\n"), nm_setting_get_name(setting)); + nmc_print(("<<< %s >>>\n"), nm_setting_get_name(setting)); for (i = 0; all_props && all_props[i]; i++) print_property_description(setting, all_props[i]); g_strfreev(all_props); @@ -7500,12 +7508,12 @@ editor_show_status_line(NMConnection *connection, gboolean dirty, gboolean temp) con_uuid = nm_connection_get_uuid(connection); /* TRANSLATORS: status line in nmcli connection editor */ - g_print(_("[ Type: %s | Name: %s | UUID: %s | Dirty: %s | Temp: %s ]\n"), - con_type, - con_id, - con_uuid, - dirty ? _("yes") : _("no"), - temp ? _("yes") : _("no")); + nmc_print(_("[ Type: %s | Name: %s | UUID: %s | Dirty: %s | Temp: %s ]\n"), + con_type, + con_id, + con_uuid, + dirty ? _("yes") : _("no"), + temp ? _("yes") : _("no")); } static gboolean @@ -7582,8 +7590,8 @@ property_edit_submenu(NmCli *nmc, /* Get the remote connection again, it may have disappeared */ removed = refresh_remote_connection(rem_con_weak, rem_con); if (removed) { - g_print(_("The connection profile has been removed from another client. " - "You may type 'save' in the main menu to restore it.\n")); + nmc_print(_("The connection profile has been removed from another client. " + "You may type 'save' in the main menu to restore it.\n")); } /* Connection is dirty? (not saved or differs from the saved) */ @@ -7614,7 +7622,7 @@ property_edit_submenu(NmCli *nmc, gs_free char *avals_str = NULL; avals_str = nmc_util_strv_for_display(avals, FALSE); - g_print(_("Allowed values for '%s' property: %s\n"), prop_name, avals_str); + nmc_print(_("Allowed values for '%s' property: %s\n"), prop_name, avals_str); } prop_val_user = nmc_readline(&nmc->nmc_config, _("Enter '%s' value: "), prop_name); } else @@ -7629,7 +7637,9 @@ property_edit_submenu(NmCli *nmc, prop_val_user, &tmp_err); if (!set_result) { - g_print(_("Error: failed to set '%s' property: %s\n"), prop_name, tmp_err->message); + nmc_print(_("Error: failed to set '%s' property: %s\n"), + prop_name, + tmp_err->message); g_clear_error(&tmp_err); } break; @@ -7646,7 +7656,9 @@ property_edit_submenu(NmCli *nmc, NM_META_ACCESSOR_MODIFIER_SET, prop_val_user, &tmp_err)) { - g_print(_("Error: failed to set '%s' property: %s\n"), prop_name, tmp_err->message); + nmc_print(_("Error: failed to set '%s' property: %s\n"), + prop_name, + tmp_err->message); g_clear_error(&tmp_err); } break; @@ -7659,7 +7671,7 @@ property_edit_submenu(NmCli *nmc, : NM_META_ACCESSOR_MODIFIER_SET), cmd_property_arg, &tmp_err)) { - g_print(_("Error: %s\n"), tmp_err->message); + nmc_print(_("Error: %s\n"), tmp_err->message); g_clear_error(&tmp_err); } break; @@ -7678,12 +7690,12 @@ property_edit_submenu(NmCli *nmc, || matches(cmd_property_arg, "all")) editor_show_connection(connection, nmc); else - g_print(_("Unknown command argument: '%s'\n"), cmd_property_arg); + nmc_print(_("Unknown command argument: '%s'\n"), cmd_property_arg); } else { gs_free char *prop_val = NULL; prop_val = nmc_setting_get_property(curr_setting, prop_name, NULL); - g_print("%s: %s\n", prop_name, prop_val); + nmc_print("%s: %s\n", prop_name, prop_val); } break; @@ -7706,7 +7718,7 @@ property_edit_submenu(NmCli *nmc, case NMC_EDITOR_SUB_CMD_UNKNOWN: default: - g_print(_("Unknown command: '%s'\n"), cmd_property_user); + nmc_print(_("Unknown command: '%s'\n"), cmd_property_user); break; } } @@ -7773,7 +7785,7 @@ ask_check_setting(const NmcConfig *nmc_config, GError *err = NULL; if (!arg) { - g_print(_("Available settings: %s\n"), valid_settings_str); + nmc_print(_("Available settings: %s\n"), valid_settings_str); setting_name_user = nmc_readline(nmc_config, EDITOR_PROMPT_SETTING); } else setting_name_user = g_strdup(arg); @@ -7784,7 +7796,7 @@ ask_check_setting(const NmcConfig *nmc_config, valid_settings_main, valid_settings_slave, &err))) { - g_print(_("Error: invalid setting name; %s\n"), err->message); + nmc_print(_("Error: invalid setting name; %s\n"), err->message); g_clear_error(&err); } return setting_name; @@ -7801,7 +7813,7 @@ ask_check_property(const NmcConfig *nmc_config, const char *prop_name; if (!arg) { - g_print(_("Available properties: %s\n"), valid_props_str); + nmc_print(_("Available properties: %s\n"), valid_props_str); prop_name_user = nmc_readline(nmc_config, EDITOR_PROMPT_PROPERTY); nm_strstrip(prop_name_user); } else @@ -7809,7 +7821,7 @@ ask_check_property(const NmcConfig *nmc_config, prop_name = nmc_string_is_valid(prop_name_user, valid_props, &tmp_err); if (!prop_name) - g_print(_("Error: property %s\n"), tmp_err->message); + nmc_print(_("Error: property %s\n"), tmp_err->message); return prop_name; } @@ -7940,7 +7952,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty valid_settings_slave = nm_meta_setting_info_valid_parts_for_slave_type(s_type, NULL); valid_settings_str = get_valid_options_string(valid_settings_main, valid_settings_slave); - g_print(_("You may edit the following settings: %s\n"), valid_settings_str); + nmc_print(_("You may edit the following settings: %s\n"), valid_settings_str); menu_ctx.main_prompt = nmc_colorize(&nmc->nmc_config, NM_META_COLOR_PROMPT, BASE_PROMPT); @@ -7968,8 +7980,8 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty /* Get the remote connection again, it may have disappeared */ removed = refresh_remote_connection(&weak, &rem_con); if (removed) { - g_print(_("The connection profile has been removed from another client. " - "You may type 'save' to restore it.\n")); + nmc_print(_("The connection profile has been removed from another client. " + "You may type 'save' to restore it.\n")); } if (!cmd_user || !*cmd_user) @@ -8006,7 +8018,9 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty gs_free char *avals_str = NULL; avals_str = nmc_util_strv_for_display(avals, FALSE); - g_print(_("Allowed values for '%s' property: %s\n"), prop_name, avals_str); + nmc_print(_("Allowed values for '%s' property: %s\n"), + prop_name, + avals_str); } prop_val_user = nmc_readline(&nmc->nmc_config, _("Enter '%s' value: "), prop_name); @@ -8017,14 +8031,15 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty NM_META_ACCESSOR_MODIFIER_ADD, prop_val_user, &tmp_err)) { - g_print(_("Error: failed to set '%s' property: %s\n"), - prop_name, - tmp_err->message); + nmc_print(_("Error: failed to set '%s' property: %s\n"), + prop_name, + tmp_err->message); g_clear_error(&tmp_err); } } else { - g_print(_("Error: no setting selected; valid are [%s]\n"), valid_settings_str); - g_print(_("use 'goto <setting>' first, or 'set <setting>.<property>'\n")); + nmc_print(_("Error: no setting selected; valid are [%s]\n"), + valid_settings_str); + nmc_print(_("use 'goto <setting>' first, or 'set <setting>.<property>'\n")); } } else { gs_free char *prop_name = NULL; @@ -8044,9 +8059,9 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty valid_settings_slave); ss = ss_created; if (!ss) { - g_print(_("Error: invalid setting argument '%s'; valid are [%s]\n"), - cmd_arg_s, - valid_settings_str); + nmc_print(_("Error: invalid setting argument '%s'; valid are [%s]\n"), + cmd_arg_s, + valid_settings_str); break; } } @@ -8054,14 +8069,14 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty if (menu_ctx.curr_setting) ss = menu_ctx.curr_setting; else { - g_print(_("Error: missing setting for '%s' property\n"), cmd_arg_p); + nmc_print(_("Error: missing setting for '%s' property\n"), cmd_arg_p); break; } } prop_name = is_property_valid(ss, cmd_arg_p, &tmp_err); if (!prop_name) { - g_print(_("Error: invalid property: %s\n"), tmp_err->message); + nmc_print(_("Error: invalid property: %s\n"), tmp_err->message); g_clear_error(&tmp_err); break; } @@ -8076,7 +8091,9 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty gs_free char *avals_str = NULL; avals_str = nmc_util_strv_for_display(avals, FALSE); - g_print(_("Allowed values for '%s' property: %s\n"), prop_name, avals_str); + nmc_print(_("Allowed values for '%s' property: %s\n"), + prop_name, + avals_str); } cmd_arg_v = nmc_readline(&nmc->nmc_config, _("Enter '%s' value: "), prop_name); } @@ -8089,9 +8106,9 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty : NM_META_ACCESSOR_MODIFIER_SET, cmd_arg_v, &tmp_err)) { - g_print(_("Error: failed to set '%s' property: %s\n"), - prop_name, - tmp_err->message); + nmc_print(_("Error: failed to set '%s' property: %s\n"), + prop_name, + tmp_err->message); g_clear_error(&tmp_err); } @@ -8122,7 +8139,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty setting_info = nm_meta_setting_info_editor_find_by_name(setting_name, FALSE); if (!setting_info) { - g_print(_("Error: unknown setting '%s'\n"), setting_name); + nmc_print(_("Error: unknown setting '%s'\n"), setting_name); break; } @@ -8148,8 +8165,8 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty menu_switch_to_level1(&nmc->nmc_config, &menu_ctx, setting, setting_name); if (!cmd_arg_s) { - g_print(_("You may edit the following properties: %s\n"), - menu_ctx.valid_props_str); + nmc_print(_("You may edit the following properties: %s\n"), + menu_ctx.valid_props_str); break; } } @@ -8194,13 +8211,13 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty NM_META_ACCESSOR_MODIFIER_SET, NULL, &tmp_err)) { - g_print(_("Error: failed to remove value of '%s': %s\n"), - prop_name, - tmp_err->message); + nmc_print(_("Error: failed to remove value of '%s': %s\n"), + prop_name, + tmp_err->message); g_clear_error(&tmp_err); } } else - g_print(_("Error: no argument given; valid are [%s]\n"), valid_settings_str); + nmc_print(_("Error: no argument given; valid are [%s]\n"), valid_settings_str); } else { NMSetting *ss = NULL; gboolean descr_all; @@ -8219,11 +8236,12 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty valid_settings_main, valid_settings_slave, NULL)) { - g_print(_("Setting '%s' is not present in the connection.\n"), user_s); + nmc_print(_("Setting '%s' is not present in the connection.\n"), + user_s); } else { - g_print(_("Error: invalid setting argument '%s'; valid are [%s]\n"), - user_s, - valid_settings_str); + nmc_print(_("Error: invalid setting argument '%s'; valid are [%s]\n"), + user_s, + valid_settings_str); } break; } @@ -8235,7 +8253,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty /* Remove setting from the connection */ if (!connection_remove_setting(connection, ss, &local)) - g_print("%s\n", local->message); + nmc_print("%s\n", local->message); if (ss == menu_ctx.curr_setting) { /* If we removed the setting we are in, go up */ @@ -8255,9 +8273,9 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty : NM_META_ACCESSOR_MODIFIER_SET, cmd_arg_v ? cmd_arg_v : NULL, &tmp_err)) { - g_print(_("Error: failed to remove value of '%s': %s\n"), - prop_name, - tmp_err->message); + nmc_print(_("Error: failed to remove value of '%s': %s\n"), + prop_name, + tmp_err->message); } } else { NMSetting *s_tmp; @@ -8272,7 +8290,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty /* Remove setting from the connection */ if (!connection_remove_setting(connection, s_tmp, &local)) - g_print("%s\n", local->message); + nmc_print("%s\n", local->message); /* coverity[copy_paste_error] - suppress Coverity COPY_PASTE_ERROR defect */ if (ss == menu_ctx.curr_setting) { @@ -8281,8 +8299,8 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty nmc_tab_completion.setting = NULL; /* for TAB completion */ } } else { - g_print(_("Error: %s properties, nor it is a setting name.\n"), - tmp_err->message); + nmc_print(_("Error: %s properties, nor it is a setting name.\n"), + tmp_err->message); } } } @@ -8305,8 +8323,10 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty /* Show property description */ print_property_description(menu_ctx.curr_setting, prop_name); } else { - g_print(_("Error: no setting selected; valid are [%s]\n"), valid_settings_str); - g_print(_("use 'goto <setting>' first, or 'describe <setting>.<property>'\n")); + nmc_print(_("Error: no setting selected; valid are [%s]\n"), + valid_settings_str); + nmc_print( + _("use 'goto <setting>' first, or 'describe <setting>.<property>'\n")); } } else { gs_unref_object NMSetting *ss_free = NULL; @@ -8327,9 +8347,9 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty valid_settings_main, valid_settings_slave); if (!ss) { - g_print(_("Error: invalid setting argument '%s'; valid are [%s]\n"), - user_s, - valid_settings_str); + nmc_print(_("Error: invalid setting argument '%s'; valid are [%s]\n"), + user_s, + valid_settings_str); break; } ss_free = ss; @@ -8338,8 +8358,10 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty ss = menu_ctx.curr_setting; if (!ss) { - g_print(_("Error: no setting selected; valid are [%s]\n"), valid_settings_str); - g_print(_("use 'goto <setting>' first, or 'describe <setting>.<property>'\n")); + nmc_print(_("Error: no setting selected; valid are [%s]\n"), + valid_settings_str); + nmc_print( + _("use 'goto <setting>' first, or 'describe <setting>.<property>'\n")); } else if (descr_all) { /* Show description for all properties */ print_setting_description(ss); @@ -8362,9 +8384,9 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty if (s_tmp) print_setting_description(s_tmp); else { - g_print(_("Error: invalid property: %s, " - "neither a valid setting name.\n"), - tmp_err->message); + nmc_print(_("Error: invalid property: %s, " + "neither a valid setting name.\n"), + tmp_err->message); } } } @@ -8392,13 +8414,13 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty valid_settings_slave, NULL); if (!s_name) { - g_print(_("Error: unknown setting: '%s'\n"), user_s); + nmc_print(_("Error: unknown setting: '%s'\n"), user_s); break; } ss = nm_connection_get_setting_by_name(connection, s_name); if (!ss) { - g_print(_("Error: '%s' setting not present in the connection\n"), - s_name); + nmc_print(_("Error: '%s' setting not present in the connection\n"), + s_name); break; } } else @@ -8417,7 +8439,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty gs_free char *prop_val = NULL; prop_val = nmc_setting_get_property(ss, prop_name, NULL); - g_print("%s.%s: %s\n", nm_setting_get_name(ss), prop_name, prop_val); + nmc_print("%s.%s: %s\n", nm_setting_get_name(ss), prop_name, prop_val); } else { /* If the string is not a property, try it as a setting */ NMSetting *s_tmp; @@ -8429,9 +8451,9 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty /* Print the whole setting */ editor_show_setting(s_tmp, nmc); } else - g_print(_("Error: invalid property: %s%s\n"), - err->message, - cmd_arg_s ? "" : _(", neither a valid setting name")); + nmc_print(_("Error: invalid property: %s%s\n"), + err->message, + cmd_arg_s ? "" : _(", neither a valid setting name")); g_clear_error(&err); } } @@ -8447,7 +8469,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty case NMC_EDITOR_MAIN_CMD_VERIFY: /* Verify current setting or the whole connection */ if (cmd_arg && !nm_streq(cmd_arg, "all") && !nm_streq(cmd_arg, "fix")) { - g_print(_("Invalid verify option: %s\n"), cmd_arg); + nmc_print(_("Invalid verify option: %s\n"), cmd_arg); break; } @@ -8455,9 +8477,9 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty gs_free_error GError *tmp_err = NULL; nm_setting_verify(menu_ctx.curr_setting, NULL, &tmp_err); - g_print(_("Verify setting '%s': %s\n"), - nm_setting_get_name(menu_ctx.curr_setting), - tmp_err ? tmp_err->message : "OK"); + nmc_print(_("Verify setting '%s': %s\n"), + nm_setting_get_name(menu_ctx.curr_setting), + tmp_err ? tmp_err->message : "OK"); } else { gs_free_error GError *tmp_err = NULL; gboolean fixed = TRUE; @@ -8470,9 +8492,9 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty g_clear_error(&tmp_err); fixed = nm_connection_normalize(connection, NULL, &modified, &tmp_err); } - g_print(_("Verify connection: %s\n"), tmp_err ? tmp_err->message : "OK"); + nmc_print(_("Verify connection: %s\n"), tmp_err ? tmp_err->message : "OK"); if (!fixed) - g_print(_("The error cannot be fixed automatically.\n")); + nmc_print(_("The error cannot be fixed automatically.\n")); } break; @@ -8492,7 +8514,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty else if (matches(cmd_arg, "persistent")) temporary = FALSE; else { - g_print(_("Error: invalid argument '%s'\n"), cmd_arg); + nmc_print(_("Error: invalid argument '%s'\n"), cmd_arg); break; } } @@ -8549,20 +8571,20 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty g_source_destroy(source); if (nmc_editor_error) { - g_print(_("Error: Failed to save '%s' (%s) connection: %s\n"), - nm_connection_get_id(connection), - nm_connection_get_uuid(connection), - nmc_editor_error->message); + nmc_print(_("Error: Failed to save '%s' (%s) connection: %s\n"), + nm_connection_get_id(connection), + nm_connection_get_uuid(connection), + nmc_editor_error->message); g_error_free(nmc_editor_error); } else if (timeout) { - g_print(_("Error: Timeout saving '%s' (%s) connection\n"), - nm_connection_get_id(connection), - nm_connection_get_uuid(connection)); + nmc_print(_("Error: Timeout saving '%s' (%s) connection\n"), + nm_connection_get_id(connection), + nm_connection_get_uuid(connection)); } else { - g_print(!rem_con ? _("Connection '%s' (%s) successfully saved.\n") - : _("Connection '%s' (%s) successfully updated.\n"), - nm_connection_get_id(connection), - nm_connection_get_uuid(connection)); + nmc_print(!rem_con ? _("Connection '%s' (%s) successfully saved.\n") + : _("Connection '%s' (%s) successfully updated.\n"), + nm_connection_get_id(connection), + nm_connection_get_uuid(connection)); con_tmp = nm_client_get_connection_by_uuid(nmc->client, nm_connection_get_uuid(connection)); @@ -8594,9 +8616,9 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty nmc_editor_cb_called = FALSE; nmc_editor_error = NULL; } else { - g_print(_("Error: connection verification failed: %s\n"), - err1 ? err1->message : _("(unknown error)")); - g_print(_("You may try running 'verify fix' to fix errors.\n")); + nmc_print(_("Error: connection verification failed: %s\n"), + err1 ? err1->message : _("(unknown error)")); + nmc_print(_("You may try running 'verify fix' to fix errors.\n")); } g_clear_error(&err1); @@ -8619,11 +8641,11 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty if (is_connection_dirty(connection, rem_con)) { /* TRANSLATORS: do not translate 'save', leave it as it is */ - g_print(_("Error: connection is not saved. Type 'save' first.\n")); + nmc_print(_("Error: connection is not saved. Type 'save' first.\n")); break; } if (!nm_connection_verify(NM_CONNECTION(rem_con), &tmp_err)) { - g_print(_("Error: connection is not valid: %s\n"), tmp_err->message); + nmc_print(_("Error: connection is not valid: %s\n"), tmp_err->message); g_clear_error(&tmp_err); break; } @@ -8639,7 +8661,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty NULL, activate_connection_editor_cb, &tmp_err)) { - g_print(_("Error: Cannot activate connection: %s.\n"), tmp_err->message); + nmc_print(_("Error: Cannot activate connection: %s.\n"), tmp_err->message); g_clear_error(&tmp_err); break; } @@ -8648,10 +8670,10 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty g_main_context_iteration(NULL, TRUE); if (nmc_editor_error) { - g_print(_("Error: Failed to activate '%s' (%s) connection: %s\n"), - nm_connection_get_id(connection), - nm_connection_get_uuid(connection), - nmc_editor_error->message); + nmc_print(_("Error: Failed to activate '%s' (%s) connection: %s\n"), + nm_connection_get_id(connection), + nm_connection_get_uuid(connection), + nmc_editor_error->message); g_error_free(nmc_editor_error); } else { nmc_readline(&nmc->nmc_config, @@ -8690,7 +8712,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty GError *tmp_err = NULL; gboolean bb; if (!nmc_string_to_bool(cmd_arg_v ? g_strstrip(cmd_arg_v) : "", &bb, &tmp_err)) { - g_print(_("Error: status-line: %s\n"), tmp_err->message); + nmc_print(_("Error: status-line: %s\n"), tmp_err->message); g_clear_error(&tmp_err); } else nmc->editor_status_line = bb; @@ -8698,7 +8720,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty GError *tmp_err = NULL; gboolean bb; if (!nmc_string_to_bool(cmd_arg_v ? g_strstrip(cmd_arg_v) : "", &bb, &tmp_err)) { - g_print(_("Error: save-confirmation: %s\n"), tmp_err->message); + nmc_print(_("Error: save-confirmation: %s\n"), tmp_err->message); g_clear_error(&tmp_err); } else nmc->editor_save_confirmation = bb; @@ -8706,7 +8728,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty GError *tmp_err = NULL; gboolean bb; if (!nmc_string_to_bool(cmd_arg_v ? g_strstrip(cmd_arg_v) : "", &bb, &tmp_err)) { - g_print(_("Error: show-secrets: %s\n"), tmp_err->message); + nmc_print(_("Error: show-secrets: %s\n"), tmp_err->message); g_clear_error(&tmp_err); } else nmc->nmc_config_mutable.show_secrets = bb; @@ -8714,17 +8736,17 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty g_debug("Ignoring erroneous --prompt-color argument. Use terminal-colors.d(5) to " "set the prompt color.\n"); } else if (!cmd_arg_p) { - g_print(_("Current nmcli configuration:\n")); - g_print("status-line: %s\n" - "save-confirmation: %s\n" - "show-secrets: %s\n", - nmc->editor_status_line ? "yes" : "no", - nmc->editor_save_confirmation ? "yes" : "no", - nmc->nmc_config.show_secrets ? "yes" : "no"); + nmc_print(_("Current nmcli configuration:\n")); + nmc_print("status-line: %s\n" + "save-confirmation: %s\n" + "show-secrets: %s\n", + nmc->editor_status_line ? "yes" : "no", + nmc->editor_save_confirmation ? "yes" : "no", + nmc->nmc_config.show_secrets ? "yes" : "no"); } else - g_print(_("Invalid configuration option '%s'; allowed [%s]\n"), - cmd_arg_v ?: "", - "status-line, save-confirmation, show-secrets"); + nmc_print(_("Invalid configuration option '%s'; allowed [%s]\n"), + cmd_arg_v ?: "", + "status-line, save-confirmation, show-secrets"); break; @@ -8738,7 +8760,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty case NMC_EDITOR_MAIN_CMD_UNKNOWN: default: - g_print(_("Unknown command: '%s'\n"), cmd_user); + nmc_print(_("Unknown command: '%s'\n"), cmd_user); break; } } @@ -8881,9 +8903,9 @@ nmc_complete_connection_type(const char *prefix) const NMMetaSettingInfoEditor *setting_info = &nm_meta_setting_infos_editor[i]; if (!*prefix || matches(prefix, setting_info->general->setting_name)) - g_print("%s\n", setting_info->general->setting_name); + nmc_print("%s\n", setting_info->general->setting_name); if (setting_info->alias && (!*prefix || matches(prefix, setting_info->alias))) - g_print("%s\n", setting_info->alias); + nmc_print("%s\n", setting_info->alias); } } @@ -8986,10 +9008,10 @@ do_connection_edit(const NMCCommand *cmd, NmCli *nmc, int argc, const char *cons connection_type = nm_setting_connection_get_connection_type(s_con); if (type) - g_print(_("Warning: editing existing connection '%s'; 'type' argument is ignored\n"), - nm_connection_get_id(connection)); + nmc_print(_("Warning: editing existing connection '%s'; 'type' argument is ignored\n"), + nm_connection_get_id(connection)); if (con_name) - g_print( + nmc_print( _("Warning: editing existing connection '%s'; 'con-name' argument is ignored\n"), nm_connection_get_id(connection)); @@ -9017,9 +9039,9 @@ do_connection_edit(const NMCCommand *cmd, NmCli *nmc, int argc, const char *cons gs_free char *type_ask = NULL; if (!type) - g_print(_("Valid connection types: %s\n"), tmp_str); + nmc_print(_("Valid connection types: %s\n"), tmp_str); else - g_print(_("Error: invalid connection type; %s\n"), err1->message); + nmc_print(_("Error: invalid connection type; %s\n"), err1->message); g_clear_error(&err1); type_ask = nmc_readline(&nmc->nmc_config, EDITOR_PROMPT_CON_TYPE); @@ -9057,23 +9079,23 @@ do_connection_edit(const NMCCommand *cmd, NmCli *nmc, int argc, const char *cons /* nmcli runs the editor */ nmc->nmc_config_mutable.in_editor = TRUE; - g_print("\n"); - g_print(_("===| nmcli interactive connection editor |===")); - g_print("\n\n"); + nmc_print("\n"); + nmc_print(_("===| nmcli interactive connection editor |===")); + nmc_print("\n\n"); if (con) - g_print(_("Editing existing '%s' connection: '%s'"), connection_type, con); + nmc_print(_("Editing existing '%s' connection: '%s'"), connection_type, con); else - g_print(_("Adding a new '%s' connection"), connection_type); - g_print("\n\n"); + nmc_print(_("Adding a new '%s' connection"), connection_type); + nmc_print("\n\n"); /* TRANSLATORS: do not translate 'help', leave it as it is */ - g_print(_("Type 'help' or '?' for available commands.")); - g_print("\n"); + nmc_print(_("Type 'help' or '?' for available commands.")); + nmc_print("\n"); /* TRANSLATORS: do not translate 'print', leave it as it is */ - g_print(_("Type 'print' to show all the connection properties.")); - g_print("\n"); + nmc_print(_("Type 'print' to show all the connection properties.")); + nmc_print("\n"); /* TRANSLATORS: do not translate 'describe', leave it as it is */ - g_print(_("Type 'describe [<setting>.<prop>]' for detailed property description.")); - g_print("\n\n"); + nmc_print(_("Type 'describe [<setting>.<prop>]' for detailed property description.")); + nmc_print("\n\n"); nmc_tab_completion.nmc = nmc; nmc_tab_completion.con_type = g_strdup(connection_type); @@ -9107,9 +9129,9 @@ modify_connection_cb(GObject *connection, GAsyncResult *result, gpointer user_da connection_warnings(nmc, NM_CONNECTION(connection)); if (nmc->nmc_config.print_output == NMC_PRINT_PRETTY) { - g_print(_("Connection '%s' (%s) successfully modified.\n"), - nm_connection_get_id(NM_CONNECTION(connection)), - nm_connection_get_uuid(NM_CONNECTION(connection))); + nmc_print(_("Connection '%s' (%s) successfully modified.\n"), + nm_connection_get_id(NM_CONNECTION(connection)), + nm_connection_get_uuid(NM_CONNECTION(connection))); } } quit(); @@ -9180,11 +9202,11 @@ clone_connection_cb(GObject *client, GAsyncResult *result, gpointer user_data) error->message); nmc->return_value = NMC_RESULT_ERROR_CON_ACTIVATION; } else { - g_print(_("%s (%s) cloned as %s (%s).\n"), - info->orig_id, - info->orig_uuid, - nm_connection_get_id(NM_CONNECTION(connection)), - nm_connection_get_uuid(NM_CONNECTION(connection))); + nmc_print(_("%s (%s) cloned as %s (%s).\n"), + info->orig_id, + info->orig_uuid, + nm_connection_get_id(NM_CONNECTION(connection)), + nm_connection_get_uuid(NM_CONNECTION(connection))); } quit(); @@ -9281,7 +9303,7 @@ delete_cb(GObject *con, GAsyncResult *result, gpointer user_data) if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) return; g_string_printf(info->nmc->return_text, _("Error: not all connections deleted.")); - g_printerr(_("Error: Connection deletion failed: %s\n"), error->message); + nmc_printerr(_("Error: Connection deletion failed: %s\n"), error->message); g_error_free(error); info->nmc->return_value = NMC_RESULT_ERROR_CON_DEL; connection_cb_info_finish(info, con); @@ -9336,7 +9358,7 @@ do_connection_delete(const NMCCommand *cmd, NmCli *nmc, int argc, const char *co get_connection(nmc, &arg_num, &arg_ptr, &cur_selector, &cur_value, &found_cons, &error); if (!connection) { if (!nmc->complete) - g_printerr(_("Error: %s.\n"), error->message); + nmc_printerr(_("Error: %s.\n"), error->message); g_string_printf(nmc->return_text, _("Error: not all connections found.")); nmc->return_value = error->code; g_clear_error(&error); @@ -9404,7 +9426,7 @@ finish: static void connection_changed(NMConnection *connection, NmCli *nmc) { - g_print(_("%s: connection profile changed\n"), nm_connection_get_id(connection)); + nmc_print(_("%s: connection profile changed\n"), nm_connection_get_id(connection)); } static void @@ -9430,7 +9452,7 @@ connection_added(NMClient *client, NMRemoteConnection *con, NmCli *nmc) { NMConnection *connection = NM_CONNECTION(con); - g_print(_("%s: connection profile created\n"), nm_connection_get_id(connection)); + nmc_print(_("%s: connection profile created\n"), nm_connection_get_id(connection)); connection_watch(nmc, connection); } @@ -9439,7 +9461,7 @@ connection_removed(NMClient *client, NMRemoteConnection *con, NmCli *nmc) { NMConnection *connection = NM_CONNECTION(con); - g_print(_("%s: connection profile removed\n"), nm_connection_get_id(connection)); + nmc_print(_("%s: connection profile removed\n"), nm_connection_get_id(connection)); connection_unwatch(nmc, connection); } @@ -9463,7 +9485,7 @@ do_connection_monitor(const NMCCommand *cmd, NmCli *nmc, int argc, const char *c while (argc > 0) { if (!get_connection(nmc, &argc, &argv, NULL, NULL, &found_cons, &error)) { if (!nmc->complete) - g_printerr(_("Error: %s.\n"), error->message); + nmc_printerr(_("Error: %s.\n"), error->message); g_string_printf(nmc->return_text, _("Error: not all connections found.")); nmc->return_value = error->code; return; @@ -9587,7 +9609,7 @@ do_connection_load(const NMCCommand *cmd, NmCli *nmc, int argc, const char *cons if (failures) { for (i = 0; failures[i]; i++) - g_printerr(_("Could not load file '%s'\n"), failures[i]); + nmc_printerr(_("Could not load file '%s'\n"), failures[i]); } } @@ -9650,10 +9672,7 @@ do_connection_import(const NMCCommand *cmd, NmCli *nmc, int argc, const char *co NULL); } - if (!type) - type = *argv; - else - g_printerr(_("Warning: 'type' already specified, ignoring extra one.\n")); + type = *argv; } else if (nm_streq(*argv, "file")) { argc--; @@ -9665,10 +9684,8 @@ do_connection_import(const NMCCommand *cmd, NmCli *nmc, int argc, const char *co } if (argc == 1 && nmc->complete) nmc->return_value = NMC_RESULT_COMPLETE_FILE; - if (!filename) - filename = *argv; - else - g_printerr(_("Warning: 'file' already specified, ignoring extra one.\n")); + + filename = *argv; } else { g_string_printf(nmc->return_text, _("Error: invalid extra argument '%s'."), *argv); nmc->return_value = NMC_RESULT_ERROR_USER_INPUT; @@ -9842,7 +9859,7 @@ do_connection_export(const NMCCommand *cmd, NmCli *nmc, int argc, const char *co nmc->return_value = NMC_RESULT_ERROR_UNKNOWN; goto finish; } - g_print("%s", contents); + nmc_print("%s", contents); } finish: @@ -9861,13 +9878,13 @@ migrate_cb(GObject *obj, GAsyncResult *result, gpointer user_data) res = nm_remote_connection_update2_finish(NM_REMOTE_CONNECTION(obj), result, &error); if (!res) { g_string_printf(info->nmc->return_text, _("Error: not all connections migrated.")); - g_printerr(_("Error: Connection migration failed: %s\n"), error->message); + nmc_printerr(_("Error: Connection migration failed: %s\n"), error->message); g_error_free(error); info->nmc->return_value = NMC_RESULT_ERROR_UNKNOWN; } else { - g_print(_("Connection '%s' (%s) successfully migrated.\n"), - nm_connection_get_id(connection), - nm_connection_get_uuid(connection)); + nmc_print(_("Connection '%s' (%s) successfully migrated.\n"), + nm_connection_get_id(connection), + nm_connection_get_uuid(connection)); } connection_cb_info_finish(info, obj); } @@ -9930,7 +9947,7 @@ do_connection_migrate(const NMCCommand *cmd, NmCli *nmc, int argc, const char *c get_connection(nmc, &arg_num, &arg_ptr, &cur_selector, &cur_value, &found_cons, &error); if (!connection) { if (!nmc->complete) - g_printerr(_("Error: %s.\n"), error->message); + nmc_printerr(_("Error: %s.\n"), error->message); g_string_printf(nmc->return_text, _("Error: not all connections found.")); nmc->return_value = error->code; g_clear_error(&error); @@ -10121,7 +10138,7 @@ nmc_command_func_connection(const NMCCommand *cmd, NmCli *nmc, int argc, const c } void -monitor_connections(NmCli *nmc) +nmc_monitor_connections(NmCli *nmc) { do_connection_monitor(NULL, nmc, 0, NULL); } diff --git a/src/nmcli/connections.h b/src/nmcli/connections.h index c610766a..48c98170 100644 --- a/src/nmcli/connections.h +++ b/src/nmcli/connections.h @@ -8,7 +8,7 @@ #include "nmcli.h" -void monitor_connections(NmCli *nmc); +void nmc_monitor_connections(NmCli *nmc); const char *nmc_connection_check_deprecated(NMConnection *c); diff --git a/src/nmcli/devices.c b/src/nmcli/devices.c index db14ec05..c160fff6 100644 --- a/src/nmcli/devices.c +++ b/src/nmcli/devices.c @@ -837,34 +837,35 @@ static guint progress_id = 0; /* ID of event source for displaying progress */ static void usage(void) { - g_printerr(_("Usage: nmcli device { COMMAND | help }\n\n" - "COMMAND := { status | show | set | connect | reapply | modify | disconnect | " - "delete | monitor | wifi | lldp }\n\n" - " status\n\n" - " show [<ifname>]\n\n" - " set [ifname] <ifname> [autoconnect yes|no] [managed yes|no]\n\n" - " connect <ifname>\n\n" - " reapply <ifname>\n\n" - " modify <ifname> ([+|-]<setting>.<property> <value>)+\n\n" - " disconnect <ifname> ...\n\n" - " delete <ifname> ...\n\n" - " monitor <ifname> ...\n\n" - " wifi [list [ifname <ifname>] [bssid <BSSID>] [--rescan yes|no|auto]]\n\n" - " wifi connect <(B)SSID> [password <password>] [wep-key-type key|phrase] [ifname " - "<ifname>]\n" - " [bssid <BSSID>] [name <name>] [private yes|no] [hidden " - "yes|no]\n\n" - " wifi hotspot [ifname <ifname>] [con-name <name>] [ssid <SSID>] [band a|bg] " - "[channel <channel>] [password <password>]\n\n" - " wifi rescan [ifname <ifname>] [[ssid <SSID to scan>] ...]\n\n" - " wifi show-password [ifname <ifname>]\n\n" - " lldp [list [ifname <ifname>]]\n\n")); + nmc_printerr( + _("Usage: nmcli device { COMMAND | help }\n\n" + "COMMAND := { status | show | set | connect | reapply | modify | disconnect | " + "delete | monitor | wifi | lldp }\n\n" + " status\n\n" + " show [<ifname>]\n\n" + " set [ifname] <ifname> [autoconnect yes|no] [managed yes|no]\n\n" + " connect <ifname>\n\n" + " reapply <ifname>\n\n" + " modify <ifname> ([+|-]<setting>.<property> <value>)+\n\n" + " disconnect <ifname> ...\n\n" + " delete <ifname> ...\n\n" + " monitor <ifname> ...\n\n" + " wifi [list [ifname <ifname>] [bssid <BSSID>] [--rescan yes|no|auto]]\n\n" + " wifi connect <(B)SSID> [password <password>] [wep-key-type key|phrase] [ifname " + "<ifname>]\n" + " [bssid <BSSID>] [name <name>] [private yes|no] [hidden " + "yes|no]\n\n" + " wifi hotspot [ifname <ifname>] [con-name <name>] [ssid <SSID>] [band a|bg] " + "[channel <channel>] [password <password>]\n\n" + " wifi rescan [ifname <ifname>] [[ssid <SSID to scan>] ...]\n\n" + " wifi show-password [ifname <ifname>]\n\n" + " lldp [list [ifname <ifname>]]\n\n")); } static void usage_device_status(void) { - g_printerr( + nmc_printerr( _("Usage: nmcli device status { help }\n" "\n" "Show status for all devices.\n" @@ -880,41 +881,41 @@ usage_device_status(void) static void usage_device_show(void) { - g_printerr(_("Usage: nmcli device show { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [<ifname>]\n" - "\n" - "Show details of device(s).\n" - "The command lists details for all devices, or for a given device.\n\n")); + nmc_printerr(_("Usage: nmcli device show { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [<ifname>]\n" + "\n" + "Show details of device(s).\n" + "The command lists details for all devices, or for a given device.\n\n")); } static void usage_device_connect(void) { - g_printerr(_("Usage: nmcli device connect { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := <ifname>\n" - "\n" - "Connect the device.\n" - "NetworkManager will try to find a suitable connection that will be activated.\n" - "It will also consider connections that are not set to auto-connect.\n\n")); + nmc_printerr(_("Usage: nmcli device connect { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := <ifname>\n" + "\n" + "Connect the device.\n" + "NetworkManager will try to find a suitable connection that will be activated.\n" + "It will also consider connections that are not set to auto-connect.\n\n")); } static void usage_device_reapply(void) { - g_printerr(_("Usage: nmcli device reapply { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := <ifname>\n" - "\n" - "Attempts to update device with changes to the currently active connection\n" - "made since it was last applied.\n\n")); + nmc_printerr(_("Usage: nmcli device reapply { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := <ifname>\n" + "\n" + "Attempts to update device with changes to the currently active connection\n" + "made since it was last applied.\n\n")); } static void usage_device_modify(void) { - g_printerr(_( + nmc_printerr(_( "Usage: nmcli device modify { ARGUMENTS | help }\n" "\n" "ARGUMENTS := <ifname> ([+|-]<setting>.<property> <value>)+\n" @@ -935,57 +936,57 @@ usage_device_modify(void) static void usage_device_disconnect(void) { - g_printerr(_("Usage: nmcli device disconnect { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := <ifname> ...\n" - "\n" - "Disconnect devices.\n" - "The command disconnects the device and prevents it from auto-activating\n" - "further connections without user/manual intervention.\n\n")); + nmc_printerr(_("Usage: nmcli device disconnect { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := <ifname> ...\n" + "\n" + "Disconnect devices.\n" + "The command disconnects the device and prevents it from auto-activating\n" + "further connections without user/manual intervention.\n\n")); } static void usage_device_delete(void) { - g_printerr(_("Usage: nmcli device delete { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := <ifname> ...\n" - "\n" - "Delete the software devices.\n" - "The command removes the interfaces. It only works for software devices\n" - "(like bonds, bridges, etc.). Hardware devices cannot be deleted by the\n" - "command.\n\n")); + nmc_printerr(_("Usage: nmcli device delete { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := <ifname> ...\n" + "\n" + "Delete the software devices.\n" + "The command removes the interfaces. It only works for software devices\n" + "(like bonds, bridges, etc.). Hardware devices cannot be deleted by the\n" + "command.\n\n")); } static void usage_device_set(void) { - g_printerr(_("Usage: nmcli device set { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := DEVICE { PROPERTY [ PROPERTY ... ] }\n" - "DEVICE := [ifname] <ifname> \n" - "PROPERTY := { autoconnect { yes | no } |\n" - " { managed { yes | no }\n" - "\n" - "Modify device properties.\n\n")); + nmc_printerr(_("Usage: nmcli device set { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := DEVICE { PROPERTY [ PROPERTY ... ] }\n" + "DEVICE := [ifname] <ifname> \n" + "PROPERTY := { autoconnect { yes | no } |\n" + " { managed { yes | no }\n" + "\n" + "Modify device properties.\n\n")); } static void usage_device_monitor(void) { - g_printerr(_("Usage: nmcli device monitor { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [<ifname>] ...\n" - "\n" - "Monitor device activity.\n" - "This command prints a line whenever the specified devices change state.\n" - "Monitors all devices in case no interface is specified.\n\n")); + nmc_printerr(_("Usage: nmcli device monitor { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [<ifname>] ...\n" + "\n" + "Monitor device activity.\n" + "This command prints a line whenever the specified devices change state.\n" + "Monitors all devices in case no interface is specified.\n\n")); } static void usage_device_wifi(void) { - g_printerr( + nmc_printerr( _("Usage: nmcli device wifi { ARGUMENTS | help }\n" "\n" "Perform operation on Wi-Fi devices.\n" @@ -1034,24 +1035,24 @@ usage_device_wifi(void) static void usage_device_lldp(void) { - g_printerr(_("Usage: nmcli device lldp { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [list [ifname <ifname>]]\n" - "\n" - "List neighboring devices discovered through LLDP. The 'ifname' option can be\n" - "used to list neighbors for a particular interface.\n\n")); + nmc_printerr(_("Usage: nmcli device lldp { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [list [ifname <ifname>]]\n" + "\n" + "List neighboring devices discovered through LLDP. The 'ifname' option can be\n" + "used to list neighbors for a particular interface.\n\n")); } static void usage_device_checkpoint(void) { - g_printerr(_("Usage: nmcli device checkpoint { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [--timeout <seconds>] -- COMMAND...\n" - "\n" - "Runs the command with a configuration checkpoint taken and asks for a\n" - "confirmation when finished. When the confirmation is not given, the\n" - "checkpoint is automatically restored after timeout.\n\n")); + nmc_printerr(_("Usage: nmcli device checkpoint { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [--timeout <seconds>] -- COMMAND...\n" + "\n" + "Runs the command with a configuration checkpoint taken and asks for a\n" + "confirmation when finished. When the confirmation is not given, the\n" + "checkpoint is automatically restored after timeout.\n\n")); } static void @@ -1108,7 +1109,7 @@ complete_device(NMDevice **devices, const char *prefix, gboolean wifi_only) continue; if (g_str_has_prefix(iface, prefix)) - g_print("%s\n", iface); + nmc_print("%s\n", iface); } } @@ -1177,10 +1178,10 @@ get_device_list(NmCli *nmc, int *argc, const char *const **argv) if (!g_ptr_array_find(queue, device, NULL)) g_ptr_array_add(queue, g_object_ref(device)); else - g_printerr(_("Warning: argument '%s' is duplicated.\n"), **argv); + nmc_printerr(_("Warning: argument '%s' is duplicated.\n"), **argv); } else { if (!nmc->complete) - g_printerr(_("Error: Device '%s' not found.\n"), **argv); + nmc_printerr(_("Error: Device '%s' not found.\n"), **argv); g_string_printf(nmc->return_text, _("Error: not all devices found.")); nmc->return_value = NMC_RESULT_ERROR_NOT_FOUND; } @@ -1639,12 +1640,12 @@ show_device_info(NMDevice *device, NmCli *nmc) /* Loop through the required sections and print them. */ for (k = 0; k < sections_array->len; k++) { - int section_idx = g_array_index(sections_array, int, k); + int section_idx = nm_g_array_index(sections_array, int, k); char *section_fld = (char *) g_ptr_array_index(fields_in_section, k); if (NM_IN_SET(nmc->nmc_config.print_output, NMC_PRINT_NORMAL, NMC_PRINT_PRETTY) && !nmc->nmc_config.multiline_output && was_output) - g_print("\n"); /* Print empty line between groups in tabular mode */ + nmc_print("\n"); /* Print empty line between groups in tabular mode */ was_output = FALSE; @@ -1653,13 +1654,14 @@ show_device_info(NMDevice *device, NmCli *nmc) if (nmc_fields_dev_show_sections[section_idx]->nested == metagen_device_detail_general) { gs_free char *f = section_fld ? g_strdup_printf("GENERAL.%s", section_fld) : NULL; - nmc_print(&nmc->nmc_config, - (gpointer[]){device, NULL}, - NULL, - NULL, - NMC_META_GENERIC_GROUP("GENERAL", metagen_device_detail_general, N_("NAME")), - f, - NULL); + nmc_print_table( + &nmc->nmc_config, + (gpointer[]){device, NULL}, + NULL, + NULL, + NMC_META_GENERIC_GROUP("GENERAL", metagen_device_detail_general, N_("NAME")), + f, + NULL); was_output = TRUE; continue; } @@ -1668,15 +1670,15 @@ show_device_info(NMDevice *device, NmCli *nmc) == metagen_device_detail_capabilities) { gs_free char *f = section_fld ? g_strdup_printf("CAPABILITIES.%s", section_fld) : NULL; - nmc_print(&nmc->nmc_config, - (gpointer[]){device, NULL}, - NULL, - NULL, - NMC_META_GENERIC_GROUP("CAPABILITIES", - metagen_device_detail_capabilities, - N_("NAME")), - f, - NULL); + nmc_print_table(&nmc->nmc_config, + (gpointer[]){device, NULL}, + NULL, + NULL, + NMC_META_GENERIC_GROUP("CAPABILITIES", + metagen_device_detail_capabilities, + N_("NAME")), + f, + NULL); was_output = TRUE; continue; } @@ -1686,15 +1688,15 @@ show_device_info(NMDevice *device, NmCli *nmc) gs_free char *f = section_fld ? g_strdup_printf("INTERFACE-FLAGS.%s", section_fld) : NULL; - nmc_print(&nmc->nmc_config, - (gpointer[]){device, NULL}, - NULL, - NULL, - NMC_META_GENERIC_GROUP("INTERFACE-FLAGS", - metagen_device_detail_interface_flags, - N_("NAME")), - f, - NULL); + nmc_print_table(&nmc->nmc_config, + (gpointer[]){device, NULL}, + NULL, + NULL, + NMC_META_GENERIC_GROUP("INTERFACE-FLAGS", + metagen_device_detail_interface_flags, + N_("NAME")), + f, + NULL); was_output = TRUE; continue; } @@ -1705,15 +1707,15 @@ show_device_info(NMDevice *device, NmCli *nmc) gs_free char *f = section_fld ? g_strdup_printf("WIFI-PROPERTIES.%s", section_fld) : NULL; - nmc_print(&nmc->nmc_config, - (gpointer[]){device, NULL}, - NULL, - NULL, - NMC_META_GENERIC_GROUP("WIFI-PROPERTIES", - metagen_device_detail_wifi_properties, - N_("NAME")), - f, - NULL); + nmc_print_table(&nmc->nmc_config, + (gpointer[]){device, NULL}, + NULL, + NULL, + NMC_META_GENERIC_GROUP("WIFI-PROPERTIES", + metagen_device_detail_wifi_properties, + N_("NAME")), + f, + NULL); was_output = TRUE; } continue; @@ -1769,15 +1771,15 @@ show_device_info(NMDevice *device, NmCli *nmc) gs_free char *f = section_fld ? g_strdup_printf("WIRED-PROPERTIES.%s", section_fld) : NULL; - nmc_print(&nmc->nmc_config, - (gpointer[]){device, NULL}, - NULL, - NULL, - NMC_META_GENERIC_GROUP("WIRED-PROPERTIES", - metagen_device_detail_wired_properties, - N_("NAME")), - f, - NULL); + nmc_print_table(&nmc->nmc_config, + (gpointer[]){device, NULL}, + NULL, + NULL, + NMC_META_GENERIC_GROUP("WIRED-PROPERTIES", + metagen_device_detail_wired_properties, + N_("NAME")), + f, + NULL); was_output = TRUE; } continue; @@ -1898,15 +1900,15 @@ show_device_info(NMDevice *device, NmCli *nmc) == metagen_device_detail_connections) { gs_free char *f = section_fld ? g_strdup_printf("CONNECTIONS.%s", section_fld) : NULL; - nmc_print(&nmc->nmc_config, - (gpointer[]){device, NULL}, - NULL, - NULL, - NMC_META_GENERIC_GROUP("CONNECTIONS", - metagen_device_detail_connections, - N_("NAME")), - f, - NULL); + nmc_print_table(&nmc->nmc_config, + (gpointer[]){device, NULL}, + NULL, + NULL, + NMC_META_GENERIC_GROUP("CONNECTIONS", + metagen_device_detail_connections, + N_("NAME")), + f, + NULL); was_output = TRUE; continue; } @@ -1975,13 +1977,13 @@ do_devices_status(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const devices = nmc_get_devices_sorted(nmc->client); - if (!nmc_print(&nmc->nmc_config, - (gpointer *) devices, - NULL, - N_("Status of devices"), - (const NMMetaAbstractInfo *const *) metagen_device_status, - fields_str, - &error)) { + if (!nmc_print_table(&nmc->nmc_config, + (gpointer *) devices, + NULL, + N_("Status of devices"), + (const NMMetaAbstractInfo *const *) metagen_device_status, + fields_str, + &error)) { g_string_printf(nmc->return_text, _("Error: 'device status': %s"), error->message); g_error_free(error); nmc->return_value = NMC_RESULT_ERROR_USER_INPUT; @@ -2031,7 +2033,7 @@ do_device_show(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const *a if (!show_device_info(devices[i], nmc)) break; if (devices[i + 1]) - g_print("\n"); /* Empty line */ + nmc_print("\n"); /* Empty line */ } g_free(devices); @@ -2105,8 +2107,10 @@ NM_AUTO_DEFINE_FCN0(AddAndActivateInfo *, add_and_activate_info_free); #define nm_auto_free_add_and_activate_info nm_auto(_nm_auto_free_add_and_activate_info) +static void add_and_activate_notify_state_cb(GObject *src, GParamSpec *pspec, gpointer user_data); + static void -connected_state_cb(AddAndActivateInfo *info) +add_and_activate_check_state(AddAndActivateInfo *info) { NMDeviceState state; NMDeviceStateReason reason; @@ -2120,30 +2124,42 @@ connected_state_cb(AddAndActivateInfo *info) if (state == NM_DEVICE_STATE_ACTIVATED) { nmc_terminal_erase_line(); - g_print(_("Device '%s' successfully activated with '%s'.\n"), - nm_device_get_iface(info->device), - nm_active_connection_get_uuid(info->active)); + nmc_print(_("Device '%s' successfully activated with '%s'.\n"), + nm_device_get_iface(info->device), + nm_active_connection_get_uuid(info->active)); if (info->hotspot) - g_print( + nmc_print( _("Hint: \"nmcli dev wifi show-password\" shows the Wi-Fi name and password.\n")); } else if (state <= NM_DEVICE_STATE_DISCONNECTED || state >= NM_DEVICE_STATE_DEACTIVATING) { reason = nm_device_get_state_reason(info->device); - g_print(_("Error: Connection activation failed: (%d) %s.\n"), - reason, - gettext(nmc_device_reason_to_string(reason))); + g_string_printf(info->nmc->return_text, + _("Error: Connection activation failed: %s."), + gettext(nmc_device_reason_to_string(reason))); + info->nmc->return_value = NMC_RESULT_ERROR_CON_ACTIVATION; } else { return; } - g_signal_handlers_disconnect_by_func(info->active, G_CALLBACK(connected_state_cb), info); - g_signal_handlers_disconnect_by_func(info->device, G_CALLBACK(connected_state_cb), info); + g_signal_handlers_disconnect_by_func(info->active, + G_CALLBACK(add_and_activate_notify_state_cb), + info); + g_signal_handlers_disconnect_by_func(info->device, + G_CALLBACK(add_and_activate_notify_state_cb), + info); add_and_activate_info_free(info); quit(); } static void +add_and_activate_notify_state_cb(GObject *src, GParamSpec *pspec, gpointer user_data) + +{ + add_and_activate_check_state(user_data); +} + +static void add_and_activate_cb(GObject *client, GAsyncResult *result, gpointer user_data) { nm_auto_free_add_and_activate_info AddAndActivateInfo *info = user_data; @@ -2179,7 +2195,7 @@ add_and_activate_cb(GObject *client, GAsyncResult *result, gpointer user_data) deprecated = nmc_connection_check_deprecated(NM_CONNECTION(nm_active_connection_get_connection(active))); if (deprecated) - g_printerr(_("Warning: %s.\n"), deprecated); + nmc_printerr(_("Warning: %s.\n"), deprecated); if (nmc->nowait_flag) { quit(); @@ -2190,9 +2206,15 @@ add_and_activate_cb(GObject *client, GAsyncResult *result, gpointer user_data) progress_id = g_timeout_add(120, progress_cb, info->device); info->active = g_steal_pointer(&active); - g_signal_connect_swapped(info->device, "notify::state", G_CALLBACK(connected_state_cb), info); - g_signal_connect_swapped(info->active, "notify::state", G_CALLBACK(connected_state_cb), info); - connected_state_cb(g_steal_pointer(&info)); + g_signal_connect(info->device, + "notify::" NM_DEVICE_STATE, + G_CALLBACK(add_and_activate_notify_state_cb), + info); + g_signal_connect(info->active, + "notify::" NM_ACTIVE_CONNECTION_STATE, + G_CALLBACK(add_and_activate_notify_state_cb), + info); + add_and_activate_check_state(g_steal_pointer(&info)); g_timeout_add_seconds(nmc->timeout, timeout_cb, nmc); /* Exit if timeout expires */ } @@ -2258,9 +2280,15 @@ connect_device_cb(GObject *client, GAsyncResult *result, gpointer user_data) } info->active = g_steal_pointer(&active); - g_signal_connect_swapped(info->device, "notify::state", G_CALLBACK(connected_state_cb), info); - g_signal_connect_swapped(info->active, "notify::state", G_CALLBACK(connected_state_cb), info); - connected_state_cb(g_steal_pointer(&info)); + g_signal_connect(info->device, + "notify::" NM_DEVICE_STATE, + G_CALLBACK(add_and_activate_notify_state_cb), + info); + g_signal_connect(info->active, + "notify::" NM_ACTIVE_CONNECTION_STATE, + G_CALLBACK(add_and_activate_notify_state_cb), + info); + add_and_activate_check_state(g_steal_pointer(&info)); /* Start timer not to loop forever if "notify::state" signal is not issued */ g_timeout_add_seconds(nmc->timeout, timeout_cb, nmc); @@ -2355,9 +2383,9 @@ device_removed_cb(NMClient *client, NMDevice *device, DeviceCbInfo *info) return; if (info->cmd_disconnect) - g_print(_("Device '%s' successfully disconnected.\n"), nm_device_get_iface(device)); + nmc_print(_("Device '%s' successfully disconnected.\n"), nm_device_get_iface(device)); else - g_print(_("Device '%s' successfully removed.\n"), nm_device_get_iface(device)); + nmc_print(_("Device '%s' successfully removed.\n"), nm_device_get_iface(device)); device_cb_info_finish(info, device); } @@ -2368,7 +2396,7 @@ disconnect_state_cb(NMDevice *device, GParamSpec *pspec, DeviceCbInfo *info) return; if (nm_device_get_state(device) <= NM_DEVICE_STATE_DISCONNECTED) { - g_print(_("Device '%s' successfully disconnected.\n"), nm_device_get_iface(device)); + nmc_print(_("Device '%s' successfully disconnected.\n"), nm_device_get_iface(device)); device_cb_info_finish(info, device); } } @@ -2427,8 +2455,8 @@ reapply_device_cb(GObject *object, GAsyncResult *result, gpointer user_data) } else { if (nmc->nmc_config.print_output == NMC_PRINT_PRETTY) nmc_terminal_erase_line(); - g_print(_("Connection successfully reapplied to device '%s'.\n"), - nm_device_get_iface(device)); + nmc_print(_("Connection successfully reapplied to device '%s'.\n"), + nm_device_get_iface(device)); device_cb_info_finish(info, device); } } @@ -2508,8 +2536,8 @@ modify_reapply_cb(GObject *object, GAsyncResult *result, gpointer user_data) } else { if (nmc->nmc_config.print_output == NMC_PRINT_PRETTY) nmc_terminal_erase_line(); - g_print(_("Connection successfully reapplied to device '%s'.\n"), - nm_device_get_iface(device)); + nmc_print(_("Connection successfully reapplied to device '%s'.\n"), + nm_device_get_iface(device)); } quit(); @@ -2608,10 +2636,10 @@ disconnect_device_cb(GObject *object, GAsyncResult *result, gpointer user_data) return; nmc = info->nmc; g_string_printf(nmc->return_text, _("Error: not all devices disconnected.")); - g_printerr(_("Error: Device '%s' (%s) disconnecting failed: %s\n"), - nm_device_get_iface(device), - nm_object_get_path(NM_OBJECT(device)), - error->message); + nmc_printerr(_("Error: Device '%s' (%s) disconnecting failed: %s\n"), + nm_device_get_iface(device), + nm_object_get_path(NM_OBJECT(device)), + error->message); g_error_free(error); nmc->return_value = NMC_RESULT_ERROR_DEV_DISCONNECT; device_cb_info_finish(info, device); @@ -2623,7 +2651,8 @@ disconnect_device_cb(GObject *object, GAsyncResult *result, gpointer user_data) if (state <= NM_DEVICE_STATE_DISCONNECTED) { if (nmc->nmc_config.print_output == NMC_PRINT_PRETTY) nmc_terminal_erase_line(); - g_print(_("Device '%s' successfully disconnected.\n"), nm_device_get_iface(device)); + nmc_print(_("Device '%s' successfully disconnected.\n"), + nm_device_get_iface(device)); } device_cb_info_finish(info, device); } @@ -2685,15 +2714,15 @@ delete_device_cb(GObject *object, GAsyncResult *result, gpointer user_data) if (!nm_device_delete_finish(device, result, &error)) { g_string_printf(nmc->return_text, _("Error: not all devices deleted.")); - g_printerr(_("Error: Device '%s' (%s) deletion failed: %s\n"), - nm_device_get_iface(device), - nm_object_get_path(NM_OBJECT(device)), - error->message); + nmc_printerr(_("Error: Device '%s' (%s) deletion failed: %s\n"), + nm_device_get_iface(device), + nm_object_get_path(NM_OBJECT(device)), + error->message); g_error_free(error); nmc->return_value = NMC_RESULT_ERROR_UNKNOWN; device_cb_info_finish(info, device); } else { - g_print(_("Device '%s' successfully removed.\n"), nm_device_get_iface(device)); + nmc_print(_("Device '%s' successfully removed.\n"), nm_device_get_iface(device)); device_cb_info_finish(info, device); } } @@ -2849,7 +2878,7 @@ device_state(NMDevice *device, GParamSpec *pspec, NmCli *nmc) nm_device_get_iface(device), gettext(nmc_device_state_to_string_with_external(device))); - g_print("%s", str); + nmc_print("%s", str); } static void @@ -2861,7 +2890,7 @@ device_ac(NMDevice *device, GParamSpec *pspec, NmCli *nmc) if (!id) return; - g_print(_("%s: using connection '%s'\n"), nm_device_get_iface(device), id); + nmc_print(_("%s: using connection '%s'\n"), nm_device_get_iface(device), id); } static void @@ -2887,14 +2916,14 @@ device_unwatch(NmCli *nmc, NMDevice *device) static void device_added(NMClient *client, NMDevice *device, NmCli *nmc) { - g_print(_("%s: device created\n"), nm_device_get_iface(device)); + nmc_print(_("%s: device created\n"), nm_device_get_iface(device)); device_watch(nmc, NM_DEVICE(device)); } static void device_removed(NMClient *client, NMDevice *device, NmCli *nmc) { - g_print(_("%s: device removed\n"), nm_device_get_iface(device)); + nmc_print(_("%s: device removed\n"), nm_device_get_iface(device)); device_unwatch(nmc, device); } @@ -2992,7 +3021,7 @@ find_ap_on_device(NMDevice *device, const char *bssid, const char *ssid, gboolea /* Compare BSSIDs */ if (complete) { if (g_str_has_prefix(candidate_bssid, bssid)) - g_print("%s\n", candidate_bssid); + nmc_print("%s\n", candidate_bssid); } else if (strcmp(bssid, candidate_bssid) != 0) continue; } @@ -3012,7 +3041,7 @@ find_ap_on_device(NMDevice *device, const char *bssid, const char *ssid, gboolea /* Compare SSIDs */ if (complete) { if (g_str_has_prefix(ssid_tmp, ssid)) - g_print("%s\n", ssid_tmp); + nmc_print("%s\n", ssid_tmp); } else if (strcmp(ssid, ssid_tmp) != 0) { g_free(ssid_tmp); continue; @@ -3080,7 +3109,7 @@ wifi_print_aps(NMDeviceWifi *wifi, static gboolean empty_line = FALSE; if (empty_line) - g_print("\n"); /* Empty line between devices' APs */ + nmc_print("\n"); /* Empty line between devices' APs */ /* Main header name */ header_name = construct_header_name(base_hdr, nm_device_get_iface(NM_DEVICE(wifi))); @@ -3952,9 +3981,10 @@ do_device_wifi_connect(const NMCCommand *cmd, NmCli *nmc, int argc, const char * /* 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); + nmc_printerr( + _("Warning: '%s' should be SSID for hidden APs; but it looks like a " + "BSSID.\n"), + param_user); } } } @@ -4172,7 +4202,7 @@ set_wireless_security_for_hotspot(NMSettingWirelessSecurity *s_wsec, NULL); } if (show_password) - g_print(_("Hotspot password: %s\n"), key); + nmc_print(_("Hotspot password: %s\n"), key); return TRUE; } @@ -4658,7 +4688,7 @@ print_wifi_connection(const NmcConfig *nmc_config, NMConnection *connection) g_return_if_fail(ssid_bytes); ssid = nm_utils_ssid_to_utf8(g_bytes_get_data(ssid_bytes, NULL), g_bytes_get_size(ssid_bytes)); g_return_if_fail(ssid); - g_print("SSID: %s\n", ssid); + nmc_print("SSID: %s\n", ssid); string = g_string_sized_new(64); g_string_append(string, "WIFI:"); @@ -4671,21 +4701,21 @@ print_wifi_connection(const NmcConfig *nmc_config, NMConnection *connection) if (key_mgmt == NULL) { type = "nopass"; - g_print("%s: %s\n", _("Security"), _("None")); + nmc_print("%s: %s\n", _("Security"), _("None")); } else if (strcmp(key_mgmt, "none") == 0 || strcmp(key_mgmt, "ieee8021x") == 0) { type = "WEP"; - g_print("%s: WEP\n", _("Security")); + nmc_print("%s: WEP\n", _("Security")); } else if (strcmp(key_mgmt, "wpa-none") == 0 || strcmp(key_mgmt, "wpa-psk") == 0 || strcmp(key_mgmt, "sae") == 0) { type = "WPA"; - g_print("%s: WPA\n", _("Security")); + nmc_print("%s: WPA\n", _("Security")); } else if (strcmp(key_mgmt, "owe") == 0) { type = "nopass"; - g_print("%s: OWE\n", _("Security")); + nmc_print("%s: OWE\n", _("Security")); } if (psk) - g_print("%s: %s\n", _("Password"), psk); + nmc_print("%s: %s\n", _("Password"), psk); string_append_mecard(string, "T:", type); string_append_mecard(string, "S:", ssid); @@ -4698,7 +4728,7 @@ print_wifi_connection(const NmcConfig *nmc_config, NMConnection *connection) if (nmc_config->use_colors) nmc_print_qrcode(string->str); - g_print("\n"); + nmc_print("\n"); } static gboolean @@ -4800,7 +4830,7 @@ do_device_wifi_show_password(const NMCCommand *cmd, NmCli *nmc, int argc, const found = TRUE; } else { if (ifname) { - g_string_printf(nmc->return_text, _("%s"), error->message); + g_string_assign(nmc->return_text, error->message); nmc->return_value = NMC_RESULT_ERROR_UNKNOWN; return; } @@ -5061,7 +5091,7 @@ checkpoints_changed_cb(GObject *object, GParamSpec *pspec, CheckpointCbInfo *inf if (!info->child_id) { /* The command is done, we're in the confirmation prompt. */ - g_print("%s\n", _("No")); + nmc_print("%s\n", _("No")); g_main_loop_quit(loop); } } @@ -5302,7 +5332,7 @@ nmc_command_func_device(const NMCCommand *cmd, NmCli *nmc, int argc, const char } void -monitor_devices(NmCli *nmc) +nmc_monitor_devices(NmCli *nmc) { do_devices_monitor(NULL, nmc, 0, NULL); } diff --git a/src/nmcli/devices.h b/src/nmcli/devices.h index 6214ea03..7ed75909 100644 --- a/src/nmcli/devices.h +++ b/src/nmcli/devices.h @@ -12,7 +12,7 @@ void nmc_complete_device(NMClient *client, const char *prefix, gboolean wifi_onl void nmc_complete_bssid(NMClient *client, const char *ifname, const char *bssid_prefix); -void monitor_devices(NmCli *nmc); +void nmc_monitor_devices(NmCli *nmc); NMDevice **nmc_get_devices_sorted(NMClient *client); diff --git a/src/nmcli/generate-docs-nm-settings-nmcli.c b/src/nmcli/gen-metadata-nm-settings-nmcli.c index 196e4d35..196e4d35 100644 --- a/src/nmcli/generate-docs-nm-settings-nmcli.c +++ b/src/nmcli/gen-metadata-nm-settings-nmcli.c diff --git a/src/nmcli/generate-docs-nm-settings-nmcli.xml b/src/nmcli/gen-metadata-nm-settings-nmcli.xml.in index f78c5f42..cec7a58e 100644 --- a/src/nmcli/generate-docs-nm-settings-nmcli.xml +++ b/src/nmcli/gen-metadata-nm-settings-nmcli.xml.in @@ -45,7 +45,7 @@ <property name="mac-address-blacklist" description="A list of permanent MAC addresses of Wi-Fi devices to which this connection should never apply. Each MAC address should be given in the standard hex-digits-and-colons notation (eg "00:11:22:33:44:55")." /> <property name="mac-address-randomization" - description="One of NM_SETTING_MAC_RANDOMIZATION_DEFAULT (0) (never randomize unless the user has set a global default to randomize and the supplicant supports randomization), NM_SETTING_MAC_RANDOMIZATION_NEVER (1) (never randomize the MAC address), or NM_SETTING_MAC_RANDOMIZATION_ALWAYS (2) (always randomize the MAC address). This property is deprecated for 'cloned-mac-address'. Deprecated: 1" /> + description="One of NM_SETTING_MAC_RANDOMIZATION_DEFAULT (0) (never randomize unless the user has set a global default to randomize and the supplicant supports randomization), NM_SETTING_MAC_RANDOMIZATION_NEVER (1) (never randomize the MAC address), or NM_SETTING_MAC_RANDOMIZATION_ALWAYS (2) (always randomize the MAC address)." /> <property name="mtu" alias="mtu" description="If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple Ethernet frames." /> @@ -123,7 +123,7 @@ <property name="ca-path" description="UTF-8 encoded path to a directory containing PEM or DER formatted certificates to be added to the verification chain in addition to the certificate specified in the "ca-cert" property. If NMSetting8021x:system-ca-certs is enabled and the built-in CA path is an existing directory, then this setting is ignored." /> <property name="subject-match" - description="Substring to be matched against the subject of the certificate presented by the authentication server. When unset, no verification of the authentication server certificate's subject is performed. This property provides little security, if any, and its use is deprecated in favor of NMSetting8021x:domain-suffix-match." /> + description="Substring to be matched against the subject of the certificate presented by the authentication server. When unset, no verification of the authentication server certificate's subject is performed. This property provides little security, if any, and should not be used." /> <property name="altsubject-matches" description="List of strings to be matched against the altSubjectName of the certificate presented by the authentication server. If the list is empty, no verification of the server certificate's altSubjectName is performed." /> <property name="domain-suffix-match" @@ -143,7 +143,7 @@ <property name="phase1-fast-provisioning" description="Enables or disables in-line provisioning of EAP-FAST credentials when FAST is specified as the EAP method in the "eap" property. Recognized values are "0" (disabled), "1" (allow unauthenticated provisioning), "2" (allow authenticated provisioning), and "3" (allow both authenticated and unauthenticated provisioning). See the wpa_supplicant documentation for more details." /> <property name="phase1-auth-flags" - description="Specifies authentication flags to use in "phase 1" outer authentication using NMSetting8021xAuthFlags options. The individual TLS versions can be explicitly disabled. If a certain TLS disable flag is not set, it is up to the supplicant to allow or forbid it. The TLS options map to tls_disable_tlsv1_x settings. See the wpa_supplicant documentation for more details." /> + description="Specifies authentication flags to use in "phase 1" outer authentication using NMSetting8021xAuthFlags options. The individual TLS versions can be explicitly disabled. TLS time checks can be also disabled. If a certain TLS disable flag is not set, it is up to the supplicant to allow or forbid it. The TLS options map to tls_disable_tlsv1_x and tls_disable_time_checks settings. See the wpa_supplicant documentation for more details." /> <property name="phase2-auth" description="Specifies the allowed "phase 2" inner authentication method when an EAP method that uses an inner TLS tunnel is specified in the "eap" property. For TTLS this property selects one of the supported non-EAP inner methods: "pap", "chap", "mschap", "mschapv2" while "phase2-autheap" selects an EAP inner method. For PEAP this selects an inner EAP method, one of: "gtc", "otp", "md5" and "tls". Each "phase 2" inner method requires specific parameters for successful authentication; see the wpa_supplicant documentation for more details. Both "phase2-auth" and "phase2-autheap" cannot be specified." /> <property name="phase2-autheap" @@ -157,7 +157,7 @@ <property name="phase2-ca-path" description="UTF-8 encoded path to a directory containing PEM or DER formatted certificates to be added to the verification chain in addition to the certificate specified in the "phase2-ca-cert" property. If NMSetting8021x:system-ca-certs is enabled and the built-in CA path is an existing directory, then this setting is ignored." /> <property name="phase2-subject-match" - description="Substring to be matched against the subject of the certificate presented by the authentication server during the inner "phase 2" authentication. When unset, no verification of the authentication server certificate's subject is performed. This property provides little security, if any, and its use is deprecated in favor of NMSetting8021x:phase2-domain-suffix-match." /> + description="Substring to be matched against the subject of the certificate presented by the authentication server during the inner "phase 2" authentication. When unset, no verification of the authentication server certificate's subject is performed. This property provides little security, if any, and should not be used." /> <property name="phase2-altsubject-matches" description="List of strings to be matched against the altSubjectName of the certificate presented by the authentication server during the inner "phase 2" authentication. If the list is empty, no verification of the server certificate's altSubjectName is performed." /> <property name="phase2-domain-suffix-match" @@ -275,7 +275,7 @@ <setting name="bridge" > <property name="mac-address" alias="mac" - description="If specified, the MAC address of bridge. When creating a new bridge, this MAC address will be set. If this field is left unspecified, the "ethernet.cloned-mac-address" is referred instead to generate the initial MAC address. Note that setting "ethernet.cloned-mac-address" anyway overwrites the MAC address of the bridge later while activating the bridge. Hence, this property is deprecated. Deprecated: 1" /> + description="If specified, the MAC address of bridge. When creating a new bridge, this MAC address will be set. If this field is left unspecified, the "ethernet.cloned-mac-address" is referred instead to generate the initial MAC address. Note that setting "ethernet.cloned-mac-address" anyway overwrites the MAC address of the bridge later while activating the bridge." /> <property name="stp" alias="stp" description="Controls whether Spanning Tree Protocol (STP) is enabled for this bridge." /> @@ -369,7 +369,7 @@ alias="con-name" description="A human readable unique identifier for the connection, like "Work Wi-Fi" or "T-Mobile 3G"." /> <property name="uuid" - description="A universally unique identifier for the connection, for example generated with libuuid. It should be assigned when the connection is created, and never changed as long as the connection still applies to the same network. For example, it should not be changed when the "id" property or NMSettingIP4Config changes, but might need to be re-created when the Wi-Fi SSID, mobile broadband network provider, or "type" property changes. The UUID must be in the format "2815492f-7e56-435e-b2e9-246bd7cdc664" (ie, contains only hexadecimal characters and "-")." /> + description="The connection.uuid is the real identifier of a profile. It cannot change and it must be unique. It is therefore often best to refer to a profile by UUID, for example with `nmcli connection up uuid $UUID`. The UUID cannot be changed, except in offline mode. In that case, the special values "new", "generate" and "" are allowed to generate a new random UUID." /> <property name="stable-id" description="This represents the identity of the connection used for various purposes. It allows to configure multiple profiles to share the identity. Also, the stable-id can contain placeholders that are substituted dynamically and deterministically depending on the context. The stable-id is used for generating IPv6 stable private addresses with ipv6.addr-gen-mode=stable-privacy. It is also used to seed the generated cloned MAC address for ethernet.cloned-mac-address=stable and wifi.cloned-mac-address=stable. It is also used as DHCP client identifier with ipv4.dhcp-client-id=stable and to derive the DHCP DUID with ipv6.dhcp-duid=stable-[llt,ll,uuid]. Note that depending on the context where it is used, other parameters are also seeded into the generation algorithm. For example, a per-host key is commonly also included, so that different systems end up generating different IDs. Or with ipv6.addr-gen-mode=stable-privacy, also the device's name is included, so that different interfaces yield different addresses. The per-host key is the identity of your machine and stored in /var/lib/NetworkManager/secret_key. See NetworkManager(8) manual about the secret-key and the host identity. The '$' character is treated special to perform dynamic substitutions at runtime. Currently, supported are "${CONNECTION}", "${DEVICE}", "${MAC}", "${BOOT}", "${RANDOM}". These effectively create unique IDs per-connection, per-device, per-boot, or every time. Note that "${DEVICE}" corresponds to the interface name of the device and "${MAC}" is the permanent MAC address of the device. Any unrecognized patterns following '$' are treated verbatim, however are reserved for future use. You are thus advised to avoid '$' or escape it as "$$". For example, set it to "${CONNECTION}-${BOOT}-${DEVICE}" to create a unique id for this connection that changes with every reboot and differs depending on the interface where the profile activates. If the value is unset, a global connection default is consulted. If the value is still unset, the default is similar to "${CONNECTION}" and uses a unique, fixed ID for the connection." /> <property name="type" @@ -560,7 +560,7 @@ <property name="auto-config" description="When TRUE, the settings such as APN, username, or password will default to values that match the network the modem will register to in the Mobile Broadband Provider database." /> <property name="number" - description="Legacy setting that used to help establishing PPP data sessions for GSM-based modems. Deprecated: 1" /> + description="Legacy setting that used to help establishing PPP data sessions for GSM-based modems." /> <property name="username" alias="user" description="The username used to authenticate with the network, if required. Many providers do not require a username, or accept any username. But if a username is required, it is specified here." /> @@ -643,6 +643,8 @@ description="How many additional levels of encapsulation are permitted to be prepended to packets. This property applies only to IPv6 tunnels." /> <property name="flow-label" description="The flow label to assign to tunnel packets. This property applies only to IPv6 tunnels." /> + <property name="fwmark" + description="The fwmark value to assign to tunnel packets. This property can be set to a non zero value only on VTI and VTI6 tunnels." /> <property name="mtu" description="If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple fragments." /> <property name="flags" @@ -652,7 +654,7 @@ <property name="method" description="IP configuration method. NMSettingIP4Config and NMSettingIP6Config both support "disabled", "auto", "manual", and "link-local". See the subclass-specific documentation for other values. In general, for the "auto" method, properties such as "dns" and "routes" specify information that is added on to the information returned from automatic configuration. The "ignore-auto-routes" and "ignore-auto-dns" properties modify this behavior. For methods that imply no upstream network, such as "shared" or "link-local", these properties must be empty. For IPv4 method "shared", the IP subnet can be configured by adding one manual IPv4 address or otherwise 10.42.x.0/24 is chosen. Note that the shared method must be configured on the interface which shares the internet to a subnet, not on the uplink which is shared." /> <property name="dns" - description="Array of IP addresses of DNS servers." /> + description="Array of IP addresses of DNS servers. For DoT (DNS over TLS), the SNI server name can be specified by appending "#example.com" to the IP address of the DNS server. This currently only has effect when using systemd-resolved." /> <property name="dns-search" description="List of DNS search domains. Domains starting with a tilde ('~') are considered 'routing' domains and are used only to decide the interface over which a query must be forwarded; they are not used to complete unqualified host names. When using a DNS plugin that supports Conditional Forwarding or Split DNS, then the search domains specify which name servers to query. This makes the behavior different from running with plain /etc/resolv.conf. For more information see also the dns-priority setting. When set on a profile that also enabled DHCP, the DNS search list received automatically (option 119 for DHCPv4 and option 24 for DHCPv6) gets merged with the manual list. This can be prevented by setting "ignore-auto-dns". Note that if no DNS searches are configured, the fallback will be derived from the domain from DHCP (option 15)." /> <property name="dns-options" @@ -704,12 +706,14 @@ description="Enable and disable the IPv4 link-local configuration independently of the ipv4.method configuration. This allows a link-local address (169.254.x.y/16) to be obtained in addition to other addresses, such as those manually configured or obtained from a DHCP server. When set to "auto", the value is dependent on "ipv4.method". When set to "default", it honors the global connection default, before falling back to "auto". Note that if "ipv4.method" is "disabled", then link local addressing is always disabled too. The default is "default"." /> <property name="dhcp-reject-servers" description="Array of servers from which DHCP offers must be rejected. This property is useful to avoid getting a lease from misconfigured or rogue servers. For DHCPv4, each element must be an IPv4 address, optionally followed by a slash and a prefix length (e.g. "192.168.122.0/24"). This property is currently not implemented for DHCPv6." /> + <property name="auto-route-ext-gw" + description="VPN connections will default to add the route automatically unless this setting is set to FALSE. For other connection types, adding such an automatic route is currently not supported and setting this to TRUE has no effect." /> </setting> <setting name="ipv6" > <property name="method" description="IP configuration method. NMSettingIP4Config and NMSettingIP6Config both support "disabled", "auto", "manual", and "link-local". See the subclass-specific documentation for other values. In general, for the "auto" method, properties such as "dns" and "routes" specify information that is added on to the information returned from automatic configuration. The "ignore-auto-routes" and "ignore-auto-dns" properties modify this behavior. For methods that imply no upstream network, such as "shared" or "link-local", these properties must be empty. For IPv4 method "shared", the IP subnet can be configured by adding one manual IPv4 address or otherwise 10.42.x.0/24 is chosen. Note that the shared method must be configured on the interface which shares the internet to a subnet, not on the uplink which is shared." /> <property name="dns" - description="Array of IP addresses of DNS servers." /> + description="Array of IP addresses of DNS servers. For DoT (DNS over TLS), the SNI server name can be specified by appending "#example.com" to the IP address of the DNS server. This currently only has effect when using systemd-resolved." /> <property name="dns-search" description="List of DNS search domains. Domains starting with a tilde ('~') are considered 'routing' domains and are used only to decide the interface over which a query must be forwarded; they are not used to complete unqualified host names. When using a DNS plugin that supports Conditional Forwarding or Split DNS, then the search domains specify which name servers to query. This makes the behavior different from running with plain /etc/resolv.conf. For more information see also the dns-priority setting. When set on a profile that also enabled DHCP, the DNS search list received automatically (option 119 for DHCPv4 and option 24 for DHCPv6) gets merged with the manual list. This can be prevented by setting "ignore-auto-dns". Note that if no DNS searches are configured, the fallback will be derived from the domain from DHCP (option 15)." /> <property name="dns-options" @@ -759,9 +763,16 @@ description="If the "dhcp-send-hostname" property is TRUE, then the specified name will be sent to the DHCP server when acquiring a lease. This property and "dhcp-fqdn" are mutually exclusive and cannot be set at the same time." /> <property name="dhcp-hostname-flags" description="Flags for the DHCP hostname and FQDN. Currently, this property only includes flags to control the FQDN flags set in the DHCP FQDN option. Supported FQDN flags are NM_DHCP_HOSTNAME_FLAG_FQDN_SERV_UPDATE (0x1), NM_DHCP_HOSTNAME_FLAG_FQDN_ENCODED (0x2) and NM_DHCP_HOSTNAME_FLAG_FQDN_NO_UPDATE (0x4). When no FQDN flag is set and NM_DHCP_HOSTNAME_FLAG_FQDN_CLEAR_FLAGS (0x8) is set, the DHCP FQDN option will contain no flag. Otherwise, if no FQDN flag is set and NM_DHCP_HOSTNAME_FLAG_FQDN_CLEAR_FLAGS (0x8) is not set, the standard FQDN flags are set in the request: NM_DHCP_HOSTNAME_FLAG_FQDN_SERV_UPDATE (0x1), NM_DHCP_HOSTNAME_FLAG_FQDN_ENCODED (0x2) for IPv4 and NM_DHCP_HOSTNAME_FLAG_FQDN_SERV_UPDATE (0x1) for IPv6. When this property is set to the default value NM_DHCP_HOSTNAME_FLAG_NONE (0x0), a global default is looked up in NetworkManager configuration. If that value is unset or also NM_DHCP_HOSTNAME_FLAG_NONE (0x0), then the standard FQDN flags described above are sent in the DHCP requests." /> + <property name="auto-route-ext-gw" + description="VPN connections will default to add the route automatically unless this setting is set to FALSE. For other connection types, adding such an automatic route is currently not supported and setting this to TRUE has no effect." /> <property name="token" description="Configure the token for draft-chown-6man-tokenised-ipv6-identifiers-02 IPv6 tokenized interface identifiers. Useful with eui64 addr-gen-mode." /> </setting> + <setting name="loopback" > + <property name="mtu" + alias="mtu" + description="If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple Ethernet frames." /> + </setting> <setting name="macsec" > <property name="parent" alias="dev" @@ -828,12 +839,20 @@ description="Open vSwitch DPDK device arguments." /> <property name="n-rxq" description="Open vSwitch DPDK number of rx queues. Defaults to zero which means to leave the parameter in OVS unspecified and effectively configures one queue." /> + <property name="n-rxq-desc" + description="The rx queue size (number of rx descriptors) for DPDK ports. Must be zero or a power of 2 between 1 and 4096, and supported by the hardware. Defaults to zero which means to leave the parameter in OVS unspecified and effectively configures 2048 descriptors." /> + <property name="n-txq-desc" + description="The tx queue size (number of tx descriptors) for DPDK ports. Must be zero or a power of 2 between 1 and 4096, and supported by the hardware. Defaults to zero which means to leave the parameter in OVS unspecified and effectively configures 2048 descriptors." /> </setting> <setting name="ovs-external-ids" > </setting> <setting name="ovs-interface" > <property name="type" description="The interface type. Either "internal", "system", "patch", "dpdk", or empty." /> + <property name="ofport-request" + description="Open vSwitch openflow port number. Defaults to zero which means that port number will not be specified and it will be chosen randomly by ovs. OpenFlow ports are the network interfaces for passing packets between OpenFlow processing and the rest of the network. OpenFlow switches connect logically to each other via their OpenFlow ports." /> + </setting> + <setting name="ovs-other-config" > </setting> <setting name="ovs-patch" > <property name="peer" @@ -841,7 +860,9 @@ </setting> <setting name="ovs-port" > <property name="vlan-mode" - description="The VLAN mode. One of "access", "native-tagged", "native-untagged", "trunk" or unset." /> + description="The VLAN mode. One of "access", "native-tagged", "native-untagged", "trunk", "dot1q-tunnel" or unset." /> + <property name="trunks" + description="A list of VLAN ranges that this port trunks. The property is valid only for ports with mode "trunk", "native-tagged", or "native-untagged port". If it is empty, the port trunks all VLANs." /> <property name="tag" description="The VLAN tag in the range 0-4095." /> <property name="lacp" @@ -1036,6 +1057,8 @@ <property name="flags" alias="flags" description="One or more flags which control the behavior and features of the VLAN interface. Flags include NM_VLAN_FLAG_REORDER_HEADERS (0x1) (reordering of output packet headers), NM_VLAN_FLAG_GVRP (0x2) (use of the GVRP protocol), and NM_VLAN_FLAG_LOOSE_BINDING (0x4) (loose binding of the interface to its master device's operating state). NM_VLAN_FLAG_MVRP (0x8) (use of the MVRP protocol). The default value of this property is NM_VLAN_FLAG_REORDER_HEADERS, but it used to be 0. To preserve backward compatibility, the default-value in the D-Bus API continues to be 0 and a missing property on D-Bus is still considered as 0." /> + <property name="protocol" + description="Specifies the VLAN protocol to use for encapsulation. Supported values are: '802.1Q', '802.1ad'. If not specified the default value is '802.1Q'." /> <property name="ingress-priority-map" alias="ingress" description="For incoming packets, a list of mappings from 802.1p priorities to Linux SKB priorities. The mapping is given in the format "from:to" where both "from" and "to" are unsigned integers, ie "7:3"." /> @@ -1117,10 +1140,10 @@ <setting name="wimax" > <property name="mac-address" alias="mac" - description="If specified, this connection will only apply to the WiMAX device whose MAC address matches. This property does not change the MAC address of the device (known as MAC spoofing). Deprecated: 1" /> + description="If specified, this connection will only apply to the WiMAX device whose MAC address matches. This property does not change the MAC address of the device (known as MAC spoofing)." /> <property name="network-name" alias="nsp" - description="Network Service Provider (NSP) name of the WiMAX network this connection should use. Deprecated: 1" /> + description="Network Service Provider (NSP) name of the WiMAX network this connection should use." /> </setting> <setting name="wireguard" > <property name="private-key" diff --git a/src/nmcli/general.c b/src/nmcli/general.c index d116ab2c..26988cd8 100644 --- a/src/nmcli/general.c +++ b/src/nmcli/general.c @@ -299,19 +299,19 @@ static const NmcMetaGenericInfo static void usage_general(void) { - g_printerr(_("Usage: nmcli general { COMMAND | help }\n\n" - "COMMAND := { status | hostname | permissions | logging | reload }\n\n" - " status\n\n" - " hostname [<hostname>]\n\n" - " permissions\n\n" - " logging [level <log level>] [domains <log domains>]\n\n" - " reload [<flags>]\n\n")); + nmc_printerr(_("Usage: nmcli general { COMMAND | help }\n\n" + "COMMAND := { status | hostname | permissions | logging | reload }\n\n" + " status\n\n" + " hostname [<hostname>]\n\n" + " permissions\n\n" + " logging [level <log level>] [domains <log domains>]\n\n" + " reload [<flags>]\n\n")); } static void usage_general_status(void) { - g_printerr( + nmc_printerr( _("Usage: nmcli general status { help }\n" "\n" "Show overall status of NetworkManager.\n" @@ -321,7 +321,7 @@ usage_general_status(void) static void usage_general_hostname(void) { - g_printerr( + nmc_printerr( _("Usage: nmcli general hostname { ARGUMENTS | help }\n" "\n" "ARGUMENTS := [<hostname>]\n" @@ -334,87 +334,88 @@ usage_general_hostname(void) static void usage_general_permissions(void) { - g_printerr(_("Usage: nmcli general permissions { help }\n" - "\n" - "Show caller permissions for authenticated operations.\n\n")); + nmc_printerr(_("Usage: nmcli general permissions { help }\n" + "\n" + "Show caller permissions for authenticated operations.\n\n")); } static void usage_general_reload(void) { - g_printerr(_("Usage: nmcli general reload { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [<flag>[,<flag>...]]\n" - "\n" - "Reload NetworkManager's configuration and perform certain updates, like\n" - "flushing caches or rewriting external state to disk. This is similar to\n" - "sending SIGHUP to NetworkManager but it allows for more fine-grained\n" - "control over what to reload through the flags argument. It also allows\n" - "non-root access via PolicyKit and contrary to signals it is synchronous.\n" - "\n" - "Available flags are:\n" - "\n" - " 'conf' Reload the NetworkManager.conf configuration from\n" - " disk. Note that this does not include connections, which\n" - " can be reloaded through 'nmcli connection reload' instead.\n" - "\n" - " 'dns-rc' Update DNS configuration, which usually involves writing\n" - " /etc/resolv.conf anew. This is equivalent to sending the\n" - " SIGUSR1 signal to the NetworkManager process.\n" - "\n" - " 'dns-full' Restart the DNS plugin. This is for example useful when\n" - " using dnsmasq plugin, which uses additional configuration\n" - " in /etc/NetworkManager/dnsmasq.d. If you edit those files,\n" - " you can restart the DNS plugin. This action shortly\n" - " interrupts name resolution.\n" - "\n" - "With no flags, everything that is supported is reloaded, which is\n" - "identical to sending a SIGHUP.\n")); + nmc_printerr(_("Usage: nmcli general reload { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [<flag>[,<flag>...]]\n" + "\n" + "Reload NetworkManager's configuration and perform certain updates, like\n" + "flushing caches or rewriting external state to disk. This is similar to\n" + "sending SIGHUP to NetworkManager but it allows for more fine-grained\n" + "control over what to reload through the flags argument. It also allows\n" + "non-root access via PolicyKit and contrary to signals it is synchronous.\n" + "\n" + "Available flags are:\n" + "\n" + " 'conf' Reload the NetworkManager.conf configuration from\n" + " disk. Note that this does not include connections, which\n" + " can be reloaded through 'nmcli connection reload' instead.\n" + "\n" + " 'dns-rc' Update DNS configuration, which usually involves writing\n" + " /etc/resolv.conf anew. This is equivalent to sending the\n" + " SIGUSR1 signal to the NetworkManager process.\n" + "\n" + " 'dns-full' Restart the DNS plugin. This is for example useful when\n" + " using dnsmasq plugin, which uses additional configuration\n" + " in /etc/NetworkManager/dnsmasq.d. If you edit those files,\n" + " you can restart the DNS plugin. This action shortly\n" + " interrupts name resolution.\n" + "\n" + "With no flags, everything that is supported is reloaded, which is\n" + "identical to sending a SIGHUP.\n")); } static void usage_general_logging(void) { - g_printerr(_("Usage: nmcli general logging { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [level <log level>] [domains <log domains>]\n" - "\n" - "Get or change NetworkManager logging level and domains.\n" - "Without any argument current logging level and domains are shown. In order to\n" - "change logging state, provide level and/or domain. Please refer to the man page\n" - "for the list of possible logging domains.\n\n")); + nmc_printerr( + _("Usage: nmcli general logging { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [level <log level>] [domains <log domains>]\n" + "\n" + "Get or change NetworkManager logging level and domains.\n" + "Without any argument current logging level and domains are shown. In order to\n" + "change logging state, provide level and/or domain. Please refer to the man page\n" + "for the list of possible logging domains.\n\n")); } static void usage_networking(void) { - g_printerr(_("Usage: nmcli networking { COMMAND | help }\n\n" - "COMMAND := { [ on | off | connectivity ] }\n\n" - " on\n\n" - " off\n\n" - " connectivity [check]\n\n")); + nmc_printerr(_("Usage: nmcli networking { COMMAND | help }\n\n" + "COMMAND := { [ on | off | connectivity ] }\n\n" + " on\n\n" + " off\n\n" + " connectivity [check]\n\n")); } static void usage_networking_on(void) { - g_printerr(_("Usage: nmcli networking on { help }\n" - "\n" - "Switch networking on.\n\n")); + nmc_printerr(_("Usage: nmcli networking on { help }\n" + "\n" + "Switch networking on.\n\n")); } static void usage_networking_off(void) { - g_printerr(_("Usage: nmcli networking off { help }\n" - "\n" - "Switch networking off.\n\n")); + nmc_printerr(_("Usage: nmcli networking off { help }\n" + "\n" + "Switch networking off.\n\n")); } static void usage_networking_connectivity(void) { - g_printerr( + nmc_printerr( _("Usage: nmcli networking connectivity { ARGUMENTS | help }\n" "\n" "ARGUMENTS := [check]\n" @@ -426,48 +427,48 @@ usage_networking_connectivity(void) static void usage_radio(void) { - g_printerr(_("Usage: nmcli radio { COMMAND | help }\n\n" - "COMMAND := { all | wifi | wwan }\n\n" - " all | wifi | wwan [ on | off ]\n\n")); + nmc_printerr(_("Usage: nmcli radio { COMMAND | help }\n\n" + "COMMAND := { all | wifi | wwan }\n\n" + " all | wifi | wwan [ on | off ]\n\n")); } static void usage_radio_all(void) { - g_printerr(_("Usage: nmcli radio all { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [on | off]\n" - "\n" - "Get status of all radio switches, or turn them on/off.\n\n")); + nmc_printerr(_("Usage: nmcli radio all { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [on | off]\n" + "\n" + "Get status of all radio switches, or turn them on/off.\n\n")); } static void usage_radio_wifi(void) { - g_printerr(_("Usage: nmcli radio wifi { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [on | off]\n" - "\n" - "Get status of Wi-Fi radio switch, or turn it on/off.\n\n")); + nmc_printerr(_("Usage: nmcli radio wifi { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [on | off]\n" + "\n" + "Get status of Wi-Fi radio switch, or turn it on/off.\n\n")); } static void usage_radio_wwan(void) { - g_printerr(_("Usage: nmcli radio wwan { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [on | off]\n" - "\n" - "Get status of mobile broadband radio switch, or turn it on/off.\n\n")); + nmc_printerr(_("Usage: nmcli radio wwan { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [on | off]\n" + "\n" + "Get status of mobile broadband radio switch, or turn it on/off.\n\n")); } static void usage_monitor(void) { - g_printerr(_("Usage: nmcli monitor\n" - "\n" - "Monitor NetworkManager changes.\n" - "Prints a line whenever a change occurs in NetworkManager\n\n")); + nmc_printerr(_("Usage: nmcli monitor\n" + "\n" + "Monitor NetworkManager changes.\n" + "Prints a line whenever a change occurs in NetworkManager\n\n")); } static void @@ -491,13 +492,13 @@ show_nm_status(NmCli *nmc, const char *pretty_header_name, const char *print_fld else fields_str = nmc->required_fields; - if (!nmc_print(&nmc->nmc_config, - (gpointer[]){nmc, NULL}, - NULL, - pretty_header_name ?: N_("NetworkManager status"), - (const NMMetaAbstractInfo *const *) metagen_general_status, - fields_str, - &error)) { + if (!nmc_print_table(&nmc->nmc_config, + (gpointer[]){nmc, NULL}, + NULL, + pretty_header_name ?: N_("NetworkManager status"), + (const NMMetaAbstractInfo *const *) metagen_general_status, + fields_str, + &error)) { g_string_printf(nmc->return_text, _("Error: only these fields are allowed: %s"), fields_all); @@ -570,13 +571,13 @@ print_permissions(void *user_data) nm_cli_spawn_pager(&nmc->nmc_config, &nmc->pager_data); - if (!nmc_print(&nmc->nmc_config, - permissions, - NULL, - _("NetworkManager permissions"), - (const NMMetaAbstractInfo *const *) metagen_general_permissions, - fields_str, - &error)) { + if (!nmc_print_table(&nmc->nmc_config, + permissions, + NULL, + _("NetworkManager permissions"), + (const NMMetaAbstractInfo *const *) metagen_general_permissions, + fields_str, + &error)) { g_string_printf(nmc->return_text, _("Error: 'general permissions': %s"), error->message); nmc->return_value = NMC_RESULT_ERROR_USER_INPUT; } @@ -724,13 +725,13 @@ show_general_logging(NmCli *nmc) } else fields_str = nmc->required_fields; - if (!nmc_print(&nmc->nmc_config, - (gpointer const[]){&d, NULL}, - NULL, - _("NetworkManager logging"), - (const NMMetaAbstractInfo *const *) metagen_general_logging, - fields_str, - &error)) { + if (!nmc_print_table(&nmc->nmc_config, + (gpointer const[]){&d, NULL}, + NULL, + _("NetworkManager logging"), + (const NMMetaAbstractInfo *const *) metagen_general_logging, + fields_str, + &error)) { g_string_printf(nmc->return_text, _("Error: 'general logging': %s"), error->message); nmc->return_value = NMC_RESULT_ERROR_USER_INPUT; } @@ -748,7 +749,7 @@ nmc_complete_strings_nocase(const char *prefix, ...) va_start(args, prefix); while ((candidate = va_arg(args, const char *))) { if (strncasecmp(prefix, candidate, len) == 0) - g_print("%s\n", candidate); + nmc_print("%s\n", candidate); } va_end(args); } @@ -919,13 +920,13 @@ do_general_hostname(const NMCCommand *cmd, NmCli *nmc, int argc, const char *con g_object_get(nmc->client, NM_CLIENT_HOSTNAME, &s, NULL); if (s) - g_print("%s\n", s); + nmc_print("%s\n", s); return; } hostname = *argv; if (next_arg(nmc, &argc, &argv, NULL) == 0) - g_print("Warning: ignoring extra garbage after '%s' hostname\n", hostname); + nmc_print("Warning: ignoring extra garbage after '%s' hostname\n", hostname); nmc->should_wait++; nm_client_save_hostname_async(nmc->client, hostname, NULL, save_hostname_cb, nmc); @@ -1233,8 +1234,8 @@ networkmanager_running(NMClient *client, GParamSpec *param, NmCli *nmc) running = nm_client_get_nm_running(client); str = nmc_colorize(&nmc->nmc_config, running ? NM_META_COLOR_MANAGER_RUNNING : NM_META_COLOR_MANAGER_STOPPED, - running ? _("NetworkManager has started") : _("NetworkManager has stopped")); - g_print("%s\n", str); + running ? _("NetworkManager is running") : _("NetworkManager is stopped")); + nmc_print("%s\n", str); g_free(str); } @@ -1244,7 +1245,7 @@ client_hostname(NMClient *client, GParamSpec *param, NmCli *nmc) const char *hostname; g_object_get(client, NM_CLIENT_HOSTNAME, &hostname, NULL); - g_print(_("Hostname set to '%s'\n"), hostname); + nmc_print(_("Hostname set to '%s'\n"), hostname); } static void @@ -1259,9 +1260,9 @@ client_primary_connection(NMClient *client, GParamSpec *param, NmCli *nmc) if (!id) id = nm_active_connection_get_uuid(primary); - g_print(_("'%s' is now the primary connection\n"), id); + nmc_print(_("'%s' is now the primary connection\n"), id); } else { - g_print(_("There's no primary connection\n")); + nmc_print(_("There's no primary connection\n")); } } @@ -1276,7 +1277,7 @@ client_connectivity(NMClient *client, GParamSpec *param, NmCli *nmc) connectivity_to_color(connectivity), _("Connectivity is now '%s'\n"), gettext(nm_connectivity_to_string(connectivity))); - g_print("%s", str); + nmc_print("%s", str); g_free(str); } @@ -1291,16 +1292,17 @@ client_state(NMClient *client, GParamSpec *param, NmCli *nmc) state_to_color(state), _("Networkmanager is now in the '%s' state\n"), gettext(nm_state_to_string(state))); - g_print("%s", str); + nmc_print("%s", str); g_free(str); } static void device_overview(NmCli *nmc, NMDevice *device) { - GString *outbuf = g_string_sized_new(80); - char *tmp; - const GPtrArray *activatable; + GString *outbuf = g_string_sized_new(80); + char *tmp; + const GPtrArray *activatable; + NMDeviceCapabilities caps; activatable = nm_device_get_available_connections(device); @@ -1309,9 +1311,9 @@ device_overview(NmCli *nmc, NMDevice *device) if (nm_device_get_state(device) == NM_DEVICE_STATE_DISCONNECTED) { if (activatable) { if (activatable->len == 1) - g_print("\t%d %s\n", activatable->len, _("connection available")); + nmc_print("\t%d %s\n", activatable->len, _("connection available")); else if (activatable->len > 1) - g_print("\t%d %s\n", activatable->len, _("connections available")); + nmc_print("\t%d %s\n", activatable->len, _("connections available")); } } @@ -1378,10 +1380,13 @@ device_overview(NmCli *nmc, NMDevice *device) break; } - if (nm_device_is_software(device)) + caps = nm_device_get_capabilities(device); + if (caps & NM_DEVICE_CAP_IS_SOFTWARE) g_string_append_printf(outbuf, "%s, ", _("sw")); else g_string_append_printf(outbuf, "%s, ", _("hw")); + if (caps & NM_DEVICE_CAP_SRIOV) + g_string_append_printf(outbuf, "%s, ", _("sriov")); if (!NM_IN_STRSET(nm_device_get_ip_iface(device), NULL, nm_device_get_iface(device))) g_string_append_printf(outbuf, "%s %s, ", _("iface"), nm_device_get_ip_iface(device)); @@ -1397,7 +1402,7 @@ device_overview(NmCli *nmc, NMDevice *device) if (outbuf->len >= 2) { g_string_truncate(outbuf, outbuf->len - 2); - g_print("\t%s\n", outbuf->str); + nmc_print("\t%s\n", outbuf->str); } g_string_free(outbuf, TRUE); @@ -1424,7 +1429,7 @@ ac_overview(NmCli *nmc, NMActiveConnection *ac) g_string_append_printf(outbuf, "%s, ", _("ip6 default")); if (outbuf->len >= 2) { g_string_truncate(outbuf, outbuf->len - 2); - g_print("\t%s\n", outbuf->str); + nmc_print("\t%s\n", outbuf->str); } ip = nm_active_connection_get_ip4_config(ac); @@ -1435,7 +1440,7 @@ ac_overview(NmCli *nmc, NMActiveConnection *ac) p = nm_ip_config_get_addresses(ip); for (i = 0; i < p->len; i++) { NMIPAddress *a = p->pdata[i]; - g_print("\tinet4 %s/%d\n", nm_ip_address_get_address(a), nm_ip_address_get_prefix(a)); + nmc_print("\tinet4 %s/%d\n", nm_ip_address_get_address(a), nm_ip_address_get_prefix(a)); } p = nm_ip_config_get_routes(ip); @@ -1445,7 +1450,7 @@ ac_overview(NmCli *nmc, NMActiveConnection *ac) nm_str_buf_reset(&str); _nm_ip_route_to_string(a, &str); - g_print("\troute4 %s\n", nm_str_buf_get_str(&str)); + nmc_print("\troute4 %s\n", nm_str_buf_get_str(&str)); } } @@ -1457,7 +1462,7 @@ ac_overview(NmCli *nmc, NMActiveConnection *ac) p = nm_ip_config_get_addresses(ip); for (i = 0; i < p->len; i++) { NMIPAddress *a = p->pdata[i]; - g_print("\tinet6 %s/%d\n", nm_ip_address_get_address(a), nm_ip_address_get_prefix(a)); + nmc_print("\tinet6 %s/%d\n", nm_ip_address_get_address(a), nm_ip_address_get_prefix(a)); } p = nm_ip_config_get_routes(ip); @@ -1467,7 +1472,7 @@ ac_overview(NmCli *nmc, NMActiveConnection *ac) nm_str_buf_reset(&str); _nm_ip_route_to_string(a, &str); - g_print("\troute6 %s\n", nm_str_buf_get_str(&str)); + nmc_print("\troute6 %s\n", nm_str_buf_get_str(&str)); } } @@ -1505,11 +1510,11 @@ nmc_command_func_overview(const NMCCommand *cmd, NmCli *nmc, int argc, const cha color, _("%s VPN connection"), nm_active_connection_get_id(ac)); - g_print("%s\n", tmp); + nmc_print("%s\n", tmp); g_free(tmp); ac_overview(nmc, ac); - g_print("\n"); + nmc_print("\n"); } devices = nmc_get_devices_sorted(nmc->client); @@ -1537,16 +1542,16 @@ nmc_command_func_overview(const NMCCommand *cmd, NmCli *nmc, int argc, const cha nm_device_get_iface(device), gettext(nmc_device_state_to_string_with_external(device))); } - g_print("%s\n", tmp); + nmc_print("%s\n", tmp); g_free(tmp); if (nm_device_get_description(device) && strcmp(nm_device_get_description(device), "")) - g_print("\t\"%s\"\n", nm_device_get_description(device)); + nmc_print("\t\"%s\"\n", nm_device_get_description(device)); device_overview(nmc, device); if (ac) ac_overview(nmc, ac); - g_print("\n"); + nmc_print("\n"); } g_free(devices); @@ -1562,31 +1567,32 @@ nmc_command_func_overview(const NMCCommand *cmd, NmCli *nmc, int argc, const cha } if (i == 0) - g_print("DNS configuration:\n"); + nmc_print("DNS configuration:\n"); tmp = g_strjoinv(" ", (char **) strv); - g_print("\tservers: %s\n", tmp); + nmc_print("\tservers: %s\n", tmp); g_free(tmp); strv = nm_dns_entry_get_domains(dns); if (strv && strv[0]) { tmp = g_strjoinv(" ", (char **) strv); - g_print("\tdomains: %s\n", tmp); + nmc_print("\tdomains: %s\n", tmp); g_free(tmp); } if (nm_dns_entry_get_interface(dns)) - g_print("\tinterface: %s\n", nm_dns_entry_get_interface(dns)); + nmc_print("\tinterface: %s\n", nm_dns_entry_get_interface(dns)); if (nm_dns_entry_get_vpn(dns)) - g_print("\ttype: vpn\n"); - g_print("\n"); + nmc_print("\ttype: vpn\n"); + nmc_print("\n"); } - g_print(_("Use \"nmcli device show\" to get complete information about known devices and\n" - "\"nmcli connection show\" to get an overview on active connection profiles.\n" - "\n" - "Consult nmcli(1) and nmcli-examples(7) manual pages for complete usage details.\n")); + nmc_print( + _("Use \"nmcli device show\" to get complete information about known devices and\n" + "\"nmcli connection show\" to get an overview on active connection profiles.\n" + "\n" + "Consult nmcli(1) and nmcli-examples(7) manual pages for complete usage details.\n")); } void @@ -1609,15 +1615,7 @@ nmc_command_func_monitor(const NMCCommand *cmd, NmCli *nmc, int argc, const char return; } - if (!nm_client_get_nm_running(nmc->client)) { - char *str; - - str = nmc_colorize(&nmc->nmc_config, - NM_META_COLOR_MANAGER_STOPPED, - _("Networkmanager is not running (waiting for it)\n")); - g_print("%s", str); - g_free(str); - } + networkmanager_running(nmc->client, NULL, nmc); g_signal_connect(nmc->client, "notify::" NM_CLIENT_NM_RUNNING, @@ -1636,6 +1634,6 @@ nmc_command_func_monitor(const NMCCommand *cmd, NmCli *nmc, int argc, const char nmc->should_wait++; - monitor_devices(nmc); - monitor_connections(nmc); + nmc_monitor_devices(nmc); + nmc_monitor_connections(nmc); } diff --git a/src/nmcli/generate-docs-nm-settings-nmcli.xml.in b/src/nmcli/generate-docs-nm-settings-nmcli.xml.in deleted file mode 100644 index f78c5f42..00000000 --- a/src/nmcli/generate-docs-nm-settings-nmcli.xml.in +++ /dev/null @@ -1,1160 +0,0 @@ -<nm-setting-docs> - <setting name="6lowpan" > - <property name="parent" - alias="dev" - description="If given, specifies the parent interface name or parent connection UUID from which this 6LowPAN interface should be created." /> - </setting> - <setting name="802-11-olpc-mesh" - alias="olpc-mesh" > - <property name="ssid" - alias="ssid" - description="SSID of the mesh network to join." /> - <property name="channel" - alias="channel" - description="Channel on which the mesh network to join is located." /> - <property name="dhcp-anycast-address" - alias="dhcp-anycast" - description="Anycast DHCP MAC address used when requesting an IP address via DHCP. The specific anycast address used determines which DHCP server class answers the request. This is currently only implemented by dhclient DHCP plugin." /> - </setting> - <setting name="802-11-wireless" - alias="wifi" > - <property name="ssid" - alias="ssid" - description="SSID of the Wi-Fi network. Must be specified." /> - <property name="mode" - alias="mode" - description="Wi-Fi network mode; one of "infrastructure", "mesh", "adhoc" or "ap". If blank, infrastructure is assumed." /> - <property name="band" - description="802.11 frequency band of the network. One of "a" for 5GHz 802.11a or "bg" for 2.4GHz 802.11. This will lock associations to the Wi-Fi network to the specific band, i.e. if "a" is specified, the device will not associate with the same network in the 2.4GHz band even if the network's settings are compatible. This setting depends on specific driver capability and may not work with all drivers." /> - <property name="channel" - description="Wireless channel to use for the Wi-Fi connection. The device will only join (or create for Ad-Hoc networks) a Wi-Fi network on the specified channel. Because channel numbers overlap between bands, this property also requires the "band" property to be set." /> - <property name="bssid" - description="If specified, directs the device to only associate with the given access point. This capability is highly driver dependent and not supported by all devices. Note: this property does not control the BSSID used when creating an Ad-Hoc network and is unlikely to in the future. Locking a client profile to a certain BSSID will prevent roaming and also disable background scanning. That can be useful, if there is only one access point for the SSID." /> - <property name="rate" - description="If non-zero, directs the device to only use the specified bitrate for communication with the access point. Units are in Kb/s, ie 5500 = 5.5 Mbit/s. This property is highly driver dependent and not all devices support setting a static bitrate." /> - <property name="tx-power" - description="If non-zero, directs the device to use the specified transmit power. Units are dBm. This property is highly driver dependent and not all devices support setting a static transmit power." /> - <property name="mac-address" - alias="mac" - description="If specified, this connection will only apply to the Wi-Fi device whose permanent MAC address matches. This property does not change the MAC address of the device (i.e. MAC spoofing)." /> - <property name="cloned-mac-address" - alias="cloned-mac" - description="If specified, request that the device use this MAC address instead. This is known as MAC cloning or spoofing. Beside explicitly specifying a MAC address, the special values "preserve", "permanent", "random" and "stable" are supported. "preserve" means not to touch the MAC address on activation. "permanent" means to use the permanent hardware address of the device. "random" creates a random MAC address on each connect. "stable" creates a hashed MAC address based on connection.stable-id and a machine dependent key. If unspecified, the value can be overwritten via global defaults, see manual of NetworkManager.conf. If still unspecified, it defaults to "preserve" (older versions of NetworkManager may use a different default value). On D-Bus, this field is expressed as "assigned-mac-address" or the deprecated "cloned-mac-address"." /> - <property name="generate-mac-address-mask" - description="With "cloned-mac-address" setting "random" or "stable", by default all bits of the MAC address are scrambled and a locally-administered, unicast MAC address is created. This property allows to specify that certain bits are fixed. Note that the least significant bit of the first MAC address will always be unset to create a unicast MAC address. If the property is NULL, it is eligible to be overwritten by a default connection setting. If the value is still NULL or an empty string, the default is to create a locally-administered, unicast MAC address. If the value contains one MAC address, this address is used as mask. The set bits of the mask are to be filled with the current MAC address of the device, while the unset bits are subject to randomization. Setting "FE:FF:FF:00:00:00" means to preserve the OUI of the current MAC address and only randomize the lower 3 bytes using the "random" or "stable" algorithm. If the value contains one additional MAC address after the mask, this address is used instead of the current MAC address to fill the bits that shall not be randomized. For example, a value of "FE:FF:FF:00:00:00 68:F7:28:00:00:00" will set the OUI of the MAC address to 68:F7:28, while the lower bits are randomized. A value of "02:00:00:00:00:00 00:00:00:00:00:00" will create a fully scrambled globally-administered, burned-in MAC address. If the value contains more than one additional MAC addresses, one of them is chosen randomly. For example, "02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00" will create a fully scrambled MAC address, randomly locally or globally administered." /> - <property name="mac-address-blacklist" - description="A list of permanent MAC addresses of Wi-Fi devices to which this connection should never apply. Each MAC address should be given in the standard hex-digits-and-colons notation (eg "00:11:22:33:44:55")." /> - <property name="mac-address-randomization" - description="One of NM_SETTING_MAC_RANDOMIZATION_DEFAULT (0) (never randomize unless the user has set a global default to randomize and the supplicant supports randomization), NM_SETTING_MAC_RANDOMIZATION_NEVER (1) (never randomize the MAC address), or NM_SETTING_MAC_RANDOMIZATION_ALWAYS (2) (always randomize the MAC address). This property is deprecated for 'cloned-mac-address'. Deprecated: 1" /> - <property name="mtu" - alias="mtu" - description="If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple Ethernet frames." /> - <property name="seen-bssids" - description="A list of BSSIDs (each BSSID formatted as a MAC address like "00:11:22:33:44:55") that have been detected as part of the Wi-Fi network. NetworkManager internally tracks previously seen BSSIDs. The property is only meant for reading and reflects the BSSID list of NetworkManager. The changes you make to this property will not be preserved." /> - <property name="hidden" - description="If TRUE, indicates that the network is a non-broadcasting network that hides its SSID. This works both in infrastructure and AP mode. In infrastructure mode, various workarounds are used for a more reliable discovery of hidden networks, such as probe-scanning the SSID. However, these workarounds expose inherent insecurities with hidden SSID networks, and thus hidden SSID networks should be used with caution. In AP mode, the created network does not broadcast its SSID. Note that marking the network as hidden may be a privacy issue for you (in infrastructure mode) or client stations (in AP mode), as the explicit probe-scans are distinctly recognizable on the air." /> - <property name="powersave" - description="One of NM_SETTING_WIRELESS_POWERSAVE_DISABLE (2) (disable Wi-Fi power saving), NM_SETTING_WIRELESS_POWERSAVE_ENABLE (3) (enable Wi-Fi power saving), NM_SETTING_WIRELESS_POWERSAVE_IGNORE (1) (don't touch currently configure setting) or NM_SETTING_WIRELESS_POWERSAVE_DEFAULT (0) (use the globally configured value). All other values are reserved." /> - <property name="wake-on-wlan" - description="The NMSettingWirelessWakeOnWLan options to enable. Not all devices support all options. May be any combination of NM_SETTING_WIRELESS_WAKE_ON_WLAN_ANY (0x2), NM_SETTING_WIRELESS_WAKE_ON_WLAN_DISCONNECT (0x4), NM_SETTING_WIRELESS_WAKE_ON_WLAN_MAGIC (0x8), NM_SETTING_WIRELESS_WAKE_ON_WLAN_GTK_REKEY_FAILURE (0x10), NM_SETTING_WIRELESS_WAKE_ON_WLAN_EAP_IDENTITY_REQUEST (0x20), NM_SETTING_WIRELESS_WAKE_ON_WLAN_4WAY_HANDSHAKE (0x40), NM_SETTING_WIRELESS_WAKE_ON_WLAN_RFKILL_RELEASE (0x80), NM_SETTING_WIRELESS_WAKE_ON_WLAN_TCP (0x100) or the special values NM_SETTING_WIRELESS_WAKE_ON_WLAN_DEFAULT (0x1) (to use global settings) and NM_SETTING_WIRELESS_WAKE_ON_WLAN_IGNORE (0x8000) (to disable management of Wake-on-LAN in NetworkManager)." /> - <property name="ap-isolation" - description="Configures AP isolation, which prevents communication between wireless devices connected to this AP. This property can be set to a value different from NM_TERNARY_DEFAULT (-1) only when the interface is configured in AP mode. If set to NM_TERNARY_TRUE (1), devices are not able to communicate with each other. This increases security because it protects devices against attacks from other clients in the network. At the same time, it prevents devices to access resources on the same wireless networks as file shares, printers, etc. If set to NM_TERNARY_FALSE (0), devices can talk to each other. When set to NM_TERNARY_DEFAULT (-1), the global default is used; in case the global default is unspecified it is assumed to be NM_TERNARY_FALSE (0)." /> - </setting> - <setting name="802-11-wireless-security" - alias="wifi-sec" > - <property name="key-mgmt" - description="Key management used for the connection. One of "none" (WEP or no password protection), "ieee8021x" (Dynamic WEP), "owe" (Opportunistic Wireless Encryption), "wpa-psk" (WPA2 + WPA3 personal), "sae" (WPA3 personal only), "wpa-eap" (WPA2 + WPA3 enterprise) or "wpa-eap-suite-b-192" (WPA3 enterprise only). This property must be set for any Wi-Fi connection that uses security." /> - <property name="wep-tx-keyidx" - description="When static WEP is used (ie, key-mgmt = "none") and a non-default WEP key index is used by the AP, put that WEP key index here. Valid values are 0 (default key) through 3. Note that some consumer access points (like the Linksys WRT54G) number the keys 1 - 4." /> - <property name="auth-alg" - description="When WEP is used (ie, key-mgmt = "none" or "ieee8021x") indicate the 802.11 authentication algorithm required by the AP here. One of "open" for Open System, "shared" for Shared Key, or "leap" for Cisco LEAP. When using Cisco LEAP (ie, key-mgmt = "ieee8021x" and auth-alg = "leap") the "leap-username" and "leap-password" properties must be specified." /> - <property name="proto" - description="List of strings specifying the allowed WPA protocol versions to use. Each element may be one "wpa" (allow WPA) or "rsn" (allow WPA2/RSN). If not specified, both WPA and RSN connections are allowed." /> - <property name="pairwise" - description="A list of pairwise encryption algorithms which prevents connections to Wi-Fi networks that do not utilize one of the algorithms in the list. For maximum compatibility leave this property empty. Each list element may be one of "tkip" or "ccmp"." /> - <property name="group" - description="A list of group/broadcast encryption algorithms which prevents connections to Wi-Fi networks that do not utilize one of the algorithms in the list. For maximum compatibility leave this property empty. Each list element may be one of "wep40", "wep104", "tkip", or "ccmp"." /> - <property name="pmf" - description="Indicates whether Protected Management Frames (802.11w) must be enabled for the connection. One of NM_SETTING_WIRELESS_SECURITY_PMF_DEFAULT (0) (use global default value), NM_SETTING_WIRELESS_SECURITY_PMF_DISABLE (1) (disable PMF), NM_SETTING_WIRELESS_SECURITY_PMF_OPTIONAL (2) (enable PMF if the supplicant and the access point support it) or NM_SETTING_WIRELESS_SECURITY_PMF_REQUIRED (3) (enable PMF and fail if not supported). When set to NM_SETTING_WIRELESS_SECURITY_PMF_DEFAULT (0) and no global default is set, PMF will be optionally enabled." /> - <property name="leap-username" - description="The login username for legacy LEAP connections (ie, key-mgmt = "ieee8021x" and auth-alg = "leap")." /> - <property name="wep-key0" - description="Index 0 WEP key. This is the WEP key used in most networks. See the "wep-key-type" property for a description of how this key is interpreted." /> - <property name="wep-key1" - description="Index 1 WEP key. This WEP index is not used by most networks. See the "wep-key-type" property for a description of how this key is interpreted." /> - <property name="wep-key2" - description="Index 2 WEP key. This WEP index is not used by most networks. See the "wep-key-type" property for a description of how this key is interpreted." /> - <property name="wep-key3" - description="Index 3 WEP key. This WEP index is not used by most networks. See the "wep-key-type" property for a description of how this key is interpreted." /> - <property name="wep-key-flags" - description="Flags indicating how to handle the "wep-key0", "wep-key1", "wep-key2", and "wep-key3" properties." /> - <property name="wep-key-type" - description="Controls the interpretation of WEP keys. Allowed values are NM_WEP_KEY_TYPE_KEY (1), in which case the key is either a 10- or 26-character hexadecimal string, or a 5- or 13-character ASCII password; or NM_WEP_KEY_TYPE_PASSPHRASE (2), in which case the passphrase is provided as a string and will be hashed using the de-facto MD5 method to derive the actual WEP key." /> - <property name="psk" - description="Pre-Shared-Key for WPA networks. For WPA-PSK, it's either an ASCII passphrase of 8 to 63 characters that is (as specified in the 802.11i standard) hashed to derive the actual key, or the key in form of 64 hexadecimal character. The WPA3-Personal networks use a passphrase of any length for SAE authentication." /> - <property name="psk-flags" - description="Flags indicating how to handle the "psk" property." /> - <property name="leap-password" - description="The login password for legacy LEAP connections (ie, key-mgmt = "ieee8021x" and auth-alg = "leap")." /> - <property name="leap-password-flags" - description="Flags indicating how to handle the "leap-password" property." /> - <property name="wps-method" - description="Flags indicating which mode of WPS is to be used if any. There's little point in changing the default setting as NetworkManager will automatically determine whether it's feasible to start WPS enrollment from the Access Point capabilities. WPS can be disabled by setting this property to a value of 1." /> - <property name="fils" - description="Indicates whether Fast Initial Link Setup (802.11ai) must be enabled for the connection. One of NM_SETTING_WIRELESS_SECURITY_FILS_DEFAULT (0) (use global default value), NM_SETTING_WIRELESS_SECURITY_FILS_DISABLE (1) (disable FILS), NM_SETTING_WIRELESS_SECURITY_FILS_OPTIONAL (2) (enable FILS if the supplicant and the access point support it) or NM_SETTING_WIRELESS_SECURITY_FILS_REQUIRED (3) (enable FILS and fail if not supported). When set to NM_SETTING_WIRELESS_SECURITY_FILS_DEFAULT (0) and no global default is set, FILS will be optionally enabled." /> - </setting> - <setting name="802-1x" > - <property name="optional" - description="Whether the 802.1X authentication is optional. If TRUE, the activation will continue even after a timeout or an authentication failure. Setting the property to TRUE is currently allowed only for Ethernet connections. If set to FALSE, the activation can continue only after a successful authentication." /> - <property name="eap" - description="The allowed EAP method to be used when authenticating to the network with 802.1x. Valid methods are: "leap", "md5", "tls", "peap", "ttls", "pwd", and "fast". Each method requires different configuration using the properties of this setting; refer to wpa_supplicant documentation for the allowed combinations." /> - <property name="identity" - description="Identity string for EAP authentication methods. Often the user's user or login name." /> - <property name="anonymous-identity" - description="Anonymous identity string for EAP authentication methods. Used as the unencrypted identity with EAP types that support different tunneled identity like EAP-TTLS." /> - <property name="pac-file" - description="UTF-8 encoded file path containing PAC for EAP-FAST." /> - <property name="ca-cert" - description="Contains the CA certificate if used by the EAP method specified in the "eap" property. Certificate data is specified using a "scheme"; three are currently supported: blob, path and pkcs#11 URL. When using the blob scheme this property should be set to the certificate's DER encoded data. When using the path scheme, this property should be set to the full UTF-8 encoded path of the certificate, prefixed with the string "file://" and ending with a terminating NUL byte. This property can be unset even if the EAP method supports CA certificates, but this allows man-in-the-middle attacks and is NOT recommended. Note that enabling NMSetting8021x:system-ca-certs will override this setting to use the built-in path, if the built-in path is not a directory." /> - <property name="ca-cert-password" - description="The password used to access the CA certificate stored in "ca-cert" property. Only makes sense if the certificate is stored on a PKCS#11 token that requires a login." /> - <property name="ca-cert-password-flags" - description="Flags indicating how to handle the "ca-cert-password" property." /> - <property name="ca-path" - description="UTF-8 encoded path to a directory containing PEM or DER formatted certificates to be added to the verification chain in addition to the certificate specified in the "ca-cert" property. If NMSetting8021x:system-ca-certs is enabled and the built-in CA path is an existing directory, then this setting is ignored." /> - <property name="subject-match" - description="Substring to be matched against the subject of the certificate presented by the authentication server. When unset, no verification of the authentication server certificate's subject is performed. This property provides little security, if any, and its use is deprecated in favor of NMSetting8021x:domain-suffix-match." /> - <property name="altsubject-matches" - description="List of strings to be matched against the altSubjectName of the certificate presented by the authentication server. If the list is empty, no verification of the server certificate's altSubjectName is performed." /> - <property name="domain-suffix-match" - description="Constraint for server domain name. If set, this FQDN is used as a suffix match requirement for dNSName element(s) of the certificate presented by the authentication server. If a matching dNSName is found, this constraint is met. If no dNSName values are present, this constraint is matched against SubjectName CN using same suffix match comparison. Since version 1.24, multiple valid FQDNs can be passed as a ";" delimited list." /> - <property name="domain-match" - description="Constraint for server domain name. If set, this list of FQDNs is used as a match requirement for dNSName element(s) of the certificate presented by the authentication server. If a matching dNSName is found, this constraint is met. If no dNSName values are present, this constraint is matched against SubjectName CN using the same comparison. Multiple valid FQDNs can be passed as a ";" delimited list." /> - <property name="client-cert" - description="Contains the client certificate if used by the EAP method specified in the "eap" property. Certificate data is specified using a "scheme"; two are currently supported: blob and path. When using the blob scheme (which is backwards compatible with NM 0.7.x) this property should be set to the certificate's DER encoded data. When using the path scheme, this property should be set to the full UTF-8 encoded path of the certificate, prefixed with the string "file://" and ending with a terminating NUL byte." /> - <property name="client-cert-password" - description="The password used to access the client certificate stored in "client-cert" property. Only makes sense if the certificate is stored on a PKCS#11 token that requires a login." /> - <property name="client-cert-password-flags" - description="Flags indicating how to handle the "client-cert-password" property." /> - <property name="phase1-peapver" - description="Forces which PEAP version is used when PEAP is set as the EAP method in the "eap" property. When unset, the version reported by the server will be used. Sometimes when using older RADIUS servers, it is necessary to force the client to use a particular PEAP version. To do so, this property may be set to "0" or "1" to force that specific PEAP version." /> - <property name="phase1-peaplabel" - description="Forces use of the new PEAP label during key derivation. Some RADIUS servers may require forcing the new PEAP label to interoperate with PEAPv1. Set to "1" to force use of the new PEAP label. See the wpa_supplicant documentation for more details." /> - <property name="phase1-fast-provisioning" - description="Enables or disables in-line provisioning of EAP-FAST credentials when FAST is specified as the EAP method in the "eap" property. Recognized values are "0" (disabled), "1" (allow unauthenticated provisioning), "2" (allow authenticated provisioning), and "3" (allow both authenticated and unauthenticated provisioning). See the wpa_supplicant documentation for more details." /> - <property name="phase1-auth-flags" - description="Specifies authentication flags to use in "phase 1" outer authentication using NMSetting8021xAuthFlags options. The individual TLS versions can be explicitly disabled. If a certain TLS disable flag is not set, it is up to the supplicant to allow or forbid it. The TLS options map to tls_disable_tlsv1_x settings. See the wpa_supplicant documentation for more details." /> - <property name="phase2-auth" - description="Specifies the allowed "phase 2" inner authentication method when an EAP method that uses an inner TLS tunnel is specified in the "eap" property. For TTLS this property selects one of the supported non-EAP inner methods: "pap", "chap", "mschap", "mschapv2" while "phase2-autheap" selects an EAP inner method. For PEAP this selects an inner EAP method, one of: "gtc", "otp", "md5" and "tls". Each "phase 2" inner method requires specific parameters for successful authentication; see the wpa_supplicant documentation for more details. Both "phase2-auth" and "phase2-autheap" cannot be specified." /> - <property name="phase2-autheap" - description="Specifies the allowed "phase 2" inner EAP-based authentication method when TTLS is specified in the "eap" property. Recognized EAP-based "phase 2" methods are "md5", "mschapv2", "otp", "gtc", and "tls". Each "phase 2" inner method requires specific parameters for successful authentication; see the wpa_supplicant documentation for more details." /> - <property name="phase2-ca-cert" - description="Contains the "phase 2" CA certificate if used by the EAP method specified in the "phase2-auth" or "phase2-autheap" properties. Certificate data is specified using a "scheme"; three are currently supported: blob, path and pkcs#11 URL. When using the blob scheme this property should be set to the certificate's DER encoded data. When using the path scheme, this property should be set to the full UTF-8 encoded path of the certificate, prefixed with the string "file://" and ending with a terminating NUL byte. This property can be unset even if the EAP method supports CA certificates, but this allows man-in-the-middle attacks and is NOT recommended. Note that enabling NMSetting8021x:system-ca-certs will override this setting to use the built-in path, if the built-in path is not a directory." /> - <property name="phase2-ca-cert-password" - description="The password used to access the "phase2" CA certificate stored in "phase2-ca-cert" property. Only makes sense if the certificate is stored on a PKCS#11 token that requires a login." /> - <property name="phase2-ca-cert-password-flags" - description="Flags indicating how to handle the "phase2-ca-cert-password" property." /> - <property name="phase2-ca-path" - description="UTF-8 encoded path to a directory containing PEM or DER formatted certificates to be added to the verification chain in addition to the certificate specified in the "phase2-ca-cert" property. If NMSetting8021x:system-ca-certs is enabled and the built-in CA path is an existing directory, then this setting is ignored." /> - <property name="phase2-subject-match" - description="Substring to be matched against the subject of the certificate presented by the authentication server during the inner "phase 2" authentication. When unset, no verification of the authentication server certificate's subject is performed. This property provides little security, if any, and its use is deprecated in favor of NMSetting8021x:phase2-domain-suffix-match." /> - <property name="phase2-altsubject-matches" - description="List of strings to be matched against the altSubjectName of the certificate presented by the authentication server during the inner "phase 2" authentication. If the list is empty, no verification of the server certificate's altSubjectName is performed." /> - <property name="phase2-domain-suffix-match" - description="Constraint for server domain name. If set, this FQDN is used as a suffix match requirement for dNSName element(s) of the certificate presented by the authentication server during the inner "phase 2" authentication. If a matching dNSName is found, this constraint is met. If no dNSName values are present, this constraint is matched against SubjectName CN using same suffix match comparison. Since version 1.24, multiple valid FQDNs can be passed as a ";" delimited list." /> - <property name="phase2-domain-match" - description="Constraint for server domain name. If set, this list of FQDNs is used as a match requirement for dNSName element(s) of the certificate presented by the authentication server during the inner "phase 2" authentication. If a matching dNSName is found, this constraint is met. If no dNSName values are present, this constraint is matched against SubjectName CN using the same comparison. Multiple valid FQDNs can be passed as a ";" delimited list." /> - <property name="phase2-client-cert" - description="Contains the "phase 2" client certificate if used by the EAP method specified in the "phase2-auth" or "phase2-autheap" properties. Certificate data is specified using a "scheme"; two are currently supported: blob and path. When using the blob scheme (which is backwards compatible with NM 0.7.x) this property should be set to the certificate's DER encoded data. When using the path scheme, this property should be set to the full UTF-8 encoded path of the certificate, prefixed with the string "file://" and ending with a terminating NUL byte. This property can be unset even if the EAP method supports CA certificates, but this allows man-in-the-middle attacks and is NOT recommended." /> - <property name="phase2-client-cert-password" - description="The password used to access the "phase2" client certificate stored in "phase2-client-cert" property. Only makes sense if the certificate is stored on a PKCS#11 token that requires a login." /> - <property name="phase2-client-cert-password-flags" - description="Flags indicating how to handle the "phase2-client-cert-password" property." /> - <property name="password" - description="UTF-8 encoded password used for EAP authentication methods. If both the "password" property and the "password-raw" property are specified, "password" is preferred." /> - <property name="password-flags" - description="Flags indicating how to handle the "password" property." /> - <property name="password-raw" - description="Password used for EAP authentication methods, given as a byte array to allow passwords in other encodings than UTF-8 to be used. If both the "password" property and the "password-raw" property are specified, "password" is preferred." /> - <property name="password-raw-flags" - description="Flags indicating how to handle the "password-raw" property." /> - <property name="private-key" - description="Contains the private key when the "eap" property is set to "tls". Key data is specified using a "scheme"; two are currently supported: blob and path. When using the blob scheme and private keys, this property should be set to the key's encrypted PEM encoded data. When using private keys with the path scheme, this property should be set to the full UTF-8 encoded path of the key, prefixed with the string "file://" and ending with a terminating NUL byte. When using PKCS#12 format private keys and the blob scheme, this property should be set to the PKCS#12 data and the "private-key-password" property must be set to password used to decrypt the PKCS#12 certificate and key. When using PKCS#12 files and the path scheme, this property should be set to the full UTF-8 encoded path of the key, prefixed with the string "file://" and ending with a terminating NUL byte, and as with the blob scheme the "private-key-password" property must be set to the password used to decode the PKCS#12 private key and certificate. WARNING: "private-key" is not a "secret" property, and thus unencrypted private key data using the BLOB scheme may be readable by unprivileged users. Private keys should always be encrypted with a private key password to prevent unauthorized access to unencrypted private key data." /> - <property name="private-key-password" - description="The password used to decrypt the private key specified in the "private-key" property when the private key either uses the path scheme, or if the private key is a PKCS#12 format key." /> - <property name="private-key-password-flags" - description="Flags indicating how to handle the "private-key-password" property." /> - <property name="phase2-private-key" - description="Contains the "phase 2" inner private key when the "phase2-auth" or "phase2-autheap" property is set to "tls". Key data is specified using a "scheme"; two are currently supported: blob and path. When using the blob scheme and private keys, this property should be set to the key's encrypted PEM encoded data. When using private keys with the path scheme, this property should be set to the full UTF-8 encoded path of the key, prefixed with the string "file://" and ending with a terminating NUL byte. When using PKCS#12 format private keys and the blob scheme, this property should be set to the PKCS#12 data and the "phase2-private-key-password" property must be set to password used to decrypt the PKCS#12 certificate and key. When using PKCS#12 files and the path scheme, this property should be set to the full UTF-8 encoded path of the key, prefixed with the string "file://" and ending with a terminating NUL byte, and as with the blob scheme the "phase2-private-key-password" property must be set to the password used to decode the PKCS#12 private key and certificate." /> - <property name="phase2-private-key-password" - description="The password used to decrypt the "phase 2" private key specified in the "phase2-private-key" property when the private key either uses the path scheme, or is a PKCS#12 format key." /> - <property name="phase2-private-key-password-flags" - description="Flags indicating how to handle the "phase2-private-key-password" property." /> - <property name="pin" - description="PIN used for EAP authentication methods." /> - <property name="pin-flags" - description="Flags indicating how to handle the "pin" property." /> - <property name="system-ca-certs" - description="When TRUE, overrides the "ca-path" and "phase2-ca-path" properties using the system CA directory specified at configure time with the --system-ca-path switch. The certificates in this directory are added to the verification chain in addition to any certificates specified by the "ca-cert" and "phase2-ca-cert" properties. If the path provided with --system-ca-path is rather a file name (bundle of trusted CA certificates), it overrides "ca-cert" and "phase2-ca-cert" properties instead (sets ca_cert/ca_cert2 options for wpa_supplicant)." /> - <property name="auth-timeout" - description="A timeout for the authentication. Zero means the global default; if the global default is not set, the authentication timeout is 25 seconds." /> - </setting> - <setting name="802-3-ethernet" - alias="ethernet" > - <property name="port" - description="Specific port type to use if the device supports multiple attachment methods. One of "tp" (Twisted Pair), "aui" (Attachment Unit Interface), "bnc" (Thin Ethernet) or "mii" (Media Independent Interface). If the device supports only one port type, this setting is ignored." /> - <property name="speed" - description="When a value greater than 0 is set, configures the device to use the specified speed. If "auto-negotiate" is "yes" the specified speed will be the only one advertised during link negotiation: this works only for BASE-T 802.3 specifications and is useful for enforcing gigabit speeds, as in this case link negotiation is mandatory. If the value is unset (0, the default), the link configuration will be either skipped (if "auto-negotiate" is "no", the default) or will be auto-negotiated (if "auto-negotiate" is "yes") and the local device will advertise all the supported speeds. In Mbit/s, ie 100 == 100Mbit/s. Must be set together with the "duplex" property when non-zero. Before specifying a speed value be sure your device supports it." /> - <property name="duplex" - description="When a value is set, either "half" or "full", configures the device to use the specified duplex mode. If "auto-negotiate" is "yes" the specified duplex mode will be the only one advertised during link negotiation: this works only for BASE-T 802.3 specifications and is useful for enforcing gigabits modes, as in these cases link negotiation is mandatory. If the value is unset (the default), the link configuration will be either skipped (if "auto-negotiate" is "no", the default) or will be auto-negotiated (if "auto-negotiate" is "yes") and the local device will advertise all the supported duplex modes. Must be set together with the "speed" property if specified. Before specifying a duplex mode be sure your device supports it." /> - <property name="auto-negotiate" - description="When TRUE, enforce auto-negotiation of speed and duplex mode. If "speed" and "duplex" properties are both specified, only that single mode will be advertised and accepted during the link auto-negotiation process: this works only for BASE-T 802.3 specifications and is useful for enforcing gigabits modes, as in these cases link negotiation is mandatory. When FALSE, "speed" and "duplex" properties should be both set or link configuration will be skipped." /> - <property name="mac-address" - alias="mac" - description="If specified, this connection will only apply to the Ethernet device whose permanent MAC address matches. This property does not change the MAC address of the device (i.e. MAC spoofing)." /> - <property name="cloned-mac-address" - alias="cloned-mac" - description="If specified, request that the device use this MAC address instead. This is known as MAC cloning or spoofing. Beside explicitly specifying a MAC address, the special values "preserve", "permanent", "random" and "stable" are supported. "preserve" means not to touch the MAC address on activation. "permanent" means to use the permanent hardware address if the device has one (otherwise this is treated as "preserve"). "random" creates a random MAC address on each connect. "stable" creates a hashed MAC address based on connection.stable-id and a machine dependent key. If unspecified, the value can be overwritten via global defaults, see manual of NetworkManager.conf. If still unspecified, it defaults to "preserve" (older versions of NetworkManager may use a different default value). On D-Bus, this field is expressed as "assigned-mac-address" or the deprecated "cloned-mac-address"." /> - <property name="generate-mac-address-mask" - description="With "cloned-mac-address" setting "random" or "stable", by default all bits of the MAC address are scrambled and a locally-administered, unicast MAC address is created. This property allows to specify that certain bits are fixed. Note that the least significant bit of the first MAC address will always be unset to create a unicast MAC address. If the property is NULL, it is eligible to be overwritten by a default connection setting. If the value is still NULL or an empty string, the default is to create a locally-administered, unicast MAC address. If the value contains one MAC address, this address is used as mask. The set bits of the mask are to be filled with the current MAC address of the device, while the unset bits are subject to randomization. Setting "FE:FF:FF:00:00:00" means to preserve the OUI of the current MAC address and only randomize the lower 3 bytes using the "random" or "stable" algorithm. If the value contains one additional MAC address after the mask, this address is used instead of the current MAC address to fill the bits that shall not be randomized. For example, a value of "FE:FF:FF:00:00:00 68:F7:28:00:00:00" will set the OUI of the MAC address to 68:F7:28, while the lower bits are randomized. A value of "02:00:00:00:00:00 00:00:00:00:00:00" will create a fully scrambled globally-administered, burned-in MAC address. If the value contains more than one additional MAC addresses, one of them is chosen randomly. For example, "02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00" will create a fully scrambled MAC address, randomly locally or globally administered." /> - <property name="mac-address-blacklist" - description="If specified, this connection will never apply to the Ethernet device whose permanent MAC address matches an address in the list. Each MAC address is in the standard hex-digits-and-colons notation (00:11:22:33:44:55)." /> - <property name="mtu" - alias="mtu" - description="If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple Ethernet frames." /> - <property name="s390-subchannels" - description="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." /> - <property name="s390-nettype" - description="s390 network device type; one of "qeth", "lcs", or "ctc", representing the different types of virtual network devices available on s390 systems." /> - <property name="s390-options" - description="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]). Currently, NetworkManager itself does nothing with this information. However, s390utils ships a udev rule which parses this information and applies it to the interface." /> - <property name="wake-on-lan" - description="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)." /> - <property name="wake-on-lan-password" - description="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." /> - <property name="accept-all-mac-addresses" - description="When TRUE, setup the interface to accept packets for all MAC addresses. This is enabling the kernel interface flag IFF_PROMISC. When FALSE, the interface will only accept the packets with the interface destination mac address or broadcast." /> - </setting> - <setting name="adsl" > - <property name="username" - alias="username" - description="Username used to authenticate with the ADSL service." /> - <property name="password" - alias="password" - description="Password used to authenticate with the ADSL service." /> - <property name="password-flags" - description="Flags indicating how to handle the "password" property." /> - <property name="protocol" - alias="protocol" - description="ADSL connection protocol. Can be "pppoa", "pppoe" or "ipoatm"." /> - <property name="encapsulation" - alias="encapsulation" - description="Encapsulation of ADSL connection. Can be "vcmux" or "llc"." /> - <property name="vpi" - description="VPI of ADSL connection" /> - <property name="vci" - description="VCI of ADSL connection" /> - </setting> - <setting name="bluetooth" > - <property name="bdaddr" - alias="addr" - description="The Bluetooth address of the device." /> - <property name="type" - alias="bt-type" - description="Either "dun" for Dial-Up Networking connections or "panu" for Personal Area Networking connections to devices supporting the NAP profile." /> - </setting> - <setting name="bond" > - <property name="options" - description="Dictionary of key/value pairs of bonding options. Both keys and values must be strings. Option names must contain only alphanumeric characters (ie, [a-zA-Z0-9])." /> - </setting> - <setting name="bond-port" > - <property name="queue-id" - alias="queue-id" - description="The queue ID of this bond port. The maximum value of queue ID is the number of TX queues currently active in device." /> - </setting> - <setting name="bridge" > - <property name="mac-address" - alias="mac" - description="If specified, the MAC address of bridge. When creating a new bridge, this MAC address will be set. If this field is left unspecified, the "ethernet.cloned-mac-address" is referred instead to generate the initial MAC address. Note that setting "ethernet.cloned-mac-address" anyway overwrites the MAC address of the bridge later while activating the bridge. Hence, this property is deprecated. Deprecated: 1" /> - <property name="stp" - alias="stp" - description="Controls whether Spanning Tree Protocol (STP) is enabled for this bridge." /> - <property name="priority" - alias="priority" - description="Sets the Spanning Tree Protocol (STP) priority for this bridge. Lower values are "better"; the lowest priority bridge will be elected the root bridge." /> - <property name="forward-delay" - alias="forward-delay" - description="The Spanning Tree Protocol (STP) forwarding delay, in seconds." /> - <property name="hello-time" - alias="hello-time" - description="The Spanning Tree Protocol (STP) hello time, in seconds." /> - <property name="max-age" - alias="max-age" - description="The Spanning Tree Protocol (STP) maximum message age, in seconds." /> - <property name="ageing-time" - alias="ageing-time" - description="The Ethernet MAC address aging time, in seconds." /> - <property name="group-address" - description="If specified, The MAC address of the multicast group this bridge uses for STP. The address must be a link-local address in standard Ethernet MAC address format, ie an address of the form 01:80:C2:00:00:0X, with X in [0, 4..F]. If not specified the default value is 01:80:C2:00:00:00." /> - <property name="group-forward-mask" - alias="group-forward-mask" - description="A mask of group addresses to forward. Usually, group addresses in the range from 01:80:C2:00:00:00 to 01:80:C2:00:00:0F are not forwarded according to standards. This property is a mask of 16 bits, each corresponding to a group address in that range that must be forwarded. The mask can't have bits 0, 1 or 2 set because they are used for STP, MAC pause frames and LACP." /> - <property name="multicast-hash-max" - description="Set maximum size of multicast hash table (value must be a power of 2)." /> - <property name="multicast-last-member-count" - description="Set the number of queries the bridge will send before stopping forwarding a multicast group after a "leave" message has been received." /> - <property name="multicast-last-member-interval" - description="Set interval (in deciseconds) between queries to find remaining members of a group, after a "leave" message is received." /> - <property name="multicast-membership-interval" - description="Set delay (in deciseconds) after which the bridge will leave a group, if no membership reports for this group are received." /> - <property name="multicast-querier" - description="Enable or disable sending of multicast queries by the bridge. If not specified the option is disabled." /> - <property name="multicast-querier-interval" - description="If no queries are seen after this delay (in deciseconds) has passed, the bridge will start to send its own queries." /> - <property name="multicast-query-interval" - description="Interval (in deciseconds) between queries sent by the bridge after the end of the startup phase." /> - <property name="multicast-query-response-interval" - description="Set the Max Response Time/Max Response Delay (in deciseconds) for IGMP/MLD queries sent by the bridge." /> - <property name="multicast-query-use-ifaddr" - description="If enabled the bridge's own IP address is used as the source address for IGMP queries otherwise the default of 0.0.0.0 is used." /> - <property name="multicast-snooping" - alias="multicast-snooping" - description="Controls whether IGMP snooping is enabled for this bridge. Note that if snooping was automatically disabled due to hash collisions, the system may refuse to enable the feature until the collisions are resolved." /> - <property name="multicast-startup-query-count" - description="Set the number of IGMP queries to send during startup phase." /> - <property name="multicast-startup-query-interval" - description="Sets the time (in deciseconds) between queries sent out at startup to determine membership information." /> - <property name="multicast-router" - description="Sets bridge's multicast router. Multicast-snooping must be enabled for this option to work. Supported values are: 'auto', 'disabled', 'enabled' to which kernel assigns the numbers 1, 0, and 2, respectively. If not specified the default value is 'auto' (1)." /> - <property name="vlan-filtering" - description="Control whether VLAN filtering is enabled on the bridge." /> - <property name="vlan-default-pvid" - description="The default PVID for the ports of the bridge, that is the VLAN id assigned to incoming untagged frames." /> - <property name="vlan-stats-enabled" - description="Controls whether per-VLAN stats accounting is enabled." /> - <property name="vlan-protocol" - description="If specified, the protocol used for VLAN filtering. Supported values are: '802.1Q', '802.1ad'. If not specified the default value is '802.1Q'." /> - <property name="vlans" - description="Array of bridge VLAN objects. In addition to the VLANs specified here, the bridge will also have the default-pvid VLAN configured by the bridge.vlan-default-pvid property. In nmcli the VLAN list can be specified with the following syntax: $vid [pvid] [untagged] [, $vid [pvid] [untagged]]... where $vid is either a single id between 1 and 4094 or a range, represented as a couple of ids separated by a dash." /> - </setting> - <setting name="bridge-port" > - <property name="priority" - alias="priority" - description="The Spanning Tree Protocol (STP) priority of this bridge port." /> - <property name="path-cost" - alias="path-cost" - description="The Spanning Tree Protocol (STP) port cost for destinations via this port." /> - <property name="hairpin-mode" - alias="hairpin" - description="Enables or disables "hairpin mode" for the port, which allows frames to be sent back out through the port the frame was received on." /> - <property name="vlans" - description="Array of bridge VLAN objects. In addition to the VLANs specified here, the port will also have the default-pvid VLAN configured on the bridge by the bridge.vlan-default-pvid property. In nmcli the VLAN list can be specified with the following syntax: $vid [pvid] [untagged] [, $vid [pvid] [untagged]]... where $vid is either a single id between 1 and 4094 or a range, represented as a couple of ids separated by a dash." /> - </setting> - <setting name="cdma" > - <property name="number" - description="The number to dial to establish the connection to the CDMA-based mobile broadband network, if any. If not specified, the default number (#777) is used when required." /> - <property name="username" - alias="user" - description="The username used to authenticate with the network, if required. Many providers do not require a username, or accept any username. But if a username is required, it is specified here." /> - <property name="password" - alias="password" - description="The password used to authenticate with the network, if required. Many providers do not require a password, or accept any password. But if a password is required, it is specified here." /> - <property name="password-flags" - description="Flags indicating how to handle the "password" property." /> - <property name="mtu" - description="If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple frames." /> - </setting> - <setting name="connection" > - <property name="id" - alias="con-name" - description="A human readable unique identifier for the connection, like "Work Wi-Fi" or "T-Mobile 3G"." /> - <property name="uuid" - description="A universally unique identifier for the connection, for example generated with libuuid. It should be assigned when the connection is created, and never changed as long as the connection still applies to the same network. For example, it should not be changed when the "id" property or NMSettingIP4Config changes, but might need to be re-created when the Wi-Fi SSID, mobile broadband network provider, or "type" property changes. The UUID must be in the format "2815492f-7e56-435e-b2e9-246bd7cdc664" (ie, contains only hexadecimal characters and "-")." /> - <property name="stable-id" - description="This represents the identity of the connection used for various purposes. It allows to configure multiple profiles to share the identity. Also, the stable-id can contain placeholders that are substituted dynamically and deterministically depending on the context. The stable-id is used for generating IPv6 stable private addresses with ipv6.addr-gen-mode=stable-privacy. It is also used to seed the generated cloned MAC address for ethernet.cloned-mac-address=stable and wifi.cloned-mac-address=stable. It is also used as DHCP client identifier with ipv4.dhcp-client-id=stable and to derive the DHCP DUID with ipv6.dhcp-duid=stable-[llt,ll,uuid]. Note that depending on the context where it is used, other parameters are also seeded into the generation algorithm. For example, a per-host key is commonly also included, so that different systems end up generating different IDs. Or with ipv6.addr-gen-mode=stable-privacy, also the device's name is included, so that different interfaces yield different addresses. The per-host key is the identity of your machine and stored in /var/lib/NetworkManager/secret_key. See NetworkManager(8) manual about the secret-key and the host identity. The '$' character is treated special to perform dynamic substitutions at runtime. Currently, supported are "${CONNECTION}", "${DEVICE}", "${MAC}", "${BOOT}", "${RANDOM}". These effectively create unique IDs per-connection, per-device, per-boot, or every time. Note that "${DEVICE}" corresponds to the interface name of the device and "${MAC}" is the permanent MAC address of the device. Any unrecognized patterns following '$' are treated verbatim, however are reserved for future use. You are thus advised to avoid '$' or escape it as "$$". For example, set it to "${CONNECTION}-${BOOT}-${DEVICE}" to create a unique id for this connection that changes with every reboot and differs depending on the interface where the profile activates. If the value is unset, a global connection default is consulted. If the value is still unset, the default is similar to "${CONNECTION}" and uses a unique, fixed ID for the connection." /> - <property name="type" - alias="type" - description="Base type of the connection. For hardware-dependent connections, should contain the setting name of the hardware-type specific setting (ie, "802-3-ethernet" or "802-11-wireless" or "bluetooth", etc), and for non-hardware dependent connections like VPN or otherwise, should contain the setting name of that setting type (ie, "vpn" or "bridge", etc)." /> - <property name="interface-name" - alias="ifname" - description="The name of the network interface this connection is bound to. If not set, then the connection can be attached to any interface of the appropriate type (subject to restrictions imposed by other settings). For software devices this specifies the name of the created device. For connection types where interface names cannot easily be made persistent (e.g. mobile broadband or USB Ethernet), this property should not be used. Setting this property restricts the interfaces a connection can be used with, and if interface names change or are reordered the connection may be applied to the wrong interface." /> - <property name="autoconnect" - alias="autoconnect" - description="Whether or not the connection should be automatically connected by NetworkManager when the resources for the connection are available. TRUE to automatically activate the connection, FALSE to require manual intervention to activate the connection. Autoconnect happens when the circumstances are suitable. That means for example that the device is currently managed and not active. Autoconnect thus never replaces or competes with an already active profile. Note that autoconnect is not implemented for VPN profiles. See "secondaries" as an alternative to automatically connect VPN profiles. If multiple profiles are ready to autoconnect on the same device, the one with the better "connection.autoconnect-priority" is chosen. If the priorities are equal, then the most recently connected profile is activated. If the profiles were not connected earlier or their "connection.timestamp" is identical, the choice is undefined. Depending on "connection.multi-connect", a profile can (auto)connect only once at a time or multiple times." /> - <property name="autoconnect-priority" - description="The autoconnect priority in range -999 to 999. If the connection is set to autoconnect, connections with higher priority will be preferred. The higher number means higher priority. Defaults to 0. Note that this property only matters if there are more than one candidate profile to select for autoconnect. In case of equal priority, the profile used most recently is chosen." /> - <property name="autoconnect-retries" - description="The number of times a connection should be tried when autoactivating before giving up. Zero means forever, -1 means the global default (4 times if not overridden). Setting this to 1 means to try activation only once before blocking autoconnect. Note that after a timeout, NetworkManager will try to autoconnect again." /> - <property name="multi-connect" - description="Specifies whether the profile can be active multiple times at a particular moment. The value is of type NMConnectionMultiConnect." /> - <property name="auth-retries" - description="The number of retries for the authentication. Zero means to try indefinitely; -1 means to use a global default. If the global default is not set, the authentication retries for 3 times before failing the connection. Currently, this only applies to 802-1x authentication." /> - <property name="timestamp" - description="The time, in seconds since the Unix Epoch, that the connection was last _successfully_ fully activated. NetworkManager updates the connection timestamp periodically when the connection is active to ensure that an active connection has the latest timestamp. The property is only meant for reading (changes to this property will not be preserved)." /> - <property name="read-only" - description="FALSE if the connection can be modified using the provided settings service's D-Bus interface with the right privileges, or TRUE if the connection is read-only and cannot be modified." /> - <property name="permissions" - description="An array of strings defining what access a given user has to this connection. If this is NULL or empty, all users are allowed to access this connection; otherwise users are allowed if and only if they are in this list. When this is not empty, the connection can be active only when one of the specified users is logged into an active session. Each entry is of the form "[type]:[id]:[reserved]"; for example, "user:dcbw:blah". At this time only the "user" [type] is allowed. Any other values are ignored and reserved for future use. [id] is the username that this permission refers to, which may not contain the ":" character. Any [reserved] information present must be ignored and is reserved for future use. All of [type], [id], and [reserved] must be valid UTF-8." /> - <property name="zone" - description="The trust level of a the connection. Free form case-insensitive string (for example "Home", "Work", "Public"). NULL or unspecified zone means the connection will be placed in the default zone as defined by the firewall. When updating this property on a currently activated connection, the change takes effect immediately." /> - <property name="master" - alias="master" - description="Interface name of the master device or UUID of the master connection." /> - <property name="slave-type" - alias="slave-type" - description="Setting name of the device type of this slave's master connection (eg, "bond"), or NULL if this connection is not a slave." /> - <property name="autoconnect-slaves" - description="Whether or not slaves of this connection should be automatically brought up when NetworkManager activates this connection. This only has a real effect for master connections. The properties "autoconnect", "autoconnect-priority" and "autoconnect-retries" are unrelated to this setting. The permitted values are: 0: leave slave connections untouched, 1: activate all the slave connections with this connection, -1: default. If -1 (default) is set, global connection.autoconnect-slaves is read to determine the real value. If it is default as well, this fallbacks to 0." /> - <property name="secondaries" - description="List of connection UUIDs that should be activated when the base connection itself is activated. Currently, only VPN connections are supported." /> - <property name="gateway-ping-timeout" - description="If greater than zero, delay success of IP addressing until either the timeout is reached, or an IP gateway replies to a ping." /> - <property name="metered" - description="Whether the connection is metered. When updating this property on a currently activated connection, the change takes effect immediately." /> - <property name="lldp" - description="Whether LLDP is enabled for the connection." /> - <property name="mdns" - description="Whether mDNS is enabled for the connection. The permitted values are: "yes" (2) register hostname and resolving for the connection, "no" (0) disable mDNS for the interface, "resolve" (1) do not register hostname but allow resolving of mDNS host names and "default" (-1) to allow lookup of a global default in NetworkManager.conf. If unspecified, "default" ultimately depends on the DNS plugin (which for systemd-resolved currently means "no"). This feature requires a plugin which supports mDNS. Otherwise, the setting has no effect. One such plugin is dns-systemd-resolved." /> - <property name="llmnr" - description="Whether Link-Local Multicast Name Resolution (LLMNR) is enabled for the connection. LLMNR is a protocol based on the Domain Name System (DNS) packet format that allows both IPv4 and IPv6 hosts to perform name resolution for hosts on the same local link. The permitted values are: "yes" (2) register hostname and resolving for the connection, "no" (0) disable LLMNR for the interface, "resolve" (1) do not register hostname but allow resolving of LLMNR host names If unspecified, "default" ultimately depends on the DNS plugin (which for systemd-resolved currently means "yes"). This feature requires a plugin which supports LLMNR. Otherwise, the setting has no effect. One such plugin is dns-systemd-resolved." /> - <property name="dns-over-tls" - description="Whether DNSOverTls (dns-over-tls) is enabled for the connection. DNSOverTls is a technology which uses TLS to encrypt dns traffic. The permitted values are: "yes" (2) use DNSOverTls and disabled fallback, "opportunistic" (1) use DNSOverTls but allow fallback to unencrypted resolution, "no" (0) don't ever use DNSOverTls. If unspecified "default" depends on the plugin used. Systemd-resolved uses global setting. This feature requires a plugin which supports DNSOverTls. Otherwise, the setting has no effect. One such plugin is dns-systemd-resolved." /> - <property name="mptcp-flags" - description="Whether to configure MPTCP endpoints and the address flags. If MPTCP is enabled in NetworkManager, it will configure the addresses of the interface as MPTCP endpoints. Note that IPv4 loopback addresses (127.0.0.0/8), IPv4 link local addresses (169.254.0.0/16), the IPv6 loopback address (::1), IPv6 link local addresses (fe80::/10), IPv6 unique local addresses (ULA, fc00::/7) and IPv6 privacy extension addresses (rfc3041, ipv6.ip6-privacy) will be excluded from being configured as endpoints. If "disabled" (0x1), MPTCP handling for the interface is disabled and no endpoints are registered. The "enabled" (0x2) flag means that MPTCP handling is enabled. This flag can also be implied from the presence of other flags. Even when enabled, MPTCP handling will by default still be disabled unless "/proc/sys/net/mptcp/enabled" sysctl is on. NetworkManager does not change the sysctl and this is up to the administrator or distribution. To configure endpoints even if the sysctl is disabled, "also-without-sysctl" (0x4) flag can be used. In that case, NetworkManager doesn't look at the sysctl and configures endpoints regardless. Even when enabled, NetworkManager will only configure MPTCP endpoints for a certain address family, if there is a unicast default route (0.0.0.0/0 or ::/0) in the main routing table. The flag "also-without-default-route" (0x8) can override that. When MPTCP handling is enabled then endpoints are configured with the specified address flags "signal" (0x10), "subflow" (0x20), "backup" (0x40), "fullmesh" (0x80). See ip-mptcp(8) manual for additional information about the flags. If the flags are zero (0x0), the global connection default from NetworkManager.conf is honored. If still unspecified, the fallback is "enabled,subflow". Note that this means that MPTCP is by default done depending on the "/proc/sys/net/mptcp/enabled" sysctl. NetworkManager does not change the MPTCP limits nor enable MPTCP via "/proc/sys/net/mptcp/enabled". That is a host configuration which the admin can change via sysctl and ip-mptcp. Strict reverse path filtering (rp_filter) breaks many MPTCP use cases, so when MPTCP handling for IPv4 addresses on the interface is enabled, NetworkManager would loosen the strict reverse path filtering (1) to the loose setting (2)." /> - <property name="mud-url" - description="If configured, set to a Manufacturer Usage Description (MUD) URL that points to manufacturer-recommended network policies for IoT devices. It is transmitted as a DHCPv4 or DHCPv6 option. The value must be a valid URL starting with "https://". The special value "none" is allowed to indicate that no MUD URL is used. If the per-profile value is unspecified (the default), a global connection default gets consulted. If still unspecified, the ultimate default is "none"." /> - <property name="wait-device-timeout" - description="Timeout in milliseconds to wait for device at startup. During boot, devices may take a while to be detected by the driver. This property will cause to delay NetworkManager-wait-online.service and nm-online to give the device a chance to appear. This works by waiting for the given timeout until a compatible device for the profile is available and managed. The value 0 means no wait time. The default value is -1, which currently has the same meaning as no wait time." /> - <property name="wait-activation-delay" - description="Time in milliseconds to wait for connection to be considered activated. The wait will start after the pre-up dispatcher event. The value 0 means no wait time. The default value is -1, which currently has the same meaning as no wait time." /> - </setting> - <setting name="dcb" > - <property name="app-fcoe-flags" - description="Specifies the NMSettingDcbFlags for the DCB FCoE application. Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4)." /> - <property name="app-fcoe-priority" - description="The highest User Priority (0 - 7) which FCoE frames should use, or -1 for default priority. Only used when the "app-fcoe-flags" property includes the NM_SETTING_DCB_FLAG_ENABLE (0x1) flag." /> - <property name="app-fcoe-mode" - description="The FCoE controller mode; either "fabric" or "vn2vn". Since 1.34, NULL is the default and means "fabric". Before 1.34, NULL was rejected as invalid and the default was "fabric"." /> - <property name="app-iscsi-flags" - description="Specifies the NMSettingDcbFlags for the DCB iSCSI application. Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4)." /> - <property name="app-iscsi-priority" - description="The highest User Priority (0 - 7) which iSCSI frames should use, or -1 for default priority. Only used when the "app-iscsi-flags" property includes the NM_SETTING_DCB_FLAG_ENABLE (0x1) flag." /> - <property name="app-fip-flags" - description="Specifies the NMSettingDcbFlags for the DCB FIP application. Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4)." /> - <property name="app-fip-priority" - description="The highest User Priority (0 - 7) which FIP frames should use, or -1 for default priority. Only used when the "app-fip-flags" property includes the NM_SETTING_DCB_FLAG_ENABLE (0x1) flag." /> - <property name="priority-flow-control-flags" - description="Specifies the NMSettingDcbFlags for DCB Priority Flow Control (PFC). Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4)." /> - <property name="priority-flow-control" - description="An array of 8 boolean values, where the array index corresponds to the User Priority (0 - 7) and the value indicates whether or not the corresponding priority should transmit priority pause." /> - <property name="priority-group-flags" - description="Specifies the NMSettingDcbFlags for DCB Priority Groups. Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4)." /> - <property name="priority-group-id" - description="An array of 8 uint values, where the array index corresponds to the User Priority (0 - 7) and the value indicates the Priority Group ID. Allowed Priority Group ID values are 0 - 7 or 15 for the unrestricted group." /> - <property name="priority-group-bandwidth" - description="An array of 8 uint values, where the array index corresponds to the Priority Group ID (0 - 7) and the value indicates the percentage of link bandwidth allocated to that group. Allowed values are 0 - 100, and the sum of all values must total 100 percents." /> - <property name="priority-bandwidth" - description="An array of 8 uint values, where the array index corresponds to the User Priority (0 - 7) and the value indicates the percentage of bandwidth of the priority's assigned group that the priority may use. The sum of all percentages for priorities which belong to the same group must total 100 percents." /> - <property name="priority-strict-bandwidth" - description="An array of 8 boolean values, where the array index corresponds to the User Priority (0 - 7) and the value indicates whether or not the priority may use all of the bandwidth allocated to its assigned group." /> - <property name="priority-traffic-class" - description="An array of 8 uint values, where the array index corresponds to the User Priority (0 - 7) and the value indicates the traffic class (0 - 7) to which the priority is mapped." /> - </setting> - <setting name="dummy" > - </setting> - <setting name="ethtool" > - <property name="feature-esp-hw-offload" /> - <property name="feature-esp-tx-csum-hw-offload" /> - <property name="feature-fcoe-mtu" /> - <property name="feature-gro" /> - <property name="feature-gso" /> - <property name="feature-highdma" /> - <property name="feature-hw-tc-offload" /> - <property name="feature-l2-fwd-offload" /> - <property name="feature-loopback" /> - <property name="feature-lro" /> - <property name="feature-macsec-hw-offload" /> - <property name="feature-ntuple" /> - <property name="feature-rx" /> - <property name="feature-rxhash" /> - <property name="feature-rxvlan" /> - <property name="feature-rx-all" /> - <property name="feature-rx-fcs" /> - <property name="feature-rx-gro-hw" /> - <property name="feature-rx-gro-list" /> - <property name="feature-rx-udp-gro-forwarding" /> - <property name="feature-rx-udp_tunnel-port-offload" /> - <property name="feature-rx-vlan-filter" /> - <property name="feature-rx-vlan-stag-filter" /> - <property name="feature-rx-vlan-stag-hw-parse" /> - <property name="feature-sg" /> - <property name="feature-tls-hw-record" /> - <property name="feature-tls-hw-rx-offload" /> - <property name="feature-tls-hw-tx-offload" /> - <property name="feature-tso" /> - <property name="feature-tx" /> - <property name="feature-txvlan" /> - <property name="feature-tx-checksum-fcoe-crc" /> - <property name="feature-tx-checksum-ipv4" /> - <property name="feature-tx-checksum-ipv6" /> - <property name="feature-tx-checksum-ip-generic" /> - <property name="feature-tx-checksum-sctp" /> - <property name="feature-tx-esp-segmentation" /> - <property name="feature-tx-fcoe-segmentation" /> - <property name="feature-tx-gre-csum-segmentation" /> - <property name="feature-tx-gre-segmentation" /> - <property name="feature-tx-gso-list" /> - <property name="feature-tx-gso-partial" /> - <property name="feature-tx-gso-robust" /> - <property name="feature-tx-ipxip4-segmentation" /> - <property name="feature-tx-ipxip6-segmentation" /> - <property name="feature-tx-nocache-copy" /> - <property name="feature-tx-scatter-gather" /> - <property name="feature-tx-scatter-gather-fraglist" /> - <property name="feature-tx-sctp-segmentation" /> - <property name="feature-tx-tcp6-segmentation" /> - <property name="feature-tx-tcp-ecn-segmentation" /> - <property name="feature-tx-tcp-mangleid-segmentation" /> - <property name="feature-tx-tcp-segmentation" /> - <property name="feature-tx-tunnel-remcsum-segmentation" /> - <property name="feature-tx-udp-segmentation" /> - <property name="feature-tx-udp_tnl-csum-segmentation" /> - <property name="feature-tx-udp_tnl-segmentation" /> - <property name="feature-tx-vlan-stag-hw-insert" /> - <property name="coalesce-adaptive-rx" /> - <property name="coalesce-adaptive-tx" /> - <property name="coalesce-pkt-rate-high" /> - <property name="coalesce-pkt-rate-low" /> - <property name="coalesce-rx-frames" /> - <property name="coalesce-rx-frames-irq" /> - <property name="coalesce-rx-frames-high" /> - <property name="coalesce-rx-frames-low" /> - <property name="coalesce-rx-usecs" /> - <property name="coalesce-rx-usecs-irq" /> - <property name="coalesce-rx-usecs-high" /> - <property name="coalesce-rx-usecs-low" /> - <property name="coalesce-sample-interval" /> - <property name="coalesce-stats-block-usecs" /> - <property name="coalesce-tx-frames" /> - <property name="coalesce-tx-frames-irq" /> - <property name="coalesce-tx-frames-high" /> - <property name="coalesce-tx-frames-low" /> - <property name="coalesce-tx-usecs" /> - <property name="coalesce-tx-usecs-irq" /> - <property name="coalesce-tx-usecs-high" /> - <property name="coalesce-tx-usecs-low" /> - <property name="pause-autoneg" - description="Whether to automatically negotiate on pause frame of flow control mechanism defined by IEEE 802.3x standard." /> - <property name="pause-rx" - description="Whether RX pause should be enabled. Only valid when automatic negotiation is disabled" /> - <property name="pause-tx" - description="Whether TX pause should be enabled. Only valid when automatic negotiation is disabled" /> - <property name="ring-rx" /> - <property name="ring-rx-jumbo" /> - <property name="ring-rx-mini" /> - <property name="ring-tx" /> - </setting> - <setting name="generic" > - </setting> - <setting name="gsm" > - <property name="auto-config" - description="When TRUE, the settings such as APN, username, or password will default to values that match the network the modem will register to in the Mobile Broadband Provider database." /> - <property name="number" - description="Legacy setting that used to help establishing PPP data sessions for GSM-based modems. Deprecated: 1" /> - <property name="username" - alias="user" - description="The username used to authenticate with the network, if required. Many providers do not require a username, or accept any username. But if a username is required, it is specified here." /> - <property name="password" - alias="password" - description="The password used to authenticate with the network, if required. Many providers do not require a password, or accept any password. But if a password is required, it is specified here." /> - <property name="password-flags" - description="Flags indicating how to handle the "password" property." /> - <property name="apn" - alias="apn" - description="The GPRS Access Point Name specifying the APN used when establishing a data session with the GSM-based network. The APN often determines how the user will be billed for their network usage and whether the user has access to the Internet or just a provider-specific walled-garden, so it is important to use the correct APN for the user's mobile broadband plan. The APN may only be composed of the characters a-z, 0-9, ., and - per GSM 03.60 Section 14.9." /> - <property name="network-id" - description="The Network ID (GSM LAI format, ie MCC-MNC) to force specific network registration. If the Network ID is specified, NetworkManager will attempt to force the device to register only on the specified network. This can be used to ensure that the device does not roam when direct roaming control of the device is not otherwise possible." /> - <property name="pin" - description="If the SIM is locked with a PIN it must be unlocked before any other operations are requested. Specify the PIN here to allow operation of the device." /> - <property name="pin-flags" - description="Flags indicating how to handle the "pin" property." /> - <property name="home-only" - description="When TRUE, only connections to the home network will be allowed. Connections to roaming networks will not be made." /> - <property name="device-id" - description="The device unique identifier (as given by the WWAN management service) which this connection applies to. If given, the connection will only apply to the specified device." /> - <property name="sim-id" - description="The SIM card unique identifier (as given by the WWAN management service) which this connection applies to. If given, the connection will apply to any device also allowed by "device-id" which contains a SIM card matching the given identifier." /> - <property name="sim-operator-id" - description="A MCC/MNC string like "310260" or "21601" identifying the specific mobile network operator which this connection applies to. If given, the connection will apply to any device also allowed by "device-id" and "sim-id" which contains a SIM card provisioned by the given operator." /> - <property name="mtu" - description="If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple frames." /> - </setting> - <setting name="hostname" > - <property name="priority" - description="The relative priority of this connection to determine the system hostname. A lower numerical value is better (higher priority). A connection with higher priority is considered before connections with lower priority. If the value is zero, it can be overridden by a global value from NetworkManager configuration. If the property doesn't have a value in the global configuration, the value is assumed to be 100. Negative values have the special effect of excluding other connections with a greater numerical priority value; so in presence of at least one negative priority, only connections with the lowest priority value will be used to determine the hostname." /> - <property name="from-dhcp" - description="Whether the system hostname can be determined from DHCP on this connection. When set to NM_TERNARY_DEFAULT (-1), the value from global configuration is used. If the property doesn't have a value in the global configuration, NetworkManager assumes the value to be NM_TERNARY_TRUE (1)." /> - <property name="from-dns-lookup" - description="Whether the system hostname can be determined from reverse DNS lookup of addresses on this device. When set to NM_TERNARY_DEFAULT (-1), the value from global configuration is used. If the property doesn't have a value in the global configuration, NetworkManager assumes the value to be NM_TERNARY_TRUE (1)." /> - <property name="only-from-default" - description="If set to NM_TERNARY_TRUE (1), NetworkManager attempts to get the hostname via DHCPv4/DHCPv6 or reverse DNS lookup on this device only when the device has the default route for the given address family (IPv4/IPv6). If set to NM_TERNARY_FALSE (0), the hostname can be set from this device even if it doesn't have the default route. When set to NM_TERNARY_DEFAULT (-1), the value from global configuration is used. If the property doesn't have a value in the global configuration, NetworkManager assumes the value to be NM_TERNARY_FALSE (0)." /> - </setting> - <setting name="infiniband" > - <property name="mac-address" - alias="mac" - description="If specified, this connection will only apply to the IPoIB device whose permanent MAC address matches. This property does not change the MAC address of the device (i.e. MAC spoofing)." /> - <property name="mtu" - alias="mtu" - description="If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple frames." /> - <property name="transport-mode" - alias="transport-mode" - description="The IP-over-InfiniBand transport mode. Either "datagram" or "connected"." /> - <property name="p-key" - alias="p-key" - description="The InfiniBand P_Key to use for this device. A value of -1 means to use the default P_Key (aka "the P_Key at index 0"). Otherwise, it is a 16-bit unsigned integer, whose high bit is set if it is a "full membership" P_Key." /> - <property name="parent" - alias="parent" - description="The interface name of the parent device of this device. Normally NULL, but if the "p_key" property is set, then you must specify the base device by setting either this property or "mac-address"." /> - </setting> - <setting name="ip-tunnel" > - <property name="mode" - alias="mode" - description="The tunneling mode, for example NM_IP_TUNNEL_MODE_IPIP (1) or NM_IP_TUNNEL_MODE_GRE (2)." /> - <property name="parent" - alias="dev" - description="If given, specifies the parent interface name or parent connection UUID the new device will be bound to so that tunneled packets will only be routed via that interface." /> - <property name="local" - alias="local" - description="The local endpoint of the tunnel; the value can be empty, otherwise it must contain an IPv4 or IPv6 address." /> - <property name="remote" - alias="remote" - description="The remote endpoint of the tunnel; the value must contain an IPv4 or IPv6 address." /> - <property name="ttl" - description="The TTL to assign to tunneled packets. 0 is a special value meaning that packets inherit the TTL value." /> - <property name="tos" - description="The type of service (IPv4) or traffic class (IPv6) field to be set on tunneled packets." /> - <property name="path-mtu-discovery" - description="Whether to enable Path MTU Discovery on this tunnel." /> - <property name="input-key" - description="The key used for tunnel input packets; the property is valid only for certain tunnel modes (GRE, IP6GRE). If empty, no key is used." /> - <property name="output-key" - description="The key used for tunnel output packets; the property is valid only for certain tunnel modes (GRE, IP6GRE). If empty, no key is used." /> - <property name="encapsulation-limit" - description="How many additional levels of encapsulation are permitted to be prepended to packets. This property applies only to IPv6 tunnels." /> - <property name="flow-label" - description="The flow label to assign to tunnel packets. This property applies only to IPv6 tunnels." /> - <property name="mtu" - description="If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple fragments." /> - <property name="flags" - description="Tunnel flags. Currently, the following values are supported: NM_IP_TUNNEL_FLAG_IP6_IGN_ENCAP_LIMIT (0x1), NM_IP_TUNNEL_FLAG_IP6_USE_ORIG_TCLASS (0x2), NM_IP_TUNNEL_FLAG_IP6_USE_ORIG_FLOWLABEL (0x4), NM_IP_TUNNEL_FLAG_IP6_MIP6_DEV (0x8), NM_IP_TUNNEL_FLAG_IP6_RCV_DSCP_COPY (0x10), NM_IP_TUNNEL_FLAG_IP6_USE_ORIG_FWMARK (0x20). They are valid only for IPv6 tunnels." /> - </setting> - <setting name="ipv4" > - <property name="method" - description="IP configuration method. NMSettingIP4Config and NMSettingIP6Config both support "disabled", "auto", "manual", and "link-local". See the subclass-specific documentation for other values. In general, for the "auto" method, properties such as "dns" and "routes" specify information that is added on to the information returned from automatic configuration. The "ignore-auto-routes" and "ignore-auto-dns" properties modify this behavior. For methods that imply no upstream network, such as "shared" or "link-local", these properties must be empty. For IPv4 method "shared", the IP subnet can be configured by adding one manual IPv4 address or otherwise 10.42.x.0/24 is chosen. Note that the shared method must be configured on the interface which shares the internet to a subnet, not on the uplink which is shared." /> - <property name="dns" - description="Array of IP addresses of DNS servers." /> - <property name="dns-search" - description="List of DNS search domains. Domains starting with a tilde ('~') are considered 'routing' domains and are used only to decide the interface over which a query must be forwarded; they are not used to complete unqualified host names. When using a DNS plugin that supports Conditional Forwarding or Split DNS, then the search domains specify which name servers to query. This makes the behavior different from running with plain /etc/resolv.conf. For more information see also the dns-priority setting. When set on a profile that also enabled DHCP, the DNS search list received automatically (option 119 for DHCPv4 and option 24 for DHCPv6) gets merged with the manual list. This can be prevented by setting "ignore-auto-dns". Note that if no DNS searches are configured, the fallback will be derived from the domain from DHCP (option 15)." /> - <property name="dns-options" - description="Array of DNS options as described in man 5 resolv.conf. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties. The currently supported options are "attempts", "debug", "edns0", "inet6", "ip6-bytestring", "ip6-dotint", "ndots", "no-check-names", "no-ip6-dotint", "no-reload", "no-tld-query", "rotate", "single-request", "single-request-reopen", "timeout", "trust-ad", "use-vc". The "trust-ad" setting is only honored if the profile contributes name servers to resolv.conf, and if all contributing profiles have "trust-ad" enabled. When using a caching DNS plugin (dnsmasq or systemd-resolved in NetworkManager.conf) then "edns0" and "trust-ad" are automatically added." /> - <property name="dns-priority" - description="DNS servers priority. The relative priority for DNS servers specified by this setting. A lower numerical value is better (higher priority). Negative values have the special effect of excluding other configurations with a greater numerical priority value; so in presence of at least one negative priority, only DNS servers from connections with the lowest priority value will be used. To avoid all DNS leaks, set the priority of the profile that should be used to the most negative value of all active connections profiles. Zero selects a globally configured default value. If the latter is missing or zero too, it defaults to 50 for VPNs (including WireGuard) and 100 for other connections. Note that the priority is to order DNS settings for multiple active connections. It does not disambiguate multiple DNS servers within the same connection profile. When multiple devices have configurations with the same priority, VPNs will be considered first, then devices with the best (lowest metric) default route and then all other devices. When using dns=default, servers with higher priority will be on top of resolv.conf. To prioritize a given server over another one within the same connection, just specify them in the desired order. Note that commonly the resolver tries name servers in /etc/resolv.conf in the order listed, proceeding with the next server in the list on failure. See for example the "rotate" option of the dns-options setting. If there are any negative DNS priorities, then only name servers from the devices with that lowest priority will be considered. When using a DNS resolver that supports Conditional Forwarding or Split DNS (with dns=dnsmasq or dns=systemd-resolved settings), each connection is used to query domains in its search list. The search domains determine which name servers to ask, and the DNS priority is used to prioritize name servers based on the domain. Queries for domains not present in any search list are routed through connections having the '~.' special wildcard domain, which is added automatically to connections with the default route (or can be added manually). When multiple connections specify the same domain, the one with the best priority (lowest numerical value) wins. If a sub domain is configured on another interface it will be accepted regardless the priority, unless parent domain on the other interface has a negative priority, which causes the sub domain to be shadowed. With Split DNS one can avoid undesired DNS leaks by properly configuring DNS priorities and the search domains, so that only name servers of the desired interface are configured." /> - <property name="addresses" - alias="ip4" - description="A list of IPv4 addresses and their prefix length. Multiple addresses can be separated by comma. For example "192.168.1.5/24, 10.1.0.5/24". The addresses are listed in decreasing priority, meaning the first address will be the primary address." /> - <property name="gateway" - alias="gw4" - description="The gateway associated with this configuration. This is only meaningful if "addresses" is also set. Setting the gateway causes NetworkManager to configure a standard default route with the gateway as next hop. This is ignored if "never-default" is set. An alternative is to configure the default route explicitly with a manual route and /0 as prefix length. Note that the gateway usually conflicts with routing that NetworkManager configures for WireGuard interfaces, so usually it should not be set in that case. See "ip4-auto-default-route"." /> - <property name="routes" - description="A list of IPv4 destination addresses, prefix length, optional IPv4 next hop addresses, optional route metric, optional attribute. The valid syntax is: "ip[/prefix] [next-hop] [metric] [attribute=val]...[,ip[/prefix]...]". For example "192.0.2.0/24 10.1.1.1 77, 198.51.100.0/24"." /> - <property name="route-metric" - description="The default metric for routes that don't explicitly specify a metric. The default value -1 means that the metric is chosen automatically based on the device type. The metric applies to dynamic routes, manual (static) routes that don't have an explicit metric setting, address prefix routes, and the default route. Note that for IPv6, the kernel accepts zero (0) but coerces it to 1024 (user default). Hence, setting this property to zero effectively mean setting it to 1024. For IPv4, zero is a regular value for the metric." /> - <property name="route-table" - description="Enable policy routing (source routing) and set the routing table used when adding routes. This affects all routes, including device-routes, IPv4LL, DHCP, SLAAC, default-routes and static routes. But note that static routes can individually overwrite the setting by explicitly specifying a non-zero routing table. If the table setting is left at zero, it is eligible to be overwritten via global configuration. If the property is zero even after applying the global configuration value, policy routing is disabled for the address family of this connection. Policy routing disabled means that NetworkManager will add all routes to the main table (except static routes that explicitly configure a different table). Additionally, NetworkManager will not delete any extraneous routes from tables except the main table. This is to preserve backward compatibility for users who manage routing tables outside of NetworkManager." /> - <property name="routing-rules" /> - <property name="ignore-auto-routes" - description="When "method" is set to "auto" and this property to TRUE, automatically configured routes are ignored and only routes specified in the "routes" property, if any, are used." /> - <property name="ignore-auto-dns" - description="When "method" is set to "auto" and this property to TRUE, automatically configured name servers and search domains are ignored and only name servers and search domains specified in the "dns" and "dns-search" properties, if any, are used." /> - <property name="dhcp-client-id" - description="A string sent to the DHCP server to identify the local machine which the DHCP server may use to customize the DHCP lease and options. When the property is a hex string ('aa:bb:cc') it is interpreted as a binary client ID, in which case the first byte is assumed to be the 'type' field as per RFC 2132 section 9.14 and the remaining bytes may be an hardware address (e.g. '01:xx:xx:xx:xx:xx:xx' where 1 is the Ethernet ARP type and the rest is a MAC address). If the property is not a hex string it is considered as a non-hardware-address client ID and the 'type' field is set to 0. The special values "mac" and "perm-mac" are supported, which use the current or permanent MAC address of the device to generate a client identifier with type ethernet (01). Currently, these options only work for ethernet type of links. The special value "ipv6-duid" uses the DUID from "ipv6.dhcp-duid" property as an RFC4361-compliant client identifier. As IAID it uses "ipv4.dhcp-iaid" and falls back to "ipv6.dhcp-iaid" if unset. The special value "duid" generates a RFC4361-compliant client identifier based on "ipv4.dhcp-iaid" and uses a DUID generated by hashing /etc/machine-id. The special value "stable" is supported to generate a type 0 client identifier based on the stable-id (see connection.stable-id) and a per-host key. If you set the stable-id, you may want to include the "${DEVICE}" or "${MAC}" specifier to get a per-device key. If unset, a globally configured default is used. If still unset, the default depends on the DHCP plugin." /> - <property name="dhcp-iaid" - description="A string containing the "Identity Association Identifier" (IAID) used by the DHCP client. The property is a 32-bit decimal value or a special value among "mac", "perm-mac", "ifname" and "stable". When set to "mac" (or "perm-mac"), the last 4 bytes of the current (or permanent) MAC address are used as IAID. When set to "ifname", the IAID is computed by hashing the interface name. The special value "stable" can be used to generate an IAID based on the stable-id (see connection.stable-id), a per-host key and the interface name. When the property is unset, the value from global configuration is used; if no global default is set then the IAID is assumed to be "ifname". Note that at the moment this property is ignored for IPv6 by dhclient, which always derives the IAID from the MAC address." /> - <property name="dhcp-timeout" - description="A timeout for a DHCP transaction in seconds. If zero (the default), a globally configured default is used. If still unspecified, a device specific timeout is used (usually 45 seconds). Set to 2147483647 (MAXINT32) for infinity." /> - <property name="dhcp-send-hostname" - description="If TRUE, a hostname is sent to the DHCP server when acquiring a lease. Some DHCP servers use this hostname to update DNS databases, essentially providing a static hostname for the computer. If the "dhcp-hostname" property is NULL and this property is TRUE, the current persistent hostname of the computer is sent." /> - <property name="dhcp-hostname" - description="If the "dhcp-send-hostname" property is TRUE, then the specified name will be sent to the DHCP server when acquiring a lease. This property and "dhcp-fqdn" are mutually exclusive and cannot be set at the same time." /> - <property name="dhcp-fqdn" - description="If the "dhcp-send-hostname" property is TRUE, then the specified FQDN will be sent to the DHCP server when acquiring a lease. This property and "dhcp-hostname" are mutually exclusive and cannot be set at the same time." /> - <property name="dhcp-hostname-flags" - description="Flags for the DHCP hostname and FQDN. Currently, this property only includes flags to control the FQDN flags set in the DHCP FQDN option. Supported FQDN flags are NM_DHCP_HOSTNAME_FLAG_FQDN_SERV_UPDATE (0x1), NM_DHCP_HOSTNAME_FLAG_FQDN_ENCODED (0x2) and NM_DHCP_HOSTNAME_FLAG_FQDN_NO_UPDATE (0x4). When no FQDN flag is set and NM_DHCP_HOSTNAME_FLAG_FQDN_CLEAR_FLAGS (0x8) is set, the DHCP FQDN option will contain no flag. Otherwise, if no FQDN flag is set and NM_DHCP_HOSTNAME_FLAG_FQDN_CLEAR_FLAGS (0x8) is not set, the standard FQDN flags are set in the request: NM_DHCP_HOSTNAME_FLAG_FQDN_SERV_UPDATE (0x1), NM_DHCP_HOSTNAME_FLAG_FQDN_ENCODED (0x2) for IPv4 and NM_DHCP_HOSTNAME_FLAG_FQDN_SERV_UPDATE (0x1) for IPv6. When this property is set to the default value NM_DHCP_HOSTNAME_FLAG_NONE (0x0), a global default is looked up in NetworkManager configuration. If that value is unset or also NM_DHCP_HOSTNAME_FLAG_NONE (0x0), then the standard FQDN flags described above are sent in the DHCP requests." /> - <property name="never-default" - description="If TRUE, this connection will never be the default connection for this IP type, meaning it will never be assigned the default route by NetworkManager." /> - <property name="may-fail" - description="If TRUE, allow overall network configuration to proceed even if the configuration specified by this property times out. Note that at least one IP configuration must succeed or overall network configuration will still fail. For example, in IPv6-only networks, setting this property to TRUE on the NMSettingIP4Config allows the overall network configuration to succeed if IPv4 configuration fails but IPv6 configuration completes successfully." /> - <property name="required-timeout" - description="The minimum time interval in milliseconds for which dynamic IP configuration should be tried before the connection succeeds. This property is useful for example if both IPv4 and IPv6 are enabled and are allowed to fail. Normally the connection succeeds as soon as one of the two address families completes; by setting a required timeout for e.g. IPv4, one can ensure that even if IP6 succeeds earlier than IPv4, NetworkManager waits some time for IPv4 before the connection becomes active. Note that if "may-fail" is FALSE for the same address family, this property has no effect as NetworkManager needs to wait for the full DHCP timeout. A zero value means that no required timeout is present, -1 means the default value (either configuration ipvx.required-timeout override or zero)." /> - <property name="dad-timeout" - description="Timeout in milliseconds used to check for the presence of duplicate IP addresses on the network. If an address conflict is detected, the activation will fail. A zero value means that no duplicate address detection is performed, -1 means the default value (either configuration ipvx.dad-timeout override or zero). A value greater than zero is a timeout in milliseconds. The property is currently implemented only for IPv4." /> - <property name="dhcp-vendor-class-identifier" - description="The Vendor Class Identifier DHCP option (60). Special characters in the data string may be escaped using C-style escapes, nevertheless this property cannot contain nul bytes. If the per-profile value is unspecified (the default), a global connection default gets consulted. If still unspecified, the DHCP option is not sent to the server." /> - <property name="link-local" - description="Enable and disable the IPv4 link-local configuration independently of the ipv4.method configuration. This allows a link-local address (169.254.x.y/16) to be obtained in addition to other addresses, such as those manually configured or obtained from a DHCP server. When set to "auto", the value is dependent on "ipv4.method". When set to "default", it honors the global connection default, before falling back to "auto". Note that if "ipv4.method" is "disabled", then link local addressing is always disabled too. The default is "default"." /> - <property name="dhcp-reject-servers" - description="Array of servers from which DHCP offers must be rejected. This property is useful to avoid getting a lease from misconfigured or rogue servers. For DHCPv4, each element must be an IPv4 address, optionally followed by a slash and a prefix length (e.g. "192.168.122.0/24"). This property is currently not implemented for DHCPv6." /> - </setting> - <setting name="ipv6" > - <property name="method" - description="IP configuration method. NMSettingIP4Config and NMSettingIP6Config both support "disabled", "auto", "manual", and "link-local". See the subclass-specific documentation for other values. In general, for the "auto" method, properties such as "dns" and "routes" specify information that is added on to the information returned from automatic configuration. The "ignore-auto-routes" and "ignore-auto-dns" properties modify this behavior. For methods that imply no upstream network, such as "shared" or "link-local", these properties must be empty. For IPv4 method "shared", the IP subnet can be configured by adding one manual IPv4 address or otherwise 10.42.x.0/24 is chosen. Note that the shared method must be configured on the interface which shares the internet to a subnet, not on the uplink which is shared." /> - <property name="dns" - description="Array of IP addresses of DNS servers." /> - <property name="dns-search" - description="List of DNS search domains. Domains starting with a tilde ('~') are considered 'routing' domains and are used only to decide the interface over which a query must be forwarded; they are not used to complete unqualified host names. When using a DNS plugin that supports Conditional Forwarding or Split DNS, then the search domains specify which name servers to query. This makes the behavior different from running with plain /etc/resolv.conf. For more information see also the dns-priority setting. When set on a profile that also enabled DHCP, the DNS search list received automatically (option 119 for DHCPv4 and option 24 for DHCPv6) gets merged with the manual list. This can be prevented by setting "ignore-auto-dns". Note that if no DNS searches are configured, the fallback will be derived from the domain from DHCP (option 15)." /> - <property name="dns-options" - description="Array of DNS options as described in man 5 resolv.conf. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties. The currently supported options are "attempts", "debug", "edns0", "inet6", "ip6-bytestring", "ip6-dotint", "ndots", "no-check-names", "no-ip6-dotint", "no-reload", "no-tld-query", "rotate", "single-request", "single-request-reopen", "timeout", "trust-ad", "use-vc". The "trust-ad" setting is only honored if the profile contributes name servers to resolv.conf, and if all contributing profiles have "trust-ad" enabled. When using a caching DNS plugin (dnsmasq or systemd-resolved in NetworkManager.conf) then "edns0" and "trust-ad" are automatically added." /> - <property name="dns-priority" - description="DNS servers priority. The relative priority for DNS servers specified by this setting. A lower numerical value is better (higher priority). Negative values have the special effect of excluding other configurations with a greater numerical priority value; so in presence of at least one negative priority, only DNS servers from connections with the lowest priority value will be used. To avoid all DNS leaks, set the priority of the profile that should be used to the most negative value of all active connections profiles. Zero selects a globally configured default value. If the latter is missing or zero too, it defaults to 50 for VPNs (including WireGuard) and 100 for other connections. Note that the priority is to order DNS settings for multiple active connections. It does not disambiguate multiple DNS servers within the same connection profile. When multiple devices have configurations with the same priority, VPNs will be considered first, then devices with the best (lowest metric) default route and then all other devices. When using dns=default, servers with higher priority will be on top of resolv.conf. To prioritize a given server over another one within the same connection, just specify them in the desired order. Note that commonly the resolver tries name servers in /etc/resolv.conf in the order listed, proceeding with the next server in the list on failure. See for example the "rotate" option of the dns-options setting. If there are any negative DNS priorities, then only name servers from the devices with that lowest priority will be considered. When using a DNS resolver that supports Conditional Forwarding or Split DNS (with dns=dnsmasq or dns=systemd-resolved settings), each connection is used to query domains in its search list. The search domains determine which name servers to ask, and the DNS priority is used to prioritize name servers based on the domain. Queries for domains not present in any search list are routed through connections having the '~.' special wildcard domain, which is added automatically to connections with the default route (or can be added manually). When multiple connections specify the same domain, the one with the best priority (lowest numerical value) wins. If a sub domain is configured on another interface it will be accepted regardless the priority, unless parent domain on the other interface has a negative priority, which causes the sub domain to be shadowed. With Split DNS one can avoid undesired DNS leaks by properly configuring DNS priorities and the search domains, so that only name servers of the desired interface are configured." /> - <property name="addresses" - alias="ip6" - description="A list of IPv6 addresses and their prefix length. Multiple addresses can be separated by comma. For example "2001:db8:85a3::8a2e:370:7334/64, 2001:db8:85a3::5/64". The addresses are listed in decreasing priority, meaning the first address will be the primary address. This can make a difference with IPv6 source address selection (RFC 6724, section 5)." /> - <property name="gateway" - alias="gw6" - description="The gateway associated with this configuration. This is only meaningful if "addresses" is also set. Setting the gateway causes NetworkManager to configure a standard default route with the gateway as next hop. This is ignored if "never-default" is set. An alternative is to configure the default route explicitly with a manual route and /0 as prefix length. Note that the gateway usually conflicts with routing that NetworkManager configures for WireGuard interfaces, so usually it should not be set in that case. See "ip4-auto-default-route"." /> - <property name="routes" - description="Array of IP routes." /> - <property name="route-metric" - description="The default metric for routes that don't explicitly specify a metric. The default value -1 means that the metric is chosen automatically based on the device type. The metric applies to dynamic routes, manual (static) routes that don't have an explicit metric setting, address prefix routes, and the default route. Note that for IPv6, the kernel accepts zero (0) but coerces it to 1024 (user default). Hence, setting this property to zero effectively mean setting it to 1024. For IPv4, zero is a regular value for the metric." /> - <property name="route-table" - description="Enable policy routing (source routing) and set the routing table used when adding routes. This affects all routes, including device-routes, IPv4LL, DHCP, SLAAC, default-routes and static routes. But note that static routes can individually overwrite the setting by explicitly specifying a non-zero routing table. If the table setting is left at zero, it is eligible to be overwritten via global configuration. If the property is zero even after applying the global configuration value, policy routing is disabled for the address family of this connection. Policy routing disabled means that NetworkManager will add all routes to the main table (except static routes that explicitly configure a different table). Additionally, NetworkManager will not delete any extraneous routes from tables except the main table. This is to preserve backward compatibility for users who manage routing tables outside of NetworkManager." /> - <property name="routing-rules" /> - <property name="ignore-auto-routes" - description="When "method" is set to "auto" and this property to TRUE, automatically configured routes are ignored and only routes specified in the "routes" property, if any, are used." /> - <property name="ignore-auto-dns" - description="When "method" is set to "auto" and this property to TRUE, automatically configured name servers and search domains are ignored and only name servers and search domains specified in the "dns" and "dns-search" properties, if any, are used." /> - <property name="never-default" - description="If TRUE, this connection will never be the default connection for this IP type, meaning it will never be assigned the default route by NetworkManager." /> - <property name="may-fail" - description="If TRUE, allow overall network configuration to proceed even if the configuration specified by this property times out. Note that at least one IP configuration must succeed or overall network configuration will still fail. For example, in IPv6-only networks, setting this property to TRUE on the NMSettingIP4Config allows the overall network configuration to succeed if IPv4 configuration fails but IPv6 configuration completes successfully." /> - <property name="required-timeout" - description="The minimum time interval in milliseconds for which dynamic IP configuration should be tried before the connection succeeds. This property is useful for example if both IPv4 and IPv6 are enabled and are allowed to fail. Normally the connection succeeds as soon as one of the two address families completes; by setting a required timeout for e.g. IPv4, one can ensure that even if IP6 succeeds earlier than IPv4, NetworkManager waits some time for IPv4 before the connection becomes active. Note that if "may-fail" is FALSE for the same address family, this property has no effect as NetworkManager needs to wait for the full DHCP timeout. A zero value means that no required timeout is present, -1 means the default value (either configuration ipvx.required-timeout override or zero)." /> - <property name="ip6-privacy" - description="Configure IPv6 Privacy Extensions for SLAAC, described in RFC4941. If enabled, it makes the kernel generate a temporary IPv6 address in addition to the public one generated from MAC address via modified EUI-64. This enhances privacy, but could cause problems in some applications, on the other hand. The permitted values are: -1: unknown, 0: disabled, 1: enabled (prefer public address), 2: enabled (prefer temporary addresses). Having a per-connection setting set to "-1" (unknown) means fallback to global configuration "ipv6.ip6-privacy". If also global configuration is unspecified or set to "-1", fallback to read "/proc/sys/net/ipv6/conf/default/use_tempaddr". Note that this setting is distinct from the Stable Privacy addresses that can be enabled with the "addr-gen-mode" property's "stable-privacy" setting as another way of avoiding host tracking with IPv6 addresses." /> - <property name="addr-gen-mode" - description="Configure method for creating the address for use with RFC4862 IPv6 Stateless Address Autoconfiguration. The permitted values are: NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64 (0), NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY (1). NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT_OR_EUI64 (2) or NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT (3). If the property is set to EUI64, the addresses will be generated using the interface tokens derived from hardware address. This makes the host part of the address to stay constant, making it possible to track host's presence when it changes networks. The address changes when the interface hardware is replaced. The value of stable-privacy enables use of cryptographically secure hash of a secret host-specific key along with the connection's stable-id and the network address as specified by RFC7217. This makes it impossible to use the address track host's presence, and makes the address stable when the network interface hardware is replaced. The special values "default" and "default-or-eui64" will fallback to the global connection default in as documented in NetworkManager.conf(5) manual. If the global default is not specified, the fallback value is "stable-privacy" or "eui64", respectively. For libnm, the property defaults to "default" since 1.40. Previously it defaulted to "stable-privacy". On D-Bus, the absence of an addr-gen-mode setting equals "default". For keyfile plugin, the absence of the setting on disk means "default-or-eui64" so that the property doesn't change on upgrade from older versions. Note that this setting is distinct from the Privacy Extensions as configured by "ip6-privacy" property and it does not affect the temporary addresses configured with this option." /> - <property name="ra-timeout" - description="A timeout for waiting Router Advertisements in seconds. If zero (the default), a globally configured default is used. If still unspecified, the timeout depends on the sysctl settings of the device. Set to 2147483647 (MAXINT32) for infinity." /> - <property name="mtu" - description="Maximum transmission unit size, in bytes. If zero (the default), the MTU is set automatically from router advertisements or is left equal to the link-layer MTU. If greater than the link-layer MTU, or greater than zero but less than the minimum IPv6 MTU of 1280, this value has no effect." /> - <property name="dhcp-duid" - description="A string containing the DHCPv6 Unique Identifier (DUID) used by the dhcp client to identify itself to DHCPv6 servers (RFC 3315). The DUID is carried in the Client Identifier option. If the property is a hex string ('aa:bb:cc') it is interpreted as a binary DUID and filled as an opaque value in the Client Identifier option. The special value "lease" will retrieve the DUID previously used from the lease file belonging to the connection. If no DUID is found and "dhclient" is the configured dhcp client, the DUID is searched in the system-wide dhclient lease file. If still no DUID is found, or another dhcp client is used, a global and permanent DUID-UUID (RFC 6355) will be generated based on the machine-id. The special values "llt" and "ll" will generate a DUID of type LLT or LL (see RFC 3315) based on the current MAC address of the device. In order to try providing a stable DUID-LLT, the time field will contain a constant timestamp that is used globally (for all profiles) and persisted to disk. The special values "stable-llt", "stable-ll" and "stable-uuid" will generate a DUID of the corresponding type, derived from the connection's stable-id and a per-host unique key. You may want to include the "${DEVICE}" or "${MAC}" specifier in the stable-id, in case this profile gets activated on multiple devices. So, the link-layer address of "stable-ll" and "stable-llt" will be a generated address derived from the stable id. The DUID-LLT time value in the "stable-llt" option will be picked among a static timespan of three years (the upper bound of the interval is the same constant timestamp used in "llt"). When the property is unset, the global value provided for "ipv6.dhcp-duid" is used. If no global value is provided, the default "lease" value is assumed." /> - <property name="dhcp-iaid" - description="A string containing the "Identity Association Identifier" (IAID) used by the DHCP client. The property is a 32-bit decimal value or a special value among "mac", "perm-mac", "ifname" and "stable". When set to "mac" (or "perm-mac"), the last 4 bytes of the current (or permanent) MAC address are used as IAID. When set to "ifname", the IAID is computed by hashing the interface name. The special value "stable" can be used to generate an IAID based on the stable-id (see connection.stable-id), a per-host key and the interface name. When the property is unset, the value from global configuration is used; if no global default is set then the IAID is assumed to be "ifname". Note that at the moment this property is ignored for IPv6 by dhclient, which always derives the IAID from the MAC address." /> - <property name="dhcp-timeout" - description="A timeout for a DHCP transaction in seconds. If zero (the default), a globally configured default is used. If still unspecified, a device specific timeout is used (usually 45 seconds). Set to 2147483647 (MAXINT32) for infinity." /> - <property name="dhcp-send-hostname" - description="If TRUE, a hostname is sent to the DHCP server when acquiring a lease. Some DHCP servers use this hostname to update DNS databases, essentially providing a static hostname for the computer. If the "dhcp-hostname" property is NULL and this property is TRUE, the current persistent hostname of the computer is sent." /> - <property name="dhcp-hostname" - description="If the "dhcp-send-hostname" property is TRUE, then the specified name will be sent to the DHCP server when acquiring a lease. This property and "dhcp-fqdn" are mutually exclusive and cannot be set at the same time." /> - <property name="dhcp-hostname-flags" - description="Flags for the DHCP hostname and FQDN. Currently, this property only includes flags to control the FQDN flags set in the DHCP FQDN option. Supported FQDN flags are NM_DHCP_HOSTNAME_FLAG_FQDN_SERV_UPDATE (0x1), NM_DHCP_HOSTNAME_FLAG_FQDN_ENCODED (0x2) and NM_DHCP_HOSTNAME_FLAG_FQDN_NO_UPDATE (0x4). When no FQDN flag is set and NM_DHCP_HOSTNAME_FLAG_FQDN_CLEAR_FLAGS (0x8) is set, the DHCP FQDN option will contain no flag. Otherwise, if no FQDN flag is set and NM_DHCP_HOSTNAME_FLAG_FQDN_CLEAR_FLAGS (0x8) is not set, the standard FQDN flags are set in the request: NM_DHCP_HOSTNAME_FLAG_FQDN_SERV_UPDATE (0x1), NM_DHCP_HOSTNAME_FLAG_FQDN_ENCODED (0x2) for IPv4 and NM_DHCP_HOSTNAME_FLAG_FQDN_SERV_UPDATE (0x1) for IPv6. When this property is set to the default value NM_DHCP_HOSTNAME_FLAG_NONE (0x0), a global default is looked up in NetworkManager configuration. If that value is unset or also NM_DHCP_HOSTNAME_FLAG_NONE (0x0), then the standard FQDN flags described above are sent in the DHCP requests." /> - <property name="token" - description="Configure the token for draft-chown-6man-tokenised-ipv6-identifiers-02 IPv6 tokenized interface identifiers. Useful with eui64 addr-gen-mode." /> - </setting> - <setting name="macsec" > - <property name="parent" - alias="dev" - description="If given, specifies the parent interface name or parent connection UUID from which this MACSEC interface should be created. If this property is not specified, the connection must contain an "802-3-ethernet" setting with a "mac-address" property." /> - <property name="mode" - alias="mode" - description="Specifies how the CAK (Connectivity Association Key) for MKA (MACsec Key Agreement) is obtained." /> - <property name="encrypt" - alias="encrypt" - description="Whether the transmitted traffic must be encrypted." /> - <property name="mka-cak" - alias="cak" - description="The pre-shared CAK (Connectivity Association Key) for MACsec Key Agreement. Must be a string of 32 hexadecimal characters." /> - <property name="mka-cak-flags" - description="Flags indicating how to handle the "mka-cak" property." /> - <property name="mka-ckn" - alias="ckn" - description="The pre-shared CKN (Connectivity-association Key Name) for MACsec Key Agreement. Must be a string of hexadecimal characters with a even length between 2 and 64." /> - <property name="port" - alias="port" - description="The port component of the SCI (Secure Channel Identifier), between 1 and 65534." /> - <property name="validation" - description="Specifies the validation mode for incoming frames." /> - <property name="send-sci" - description="Specifies whether the SCI (Secure Channel Identifier) is included in every packet." /> - </setting> - <setting name="macvlan" > - <property name="parent" - alias="dev" - description="If given, specifies the parent interface name or parent connection UUID from which this MAC-VLAN interface should be created. If this property is not specified, the connection must contain an "802-3-ethernet" setting with a "mac-address" property." /> - <property name="mode" - alias="mode" - description="The macvlan mode, which specifies the communication mechanism between multiple macvlans on the same lower device." /> - <property name="promiscuous" - description="Whether the interface should be put in promiscuous mode." /> - <property name="tap" - alias="tap" - description="Whether the interface should be a MACVTAP." /> - </setting> - <setting name="match" > - <property name="interface-name" - description="A list of interface names to match. Each element is a shell wildcard pattern. An element can be prefixed with a pipe symbol (|) or an ampersand (&). The former means that the element is optional and the latter means that it is mandatory. If there are any optional elements, than the match evaluates to true if at least one of the optional element matches (logical OR). If there are any mandatory elements, then they all must match (logical AND). By default, an element is optional. This means that an element "foo" behaves the same as "|foo". An element can also be inverted with exclamation mark (!) between the pipe symbol (or the ampersand) and before the pattern. Note that "!foo" is a shortcut for the mandatory match "&!foo". Finally, a backslash can be used at the beginning of the element (after the optional special characters) to escape the start of the pattern. For example, "&\!a" is an mandatory match for literally "!a"." /> - <property name="kernel-command-line" - description="A list of kernel command line arguments to match. This may be used to check whether a specific kernel command line option is set (or unset, if prefixed with the exclamation mark). The argument must either be a single word, or an assignment (i.e. two words, joined by "="). In the former case the kernel command line is searched for the word appearing as is, or as left hand side of an assignment. In the latter case, the exact assignment is looked for with right and left hand side matching. Wildcard patterns are not supported. See NMSettingMatch:interface-name for how special characters '|', '&', '!' and '\' are used for optional and mandatory matches and inverting the match." /> - <property name="driver" - description="A list of driver names to match. Each element is a shell wildcard pattern. See NMSettingMatch:interface-name for how special characters '|', '&', '!' and '\' are used for optional and mandatory matches and inverting the pattern." /> - <property name="path" - description="A list of paths to match against the ID_PATH udev property of devices. ID_PATH represents the topological persistent path of a device. It typically contains a subsystem string (pci, usb, platform, etc.) and a subsystem-specific identifier. For PCI devices the path has the form "pci-$domain:$bus:$device.$function", where each variable is an hexadecimal value; for example "pci-0000:0a:00.0". The path of a device can be obtained with "udevadm info /sys/class/net/$dev | grep ID_PATH=" or by looking at the "path" property exported by NetworkManager ("nmcli -f general.path device show $dev"). Each element of the list is a shell wildcard pattern. See NMSettingMatch:interface-name for how special characters '|', '&', '!' and '\' are used for optional and mandatory matches and inverting the pattern." /> - </setting> - <setting name="ovs-bridge" > - <property name="fail-mode" - description="The bridge failure mode. One of "secure", "standalone" or empty." /> - <property name="mcast-snooping-enable" - description="Enable or disable multicast snooping." /> - <property name="rstp-enable" - description="Enable or disable RSTP." /> - <property name="stp-enable" - description="Enable or disable STP." /> - <property name="datapath-type" - description="The data path type. One of "system", "netdev" or empty." /> - </setting> - <setting name="ovs-dpdk" > - <property name="devargs" - description="Open vSwitch DPDK device arguments." /> - <property name="n-rxq" - description="Open vSwitch DPDK number of rx queues. Defaults to zero which means to leave the parameter in OVS unspecified and effectively configures one queue." /> - </setting> - <setting name="ovs-external-ids" > - </setting> - <setting name="ovs-interface" > - <property name="type" - description="The interface type. Either "internal", "system", "patch", "dpdk", or empty." /> - </setting> - <setting name="ovs-patch" > - <property name="peer" - description="Specifies the name of the interface for the other side of the patch. The patch on the other side must also set this interface as peer." /> - </setting> - <setting name="ovs-port" > - <property name="vlan-mode" - description="The VLAN mode. One of "access", "native-tagged", "native-untagged", "trunk" or unset." /> - <property name="tag" - description="The VLAN tag in the range 0-4095." /> - <property name="lacp" - description="LACP mode. One of "active", "off", or "passive"." /> - <property name="bond-mode" - description="Bonding mode. One of "active-backup", "balance-slb", or "balance-tcp"." /> - <property name="bond-updelay" - description="The time port must be active before it starts forwarding traffic." /> - <property name="bond-downdelay" - description="The time port must be inactive in order to be considered down." /> - </setting> - <setting name="ppp" > - <property name="noauth" - description="If TRUE, do not require the other side (usually the PPP server) to authenticate itself to the client. If FALSE, require authentication from the remote side. In almost all cases, this should be TRUE." /> - <property name="refuse-eap" - description="If TRUE, the EAP authentication method will not be used." /> - <property name="refuse-pap" - description="If TRUE, the PAP authentication method will not be used." /> - <property name="refuse-chap" - description="If TRUE, the CHAP authentication method will not be used." /> - <property name="refuse-mschap" - description="If TRUE, the MSCHAP authentication method will not be used." /> - <property name="refuse-mschapv2" - description="If TRUE, the MSCHAPv2 authentication method will not be used." /> - <property name="nobsdcomp" - description="If TRUE, BSD compression will not be requested." /> - <property name="nodeflate" - description="If TRUE, "deflate" compression will not be requested." /> - <property name="no-vj-comp" - description="If TRUE, Van Jacobsen TCP header compression will not be requested." /> - <property name="require-mppe" - description="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." /> - <property name="require-mppe-128" - description="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." /> - <property name="mppe-stateful" - description="If TRUE, stateful MPPE is used. See pppd documentation for more information on stateful MPPE." /> - <property name="crtscts" - description="If TRUE, specify that pppd should set the serial port to use hardware flow control with RTS and CTS signals. This value should normally be set to FALSE." /> - <property name="baud" - description="If non-zero, instruct pppd to set the serial port to the specified baudrate. This value should normally be left as 0 to automatically choose the speed." /> - <property name="mru" - description="If non-zero, instruct pppd to request that the peer send packets no larger than the specified size. If non-zero, the MRU should be between 128 and 16384." /> - <property name="mtu" - description="If non-zero, instruct pppd to send packets no larger than the specified size." /> - <property name="lcp-echo-failure" - description="If non-zero, instruct pppd to presume the connection to the peer has failed if the specified number of LCP echo-requests go unanswered by the peer. The "lcp-echo-interval" property must also be set to a non-zero value if this property is used." /> - <property name="lcp-echo-interval" - description="If non-zero, instruct pppd to send an LCP echo-request frame to the peer every n seconds (where n is the specified value). Note that some PPP peers will respond to echo requests and some will not, and it is not possible to autodetect this." /> - </setting> - <setting name="pppoe" > - <property name="parent" - alias="parent" - description="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." /> - <property name="service" - alias="service" - description="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." /> - <property name="username" - alias="username" - description="Username used to authenticate with the PPPoE service." /> - <property name="password" - alias="password" - description="Password used to authenticate with the PPPoE service." /> - <property name="password-flags" - description="Flags indicating how to handle the "password" property." /> - </setting> - <setting name="proxy" > - <property name="method" - alias="method" - description="Method for proxy configuration, Default is NM_SETTING_PROXY_METHOD_NONE (0)" /> - <property name="browser-only" - alias="browser-only" - description="Whether the proxy configuration is for browser only." /> - <property name="pac-url" - alias="pac-url" - description="PAC URL for obtaining PAC file." /> - <property name="pac-script" - alias="pac-script" - description="The PAC script. In the profile this must be an UTF-8 encoded javascript code that defines a FindProxyForURL() function. When setting the property in nmcli, a filename is accepted too. In that case, nmcli will read the content of the file and set the script. The prefixes "file://" and "js://" are supported to explicitly differentiate between the two." /> - </setting> - <setting name="serial" > - <property name="baud" - description="Speed to use for communication over the serial port. Note that this value usually has no effect for mobile broadband modems as they generally ignore speed settings and use the highest available speed." /> - <property name="bits" - description="Byte-width of the serial communication. The 8 in "8n1" for example." /> - <property name="parity" - description="Parity setting of the serial port." /> - <property name="stopbits" - description="Number of stop bits for communication on the serial port. Either 1 or 2. The 1 in "8n1" for example." /> - <property name="send-delay" - description="Time to delay between each byte sent to the modem, in microseconds." /> - </setting> - <setting name="sriov" > - <property name="total-vfs" - description="The total number of virtual functions to create. Note that when the sriov setting is present NetworkManager enforces the number of virtual functions on the interface (also when it is zero) during activation and resets it upon deactivation. To prevent any changes to SR-IOV parameters don't add a sriov setting to the connection." /> - <property name="vfs" - description="Array of virtual function descriptors. Each VF descriptor is a dictionary mapping attribute names to GVariant values. The 'index' entry is mandatory for each VF. When represented as string a VF is in the form: "INDEX [ATTR=VALUE[ ATTR=VALUE]...]". for example: "2 mac=00:11:22:33:44:55 spoof-check=true". Multiple VFs can be specified using a comma as separator. Currently, the following attributes are supported: mac, spoof-check, trust, min-tx-rate, max-tx-rate, vlans. The "vlans" attribute is represented as a semicolon-separated list of VLAN descriptors, where each descriptor has the form "ID[.PRIORITY[.PROTO]]". PROTO can be either 'q' for 802.1Q (the default) or 'ad' for 802.1ad." /> - <property name="autoprobe-drivers" - description="Whether to autoprobe virtual functions by a compatible driver. If set to NM_TERNARY_TRUE (1), the kernel will try to bind VFs to a compatible driver and if this succeeds a new network interface will be instantiated for each VF. If set to NM_TERNARY_FALSE (0), VFs will not be claimed and no network interfaces will be created for them. When set to NM_TERNARY_DEFAULT (-1), the global default is used; in case the global default is unspecified it is assumed to be NM_TERNARY_TRUE (1)." /> - </setting> - <setting name="tc" > - <property name="qdiscs" - description="Array of TC queueing disciplines. When the "tc" setting is present, qdiscs from this property are applied upon activation. If the property is empty, all qdiscs are removed and the device will only have the default qdisc assigned by kernel according to the "net.core.default_qdisc" sysctl. If the "tc" setting is not present, NetworkManager doesn't touch the qdiscs present on the interface." /> - <property name="tfilters" - description="Array of TC traffic filters. When the "tc" setting is present, filters from this property are applied upon activation. If the property is empty, NetworkManager removes all the filters. If the "tc" setting is not present, NetworkManager doesn't touch the filters present on the interface." /> - </setting> - <setting name="team" > - <property name="config" - alias="config" - description="The JSON configuration for the team network interface. The property should contain raw JSON configuration data suitable for teamd, because the value is passed directly to teamd. If not specified, the default configuration is used. See man teamd.conf for the format details." /> - <property name="notify-peers-count" - description="Corresponds to the teamd notify_peers.count." /> - <property name="notify-peers-interval" - description="Corresponds to the teamd notify_peers.interval." /> - <property name="mcast-rejoin-count" - description="Corresponds to the teamd mcast_rejoin.count." /> - <property name="mcast-rejoin-interval" - description="Corresponds to the teamd mcast_rejoin.interval." /> - <property name="runner" - description="Corresponds to the teamd runner.name. Permitted values are: "roundrobin", "broadcast", "activebackup", "loadbalance", "lacp", "random"." /> - <property name="runner-hwaddr-policy" - description="Corresponds to the teamd runner.hwaddr_policy." /> - <property name="runner-tx-hash" - description="Corresponds to the teamd runner.tx_hash." /> - <property name="runner-tx-balancer" - description="Corresponds to the teamd runner.tx_balancer.name." /> - <property name="runner-tx-balancer-interval" - description="Corresponds to the teamd runner.tx_balancer.interval." /> - <property name="runner-active" - description="Corresponds to the teamd runner.active." /> - <property name="runner-fast-rate" - description="Corresponds to the teamd runner.fast_rate." /> - <property name="runner-sys-prio" - description="Corresponds to the teamd runner.sys_prio." /> - <property name="runner-min-ports" - description="Corresponds to the teamd runner.min_ports." /> - <property name="runner-agg-select-policy" - description="Corresponds to the teamd runner.agg_select_policy." /> - <property name="link-watchers" - description="Link watchers configuration for the connection: each link watcher is defined by a dictionary, whose keys depend upon the selected link watcher. Available link watchers are 'ethtool', 'nsna_ping' and 'arp_ping' and it is specified in the dictionary with the key 'name'. Available keys are: ethtool: 'delay-up', 'delay-down', 'init-wait'; nsna_ping: 'init-wait', 'interval', 'missed-max', 'target-host'; arp_ping: all the ones in nsna_ping and 'source-host', 'validate-active', 'validate-inactive', 'send-always'. See teamd.conf man for more details." /> - </setting> - <setting name="team-port" > - <property name="config" - alias="config" - description="The JSON configuration for the team port. The property should contain raw JSON configuration data suitable for teamd, because the value is passed directly to teamd. If not specified, the default configuration is used. See man teamd.conf for the format details." /> - <property name="queue-id" - description="Corresponds to the teamd ports.PORTIFNAME.queue_id. When set to -1 means the parameter is skipped from the json config." /> - <property name="prio" - description="Corresponds to the teamd ports.PORTIFNAME.prio." /> - <property name="sticky" - description="Corresponds to the teamd ports.PORTIFNAME.sticky." /> - <property name="lacp-prio" - description="Corresponds to the teamd ports.PORTIFNAME.lacp_prio." /> - <property name="lacp-key" - description="Corresponds to the teamd ports.PORTIFNAME.lacp_key." /> - <property name="link-watchers" - description="Link watchers configuration for the connection: each link watcher is defined by a dictionary, whose keys depend upon the selected link watcher. Available link watchers are 'ethtool', 'nsna_ping' and 'arp_ping' and it is specified in the dictionary with the key 'name'. Available keys are: ethtool: 'delay-up', 'delay-down', 'init-wait'; nsna_ping: 'init-wait', 'interval', 'missed-max', 'target-host'; arp_ping: all the ones in nsna_ping and 'source-host', 'validate-active', 'validate-inactive', 'send-always'. See teamd.conf man for more details." /> - </setting> - <setting name="tun" > - <property name="mode" - alias="mode" - description="The operating mode of the virtual device. Allowed values are NM_SETTING_TUN_MODE_TUN (1) to create a layer 3 device and NM_SETTING_TUN_MODE_TAP (2) to create an Ethernet-like layer 2 one." /> - <property name="owner" - alias="owner" - description="The user ID which will own the device. If set to NULL everyone will be able to use the device." /> - <property name="group" - alias="group" - description="The group ID which will own the device. If set to NULL everyone will be able to use the device." /> - <property name="pi" - alias="pi" - description="If TRUE the interface will prepend a 4 byte header describing the physical interface to the packets." /> - <property name="vnet-hdr" - alias="vnet-hdr" - description="If TRUE the IFF_VNET_HDR the tunnel packets will include a virtio network header." /> - <property name="multi-queue" - alias="multi-queue" - description="If the property is set to TRUE, the interface will support multiple file descriptors (queues) to parallelize packet sending or receiving. Otherwise, the interface will only support a single queue." /> - </setting> - <setting name="user" > - </setting> - <setting name="veth" > - <property name="peer" - alias="peer" - description="This property specifies the peer interface name of the veth. This property is mandatory." /> - </setting> - <setting name="vlan" > - <property name="parent" - alias="dev" - description="If given, specifies the parent interface name or parent connection UUID from which this VLAN interface should be created. If this property is not specified, the connection must contain an "802-3-ethernet" setting with a "mac-address" property." /> - <property name="id" - alias="id" - description="The VLAN identifier that the interface created by this connection should be assigned. The valid range is from 0 to 4094, without the reserved id 4095." /> - <property name="flags" - alias="flags" - description="One or more flags which control the behavior and features of the VLAN interface. Flags include NM_VLAN_FLAG_REORDER_HEADERS (0x1) (reordering of output packet headers), NM_VLAN_FLAG_GVRP (0x2) (use of the GVRP protocol), and NM_VLAN_FLAG_LOOSE_BINDING (0x4) (loose binding of the interface to its master device's operating state). NM_VLAN_FLAG_MVRP (0x8) (use of the MVRP protocol). The default value of this property is NM_VLAN_FLAG_REORDER_HEADERS, but it used to be 0. To preserve backward compatibility, the default-value in the D-Bus API continues to be 0 and a missing property on D-Bus is still considered as 0." /> - <property name="ingress-priority-map" - alias="ingress" - description="For incoming packets, a list of mappings from 802.1p priorities to Linux SKB priorities. The mapping is given in the format "from:to" where both "from" and "to" are unsigned integers, ie "7:3"." /> - <property name="egress-priority-map" - alias="egress" - description="For outgoing packets, a list of mappings from Linux SKB priorities to 802.1p priorities. The mapping is given in the format "from:to" where both "from" and "to" are unsigned integers, ie "7:3"." /> - </setting> - <setting name="vpn" > - <property name="service-type" - alias="vpn-type" - description="D-Bus service name of the VPN plugin that this setting uses to connect to its network. i.e. org.freedesktop.NetworkManager.vpnc for the vpnc plugin." /> - <property name="user-name" - alias="user" - description="If the VPN connection requires a user name for authentication, that name should be provided here. If the connection is available to more than one user, and the VPN requires each user to supply a different name, then leave this property empty. If this property is empty, NetworkManager will automatically supply the username of the user which requested the VPN connection." /> - <property name="data" - description="Dictionary of key/value pairs of VPN plugin specific data. Both keys and values must be strings." /> - <property name="secrets" - description="Dictionary of key/value pairs of VPN plugin specific secrets like passwords or private keys. Both keys and values must be strings." /> - <property name="persistent" - description="If the VPN service supports persistence, and this property is TRUE, the VPN will attempt to stay connected across link changes and outages, until explicitly disconnected." /> - <property name="timeout" - description="Timeout for the VPN service to establish the connection. Some services may take quite a long time to connect. Value of 0 means a default timeout, which is 60 seconds (unless overridden by vpn.timeout in configuration file). Values greater than zero mean timeout in seconds." /> - </setting> - <setting name="vrf" > - <property name="table" - alias="table" - description="The routing table for this VRF." /> - </setting> - <setting name="vxlan" > - <property name="parent" - alias="dev" - description="If given, specifies the parent interface name or parent connection UUID." /> - <property name="id" - alias="id" - description="Specifies the VXLAN Network Identifier (or VXLAN Segment Identifier) to use." /> - <property name="local" - alias="local" - description="If given, specifies the source IP address to use in outgoing packets." /> - <property name="remote" - alias="remote" - description="Specifies the unicast destination IP address to use in outgoing packets when the destination link layer address is not known in the VXLAN device forwarding database, or the multicast IP address to join." /> - <property name="source-port-min" - alias="source-port-min" - description="Specifies the minimum UDP source port to communicate to the remote VXLAN tunnel endpoint." /> - <property name="source-port-max" - alias="source-port-max" - description="Specifies the maximum UDP source port to communicate to the remote VXLAN tunnel endpoint." /> - <property name="destination-port" - alias="destination-port" - description="Specifies the UDP destination port to communicate to the remote VXLAN tunnel endpoint." /> - <property name="tos" - description="Specifies the TOS value to use in outgoing packets." /> - <property name="ttl" - description="Specifies the time-to-live value to use in outgoing packets." /> - <property name="ageing" - description="Specifies the lifetime in seconds of FDB entries learnt by the kernel." /> - <property name="limit" - description="Specifies the maximum number of FDB entries. A value of zero means that the kernel will store unlimited entries." /> - <property name="learning" - description="Specifies whether unknown source link layer addresses and IP addresses are entered into the VXLAN device forwarding database." /> - <property name="proxy" - description="Specifies whether ARP proxy is turned on." /> - <property name="rsc" - description="Specifies whether route short circuit is turned on." /> - <property name="l2-miss" - description="Specifies whether netlink LL ADDR miss notifications are generated." /> - <property name="l3-miss" - description="Specifies whether netlink IP ADDR miss notifications are generated." /> - </setting> - <setting name="wifi-p2p" > - <property name="peer" - alias="peer" - description="The P2P device that should be connected to. Currently, this is the only way to create or join a group." /> - <property name="wps-method" - description="Flags indicating which mode of WPS is to be used. There's little point in changing the default setting as NetworkManager will automatically determine the best method to use." /> - <property name="wfd-ies" - description="The Wi-Fi Display (WFD) Information Elements (IEs) to set. Wi-Fi Display requires a protocol specific information element to be set in certain Wi-Fi frames. These can be specified here for the purpose of establishing a connection. This setting is only useful when implementing a Wi-Fi Display client." /> - </setting> - <setting name="wimax" > - <property name="mac-address" - alias="mac" - description="If specified, this connection will only apply to the WiMAX device whose MAC address matches. This property does not change the MAC address of the device (known as MAC spoofing). Deprecated: 1" /> - <property name="network-name" - alias="nsp" - description="Network Service Provider (NSP) name of the WiMAX network this connection should use. Deprecated: 1" /> - </setting> - <setting name="wireguard" > - <property name="private-key" - description="The 256 bit private-key in base64 encoding." /> - <property name="private-key-flags" - description="Flags indicating how to handle the "private-key" property." /> - <property name="listen-port" - description="The listen-port. If listen-port is not specified, the port will be chosen randomly when the interface comes up." /> - <property name="fwmark" - description="The use of fwmark is optional and is by default off. Setting it to 0 disables it. Otherwise, it is a 32-bit fwmark for outgoing packets. Note that "ip4-auto-default-route" or "ip6-auto-default-route" enabled, implies to automatically choose a fwmark." /> - <property name="peer-routes" - description="Whether to automatically add routes for the AllowedIPs ranges of the peers. If TRUE (the default), NetworkManager will automatically add routes in the routing tables according to ipv4.route-table and ipv6.route-table. Usually you want this automatism enabled. If FALSE, no such routes are added automatically. In this case, the user may want to configure static routes in ipv4.routes and ipv6.routes, respectively. Note that if the peer's AllowedIPs is "0.0.0.0/0" or "::/0" and the profile's ipv4.never-default or ipv6.never-default setting is enabled, the peer route for this peer won't be added automatically." /> - <property name="mtu" - description="If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple fragments. If zero a default MTU is used. Note that contrary to wg-quick's MTU setting, this does not take into account the current routes at the time of activation." /> - <property name="ip4-auto-default-route" - description="Whether to enable special handling of the IPv4 default route. If enabled, the IPv4 default route from wireguard.peer-routes will be placed to a dedicated routing-table and two policy routing rules will be added. The fwmark number is also used as routing-table for the default-route, and if fwmark is zero, an unused fwmark/table is chosen automatically. This corresponds to what wg-quick does with Table=auto and what WireGuard calls "Improved Rule-based Routing". Note that for this automatism to work, you usually don't want to set ipv4.gateway, because that will result in a conflicting default route. Leaving this at the default will enable this option automatically if ipv4.never-default is not set and there are any peers that use a default-route as allowed-ips. Since this automatism only makes sense if you also have a peer with an /0 allowed-ips, it is usually not necessary to enable this explicitly. However, you can disable it if you want to configure your own routing and rules." /> - <property name="ip6-auto-default-route" - description="Like ip4-auto-default-route, but for the IPv6 default route." /> - </setting> - <setting name="wpan" > - <property name="mac-address" - alias="mac" - description="If specified, this connection will only apply to the IEEE 802.15.4 (WPAN) MAC layer device whose permanent MAC address matches." /> - <property name="short-address" - alias="short-addr" - description="Short IEEE 802.15.4 address to be used within a restricted environment." /> - <property name="pan-id" - alias="pan-id" - description="IEEE 802.15.4 Personal Area Network (PAN) identifier." /> - <property name="page" - alias="page" - description="IEEE 802.15.4 channel page. A positive integer or -1, meaning "do not set, use whatever the device is already set to"." /> - <property name="channel" - alias="channel" - description="IEEE 802.15.4 channel. A positive integer or -1, meaning "do not set, use whatever the device is already set to"." /> - </setting> -</nm-setting-docs> diff --git a/src/nmcli/meson.build b/src/nmcli/meson.build index be625fe0..7e3c44bf 100644 --- a/src/nmcli/meson.build +++ b/src/nmcli/meson.build @@ -45,10 +45,10 @@ executable( endif -generate_docs_nm_settings_nmcli = executable( - 'generate-docs-nm-settings-nmcli', +gen_metadata_nm_settings_nmcli = executable( + 'gen-metadata-nm-settings-nmcli', files( - 'generate-docs-nm-settings-nmcli.c', + 'gen-metadata-nm-settings-nmcli.c', ), dependencies: [ libnm_dep, @@ -70,25 +70,24 @@ generate_docs_nm_settings_nmcli = executable( ) if enable_docs - generate_docs_nm_settings_nmcli_xml = custom_target( - 'generate-docs-nm-settings-nmcli.xml', - output: 'generate-docs-nm-settings-nmcli.xml', - command: [ generate_docs_nm_settings_nmcli ], + gen_metadata_nm_settings_nmcli_xml = custom_target( + 'gen-metadata-nm-settings-nmcli.xml', + output: 'gen-metadata-nm-settings-nmcli.xml', + command: [ gen_metadata_nm_settings_nmcli ], capture: true, ) test( - 'check-local-generate-docs-nm-settings-nmcli', + 'check-local-gen-metadata-nm-settings-nmcli', find_program(join_paths(source_root, 'tools', 'check-compare-generated.sh')), args: [ - source_root, - build_root, - 'src/nmcli/generate-docs-nm-settings-nmcli.xml', + source_root + '/src/nmcli/gen-metadata-nm-settings-nmcli.xml.in', + gen_metadata_nm_settings_nmcli_xml, ], ) else gen_metadata_nm_settings_nmcli_xml = configure_file( - input: 'generate-docs-nm-settings-nmcli.xml.in', + input: 'gen-metadata-nm-settings-nmcli.xml.in', output: '@BASENAME@', configuration: configuration_data(), ) diff --git a/src/nmcli/nmcli.c b/src/nmcli/nmcli.c index bc37a7f0..ff496874 100644 --- a/src/nmcli/nmcli.c +++ b/src/nmcli/nmcli.c @@ -166,13 +166,13 @@ complete_one(gpointer key, gpointer value, gpointer user_data) /* value prefix was not a standalone argument, * it was part of --option=<value> argument. * Repeat the part leading to "=". */ - g_print("%s=", option); + nmc_print("%s=", option); } - g_print("%.*s%s%s\n", - (int) (last - prefix), - prefix, - name, - strcmp(last, name) == 0 ? "," : ""); + nmc_print("%.*s%s%s\n", + (int) (last - prefix), + prefix, + name, + strcmp(last, name) == 0 ? "," : ""); } } @@ -228,9 +228,9 @@ complete_option_with_value(const char *option, const char *prefix, ...) /* value prefix was not a standalone argument, * it was part of --option=<value> argument. * Repeat the part leading to "=". */ - g_print("%s=", option); + nmc_print("%s=", option); } - g_print("%s\n", candidate); + nmc_print("%s\n", candidate); } } va_end(args); @@ -239,7 +239,7 @@ complete_option_with_value(const char *option, const char *prefix, ...) static void usage(void) { - g_printerr(_( + nmc_printerr(_( "Usage: nmcli [OPTIONS] OBJECT { COMMAND | help }\n" "\n" "OPTIONS\n" @@ -889,7 +889,7 @@ process_command_line(NmCli *nmc, int argc, char **argv_orig) nmc->timeout = (int) timeout; } else if (matches_arg(nmc, &argc, &argv, "-version", NULL)) { if (!nmc->complete) - g_print(_("nmcli tool, version %s\n"), NMCLI_VERSION); + nmc_print(_("nmcli tool, version %s\n"), NMCLI_VERSION); return NMC_RESULT_SUCCESS; } else if (matches_arg(nmc, &argc, &argv, "-help", NULL)) { if (!nmc->complete) @@ -1047,7 +1047,7 @@ main(int argc, char *argv[]) nm_cli.return_value = NMC_RESULT_SUCCESS; } else if (nm_cli.return_value != NMC_RESULT_SUCCESS) { /* Print result descripting text */ - g_printerr("%s\n", nm_cli.return_text->str); + nmc_printerr("%s\n", nm_cli.return_text->str); } nmc_cleanup(&nm_cli); diff --git a/src/nmcli/polkit-agent.c b/src/nmcli/polkit-agent.c index 41567023..8b74b338 100644 --- a/src/nmcli/polkit-agent.c +++ b/src/nmcli/polkit-agent.c @@ -13,6 +13,7 @@ #include "libnmc-base/nm-polkit-listener.h" #include "common.h" +#include "utils.h" static char * polkit_read_passwd(gpointer instance, @@ -23,8 +24,8 @@ polkit_read_passwd(gpointer instance, { NmCli *nmc = user_data; - g_print("%s\n", message); - g_print("(action_id: %s)\n", action_id); + nmc_print("%s\n", message); + nmc_print("(action_id: %s)\n", action_id); /* Ask user for polkit authorization password */ if (user) { @@ -36,7 +37,7 @@ polkit_read_passwd(gpointer instance, static void polkit_error(gpointer instance, const char *error, gpointer user_data) { - g_printerr(_("Error: polkit agent failed: %s\n"), error); + nmc_printerr(_("Error: polkit agent failed: %s\n"), error); } gboolean @@ -89,7 +90,7 @@ nmc_start_polkit_agent_start_try(NmCli *nmc) return TRUE; if (!nmc_polkit_agent_init(nmc, FALSE, &error)) { - g_printerr(_("Warning: polkit agent initialization failed: %s\n"), error->message); + nmc_printerr(_("Warning: polkit agent initialization failed: %s\n"), error->message); return FALSE; } return TRUE; diff --git a/src/nmcli/settings.c b/src/nmcli/settings.c index c80d0c7c..3c1f3c38 100644 --- a/src/nmcli/settings.c +++ b/src/nmcli/settings.c @@ -246,10 +246,10 @@ wireless_band_channel_changed_cb(GObject *object, GParamSpec *pspec, gpointer us mode = nm_setting_wireless_get_mode(NM_SETTING_WIRELESS(object)); if (!mode || !*mode || strcmp(mode, NM_SETTING_WIRELESS_MODE_INFRA) == 0) { - g_print(_("Warning: %s.%s set to '%s', but it might be ignored in infrastructure mode\n"), - nm_setting_get_name(NM_SETTING(s_wireless)), - g_param_spec_get_name(pspec), - value); + nmc_print(_("Warning: %s.%s set to '%s', but it might be ignored in infrastructure mode\n"), + nm_setting_get_name(NM_SETTING(s_wireless)), + g_param_spec_get_name(pspec), + value); } } @@ -266,9 +266,9 @@ connection_master_changed_cb(GObject *object, GParamSpec *pspec, gpointer user_d s_ipv4 = nm_connection_get_setting_by_name(connection, NM_SETTING_IP4_CONFIG_SETTING_NAME); s_ipv6 = nm_connection_get_setting_by_name(connection, NM_SETTING_IP6_CONFIG_SETTING_NAME); if (s_ipv4 || s_ipv6) { - g_print(_("Warning: setting %s.%s requires removing ipv4 and ipv6 settings\n"), - nm_setting_get_name(NM_SETTING(s_con)), - g_param_spec_get_name(pspec)); + nmc_print(_("Warning: setting %s.%s requires removing ipv4 and ipv6 settings\n"), + nm_setting_get_name(NM_SETTING(s_con)), + g_param_spec_get_name(pspec)); tmp_str = nmc_get_user_input(_("Do you want to remove them? [yes] ")); if (!tmp_str || matches(tmp_str, "yes")) { if (s_ipv4) @@ -373,8 +373,8 @@ _set_fcn_precheck_connection_secondaries(NMClient *client, if (nm_utils_is_uuid(*iter)) { con = nmc_find_connection(connections, "uuid", *iter, NULL, FALSE); if (!con) { - g_print(_("Warning: %s is not an UUID of any existing connection profile\n"), - *iter); + nmc_print(_("Warning: %s is not an UUID of any existing connection profile\n"), + *iter); } else { /* Currently, NM only supports VPN connections as secondaries */ if (!nm_connection_is_type(con, NM_SETTING_VPN_SETTING_NAME)) { @@ -385,7 +385,7 @@ _set_fcn_precheck_connection_secondaries(NMClient *client, } else { con = nmc_find_connection(connections, "id", *iter, NULL, FALSE); if (!con) { - g_set_error(error, 1, 0, _("'%s' is not a name of any exiting profile"), *iter); + g_set_error(error, 1, 0, _("'%s' is not a name of any existing profile"), *iter); return FALSE; } @@ -431,13 +431,13 @@ _env_warn_fcn_handle( switch (warn_level) { case NM_META_ENV_WARN_LEVEL_WARN: - g_print(_("Warning: %s\n"), m); + nmc_print(_("Warning: %s\n"), m); return; case NM_META_ENV_WARN_LEVEL_INFO: - g_print(_("Info: %s\n"), m); + nmc_print(_("Info: %s\n"), m); return; } - g_print(_("Error: %s\n"), m); + nmc_print(_("Error: %s\n"), m); } static NMDevice *const * @@ -488,12 +488,23 @@ _env_get_nm_connections(const NMMetaEnvironment *environment, return (NMRemoteConnection *const *) values->pdata; } +static NMMetaEnvFlags +_env_get_env_flags(const NMMetaEnvironment *environment, gpointer environment_user_data) +{ + NmCli *nmc = environment_user_data; + + nm_assert(nmc); + + return (nmc->offline ? NM_META_ENV_FLAGS_OFFLINE : NM_META_ENV_FLAGS_NONE); +} + /*****************************************************************************/ const NMMetaEnvironment *const nmc_meta_environment = &((NMMetaEnvironment){ .warn_fcn = _env_warn_fcn_handle, .get_nm_devices = _env_get_nm_devices, .get_nm_connections = _env_get_nm_connections, + .get_env_flags = _env_get_env_flags, }); static char * @@ -748,7 +759,7 @@ setting_details(const NmcConfig *nmc_config, NMSetting *setting, const char *one fields_str = g_strdup_printf("%s.%s", nm_setting_get_name(setting), one_prop); } - if (!nmc_print( + if (!nmc_print_table( nmc_config, (gpointer[]){setting, NULL}, NULL, diff --git a/src/nmcli/utils.c b/src/nmcli/utils.c index 209a5b69..2c155fff 100644 --- a/src/nmcli/utils.c +++ b/src/nmcli/utils.c @@ -346,7 +346,7 @@ ssid_to_hex(const char *str, gsize len) void nmc_terminal_erase_line(void) { - /* We intentionally use printf(), not g_print() here, to ensure that + /* We intentionally use printf(), not nmc_print() here, to ensure that * GLib doesn't mistakenly try to convert the string. */ printf("\33[2K\r"); @@ -365,7 +365,7 @@ nmc_terminal_show_progress(const char *str) const char slashes[4] = {'|', '/', '-', '\\'}; nmc_terminal_erase_line(); - g_print("%c %s", slashes[idx++], str ?: ""); + nmc_print("%c %s", slashes[idx++], str ?: ""); fflush(stdout); if (idx == 4) idx = 0; @@ -467,7 +467,7 @@ nmc_get_user_input(const char *ask_str) size_t line_ln = 0; ssize_t num; - g_print("%s", ask_str); + nmc_print("%s", ask_str); num = getline(&line, &line_ln, stdin); /* Remove newline from the string */ @@ -691,7 +691,7 @@ _output_selection_append(GArray *cols, if (parent_idx != PRINT_DATA_COL_PARENT_NIL) { const NMMetaSelectionItem *si; - si = g_array_index(cols, PrintDataCol, parent_idx).selection_item; + si = nm_g_array_index(cols, PrintDataCol, parent_idx).selection_item; allowed_fields = nm_meta_abstract_info_get_nested_names_str(si->info, si->self_selection); } @@ -741,7 +741,7 @@ _output_selection_append(GArray *cols, if (!NM_IN_SET(selection_item->info->meta_type, &nm_meta_type_setting_info_editor, &nmc_meta_type_generic_info)) - g_array_index(cols, PrintDataCol, col_idx).is_leaf = FALSE; + nm_g_array_index(cols, PrintDataCol, col_idx).is_leaf = FALSE; } return TRUE; @@ -756,13 +756,13 @@ _output_selection_complete(GArray *cols) nm_assert(g_array_get_element_size(cols) == sizeof(PrintDataCol)); for (i = 0; i < cols->len; i++) { - PrintDataCol *col = &g_array_index(cols, PrintDataCol, i); + PrintDataCol *col = &nm_g_array_index(cols, PrintDataCol, i); if (col->_parent_idx == PRINT_DATA_COL_PARENT_NIL) col->parent_col = NULL; else { nm_assert(col->_parent_idx < i); - col->parent_col = &g_array_index(cols, PrintDataCol, col->_parent_idx); + col->parent_col = &nm_g_array_index(cols, PrintDataCol, col->_parent_idx); } } } @@ -825,7 +825,7 @@ _output_selection_parse(const NMMetaAbstractInfo *const *fields, _output_selection_complete(cols); *out_cols_len = cols->len; - *out_cols_data = (PrintDataCol *) g_array_free(g_steal_pointer(&cols), FALSE); + *out_cols_data = (PrintDataCol *) ((gpointer) g_array_free(g_steal_pointer(&cols), FALSE)); *out_gfree_keeper = g_steal_pointer(&gfree_keeper); return TRUE; } @@ -1026,7 +1026,7 @@ _print_fill(const NmcConfig *nmc_config, col_idx = header_row->len; g_array_set_size(header_row, col_idx + 1); - header_cell = &g_array_index(header_row, PrintDataHeaderCell, col_idx); + header_cell = &nm_g_array_index(header_row, PrintDataHeaderCell, col_idx); header_cell->col_idx = col_idx; header_cell->col = col; @@ -1060,8 +1060,9 @@ _print_fill(const NmcConfig *nmc_config, text_get_flags |= NM_META_ACCESSOR_GET_FLAGS_SHOW_SECRETS; for (i_row = 0; i_row < targets_len; i_row++) { - gpointer target = targets[i_row]; - PrintDataCell *cells_line = &g_array_index(cells, PrintDataCell, i_row * header_row->len); + gpointer target = targets[i_row]; + PrintDataCell *cells_line = + &nm_g_array_index(cells, PrintDataCell, i_row * header_row->len); for (i_col = 0; i_col < header_row->len; i_col++) { char *to_free = NULL; @@ -1072,7 +1073,7 @@ _print_fill(const NmcConfig *nmc_config, gconstpointer value; gboolean is_default; - header_cell = &g_array_index(header_row, PrintDataHeaderCell, i_col); + header_cell = &nm_g_array_index(header_row, PrintDataHeaderCell, i_col); info = header_cell->col->selection_item->info; cell->row_idx = i_row; @@ -1115,7 +1116,7 @@ _print_fill(const NmcConfig *nmc_config, cell->text_to_free = TRUE; } if (to_free) - g_strfreev((char **) to_free); + g_strfreev(NM_CAST_ALIGN(char *, to_free)); } } else { cell->text.plain = value; @@ -1147,13 +1148,14 @@ _print_fill(const NmcConfig *nmc_config, } for (i_col = 0; i_col < header_row->len; i_col++) { - PrintDataHeaderCell *header_cell = &g_array_index(header_row, PrintDataHeaderCell, i_col); + PrintDataHeaderCell *header_cell = + &nm_g_array_index(header_row, PrintDataHeaderCell, i_col); header_cell->width = nmc_string_screen_width(header_cell->title, NULL); for (i_row = 0; i_row < targets_len; i_row++) { const PrintDataCell *cells_line = - &g_array_index(cells, PrintDataCell, i_row * header_row->len); + &nm_g_array_index(cells, PrintDataCell, i_row * header_row->len); const PrintDataCell *cell = &cells_line[i_col]; const char *const *i_strv; @@ -1249,9 +1251,9 @@ _print_do(const NmcConfig *nmc_config, width1 = strlen(header_name); width2 = nmc_string_screen_width(header_name, NULL); - g_print("%s\n", line); - g_print("%*s\n", (table_width + width2) / 2 + width1 - width2, header_name); - g_print("%s\n", line); + nmc_print("%s\n", line); + nmc_print("%*s\n", (table_width + width2) / 2 + width1 - width2, header_name); + nmc_print("%s\n", line); } str = !nmc_config->multiline_output ? g_string_sized_new(100) : NULL; @@ -1281,14 +1283,14 @@ _print_do(const NmcConfig *nmc_config, if (str->len) g_string_truncate(str, str->len - 1); /* Chop off last column separator */ - g_print("%s\n", str->str); + nmc_print("%s\n", str->str); g_string_truncate(str, 0); /* Print horizontal separator */ if (nmc_config->print_output == NMC_PRINT_PRETTY) { gs_free char *line = NULL; - g_print("%s\n", (line = g_strnfill(table_width, '-'))); + nmc_print("%s\n", (line = g_strnfill(table_width, '-'))); } } @@ -1330,12 +1332,12 @@ _print_do(const NmcConfig *nmc_config, prefix = g_strdup_printf("%s:", cell->header_cell->title); width1 = strlen(prefix); width2 = nmc_string_screen_width(prefix, NULL); - g_print("%-*s%s\n", - (int) (nmc_config->print_output == NMC_PRINT_TERSE - ? 0 - : ML_VALUE_INDENT + width1 - width2), - prefix, - text); + nmc_print("%-*s%s\n", + (int) (nmc_config->print_output == NMC_PRINT_TERSE + ? 0 + : ML_VALUE_INDENT + width1 - width2), + prefix, + text); } else { nm_assert(str); if (nmc_config->print_output == NMC_PRINT_TERSE) { @@ -1371,7 +1373,7 @@ _print_do(const NmcConfig *nmc_config, if (!nmc_config->multiline_output) { if (str->len) g_string_truncate(str, str->len - 1); /* Chop off last column separator */ - g_print("%s\n", str->str); + nmc_print("%s\n", str->str); g_string_truncate(str, 0); } @@ -1379,19 +1381,19 @@ _print_do(const NmcConfig *nmc_config, if (nmc_config->print_output == NMC_PRINT_PRETTY && nmc_config->multiline_output) { gs_free char *line = NULL; - g_print("%s\n", (line = g_strnfill(ML_HEADER_WIDTH, '-'))); + nmc_print("%s\n", (line = g_strnfill(ML_HEADER_WIDTH, '-'))); } } } gboolean -nmc_print(const NmcConfig *nmc_config, - gpointer const *targets, - gpointer targets_data, - const char *header_name_no_l10n, - const NMMetaAbstractInfo *const *fields, - const char *fields_str, - GError **error) +nmc_print_table(const NmcConfig *nmc_config, + gpointer const *targets, + gpointer targets_data, + const char *header_name_no_l10n, + const NMMetaAbstractInfo *const *fields, + const char *fields_str, + GError **error) { gs_unref_ptrarray GPtrArray *gfree_keeper = NULL; gs_free PrintDataCol *cols_data = NULL; @@ -1408,8 +1410,8 @@ nmc_print(const NmcConfig *nmc_config, header_name_no_l10n, header_row->len, cells->len / header_row->len, - &g_array_index(header_row, PrintDataHeaderCell, 0), - &g_array_index(cells, PrintDataCell, 0)); + nm_g_array_first_p(header_row, PrintDataHeaderCell), + nm_g_array_first_p(cells, PrintDataCell)); return TRUE; } @@ -1419,22 +1421,20 @@ nmc_print(const NmcConfig *nmc_config, static void pager_fallback(void) { - char buf[64]; + char buf[1024]; int rb; - int errsv; + + /* We are still in the child process (after fork() and before exec()). + * We must only used functions listed in `man signal-safety`. */ do { rb = read(STDIN_FILENO, buf, sizeof(buf)); if (rb == -1) { - errsv = errno; - if (errsv == EINTR) + if (errno == EINTR) continue; - g_printerr(_("Error reading nmcli output: %s\n"), nm_strerror_native(errsv)); _exit(EXIT_FAILURE); } if (write(STDOUT_FILENO, buf, rb) == -1) { - errsv = errno; - g_printerr(_("Error writing nmcli output: %s\n"), nm_strerror_native(errsv)); _exit(EXIT_FAILURE); } } while (rb > 0); @@ -1445,11 +1445,12 @@ pager_fallback(void) pid_t nmc_terminal_spawn_pager(const NmcConfig *nmc_config) { - const char *pager = getenv("PAGER"); - pid_t pager_pid; - pid_t parent_pid; - int fd[2]; - int errsv; + const char *pager = getenv("PAGER"); + pid_t pager_pid; + pid_t parent_pid; + int fd[2]; + int errsv; + gs_strfreev char **ev = NULL; if (nmc_config->in_editor || nmc_config->print_output == NMC_PRINT_TERSE || !nmc_config->use_colors || g_strcmp0(pager, "") == 0 || getauxval(AT_SECURE)) @@ -1457,16 +1458,20 @@ nmc_terminal_spawn_pager(const NmcConfig *nmc_config) if (pipe(fd) == -1) { errsv = errno; - g_printerr(_("Failed to create pager pipe: %s\n"), nm_strerror_native(errsv)); + nmc_printerr(_("Failed to create pager pipe: %s\n"), nm_strerror_native(errsv)); return 0; } parent_pid = getpid(); + ev = g_get_environ(); + ev = g_environ_setenv(ev, "LESS", "FRSXMK", TRUE); + ev = g_environ_setenv(ev, "LESSCHARSET", "utf-8", TRUE); + pager_pid = fork(); if (pager_pid == -1) { errsv = errno; - g_printerr(_("Failed to fork pager: %s\n"), nm_strerror_native(errsv)); + nmc_printerr(_("Failed to fork pager: %s\n"), nm_strerror_native(errsv)); nm_close(fd[0]); nm_close(fd[1]); return 0; @@ -1478,9 +1483,6 @@ nmc_terminal_spawn_pager(const NmcConfig *nmc_config) nm_close(fd[0]); nm_close(fd[1]); - setenv("LESS", "FRSXMK", 1); - setenv("LESSCHARSET", "utf-8", 1); - /* Make sure the pager goes away when the parent dies */ if (prctl(PR_SET_PDEATHSIG, SIGTERM) < 0) _exit(EXIT_FAILURE); @@ -1491,8 +1493,8 @@ nmc_terminal_spawn_pager(const NmcConfig *nmc_config) _exit(EXIT_SUCCESS); if (pager) { - execlp(pager, pager, NULL); - execl("/bin/sh", "sh", "-c", pager, NULL); + execvpe(pager, (char **) NM_MAKE_STRV(pager), ev); + execvpe("/bin/sh", (char **) NM_MAKE_STRV("sh", "-c", pager), ev); } /* Debian's alternatives command for pagers is @@ -1501,10 +1503,10 @@ nmc_terminal_spawn_pager(const NmcConfig *nmc_config) * shell script that implements a logic that * is similar to this one anyway, but is * Debian-specific. */ - execlp("pager", "pager", NULL); + execvpe("pager", (char **) NM_MAKE_STRV("pager"), ev); - execlp("less", "less", NULL); - execlp("more", "more", NULL); + execvpe("less", (char **) NM_MAKE_STRV("less"), ev); + execvpe("more", (char **) NM_MAKE_STRV("more"), ev); pager_fallback(); /* not reached */ @@ -1513,11 +1515,11 @@ nmc_terminal_spawn_pager(const NmcConfig *nmc_config) /* Return in the parent */ if (dup2(fd[1], STDOUT_FILENO) < 0) { errsv = errno; - g_printerr(_("Failed to duplicate pager pipe: %s\n"), nm_strerror_native(errsv)); + nmc_printerr(_("Failed to duplicate pager pipe: %s\n"), nm_strerror_native(errsv)); } if (dup2(fd[1], STDERR_FILENO) < 0) { errsv = errno; - g_printerr(_("Failed to duplicate pager pipe: %s\n"), nm_strerror_native(errsv)); + nmc_printerr(_("Failed to duplicate pager pipe: %s\n"), nm_strerror_native(errsv)); } nm_close(fd[0]); @@ -1606,9 +1608,9 @@ print_required_fields(const NmcConfig *nmc_config, width1 = strlen(header_name); width2 = nmc_string_screen_width(header_name, NULL); - g_print("%s\n", line); - g_print("%*s\n", (table_width + width2) / 2 + width1 - width2, header_name); - g_print("%s\n", line); + nmc_print("%s\n", line); + nmc_print("%*s\n", (table_width + width2) / 2 + width1 - width2, header_name); + nmc_print("%s\n", line); } if (main_header_only) @@ -1624,7 +1626,7 @@ print_required_fields(const NmcConfig *nmc_config, if (nmc_config->multiline_output) { for (i = 0; i < indices->len; i++) { - int idx = g_array_index(indices, int, i); + int idx = nm_g_array_index(indices, int, i); gboolean is_array = field_values[idx].value_is_array; /* section prefix can't be an array */ @@ -1654,12 +1656,12 @@ print_required_fields(const NmcConfig *nmc_config, j); width1 = strlen(tmp); width2 = nmc_string_screen_width(tmp, NULL); - g_print("%-*s%s\n", - (int) (nmc_config->print_output == NMC_PRINT_TERSE - ? 0 - : ML_VALUE_INDENT + width1 - width2), - tmp, - print_val); + nmc_print("%-*s%s\n", + (int) (nmc_config->print_output == NMC_PRINT_TERSE + ? 0 + : ML_VALUE_INDENT + width1 - width2), + tmp, + print_val); } } else { gs_free char *val_to_free = NULL; @@ -1679,18 +1681,18 @@ print_required_fields(const NmcConfig *nmc_config, nm_meta_abstract_info_get_name(field_values[idx].info, FALSE)); width1 = strlen(tmp); width2 = nmc_string_screen_width(tmp, NULL); - g_print("%-*s%s\n", - (int) (nmc_config->print_output == NMC_PRINT_TERSE - ? 0 - : ML_VALUE_INDENT + width1 - width2), - tmp, - print_val); + nmc_print("%-*s%s\n", + (int) (nmc_config->print_output == NMC_PRINT_TERSE + ? 0 + : ML_VALUE_INDENT + width1 - width2), + tmp, + print_val); } } if (nmc_config->print_output == NMC_PRINT_PRETTY) { gs_free char *line = NULL; - g_print("%s\n", (line = g_strnfill(ML_HEADER_WIDTH, '-'))); + nmc_print("%s\n", (line = g_strnfill(ML_HEADER_WIDTH, '-'))); } return; @@ -1705,7 +1707,7 @@ print_required_fields(const NmcConfig *nmc_config, int idx; const char *value; - idx = g_array_index(indices, int, i); + idx = nm_g_array_index(indices, int, i); value = get_value_to_print(nmc_config, (NmcOutputField *) field_values + idx, @@ -1747,13 +1749,13 @@ print_required_fields(const NmcConfig *nmc_config, g_string_prepend(str, (indent_str = g_strnfill(indent, ' '))); } - g_print("%s\n", str->str); + nmc_print("%s\n", str->str); /* Print horizontal separator */ if (nmc_config->print_output == NMC_PRINT_PRETTY && field_names) { gs_free char *line = NULL; - g_print("%s\n", (line = g_strnfill(table_width, '-'))); + nmc_print("%s\n", (line = g_strnfill(table_width, '-'))); } } } diff --git a/src/nmcli/utils.h b/src/nmcli/utils.h index c6ead55b..5d9449f5 100644 --- a/src/nmcli/utils.h +++ b/src/nmcli/utils.h @@ -359,13 +359,43 @@ nmc_meta_generic_get_enum_with_detail(NmcMetaGenericGetEnumType get_enum_type, /*****************************************************************************/ -gboolean nmc_print(const NmcConfig *nmc_config, - gpointer const *targets, - gpointer targets_data, - const char *header_name_no_l10n, - const NMMetaAbstractInfo *const *fields, - const char *fields_str, - GError **error); +gboolean nmc_print_table(const NmcConfig *nmc_config, + gpointer const *targets, + gpointer targets_data, + const char *header_name_no_l10n, + const NMMetaAbstractInfo *const *fields, + const char *fields_str, + GError **error); + +/*****************************************************************************/ + +#if 0 +/* For manual testing to sync output with LIBNM_CLIENT_DEBUG/LIBNM_CLIENT_DEBUG_FILE */ +#define nmc_print(...) \ + G_STMT_START \ + { \ + gs_free char *_ss = g_strdup_printf(__VA_ARGS__); \ + gs_free char *_ss1 = g_strdup_printf("nmcli[out]: %s", _ss); \ + \ + nm_utils_print(0, _ss1); \ + nm_utils_print(1, _ss); \ + } \ + G_STMT_END + +#define nmc_printerr(...) \ + G_STMT_START \ + { \ + gs_free char *_ss = g_strdup_printf(__VA_ARGS__); \ + gs_free char *_ss1 = g_strdup_printf("nmcli[err]: %s", _ss); \ + \ + nm_utils_print(0, _ss1); \ + nm_utils_print(2, _ss); \ + } \ + G_STMT_END +#else +#define nmc_print(...) g_print(__VA_ARGS__) +#define nmc_printerr(...) g_printerr(__VA_ARGS__) +#endif /*****************************************************************************/ |