diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2015-10-12 18:10:03 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-10-27 17:27:41 +0100 |
commit | ec7de9f2871f79a1cd9507e12c488bfb0198ac4a (patch) | |
tree | b9f4c7eb6c75f3a75bcdd12b104614e66bf46094 | |
parent | 1df773fcef6b572ab384cd005bdc9cf75a1ee9ab (diff) | |
download | NetworkManager-jk/vlan-assume-and-fixes.tar.gz |
platform: print VLAN ingress/egress priorities when logging the linkjk/vlan-assume-and-fixes
-rw-r--r-- | src/platform/nm-platform.c | 35 | ||||
-rw-r--r-- | src/platform/nm-platform.h | 2 |
2 files changed, 30 insertions, 7 deletions
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index 40e3a3e924..a9d282022c 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -2408,14 +2408,14 @@ _lifetime_summary_to_string (gint32 now, guint32 timestamp, guint32 preferred, g return buf; } -char _nm_platform_to_string_buffer[256]; +char _nm_platform_to_string_buffer[1024]; const char * nm_platform_link_to_string (const NMPlatformLink *link) { char master[20]; char parent[20]; - char str_vlan[16]; + char *str_vlan = NULL; GString *str_flags; char str_addrmode[30]; gs_free char *str_addr = NULL; @@ -2453,10 +2453,32 @@ nm_platform_link_to_string (const NMPlatformLink *link) else parent[0] = 0; - if (link->vlan_id) - g_snprintf (str_vlan, sizeof (str_vlan), " vlan id %u flags %u", (guint) link->vlan_id, link->vlan_flags); - else - str_vlan[0] = '\0'; + if (link->vlan_id) { + GString *str_ingress_map = g_string_new (NULL); + GString *str_egress_map = g_string_new (NULL); + int i; + const guint32 *egress_map_from; + const guint32 *egress_map_to; + guint32 size = 0; + + for (i = 0; i < 8; i++) { + if (link->vlan_ingress_map[i]) + g_string_append_printf (str_ingress_map, "%u:%u,", i, link->vlan_ingress_map[i]); + } + g_string_truncate (str_ingress_map, str_ingress_map->len - 1); + + nm_platform_vlan_get_egress_map (NM_PLATFORM_GET, link->ifindex, &egress_map_from, &egress_map_to, &size); + for (i = 0; i < size; i++) { + g_string_append_printf (str_egress_map, i == 0 ? "%u:%u" : ",%u:%u", + egress_map_from[i], egress_map_to[i]); + } + str_vlan = g_strdup_printf (" vlan id %u flags %u ingress {%s} egress {%s}", + (guint) link->vlan_id, link->vlan_flags, + str_ingress_map->str, str_egress_map->str); + g_string_free (str_ingress_map, TRUE); + g_string_free (str_egress_map, TRUE); + } else + str_vlan = g_strdup (""); if (link->inet6_addr_gen_mode_inv) { switch (_nm_platform_uint8_inv (link->inet6_addr_gen_mode_inv)) { @@ -2515,6 +2537,7 @@ nm_platform_link_to_string (const NMPlatformLink *link) link->driver ? " driver " : "", link->driver ? link->driver : ""); g_string_free (str_flags, TRUE); + g_free (str_vlan); return _nm_platform_to_string_buffer; } diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index 7e9ea9e0b1..8dbdf276cd 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -333,7 +333,7 @@ typedef struct { extern const NMPlatformVTableRoute nm_platform_vtable_route_v4; extern const NMPlatformVTableRoute nm_platform_vtable_route_v6; -extern char _nm_platform_to_string_buffer[256]; +extern char _nm_platform_to_string_buffer[1024]; typedef struct { int peer; |