Check the address type, not the address length, in multicast/broadcast tests.

The tests assume an IPv4 address; check for IPv4 addresses.  They're
always 4 octets long, so no need to check the length.

Change the XXX comment to ask whether the check for an IPv4 address is
even necessary.

Change-Id: Ic55d2c208d5472ec995aa0c150b09a2118f04a76
Reviewed-on: https://code.wireshark.org/review/28353
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2018-06-20 13:48:57 -07:00
parent 50c1900141
commit 1600a7d9f8
1 changed files with 3 additions and 3 deletions

View File

@ -359,13 +359,13 @@ static const value_string interface_role_str[] = {
#define is_a_broadcast_addr(a) ((a) == 0xffffffffU)
/*
* XXX - should these be checking the address *type*, instead?
* XXX - will the destination address ever not be an IPv4 address?
*/
#define ADDR_IS_MULTICAST(addr) \
(((addr)->len == 4) && is_a_multicast_addr(pntoh32((addr)->data)))
(((addr)->type == AT_IPv4) && is_a_multicast_addr(pntoh32((addr)->data)))
#define ADDR_IS_BROADCAST(addr) \
(((addr)->len == 4) && is_a_broadcast_addr(pntoh32((addr)->data)))
(((addr)->type == AT_IPv4) && is_a_broadcast_addr(pntoh32((addr)->data)))
#define ADDR_IS_NOT_UNICAST(addr) \
(ADDR_IS_MULTICAST(addr) || ADDR_IS_BROADCAST(addr))