From 787124bd890fd8ecbe55db54e3e2783308f56c64 Mon Sep 17 00:00:00 2001 From: zhangzujian Date: Fri, 19 Jan 2024 12:02:02 +0000 Subject: [PATCH] debug Signed-off-by: zhangzujian --- lib/netdev.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lib/netdev.c b/lib/netdev.c index b5e877c6a51..eddb9e559b2 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -2332,11 +2332,33 @@ netdev_get_addrs_list_flush(void) ovs_mutex_lock(&if_addr_list_lock); if (if_addr_list) { struct netdev_linux_addr_list *list; + struct ds s1, s2; + ds_init(&s1); + ds_init(&s2); HMAP_FOR_EACH_SAFE (list, hmap_node, if_addr_list) { + if (IN6_IS_ADDR_V4MAPPED(&list->addr_array[0])) { + ip_format_masked(in6_addr_get_mapped_ipv4(&list->addr_array[0]), in6_addr_get_mapped_ipv4(&list->mask_array[0]), &s1); + } else { + ipv6_format_masked(&list->addr_array[0], &list->mask_array[0], &s1); + } + + if (IN6_IS_ADDR_V4MAPPED(&list->addr_array[list->count-1])) { + ip_format_masked(in6_addr_get_mapped_ipv4(&list->addr_array[list->count-1]), in6_addr_get_mapped_ipv4(&list->mask_array[list->count-1]), &s2); + } else { + ipv6_format_masked(&list->addr_array[list->count-1], &list->mask_array[list->count-1], &s2); + } + + VLOG_INFO("interface %d has %d ip(s): %s ... %s", + list->if_index, list->count, + ds_cstr_ro(&s1), ds_cstr_ro(&s2)); + ds_clear(&s1); + ds_clear(&s2); free(list->addr_array); free(list->mask_array); free(list); } + ds_destroy(&s1); + ds_destroy(&s2); hmap_destroy(if_addr_list); free(if_addr_list); if_addr_list = NULL;