firewall/utils: move logs from sharing to firewall domain

This commit is contained in:
Jan Vaclav
2025-03-27 11:14:51 +01:00
parent e39e119636
commit 10c2892d57

View File

@@ -185,7 +185,7 @@ _share_iptables_call_v(const char *const *argv)
gs_free char *argv_str = NULL; gs_free char *argv_str = NULL;
int status; int status;
nm_log_dbg(LOGD_SHARING, "iptables: %s", (argv_str = g_strjoinv(" ", (char **) argv))); nm_log_dbg(LOGD_FIREWALL, "iptables: %s", (argv_str = g_strjoinv(" ", (char **) argv)));
if (!g_spawn_sync("/", if (!g_spawn_sync("/",
(char **) argv, (char **) argv,
@@ -197,7 +197,7 @@ _share_iptables_call_v(const char *const *argv)
NULL, NULL,
&status, &status,
&error)) { &error)) {
nm_log_warn(LOGD_SHARING, nm_log_warn(LOGD_FIREWALL,
"iptables: error executing command %s: %s", "iptables: error executing command %s: %s",
argv[0], argv[0],
error->message); error->message);
@@ -205,7 +205,7 @@ _share_iptables_call_v(const char *const *argv)
} }
if (!g_spawn_check_exit_status(status, &error)) { if (!g_spawn_check_exit_status(status, &error)) {
nm_log_warn(LOGD_SHARING, "iptables: command %s failed: %s", argv[0], error->message); nm_log_warn(LOGD_FIREWALL, "iptables: command %s failed: %s", argv[0], error->message);
return FALSE; return FALSE;
} }
@@ -460,18 +460,18 @@ _fw_nft_call_communicate_cb(GObject *source, GAsyncResult *result, gpointer user
/* on any error, the process might still be running. We need to abort it in /* on any error, the process might still be running. We need to abort it in
* the background... */ * the background... */
if (!nm_utils_error_is_cancelled(error)) { if (!nm_utils_error_is_cancelled(error)) {
nm_log_dbg(LOGD_SHARING, nm_log_dbg(LOGD_FIREWALL,
"firewall: nft[%s]: communication failed: %s. Kill process", "firewall: nft[%s]: communication failed: %s. Kill process",
call_data->identifier, call_data->identifier,
error->message); error->message);
} else if (!call_data->timeout_source) { } else if (!call_data->timeout_source) {
nm_log_dbg(LOGD_SHARING, nm_log_dbg(LOGD_FIREWALL,
"firewall: nft[%s]: communication timed out. Kill process", "firewall: nft[%s]: communication timed out. Kill process",
call_data->identifier); call_data->identifier);
nm_clear_error(&error); nm_clear_error(&error);
nm_utils_error_set(&error, NM_UTILS_ERROR_UNKNOWN, "timeout communicating with nft"); nm_utils_error_set(&error, NM_UTILS_ERROR_UNKNOWN, "timeout communicating with nft");
} else { } else {
nm_log_dbg(LOGD_SHARING, nm_log_dbg(LOGD_FIREWALL,
"firewall: nft[%s]: communication cancelled. Kill process", "firewall: nft[%s]: communication cancelled. Kill process",
call_data->identifier); call_data->identifier);
} }
@@ -485,7 +485,7 @@ _fw_nft_call_communicate_cb(GObject *source, GAsyncResult *result, gpointer user
nm_g_subprocess_terminate_in_background(call_data->subprocess, 200); nm_g_subprocess_terminate_in_background(call_data->subprocess, 200);
} }
} else if (g_subprocess_get_successful(call_data->subprocess)) { } else if (g_subprocess_get_successful(call_data->subprocess)) {
nm_log_dbg(LOGD_SHARING, "firewall: nft[%s]: command successful", call_data->identifier); nm_log_dbg(LOGD_FIREWALL, "firewall: nft[%s]: command successful", call_data->identifier);
} else { } else {
char buf[NM_UTILS_GET_PROCESS_EXIT_STATUS_BUF_LEN]; char buf[NM_UTILS_GET_PROCESS_EXIT_STATUS_BUF_LEN];
gs_free char *ss_stdout = NULL; gs_free char *ss_stdout = NULL;
@@ -498,7 +498,7 @@ _fw_nft_call_communicate_cb(GObject *source, GAsyncResult *result, gpointer user
nm_utils_get_process_exit_status_desc_buf(status, buf, sizeof(buf)); nm_utils_get_process_exit_status_desc_buf(status, buf, sizeof(buf));
nm_log_warn(LOGD_SHARING, nm_log_warn(LOGD_FIREWALL,
"firewall: nft[%s]: command %s:%s%s%s%s%s%s%s", "firewall: nft[%s]: command %s:%s%s%s%s%s%s%s",
call_data->identifier, call_data->identifier,
buf, buf,
@@ -534,7 +534,7 @@ _fw_nft_call_cancelled_cb(GCancellable *cancellable, gpointer user_data)
if (call_data->cancellable_id == 0) if (call_data->cancellable_id == 0)
return; return;
nm_log_dbg(LOGD_SHARING, "firewall: nft[%s]: operation cancelled", call_data->identifier); nm_log_dbg(LOGD_FIREWALL, "firewall: nft[%s]: operation cancelled", call_data->identifier);
nm_clear_g_signal_handler(g_task_get_cancellable(call_data->task), &call_data->cancellable_id); nm_clear_g_signal_handler(g_task_get_cancellable(call_data->task), &call_data->cancellable_id);
nm_clear_g_cancellable(&call_data->intern_cancellable); nm_clear_g_cancellable(&call_data->intern_cancellable);
@@ -546,7 +546,7 @@ _fw_nft_call_timeout_cb(gpointer user_data)
FwNftCallData *call_data = user_data; FwNftCallData *call_data = user_data;
nm_clear_g_source_inst(&call_data->timeout_source); nm_clear_g_source_inst(&call_data->timeout_source);
nm_log_dbg(LOGD_SHARING, nm_log_dbg(LOGD_FIREWALL,
"firewall: nft[%s]: cancel operation after timeout", "firewall: nft[%s]: cancel operation after timeout",
call_data->identifier); call_data->identifier);
@@ -573,7 +573,7 @@ nm_firewall_nft_call(GBytes *stdin_buf,
.timeout_source = NULL, .timeout_source = NULL,
}; };
nm_log_trace(LOGD_SHARING, nm_log_trace(LOGD_FIREWALL,
"firewall: nft: call command: [ '%s' ]", "firewall: nft: call command: [ '%s' ]",
nm_utils_buf_utf8safe_escape_bytes(stdin_buf, nm_utils_buf_utf8safe_escape_bytes(stdin_buf,
NM_UTILS_STR_UTF8_SAFE_FLAG_ESCAPE_CTRL, NM_UTILS_STR_UTF8_SAFE_FLAG_ESCAPE_CTRL,
@@ -585,7 +585,7 @@ nm_firewall_nft_call(GBytes *stdin_buf,
call_data, call_data,
NULL); NULL);
if (call_data->cancellable_id == 0) { if (call_data->cancellable_id == 0) {
nm_log_dbg(LOGD_SHARING, "firewall: nft: already cancelled"); nm_log_dbg(LOGD_FIREWALL, "firewall: nft: already cancelled");
nm_utils_error_set_cancelled(&error, FALSE, NULL); nm_utils_error_set_cancelled(&error, FALSE, NULL);
_fw_nft_call_data_free(call_data, g_steal_pointer(&error)); _fw_nft_call_data_free(call_data, g_steal_pointer(&error));
return; return;
@@ -602,14 +602,14 @@ nm_firewall_nft_call(GBytes *stdin_buf,
&error); &error);
if (!call_data->subprocess) { if (!call_data->subprocess) {
nm_log_dbg(LOGD_SHARING, "firewall: nft: spawning nft failed: %s", error->message); nm_log_dbg(LOGD_FIREWALL, "firewall: nft: spawning nft failed: %s", error->message);
_fw_nft_call_data_free(call_data, g_steal_pointer(&error)); _fw_nft_call_data_free(call_data, g_steal_pointer(&error));
return; return;
} }
call_data->identifier = g_strdup(g_subprocess_get_identifier(call_data->subprocess)); call_data->identifier = g_strdup(g_subprocess_get_identifier(call_data->subprocess));
nm_log_dbg(LOGD_SHARING, "firewall: nft[%s]: communicate with nft", call_data->identifier); nm_log_dbg(LOGD_FIREWALL, "firewall: nft[%s]: communicate with nft", call_data->identifier);
nm_shutdown_wait_obj_register_object(call_data->task, "nft-call"); nm_shutdown_wait_obj_register_object(call_data->task, "nft-call");
@@ -1124,7 +1124,7 @@ again:
if (!g_atomic_int_compare_and_exchange(&backend, NM_FIREWALL_BACKEND_UNKNOWN, b)) if (!g_atomic_int_compare_and_exchange(&backend, NM_FIREWALL_BACKEND_UNKNOWN, b))
goto again; goto again;
nm_log_dbg(LOGD_SHARING, nm_log_dbg(LOGD_FIREWALL,
"firewall: use %s backend%s%s%s%s%s%s%s", "firewall: use %s backend%s%s%s%s%s%s%s",
FirewallBackends[b - 1].name, FirewallBackends[b - 1].name,
NM_PRINT_FMT_QUOTED(FirewallBackends[b - 1].path, NM_PRINT_FMT_QUOTED(FirewallBackends[b - 1].path,