batadv: Fix info column seqno of IV_OGM v15 packets

The sequence number shown in the info field is read from the
iv_ogm_packet_v15 object before the actual member is actual read from the
packet buffer. Just split the initialization of the info column to the
actual dissection code for the packet to avoid these kind of problems.

Change-Id: I8eb637aae17680d227116156ef7828e77e36beae
Fixes: 4cc4315793 ("batadv: Add dissector support for batadv v15")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Reviewed-on: https://code.wireshark.org/review/33547
Petri-Dish: Pascal Quantin <pascal@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
This commit is contained in:
Sven Eckelmann 2019-06-10 08:31:28 +02:00 committed by Pascal Quantin
parent c600e15002
commit 292193bff1
1 changed files with 5 additions and 4 deletions

View File

@ -1714,7 +1714,7 @@ static int dissect_batadv_iv_ogm_v15(tvbuff_t *tvb, int offset,
sizeof(struct iv_ogm_packet_v15));
/* Set info column */
col_add_fstr(pinfo->cinfo, COL_INFO, "Seq=%u", iv_ogm_packeth->seqno);
col_clear(pinfo->cinfo, COL_INFO);
/* Set tree info */
ti = proto_tree_add_protocol_format(tree, proto_batadv_plugin,
@ -1749,9 +1749,10 @@ static int dissect_batadv_iv_ogm_v15(tvbuff_t *tvb, int offset,
flags, ENC_NA);
offset += 1;
iv_ogm_packeth->seqno = tvb_get_ntohl(tvb, offset);
proto_tree_add_item(batadv_iv_ogm_tree, hf_batadv_iv_ogm_seqno, tvb,
offset, 4, ENC_BIG_ENDIAN);
proto_tree_add_item_ret_uint(batadv_iv_ogm_tree, hf_batadv_iv_ogm_seqno,
tvb, offset, 4, ENC_BIG_ENDIAN,
&iv_ogm_packeth->seqno);
col_add_fstr(pinfo->cinfo, COL_INFO, "Seq=%u", iv_ogm_packeth->seqno);
offset += 4;
set_address_tvb(&iv_ogm_packeth->orig, AT_ETHER, 6, tvb, offset);