IPv4: Fix incorrect expert info for IGMP TTL

IGMP uses TTL = 1 for the network control block. The code assumes
a certain registered multicast destination address always carries
traffic for that protocol, which isn't true. For example mDNS
usually uses a TTL of 255 but IGMP Membership reports use a TTL
of 1 for the same destination address.

The end result is that IGMP traffic to mDNS multicast destination
shows a confusing and incorrect "TTL != 255 for the Local Network
Control Block" expert info.

Rename the "ttl" variable for clarity.

Change-Id: I693306cd6531aa250a6f5884a6731a2ea254bf2a
Reviewed-on: https://code.wireshark.org/review/35639
Reviewed-by: João Valverde <j@v6e.pt>
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
This commit is contained in:
João Valverde 2020-01-04 17:31:11 +00:00 committed by Alexis La Goutte
parent b401c92615
commit 376d877012
1 changed files with 7 additions and 4 deletions

View File

@ -1863,7 +1863,7 @@ dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
guint32 src32, dst32;
proto_tree *tree;
proto_item *item = NULL, *ttl_item;
guint16 ttl;
guint16 ttl_valid;
static const int * ip_flags[] = {
&hf_ip_flags_rf,
@ -2147,11 +2147,14 @@ dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
* (see http://tools.ietf.org/html/rfc3973#section-4.7).
*/
if (in4_addr_is_local_network_control_block(dst32)) {
ttl = local_network_control_block_addr_valid_ttl(dst32);
if (ttl != iph->ip_ttl && ttl != IPLOCAL_NETWRK_CTRL_BLK_ANY_TTL) {
if (iph->ip_proto == IP_PROTO_IGMP)
ttl_valid = IPLOCAL_NETWRK_CTRL_BLK_DEFAULT_TTL;
else
ttl_valid = local_network_control_block_addr_valid_ttl(dst32);
if (iph->ip_ttl != ttl_valid && ttl_valid != IPLOCAL_NETWRK_CTRL_BLK_ANY_TTL) {
expert_add_info_format(pinfo, ttl_item, &ei_ip_ttl_lncb, "\"Time To Live\" != %d for a packet sent to the "
"Local Network Control Block (see RFC 3171)",
ttl);
ttl_valid);
}
} else if (iph->ip_ttl < 5 && !in4_addr_is_multicast(dst32) &&
/* At least BGP should appear here as well */