summary refs log tree commit diff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/devices/nm-device.c2
-rw-r--r--src/core/devices/ovs/nm-ovsdb.c70
-rw-r--r--src/core/nm-config.c4
-rw-r--r--src/core/nm-connectivity.c6
-rw-r--r--src/core/nm-core-utils.h6
-rw-r--r--src/core/nm-firewall-utils.c32
-rw-r--r--src/core/platform/tests/test-common.c11
7 files changed, 73 insertions, 58 deletions
diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c
index a723bf7f..c4f0f9a2 100644
--- a/src/core/devices/nm-device.c
+++ b/src/core/devices/nm-device.c
@@ -15043,7 +15043,7 @@ nm_device_recheck_available_connections(NMDevice *self)
 
         if (nm_device_check_connection_available(self,
                                                  nm_settings_connection_get_connection(sett_conn),
-                                                 NM_DEVICE_CHECK_CON_AVAILABLE_NONE,
+                                                 _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST,
                                                  NULL,
                                                  NULL)) {
             if (available_connections_add(self, sett_conn))
diff --git a/src/core/devices/ovs/nm-ovsdb.c b/src/core/devices/ovs/nm-ovsdb.c
index d3e858a1..0d688396 100644
--- a/src/core/devices/ovs/nm-ovsdb.c
+++ b/src/core/devices/ovs/nm-ovsdb.c
@@ -592,21 +592,30 @@ _set_bridge_ports(json_t *params, const char *ifname, json_t *new_ports)
 static void
 _set_bridge_mac(json_t *params, const char *ifname, const char *mac)
 {
-    json_array_append_new(params,
-                          json_pack("{s:s, s:s, s:{s:[s, [[s, s]]]}, s:[[s, s, s]]}",
-                                    "op",
-                                    "update",
-                                    "table",
-                                    "Bridge",
-                                    "row",
-                                    "other_config",
-                                    "map",
-                                    "hwaddr",
-                                    mac,
-                                    "where",
-                                    "name",
-                                    "==",
-                                    ifname));
+    json_array_append_new(
+        params,
+        json_pack("{s:s, s:s, s:[[s, s, [s, [s]]], [s, s, [s, [[s, s]]]]], s:[[s, s, s]]}",
+                  "op",
+                  "mutate",
+                  "table",
+                  "Bridge",
+                  "mutations",
+
+                  "other_config",
+                  "delete",
+                  "set",
+                  "hwaddr",
+
+                  "other_config",
+                  "insert",
+                  "map",
+                  "hwaddr",
+                  mac,
+
+                  "where",
+                  "name",
+                  "==",
+                  ifname));
 }
 
 /**
@@ -714,26 +723,27 @@ _j_create_external_ids_array_update(const char *connection_uuid,
 
     mutations = json_array();
 
+    array = json_array();
     if (exid_old) {
-        array = NULL;
         g_hash_table_iter_init(&iter, exid_old);
         while (g_hash_table_iter_next(&iter, (gpointer *) &key, NULL)) {
-            if (nm_g_hash_table_contains(exid_new, key))
-                continue;
-            if (NM_STR_HAS_PREFIX(key, NM_OVS_EXTERNAL_ID_NM_PREFIX))
-                continue;
-
-            if (!array)
-                array = json_array();
-
             json_array_append_new(array, json_string(key));
         }
-        if (array) {
-            json_array_append_new(
-                mutations,
-                json_pack("[s, s, [s, o]]", "external_ids", "delete", "set", array));
+    }
+    if (exid_new) {
+        g_hash_table_iter_init(&iter, exid_new);
+        while (g_hash_table_iter_next(&iter, (gpointer *) &key, NULL)) {
+            if (nm_g_hash_table_contains(exid_old, key))
+                continue;
+            json_array_append_new(array, json_string(key));
         }
     }
+    if (!nm_g_hash_table_contains(exid_old, NM_OVS_EXTERNAL_ID_NM_PREFIX)
+        && !nm_g_hash_table_contains(exid_new, NM_OVS_EXTERNAL_ID_NM_PREFIX)) {
+        json_array_append_new(array, json_string(NM_OVS_EXTERNAL_ID_NM_PREFIX));
+    }
+    json_array_append_new(mutations,
+                          json_pack("[s, s, [s, o]]", "external_ids", "delete", "set", array));
 
     array = json_array();
 
@@ -1569,9 +1579,9 @@ _external_ids_to_string(const GArray *arr)
 
         if (i > 0)
             nm_str_buf_append_c(&strbuf, ',');
-        nm_str_buf_append_printf(&strbuf, " \"%s\" = \"%s\"]", n->name, n->value_str);
+        nm_str_buf_append_printf(&strbuf, " \"%s\" = \"%s\" ", n->name, n->value_str);
     }
-    nm_str_buf_append(&strbuf, " ]");
+    nm_str_buf_append(&strbuf, "]");
 
     return nm_str_buf_finalize(&strbuf, NULL);
 }
diff --git a/src/core/nm-config.c b/src/core/nm-config.c
index 3d23d4f6..62e4e7ea 100644
--- a/src/core/nm-config.c
+++ b/src/core/nm-config.c
@@ -1509,8 +1509,8 @@ nm_config_keyfile_has_global_dns_config(GKeyFile *keyfile, gboolean internal)
     if (!keyfile)
         return FALSE;
     if (g_key_file_has_group(keyfile,
-                             internal ? NM_CONFIG_KEYFILE_GROUP_GLOBAL_DNS
-                                      : NM_CONFIG_KEYFILE_GROUP_INTERN_GLOBAL_DNS))
+                             internal ? NM_CONFIG_KEYFILE_GROUP_INTERN_GLOBAL_DNS
+                                      : NM_CONFIG_KEYFILE_GROUP_GLOBAL_DNS))
         return TRUE;
 
     groups = g_key_file_get_groups(keyfile, NULL);
diff --git a/src/core/nm-connectivity.c b/src/core/nm-connectivity.c
index cd30853d..c0e77e35 100644
--- a/src/core/nm-connectivity.c
+++ b/src/core/nm-connectivity.c
@@ -767,7 +767,13 @@ do_curl_request(NMConnectivityCheckHandle *cb_data, const char *hosts)
     curl_easy_setopt(ehandle, CURLOPT_INTERFACE, cb_data->ifspec);
     curl_easy_setopt(ehandle, CURLOPT_RESOLVE, cb_data->concheck.hosts);
     curl_easy_setopt(ehandle, CURLOPT_IPRESOLVE, resolve);
+
+#if LIBCURL_VERSION_NUM >= 0x075500 /* libcurl 7.85.0 */
+    curl_easy_setopt(ehandle, CURLOPT_PROTOCOLS_STR, "HTTP,HTTPS");
+#else
     curl_easy_setopt(ehandle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
+#endif
+
     if (_LOGT_ENABLED() && easy_debug_enabled()) {
         curl_easy_setopt(ehandle, CURLOPT_DEBUGFUNCTION, easy_debug_cb);
         curl_easy_setopt(ehandle, CURLOPT_DEBUGDATA, cb_data);
diff --git a/src/core/nm-core-utils.h b/src/core/nm-core-utils.h
index d1a62a60..483af077 100644
--- a/src/core/nm-core-utils.h
+++ b/src/core/nm-core-utils.h
@@ -154,7 +154,7 @@ nm_utils_ip_route_metric_penalize(guint32 metric, guint32 penalty)
 void nm_utils_kill_process_sync(pid_t       pid,
                                 guint64     start_time,
                                 int         sig,
-                                guint64     log_domain,
+                                NMLogDomain log_domain,
                                 const char *log_name,
                                 guint32     wait_before_kill_msec,
                                 guint32     sleep_duration_msec,
@@ -166,14 +166,14 @@ typedef void (*NMUtilsKillChildAsyncCb)(pid_t    pid,
                                         void    *user_data);
 void     nm_utils_kill_child_async(pid_t                   pid,
                                    int                     sig,
-                                   guint64                 log_domain,
+                                   NMLogDomain             log_domain,
                                    const char             *log_name,
                                    guint32                 wait_before_kill_msec,
                                    NMUtilsKillChildAsyncCb callback,
                                    void                   *user_data);
 gboolean nm_utils_kill_child_sync(pid_t       pid,
                                   int         sig,
-                                  guint64     log_domain,
+                                  NMLogDomain log_domain,
                                   const char *log_name,
                                   int        *child_status,
                                   guint32     wait_before_kill_msec,
diff --git a/src/core/nm-firewall-utils.c b/src/core/nm-firewall-utils.c
index e482ab96..4bcde85f 100644
--- a/src/core/nm-firewall-utils.c
+++ b/src/core/nm-firewall-utils.c
@@ -147,12 +147,13 @@ _share_iptables_call_v(const char *const *argv)
     return TRUE;
 }
 
-#define _share_iptables_call(...) _share_iptables_call_v(NM_MAKE_STRV(__VA_ARGS__))
+#define _share_iptables_call(...) \
+    _share_iptables_call_v(NM_MAKE_STRV("" IPTABLES_PATH "", "--wait", "2", __VA_ARGS__))
 
 static gboolean
 _share_iptables_chain_op(const char *table, const char *chain, const char *op)
 {
-    return _share_iptables_call("" IPTABLES_PATH "", "--table", table, op, chain);
+    return _share_iptables_call("--table", table, op, chain);
 }
 
 static gboolean
@@ -181,8 +182,7 @@ _share_iptables_set_masquerade_sync(gboolean up, const char *ip_iface, in_addr_t
     comment_name = _share_iptables_get_name(FALSE, "nm-shared", ip_iface);
 
     _share_iptables_subnet_to_str(str_subnet, addr, plen);
-    _share_iptables_call("" IPTABLES_PATH "",
-                         "--table",
+    _share_iptables_call("--table",
                          "nat",
                          up ? "--insert" : "--delete",
                          "POSTROUTING",
@@ -232,8 +232,7 @@ _share_iptables_set_shared_chains_add(const char *chain_input,
     _share_iptables_chain_add("filter", chain_input);
 
     for (i = 0; i < (int) G_N_ELEMENTS(input_params); i++) {
-        _share_iptables_call("" IPTABLES_PATH "",
-                             "--table",
+        _share_iptables_call("--table",
                              "filter",
                              "--append",
                              chain_input,
@@ -247,8 +246,7 @@ _share_iptables_set_shared_chains_add(const char *chain_input,
 
     _share_iptables_chain_add("filter", chain_forward);
 
-    _share_iptables_call("" IPTABLES_PATH "",
-                         "--table",
+    _share_iptables_call("--table",
                          "filter",
                          "--append",
                          chain_forward,
@@ -262,8 +260,7 @@ _share_iptables_set_shared_chains_add(const char *chain_input,
                          "ESTABLISHED,RELATED",
                          "--jump",
                          "ACCEPT");
-    _share_iptables_call("" IPTABLES_PATH "",
-                         "--table",
+    _share_iptables_call("--table",
                          "filter",
                          "--append",
                          chain_forward,
@@ -273,8 +270,7 @@ _share_iptables_set_shared_chains_add(const char *chain_input,
                          ip_iface,
                          "--jump",
                          "ACCEPT");
-    _share_iptables_call("" IPTABLES_PATH "",
-                         "--table",
+    _share_iptables_call("--table",
                          "filter",
                          "--append",
                          chain_forward,
@@ -284,8 +280,7 @@ _share_iptables_set_shared_chains_add(const char *chain_input,
                          ip_iface,
                          "--jump",
                          "ACCEPT");
-    _share_iptables_call("" IPTABLES_PATH "",
-                         "--table",
+    _share_iptables_call("--table",
                          "filter",
                          "--append",
                          chain_forward,
@@ -293,8 +288,7 @@ _share_iptables_set_shared_chains_add(const char *chain_input,
                          ip_iface,
                          "--jump",
                          "REJECT");
-    _share_iptables_call("" IPTABLES_PATH "",
-                         "--table",
+    _share_iptables_call("--table",
                          "filter",
                          "--append",
                          chain_forward,
@@ -325,8 +319,7 @@ _share_iptables_set_shared_sync(gboolean up, const char *ip_iface, in_addr_t add
     if (up)
         _share_iptables_set_shared_chains_add(chain_input, chain_forward, ip_iface, addr, plen);
 
-    _share_iptables_call("" IPTABLES_PATH "",
-                         "--table",
+    _share_iptables_call("--table",
                          "filter",
                          up ? "--insert" : "--delete",
                          "INPUT",
@@ -339,8 +332,7 @@ _share_iptables_set_shared_sync(gboolean up, const char *ip_iface, in_addr_t add
                          "--comment",
                          comment_name);
 
-    _share_iptables_call("" IPTABLES_PATH "",
-                         "--table",
+    _share_iptables_call("--table",
                          "filter",
                          up ? "--insert" : "--delete",
                          "FORWARD",
diff --git a/src/core/platform/tests/test-common.c b/src/core/platform/tests/test-common.c
index 34ec5cc2..b5bb1232 100644
--- a/src/core/platform/tests/test-common.c
+++ b/src/core/platform/tests/test-common.c
@@ -12,6 +12,7 @@
 #include <sys/wait.h>
 #include <fcntl.h>
 #include <linux/if_tun.h>
+#include <linux/rtnetlink.h>
 
 #include "n-acd/src/n-acd.h"
 
@@ -540,7 +541,7 @@ _ip4_route_get(NMPlatform *platform,
 
     _init_platform(&platform, FALSE);
 
-    nmp_lookup_init_ip4_route_by_weak_id(&lookup, network, plen, metric, tos);
+    nmp_lookup_init_ip4_route_by_weak_id(&lookup, RT_TABLE_MAIN, network, plen, metric, tos);
 
     c = 0;
     nmp_cache_iter_for_each (&iter, nm_platform_lookup(platform, &lookup), &o) {
@@ -633,7 +634,13 @@ _ip6_route_get(NMPlatform            *platform,
 
     _init_platform(&platform, FALSE);
 
-    nmp_lookup_init_ip6_route_by_weak_id(&lookup, network, plen, metric, src, src_plen);
+    nmp_lookup_init_ip6_route_by_weak_id(&lookup,
+                                         RT_TABLE_MAIN,
+                                         network,
+                                         plen,
+                                         metric,
+                                         src,
+                                         src_plen);
 
     c = 0;
     nmp_cache_iter_for_each (&iter, nm_platform_lookup(platform, &lookup), &o) {