firewall: fix supressing errors from D-Bus calls
We want to ignore certain errors from firewalld. In the past, the error message contained only the error code. Since recently ([1], [2]), the error message contains a longer text: NetworkManager[647]: <debug> [1492768494.7475] device[0x7f7f21e78f50] (eth0): Activation: setting firewall zone 'default' NetworkManager[647]: <debug> [1492768494.7475] firewall: [0x7f7f21ed8900,change:"eth0"]: firewall zone change eth0:default ... firewalld[2342]: ERROR: UNKNOWN_INTERFACE: 'eth0' is not in any zone NetworkManager[647]: <warn> [1492768494.7832] firewall: [0x7f7f0400c780,remove:"eth0"]: complete: request failed (UNKNOWN_INTERFACE: 'eth0' is not in any zone) [1]c77156d7f6
[2]7c6ab456c5
This commit is contained in:
@@ -263,14 +263,16 @@ _handle_dbus (GObject *proxy, GAsyncResult *result, gpointer user_data)
|
||||
non_error = "UNKNOWN_INTERFACE";
|
||||
break;
|
||||
}
|
||||
if (!g_strcmp0 (error->message, non_error)) {
|
||||
if ( error->message
|
||||
&& non_error
|
||||
&& g_str_has_prefix (error->message, non_error)
|
||||
&& NM_IN_SET (error->message[strlen (non_error)], '\0', ':')) {
|
||||
_LOGD (info, "complete: request failed with a non-error (%s)", error->message);
|
||||
|
||||
/* The operation failed with an error reason that we don't want
|
||||
* to propagate. Instead, signal success. */
|
||||
g_clear_error (&error);
|
||||
}
|
||||
else
|
||||
} else
|
||||
_LOGW (info, "complete: request failed (%s)", error->message);
|
||||
} else
|
||||
_LOGD (info, "complete: success");
|
||||
|
Reference in New Issue
Block a user