aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-10-25 12:36:02 -0700
committerGuy Harris <guy@alum.mit.edu>2017-10-25 19:36:34 +0000
commit6537c996a62ac0540fb21e4b0462119422dd6ad6 (patch)
tree7ee359fa2e58b5d3540d97847606feb690a56f57
parent90644c83725f979f82e7990792faaf6e847f74ea (diff)
Clean up and expand comments.
Note the dropping of support for hex IPv4 addresses and addresses with fewer than four components, and indicate that, if there are any places where that support is expected, we should change those places (i.e., don't just change get_host_ipaddr() and, if there aren't any such places, just leave everything as it is). It's not clear that get_host_ipaddr() is "Used more in the dfilter parser rather than in packet dissectors"; that may depend on whether you're counting number of calls executed from those places or the number of lines of code making those calls. Just drop the claim, which is absent in the comment for get_host_ipaddr6(). Also ask whether we're using get_host_ipaddr{6}() in any places where it should *only* support numeric addresses rather than names. Change-Id: Ib5d8730ca703339342f308081a68309479f842c5 Reviewed-on: https://code.wireshark.org/review/24055 Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--epan/addr_resolv.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c
index c9ecd0d..b49dc78 100644
--- a/epan/addr_resolv.c
+++ b/epan/addr_resolv.c
@@ -3114,10 +3114,9 @@ c_ares_ghi_cb(void *arg, int status, int timeouts _U_, struct hostent *hp) {
}
#endif /* HAVE_C_ARES */
-/* Translate a string, assumed either to be a dotted-quad IP address or
- * a host name, to a numeric IP address. Return TRUE if we succeed and
- * set "*addrp" to that numeric IP address; return FALSE if we fail.
- * Used more in the dfilter parser rather than in packet dissectors */
+/* Translate a string, assumed either to be a dotted-quad IPv4 address or
+ * a host name, to a numeric IPv4 address. Return TRUE if we succeed and
+ * set "*addrp" to that numeric IPv4 address; return FALSE if we fail. */
gboolean
get_host_ipaddr(const char *host, guint32 *addrp)
{
@@ -3129,6 +3128,16 @@ get_host_ipaddr(const char *host, guint32 *addrp)
async_hostent_t ahe;
#endif
+ /*
+ * XXX - if there are any places where this needs to support
+ * the hex-address form for IPv4 addresses, or to support
+ * fewer than 4 components for a network address, add that
+ * wherever it's appropriate.
+ *
+ * XXX - are there places where this is used to translate something
+ * that's *only* supposed to be an IPv4 address, and where it
+ * *shouldn't* translate host names?
+ */
if (!ws_inet_pton4(host, &ipaddr)) {
/* It's not a valid dotted-quad IP address; is it a valid
@@ -3184,8 +3193,8 @@ get_host_ipaddr(const char *host, guint32 *addrp)
}
/*
- * Translate IPv6 numeric address or FQDN hostname, into binary IPv6 address.
- * Return TRUE if we succeed and set "*addrp" to that numeric IP address;
+ * Translate IPv6 numeric address or FQDN hostname into binary IPv6 address.
+ * Return TRUE if we succeed and set "*addrp" to that numeric IPv6 address;
* return FALSE if we fail.
*/
gboolean
@@ -3203,6 +3212,10 @@ get_host_ipaddr6(const char *host, struct e_in6_addr *addrp)
/* It's not a valid dotted-quad IP address; is it a valid
* host name?
+ *
+ * XXX - are there places where this is used to translate something
+ * that's *only* supposed to be an IPv6 address, and where it
+ * *shouldn't* translate host names?
*/
/* If we're not allowed to do name resolution, don't do name