diff options
| author | Michael Biebl <biebl@debian.org> | 2020-05-08 21:40:53 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2020-05-08 21:40:53 +0200 |
| commit | d460892bbfece74fb6d3cd846bf6ef548290be41 (patch) | |
| tree | 0474e5be0b5e5fac0d2f3a1e554382e8d1aa6397 /libnm-core | |
| parent | 1e5977b62f896e844b548c3007ace9e1dfa7f9ed (diff) | |
New upstream version 1.24.0 upstream/1.24.0
Diffstat (limited to 'libnm-core')
| -rw-r--r-- | libnm-core/nm-setting-bridge.c | 10 | ||||
| -rw-r--r-- | libnm-core/nm-setting-ip-config.c | 18 | ||||
| -rw-r--r-- | libnm-core/nm-setting-ip-config.h | 2 | ||||
| -rw-r--r-- | libnm-core/nm-setting-match.c | 3 | ||||
| -rw-r--r-- | libnm-core/nm-setting-sriov.c | 2 | ||||
| -rw-r--r-- | libnm-core/nm-setting-wireguard.c | 20 | ||||
| -rw-r--r-- | libnm-core/nm-utils.c | 82 |
7 files changed, 86 insertions, 51 deletions
diff --git a/libnm-core/nm-setting-bridge.c b/libnm-core/nm-setting-bridge.c index d8000221..957520f4 100644 --- a/libnm-core/nm-setting-bridge.c +++ b/libnm-core/nm-setting-bridge.c @@ -1741,6 +1741,8 @@ nm_setting_bridge_class_init (NMSettingBridgeClass *klass) * description: VLAN filtering protocol. * example: BRIDGING_OPTS="vlan_protocol=802.1Q" * ---end--- + * + * Since: 1.24 */ obj_properties[PROP_VLAN_PROTOCOL] = g_param_spec_string (NM_SETTING_BRIDGE_VLAN_PROTOCOL, "", "", @@ -1760,6 +1762,8 @@ nm_setting_bridge_class_init (NMSettingBridgeClass *klass) * default: 0 * example: BRIDGING_OPTS="vlan_stats_enabled=1" * ---end--- + * + * Since: 1.24 */ obj_properties[PROP_VLAN_STATS_ENABLED] = g_param_spec_boolean (NM_SETTING_BRIDGE_VLAN_STATS_ENABLED, "", "", @@ -1784,6 +1788,8 @@ nm_setting_bridge_class_init (NMSettingBridgeClass *klass) * default: auto * example: BRIDGING_OPTS="multicast_router=enabled" * ---end--- + * + * Since: 1.24 */ obj_properties[PROP_MULTICAST_ROUTER] = g_param_spec_string (NM_SETTING_BRIDGE_MULTICAST_ROUTER, "", "", @@ -1805,6 +1811,8 @@ nm_setting_bridge_class_init (NMSettingBridgeClass *klass) * default: 0 * example: BRIDGING_OPTS="multicast_query-use_ifaddr=1" * ---end--- + * + * Since: 1.24 */ obj_properties[PROP_MULTICAST_QUERY_USE_IFADDR] = g_param_spec_boolean (NM_SETTING_BRIDGE_MULTICAST_QUERY_USE_IFADDR, "", "", @@ -1825,6 +1833,8 @@ nm_setting_bridge_class_init (NMSettingBridgeClass *klass) * default: 0 * example: BRIDGING_OPTS="multicast_querier=1" * ---end--- + * + * Since: 1.24 */ obj_properties[PROP_MULTICAST_QUERIER] = g_param_spec_boolean (NM_SETTING_BRIDGE_MULTICAST_QUERIER, "", "", diff --git a/libnm-core/nm-setting-ip-config.c b/libnm-core/nm-setting-ip-config.c index 55cec35f..36f09b69 100644 --- a/libnm-core/nm-setting-ip-config.c +++ b/libnm-core/nm-setting-ip-config.c @@ -47,6 +47,8 @@ const NMUtilsDNSOptionDesc _nm_utils_dns_option_descs[] = { { NM_SETTING_DNS_OPTION_SINGLE_REQUEST_REOPEN, FALSE, FALSE }, { NM_SETTING_DNS_OPTION_NO_TLD_QUERY, FALSE, FALSE }, { NM_SETTING_DNS_OPTION_USE_VC, FALSE, FALSE }, + { NM_SETTING_DNS_OPTION_NO_RELOAD, FALSE, FALSE }, + { NM_SETTING_DNS_OPTION_TRUST_AD, FALSE, FALSE }, { NULL, FALSE, FALSE } }; @@ -5602,6 +5604,15 @@ nm_setting_ip_config_class_init (NMSettingIPConfigClass *klass) * 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. + * * Since: 1.2 **/ obj_properties[PROP_DNS_OPTIONS] = @@ -5674,6 +5685,13 @@ nm_setting_ip_config_class_init (NMSettingIPConfigClass *klass) * * The gateway associated with this configuration. This is only meaningful * if #NMSettingIPConfig:addresses is also set. + * + * The gateway's main purpose is to control the next hop of the standard default route on the device. + * Hence, the gateway property conflicts with #NMSettingIPConfig:never-default and will be + * automatically dropped if the IP configuration is set to never-default. + * + * As an alternative to set the gateway, configure a static default route with /0 as prefix + * length. **/ obj_properties[PROP_GATEWAY] = g_param_spec_string (NM_SETTING_IP_CONFIG_GATEWAY, "", "", diff --git a/libnm-core/nm-setting-ip-config.h b/libnm-core/nm-setting-ip-config.h index ef3671c4..ae77480c 100644 --- a/libnm-core/nm-setting-ip-config.h +++ b/libnm-core/nm-setting-ip-config.h @@ -368,6 +368,8 @@ char *nm_ip_routing_rule_to_string (const NMIPRoutingRule *self, #define NM_SETTING_DNS_OPTION_SINGLE_REQUEST_REOPEN "single-request-reopen" #define NM_SETTING_DNS_OPTION_NO_TLD_QUERY "no-tld-query" #define NM_SETTING_DNS_OPTION_USE_VC "use-vc" +#define NM_SETTING_DNS_OPTION_NO_RELOAD "no-reload" +#define NM_SETTING_DNS_OPTION_TRUST_AD "trust-ad" /** * NMSettingIPConfig: diff --git a/libnm-core/nm-setting-match.c b/libnm-core/nm-setting-match.c index 2e058810..3ad58daf 100644 --- a/libnm-core/nm-setting-match.c +++ b/libnm-core/nm-setting-match.c @@ -171,10 +171,11 @@ nm_setting_match_clear_interface_names (NMSettingMatch *setting) /** * nm_setting_match_get_interface_names: * @setting: the #NMSettingMatch + * @length: (out): the length of the returned interface names array. * * Returns all the interface names. * - * Returns: (transfer none): the configured interface names. + * Returns: (transfer none) (array length=length): the configured interface names. * * Since: 1.14 **/ diff --git a/libnm-core/nm-setting-sriov.c b/libnm-core/nm-setting-sriov.c index a679a0be..3c52dc6c 100644 --- a/libnm-core/nm-setting-sriov.c +++ b/libnm-core/nm-setting-sriov.c @@ -856,7 +856,7 @@ nm_setting_sriov_get_autoprobe_drivers (NMSettingSriov *setting) return setting->autoprobe_drivers; } -static gint +static int vf_index_compare (gconstpointer a, gconstpointer b) { NMSriovVF *vf_a = *(NMSriovVF **) a; diff --git a/libnm-core/nm-setting-wireguard.c b/libnm-core/nm-setting-wireguard.c index ecfc5bb3..2bd633ce 100644 --- a/libnm-core/nm-setting-wireguard.c +++ b/libnm-core/nm-setting-wireguard.c @@ -2493,11 +2493,15 @@ nm_setting_wireguard_class_init (NMSettingWireGuardClass *klass) * 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. + * 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. + * * Since: 1.16 **/ obj_properties[PROP_PEER_ROUTES] = @@ -2530,11 +2534,15 @@ nm_setting_wireguard_class_init (NMSettingWireGuardClass *klass) * NMSettingWireGuard:ip4-auto-default-route: * * Whether to enable special handling of the IPv4 default route. - * If enabled, the IPv4 default route 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, a unused fwmark/table is chosen automatically. - * This corresponds to what wg-quick does with Table=auto. + * 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 diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c index 062ff393..7391b0f0 100644 --- a/libnm-core/nm-utils.c +++ b/libnm-core/nm-utils.c @@ -4033,8 +4033,6 @@ nm_utils_hwaddr_aton (const char *asc, gpointer buffer, gsize length) return buffer; } - - /** * nm_utils_bin2hexstr: * @src: (type guint8) (array length=len): an array of bytes @@ -5144,7 +5142,9 @@ _nm_utils_strstrdictkey_create (const char *v1, const char *v2) } static gboolean -validate_dns_option (const char *name, gboolean numeric, gboolean ipv6, +validate_dns_option (const char *name, + gboolean numeric, + gboolean ipv6, const NMUtilsDNSOptionDesc *option_descs) { const NMUtilsDNSOptionDesc *desc; @@ -5180,58 +5180,54 @@ validate_dns_option (const char *name, gboolean numeric, gboolean ipv6, * %FALSE otherwise */ gboolean -_nm_utils_dns_option_validate (const char *option, char **out_name, - long *out_value, gboolean ipv6, +_nm_utils_dns_option_validate (const char *option, + char **out_name, + long *out_value, + gboolean ipv6, const NMUtilsDNSOptionDesc *option_descs) { - char **tokens, *ptr; - gboolean ret = FALSE; + gs_free char *option0_free = NULL; + const char *option0; + const char *option1; + const char *delim; + long option1_num; g_return_val_if_fail (option != NULL, FALSE); - if (out_name) - *out_name = NULL; - if (out_value) - *out_value = -1; + NM_SET_OUT (out_name, NULL); + NM_SET_OUT (out_value, -1); if (!option[0]) return FALSE; - tokens = g_strsplit (option, ":", 2); - - if (g_strv_length (tokens) == 1) { - ret = validate_dns_option (tokens[0], FALSE, ipv6, option_descs); - if (ret && out_name) - *out_name = g_strdup (tokens[0]); - goto out; + delim = strchr (option, ':'); + if (!delim) { + if (!validate_dns_option (option, FALSE, ipv6, option_descs)) + return FALSE; + NM_SET_OUT (out_name, g_strdup (option)); + return TRUE; } - if (!tokens[1][0]) { - ret = FALSE; - goto out; - } + option1 = &delim[1]; - for (ptr = tokens[1]; *ptr; ptr++) { - if (!g_ascii_isdigit (*ptr)) { - ret = FALSE; - goto out; - } - } + if (!option1[0]) + return FALSE; + if (!NM_STRCHAR_ALL (option1, ch, g_ascii_isdigit (ch))) + return FALSE; - ret = FALSE; - if (validate_dns_option (tokens[0], TRUE, ipv6, option_descs)) { - int value = _nm_utils_ascii_str_to_int64 (tokens[1], 10, 0, G_MAXINT32, -1); - if (value >= 0) { - if (out_name) - *out_name = g_strdup (tokens[0]); - if (out_value) - *out_value = value; - ret = TRUE; - } - } -out: - g_strfreev (tokens); - return ret; + option0 = nm_strndup_a (300, option, delim - option, &option0_free); + + if (!validate_dns_option (option0, TRUE, ipv6, option_descs)) + return FALSE; + + option1_num = _nm_utils_ascii_str_to_int64 (option1, 10, 0, G_MAXINT32, -1); + if (option1_num == -1) + return FALSE; + + NM_SET_OUT (out_name, g_steal_pointer (&option0_free) + ?: g_strdup (option0)); + NM_SET_OUT (out_value, option1_num); + return TRUE; } /** @@ -5448,7 +5444,7 @@ attribute_escape (const char *src, char c1, char c2) { char *ret, *dest; - dest = ret = malloc (strlen (src) * 2 + 1); + dest = ret = g_malloc (strlen (src) * 2 + 1); while (*src) { if (*src == c1 || *src == c2 || *src == '\\') |