diff options
author | Thomas Haller <thaller@redhat.com> | 2017-04-21 12:05:14 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-04-21 13:41:21 +0200 |
commit | 5eb1ef41ac2c4b6895d679e13ae1d9e9f6bdcd73 (patch) | |
tree | 9c7ac76a738177604d99e5424a2e2ddd41250942 /src/nm-firewall-manager.c | |
parent | 2e612f9bf04f8ea83fbee307cc5944719b6037c8 (diff) | |
download | NetworkManager-5eb1ef41ac2c4b6895d679e13ae1d9e9f6bdcd73.tar.gz |
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] https://github.com/t-woerner/firewalld/commit/c77156d7f688a0be3f0a1b4869b1c659e9e18cd6
[2] https://github.com/t-woerner/firewalld/commit/7c6ab456c5c461ac40cd7bb979a5daec6a13e6e4
(cherry picked from commit 2ad8bb0ce377624eefafe3b626d3fe691a7b9b7c)
Diffstat (limited to 'src/nm-firewall-manager.c')
-rw-r--r-- | src/nm-firewall-manager.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nm-firewall-manager.c b/src/nm-firewall-manager.c index 045d5abc4c..0d893652f8 100644 --- a/src/nm-firewall-manager.c +++ b/src/nm-firewall-manager.c @@ -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"); |