diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2016-02-10 09:11:12 +0000 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2016-02-19 15:55:09 +0000 |
commit | 8bee8bad813446bbf75428a8cdd756fe6063ca6f (patch) | |
tree | d6a335bcf1bf745c36fcefefab3356f6c1705a05 /capchild | |
parent | 5fec8fa74619a69e3faeca01fd483157d39f7b13 (diff) | |
download | wireshark-8bee8bad813446bbf75428a8cdd756fe6063ca6f.tar.gz wireshark-8bee8bad813446bbf75428a8cdd756fe6063ca6f.tar.bz2 wireshark-8bee8bad813446bbf75428a8cdd756fe6063ca6f.zip |
Add inet_pton/inet_ntop interface to libwsutil
Change-Id: Ifc344ed33f2f7ca09a6912a5adb49dc35f07c81f
Reviewed-on: https://code.wireshark.org/review/13881
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
Diffstat (limited to 'capchild')
-rw-r--r-- | capchild/capture_ifinfo.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/capchild/capture_ifinfo.c b/capchild/capture_ifinfo.c index b6bef3cf1e..3753ee2684 100644 --- a/capchild/capture_ifinfo.c +++ b/capchild/capture_ifinfo.c @@ -28,22 +28,6 @@ #include <string.h> #include <stdio.h> -#ifdef HAVE_ARPA_INET_H -#include <arpa/inet.h> -#endif - -#ifdef HAVE_SYS_SOCKET_H -#include <sys/socket.h> /* needed to define AF_ values on UNIX */ -#endif - -#ifdef HAVE_WINSOCK2_H -#include <winsock2.h> /* needed to define AF_ values on Windows */ -#endif - -#ifdef NEED_INET_V6DEFS_H -# include "wsutil/inet_v6defs.h" -#endif - #include <glib.h> #include "capture_opts.h" @@ -56,6 +40,7 @@ #include "log.h" #include <caputils/capture_ifinfo.h> +#include <wsutil/inet_addr.h> #ifdef HAVE_PCAP_REMOTE static GList *remote_interface_list = NULL; @@ -187,10 +172,9 @@ capture_interface_list(int *err, char **err_str, void (*update_cb)(void)) addr_parts = g_strsplit(if_parts[4], ",", 0); for (j = 0; addr_parts[j] != NULL; j++) { if_addr = g_new0(if_addr_t,1); - if (inet_pton(AF_INET, addr_parts[j], &if_addr->addr.ip4_addr) > 0) { + if (ws_inet_pton4(addr_parts[j], &if_addr->addr.ip4_addr)) { if_addr->ifat_type = IF_AT_IPv4; - } else if (inet_pton(AF_INET6, addr_parts[j], - &if_addr->addr.ip6_addr) > 0) { + } else if (ws_inet_pton6(addr_parts[j], (struct e_in6_addr *)&if_addr->addr.ip6_addr)) { if_addr->ifat_type = IF_AT_IPv6; } else { g_free(if_addr); |