Have "get_host_ipaddr()" return a Boolean indicating whether it
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 11 Oct 1999 03:03:12 +0000 (03:03 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 11 Oct 1999 03:03:12 +0000 (03:03 +0000)
commit974baaf856fcec198fa51f03581d03afe39a7f20
tree2f4a35a2ca11bf7a6c31bd3079ab48e12ed9b957
parentaa3d87e49d6708b431c48eb000822271f5ad46fb
Have "get_host_ipaddr()" return a Boolean indicating whether it
succeeded or failed, and, if it succeeded, have it fill in the IP
address if found through a pointer passed as the second argument.

Have it first try interpreting its first argument as a dotted-quad IP
address, with "inet_aton()", and, if that fails, have it try to
interpret it as a host name with "gethostbyname()"; don't bother with
"gethostbyaddr()", as we should be allowed to filter on IP addresses
even if there's no host name associated with them (there's no guarantee
that "gethostbyaddr()" will succeed if handed an IP address with no
corresponding name - and it looks as if FreeBSD 3.2, at least, may not
succeed in that case).

Add a "dfilter_fail()" routine that takes "printf()"-like arguments and
uses them to set an error message for the parse; doing so means that
even if the filter expression is syntactically valid, we treat it as
being invalid.  (Is there a better way to force a parse to fail from
arbitrary places in routines called by the parser?)

Use that routine in the lexical analyzer.

If that error message was set, use it as is as the failure message,
rather than adding "Unable to parse filter string XXX" to it.

Have the code to handle IP addresses and host names in display filters
check whether "get_host_ipaddr()" succeeded or failed and, if it failed,
arrange that the parse fail with an error message indicating the source
of the problem.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@802 f5534014-38df-0310-8fa8-9805f1628bb7
dfilter-grammar.y
dfilter-int.h
dfilter-scanner.l
dfilter.c
resolv.c
resolv.h