diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2016-09-06 20:43:17 +0100 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2016-09-07 14:43:23 +0000 |
commit | f90d436a7e1c4aee19b4b3b83263d3ac606ff0b7 (patch) | |
tree | 640c64b0b2094c460de122c3920362130f950516 /epan/dissectors/packet-icmp.c | |
parent | 693c745e36eb93fca6a06507bd1b63e3503dcb98 (diff) |
ICMP: Avoid spurious reply not found for broadcast ping
Bug: 12830
Change-Id: Ie73b2b6e75c396660d0d2f2fc975c57bbb58d2eb
Reviewed-on: https://code.wireshark.org/review/17541
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 'epan/dissectors/packet-icmp.c')
-rw-r--r-- | epan/dissectors/packet-icmp.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/epan/dissectors/packet-icmp.c b/epan/dissectors/packet-icmp.c index 2e61a88f05..d09dafe7f2 100644 --- a/epan/dissectors/packet-icmp.c +++ b/epan/dissectors/packet-icmp.c @@ -352,8 +352,21 @@ static const value_string interface_role_str[] = { #define MPLS_EXTENDED_PAYLOAD_C_TYPE 1 /* Return true if the address is in the 224.0.0.0/4 network block */ -#define is_a_multicast_addr(addr) \ - ((g_ntohl(addr) & 0xf0000000) == 0xe0000000) +#define is_a_multicast_addr(a) \ + ((g_ntohl(a) & 0xf0000000) == 0xe0000000) + +/* Return true if the address is the 255.255.255.255 broadcast address */ +#define is_a_broadcast_addr(a) \ + (g_ntohl(a) == 0xffffffff) + +#define ADDR_IS_MULTICAST(addr) \ + (((addr)->len == 4) && is_a_multicast_addr(*(const guint32 *)((addr)->data))) + +#define ADDR_IS_BROADCAST(addr) \ + (((addr)->len == 4) && is_a_broadcast_addr(*(const guint32 *)((addr)->data))) + +#define ADDR_IS_NOT_UNICAST(addr) \ + (ADDR_IS_MULTICAST(addr) || ADDR_IS_BROADCAST(addr)) static conversation_t *_find_or_create_conversation(packet_info * pinfo) { @@ -958,10 +971,9 @@ static icmp_transaction_t *transaction_start(packet_info * pinfo, icmp_key); } if (icmp_trans == NULL) { - if (pinfo->dst.len == 4 && is_a_multicast_addr(*(const guint32 *)(pinfo->dst.data))) { - /* XXX We should support multicast echo requests, but we don't currently */ - /* Note the multicast destination and skip transaction tracking */ - col_append_str(pinfo->cinfo, COL_INFO, " (multicast)"); + if (ADDR_IS_NOT_UNICAST(&pinfo->dst)) { + /* Note the non-unicast destination and skip transaction tracking */ + col_append_str(pinfo->cinfo, COL_INFO, ADDR_IS_BROADCAST(&pinfo->dst) ? " (broadcast)" : " (multicast)"); } else if (PINFO_FD_VISITED(pinfo)) { /* No response found - add field and expert info */ it = proto_tree_add_item(tree, hf_icmp_no_resp, NULL, 0, 0, |