diff options
author | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2017-02-26 11:49:32 +0100 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2017-02-27 21:21:24 +0000 |
commit | 59b672e5907d272ea5bd5ef571b03e004d07705a (patch) | |
tree | cac240a9a427e0c7928c93caaada1c5d4b046898 | |
parent | 8b8a3b8d1a28c8406d41f3836dbc73fdddb568fc (diff) |
Return correct filter for get_hostlist_filter()
It was returning (ip.src == ... && <protocol>.port == ...).
Now, I think correctly returns (ip.addr == ... && <protocol>.port == ...)
Change-Id: I242e13c0c79c2222e2b27fc2f9ee348b89d21ec1
Reviewed-on: https://code.wireshark.org/review/20281
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jakub Zawadzki <darkjames-ws@darkjames.pl>
Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r-- | epan/dissectors/packet-sctp.c | 17 | ||||
-rw-r--r-- | epan/dissectors/packet-tcp.c | 16 | ||||
-rw-r--r-- | epan/dissectors/packet-udp.c | 17 |
3 files changed, 46 insertions, 4 deletions
diff --git a/epan/dissectors/packet-sctp.c b/epan/dissectors/packet-sctp.c index 9ccc23caf2..061fe95b31 100644 --- a/epan/dissectors/packet-sctp.c +++ b/epan/dissectors/packet-sctp.c @@ -878,14 +878,27 @@ static const char* sctp_host_get_filter_type(hostlist_talker_t* host, conv_filte return CONV_FILTER_INVALID; } - if (filter == CONV_FT_SRC_ADDRESS || filter == CONV_FT_DST_ADDRESS || filter == CONV_FT_ANY_ADDRESS) { + if (filter == CONV_FT_SRC_ADDRESS) { + if (host->myaddress.type == AT_IPv4) + return "ip.src"; + if (host->myaddress.type == AT_IPv6) + return "ipv6.src"; + } + + if (filter == CONV_FT_DST_ADDRESS) { + if (host->myaddress.type == AT_IPv4) + return "ip.dst"; + if (host->myaddress.type == AT_IPv6) + return "ipv6.dst"; + } + + if (filter == CONV_FT_ANY_ADDRESS) { if (host->myaddress.type == AT_IPv4) return "ip.addr"; if (host->myaddress.type == AT_IPv6) return "ipv6.addr"; } - return CONV_FILTER_INVALID; } diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index 2e075cef1d..08bd75e29e 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -727,13 +727,27 @@ static const char* tcp_host_get_filter_type(hostlist_talker_t* host, conv_filter return CONV_FILTER_INVALID; } - if (filter == CONV_FT_SRC_ADDRESS || filter == CONV_FT_DST_ADDRESS || filter == CONV_FT_ANY_ADDRESS) { + if (filter == CONV_FT_SRC_ADDRESS) { if (host->myaddress.type == AT_IPv4) return "ip.src"; if (host->myaddress.type == AT_IPv6) return "ipv6.src"; } + if (filter == CONV_FT_DST_ADDRESS) { + if (host->myaddress.type == AT_IPv4) + return "ip.dst"; + if (host->myaddress.type == AT_IPv6) + return "ipv6.dst"; + } + + if (filter == CONV_FT_ANY_ADDRESS) { + if (host->myaddress.type == AT_IPv4) + return "ip.addr"; + if (host->myaddress.type == AT_IPv6) + return "ipv6.addr"; + } + return CONV_FILTER_INVALID; } diff --git a/epan/dissectors/packet-udp.c b/epan/dissectors/packet-udp.c index 12fbf1768f..86b3228fad 100644 --- a/epan/dissectors/packet-udp.c +++ b/epan/dissectors/packet-udp.c @@ -345,13 +345,28 @@ static const char* udp_host_get_filter_type(hostlist_talker_t* host, conv_filter return CONV_FILTER_INVALID; } - if (filter == CONV_FT_SRC_ADDRESS || filter == CONV_FT_DST_ADDRESS || filter == CONV_FT_ANY_ADDRESS) { + + if (filter == CONV_FT_SRC_ADDRESS) { if (host->myaddress.type == AT_IPv4) return "ip.src"; if (host->myaddress.type == AT_IPv6) return "ipv6.src"; } + if (filter == CONV_FT_DST_ADDRESS) { + if (host->myaddress.type == AT_IPv4) + return "ip.dst"; + if (host->myaddress.type == AT_IPv6) + return "ipv6.dst"; + } + + if (filter == CONV_FT_ANY_ADDRESS) { + if (host->myaddress.type == AT_IPv4) + return "ip.addr"; + if (host->myaddress.type == AT_IPv6) + return "ipv6.addr"; + } + return CONV_FILTER_INVALID; } |