summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2014-08-11 21:40:52 +0200
committerThomas Haller <thaller@redhat.com>2014-09-24 16:32:11 +0200
commit64851f955909c6ef476a5f703004e674dd0bb927 (patch)
tree3cb1fc6f5f5091431581bb1d2878381d1d527f3a
parentfa18bd6e0a745004ff1fc5b1cf45c76bdb41a5a5 (diff)
downloadNetworkManager-64851f955909c6ef476a5f703004e674dd0bb927.tar.gz
platform: log ifindex and ifname when deleting addresses or routes
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r--src/platform/nm-platform.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 5c62c591b5..583e190ccb 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -1449,24 +1449,27 @@ nm_platform_mesh_set_ssid (int ifindex, const guint8 *ssid, gsize len)
}
#define TO_STRING_DEV_BUF_SIZE (5+15+1)
-static void
+static const char *
_to_string_dev (int ifindex, char *buf, size_t size)
{
g_assert (buf && size >= TO_STRING_DEV_BUF_SIZE);
if (ifindex) {
const char *name = ifindex > 0 ? nm_platform_link_get_name (ifindex) : NULL;
+ char *buf2;
strcpy (buf, " dev ");
- buf += 5;
+ buf2 = buf + 5;
size -= 5;
if (name)
- g_strlcpy (buf, name, size);
+ g_strlcpy (buf2, name, size);
else
- g_snprintf (buf, size, "%d", ifindex);
+ g_snprintf (buf2, size, "%d", ifindex);
} else
buf[0] = 0;
+
+ return buf;
}
/******************************************************************/
@@ -1566,26 +1569,34 @@ nm_platform_ip6_address_add (int ifindex,
gboolean
nm_platform_ip4_address_delete (int ifindex, in_addr_t address, int plen)
{
+ char str_dev[TO_STRING_DEV_BUF_SIZE];
+
reset_error ();
g_return_val_if_fail (ifindex > 0, FALSE);
g_return_val_if_fail (plen > 0, FALSE);
g_return_val_if_fail (klass->ip4_address_delete, FALSE);
- debug ("address: deleting IPv4 address %s/%d", nm_utils_inet4_ntop (address, NULL), plen);
+ debug ("address: deleting IPv4 address %s/%d, ifindex %d%s",
+ nm_utils_inet4_ntop (address, NULL), plen, ifindex,
+ _to_string_dev (ifindex, str_dev, sizeof (str_dev)));
return klass->ip4_address_delete (platform, ifindex, address, plen);
}
gboolean
nm_platform_ip6_address_delete (int ifindex, struct in6_addr address, int plen)
{
+ char str_dev[TO_STRING_DEV_BUF_SIZE];
+
reset_error ();
g_return_val_if_fail (ifindex > 0, FALSE);
g_return_val_if_fail (plen > 0, FALSE);
g_return_val_if_fail (klass->ip6_address_delete, FALSE);
- debug ("address: deleting IPv6 address %s/%d", nm_utils_inet6_ntop (&address, NULL), plen);
+ debug ("address: deleting IPv6 address %s/%d, ifindex %d%s",
+ nm_utils_inet6_ntop (&address, NULL), plen, ifindex,
+ _to_string_dev (ifindex, str_dev, sizeof (str_dev)));
return klass->ip6_address_delete (platform, ifindex, address, plen);
}
@@ -1900,24 +1911,32 @@ nm_platform_ip6_route_add (int ifindex, NMPlatformSource source,
gboolean
nm_platform_ip4_route_delete (int ifindex, in_addr_t network, int plen, int metric)
{
+ char str_dev[TO_STRING_DEV_BUF_SIZE];
+
reset_error ();
g_return_val_if_fail (platform, FALSE);
g_return_val_if_fail (klass->ip4_route_delete, FALSE);
- debug ("route: deleting IPv4 route %s/%d, metric=%d", nm_utils_inet4_ntop (network, NULL), plen, metric);
+ debug ("route: deleting IPv4 route %s/%d, metric=%d, ifindex %d%s",
+ nm_utils_inet4_ntop (network, NULL), plen, metric, ifindex,
+ _to_string_dev (ifindex, str_dev, sizeof (str_dev)));
return klass->ip4_route_delete (platform, ifindex, network, plen, metric);
}
gboolean
nm_platform_ip6_route_delete (int ifindex, struct in6_addr network, int plen, int metric)
{
+ char str_dev[TO_STRING_DEV_BUF_SIZE];
+
reset_error ();
g_return_val_if_fail (platform, FALSE);
g_return_val_if_fail (klass->ip6_route_delete, FALSE);
- debug ("route: deleting IPv6 route %s/%d, metric=%d", nm_utils_inet6_ntop (&network, NULL), plen, metric);
+ debug ("route: deleting IPv6 route %s/%d, metric=%d, ifindex %d%s",
+ nm_utils_inet6_ntop (&network, NULL), plen, metric, ifindex,
+ _to_string_dev (ifindex, str_dev, sizeof (str_dev)));
return klass->ip6_route_delete (platform, ifindex, network, plen, metric);
}