aboutsummaryrefslogtreecommitdiffstats
path: root/epan/addr_resolv.c
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2017-10-24 21:04:19 +0100
committerJoão Valverde <j@v6e.pt>2017-10-25 19:10:57 +0000
commit90644c83725f979f82e7990792faaf6e847f74ea (patch)
tree2b0b1eccab4d2bc2296dc446e69f93a494e223bc /epan/addr_resolv.c
parentc5529dd7f1269e88b4c122fa3c755d5696b58a70 (diff)
Remove inet_aton() usage everywhere
Including where it says not to in comments. Use IPv4 dotted-decimal notation. Change-Id: Iafe1f6fbd2bd5867c41642dc27411f47dff8ce6a Reviewed-on: https://code.wireshark.org/review/24044 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde <j@v6e.pt>
Diffstat (limited to 'epan/addr_resolv.c')
-rw-r--r--epan/addr_resolv.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c
index 1826321eec..c9ecd0d78a 100644
--- a/epan/addr_resolv.c
+++ b/epan/addr_resolv.c
@@ -103,7 +103,6 @@
#include <wsutil/report_message.h>
#include <wsutil/file_util.h>
#include <wsutil/pint.h>
-#include "wsutil/inet_aton.h"
#include <wsutil/inet_addr.h>
#include <epan/strutil.h>
@@ -3122,7 +3121,7 @@ c_ares_ghi_cb(void *arg, int status, int timeouts _U_, struct hostent *hp) {
gboolean
get_host_ipaddr(const char *host, guint32 *addrp)
{
- struct in_addr ipaddr;
+ guint32 ipaddr;
#ifdef HAVE_C_ARES
struct timeval tv = { 0, GHI_TIMEOUT }, *tvp;
int nfds;
@@ -3130,12 +3129,7 @@ get_host_ipaddr(const char *host, guint32 *addrp)
async_hostent_t ahe;
#endif
- /*
- * don't change it to inet_pton(AF_INET), they are not 100% compatible.
- * inet_pton(AF_INET) does not support hexadecimal notation nor
- * less-than-4 octet notation.
- */
- if (!inet_aton(host, &ipaddr)) {
+ if (!ws_inet_pton4(host, &ipaddr)) {
/* It's not a valid dotted-quad IP address; is it a valid
* host name?
@@ -3185,7 +3179,7 @@ get_host_ipaddr(const char *host, guint32 *addrp)
return FALSE;
}
- *addrp = ipaddr.s_addr;
+ *addrp = ipaddr;
return TRUE;
}