From 150fe9eef8dd22307ee16687509acde616663982 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Mon, 12 Jun 2023 11:25:29 +0200 Subject: New upstream version 1.42.6 --- src/nmcli/devices.c | 30 ++++++++++++------------- src/nmcli/gen-metadata-nm-settings-nmcli.xml.in | 6 ++--- 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src/nmcli') diff --git a/src/nmcli/devices.c b/src/nmcli/devices.c index c160fff6..d408b47f 100644 --- a/src/nmcli/devices.c +++ b/src/nmcli/devices.c @@ -17,6 +17,7 @@ #include #include "libnm-glib-aux/nm-secret-utils.h" +#include "libnm-glib-aux/nm-random-utils.h" #include "common.h" #include "connections.h" #include "libnmc-base/nm-client-utils.h" @@ -4090,7 +4091,7 @@ generate_ssid_for_hotspot(void) return ssid_bytes; } -#define WPA_PASSKEY_SIZE 8 +#define WPA_PASSKEY_SIZE 12 static void generate_wpa_key(char *key, size_t len) { @@ -4099,13 +4100,14 @@ generate_wpa_key(char *key, size_t len) g_return_if_fail(key); g_return_if_fail(len > WPA_PASSKEY_SIZE); - /* generate a 8-chars ASCII WPA key */ for (i = 0; i < WPA_PASSKEY_SIZE; i++) { int c; - c = g_random_int_range(33, 126); - /* too many non alphanumeric characters are hard to remember for humans */ - while (!g_ascii_isalnum(c)) - c = g_random_int_range(33, 126); + + do { + c = nm_random_u64_range_full(48, 122, TRUE); + /* skip characters that look similar */ + } while (NM_IN_SET(c, '1', 'l', 'I', '0', 'O', 'Q', '8', 'B', '5', 'S') + || !g_ascii_isalnum(c)); key[i] = (char) c; } @@ -4124,7 +4126,8 @@ generate_wep_key(char *key, size_t len) /* generate a 10-digit hex WEP key */ for (i = 0; i < 10; i++) { int digit; - digit = g_random_int_range(0, 16); + + digit = nm_random_u64_range_full(0, 16, TRUE); key[i] = hexdigits[digit]; } key[10] = '\0'; @@ -4138,7 +4141,7 @@ set_wireless_security_for_hotspot(NMSettingWirelessSecurity *s_wsec, gboolean show_password, GError **error) { - char generated_key[11]; + char generated_key[20]; const char *key; const char *key_mgmt; @@ -4264,6 +4267,8 @@ create_hotspot_conn(const GPtrArray *connections, NMSettingIPConfig *s_ip4, *s_ip6; NMSettingProxy *s_proxy; + nm_assert(channel_int == -1 || band); + connection = nm_simple_connection_new(); s_con = (NMSettingConnection *) nm_setting_connection_new(); nm_connection_add_setting(connection, NM_SETTING(s_con)); @@ -4294,6 +4299,8 @@ create_hotspot_conn(const GPtrArray *connections, NM_SETTING_WIRELESS_BAND, band, NULL); + } else if (band) { + g_object_set(s_wifi, NM_SETTING_WIRELESS_BAND, band, NULL); } s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new(); @@ -4439,13 +4446,6 @@ do_device_wifi_hotspot(const NMCCommand *cmd, NmCli *nmc, int argc, const char * if (nmc->complete) return; - /* Verify band and channel parameters */ - if (!channel) { - if (g_strcmp0(band, "bg") == 0) - channel = "1"; - if (g_strcmp0(band, "a") == 0) - channel = "7"; - } if (channel) { unsigned long int value; diff --git a/src/nmcli/gen-metadata-nm-settings-nmcli.xml.in b/src/nmcli/gen-metadata-nm-settings-nmcli.xml.in index dfea3c34..a3409afb 100644 --- a/src/nmcli/gen-metadata-nm-settings-nmcli.xml.in +++ b/src/nmcli/gen-metadata-nm-settings-nmcli.xml.in @@ -640,7 +640,7 @@ + description="How many additional levels of encapsulation are permitted to be prepended to packets. This property applies only to IPv6 tunnels. To disable this option, add NM_IP_TUNNEL_FLAG_IP6_IGN_ENCAP_LIMIT (0x1) to ip-tunnel flags." /> + 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-aaaa", "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." /> + 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-aaaa", "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." />