diff options
Diffstat (limited to 'caputils/capture-pcap-util.c')
-rw-r--r-- | caputils/capture-pcap-util.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/caputils/capture-pcap-util.c b/caputils/capture-pcap-util.c index c014f83872..a41b7668d5 100644 --- a/caputils/capture-pcap-util.c +++ b/caputils/capture-pcap-util.c @@ -423,7 +423,7 @@ if_info_add_address(if_info_t *if_info, struct sockaddr *addr) if_addr->ifat_type = IF_AT_IPv4; if_addr->addr.ip4_addr = *((guint32 *)&(ai->sin_addr.s_addr)); - if_info->addrs = g_slist_append(if_info->addrs, if_addr); + if_info->addrs = g_slist_prepend(if_info->addrs, if_addr); break; case AF_INET6: @@ -433,7 +433,7 @@ if_info_add_address(if_info_t *if_info, struct sockaddr *addr) memcpy((void *)&if_addr->addr.ip6_addr, (void *)&ai6->sin6_addr.s6_addr, sizeof if_addr->addr.ip6_addr); - if_info->addrs = g_slist_append(if_info->addrs, if_addr); + if_info->addrs = g_slist_prepend(if_info->addrs, if_addr); break; } } @@ -452,6 +452,10 @@ if_info_ip(if_info_t *if_info, pcap_if_t *d) if (a->addr != NULL) if_info_add_address(if_info, a->addr); } + + if(if_info->addrs){ + if_info->addrs = g_slist_reverse(if_info->addrs); + } } #ifdef HAVE_PCAP_REMOTE |