Add VLAN ID to pinfo

I have traces where IP reassembly gets confused by multiple frames from
different VLANS and ends up adding fragments from differet messages
togeter after IP Identification is reused.
I think VLAN ID could be useful in other places too to aviliate duplicate
packet detection. Making this a separate patch while testing the usage.

Change-Id: Id7c23dc52f6de2e1f2e980ec8fe61d0598500d0d
Reviewed-on: https://code.wireshark.org/review/13452
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
AndersBroman 2016-01-20 15:13:59 +01:00 committed by Anders Broman
parent 2d6e044b8d
commit dede3c826e
2 changed files with 8 additions and 2 deletions

View File

@ -137,7 +137,7 @@ static int
dissect_vlan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
guint16 tci;
guint16 tci, vlan_id;
guint16 encap_proto;
gboolean is_802_2;
proto_tree *vlan_tree;
@ -146,6 +146,11 @@ dissect_vlan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
col_clear(pinfo->cinfo, COL_INFO);
tci = tvb_get_ntohs( tvb, 0 );
vlan_id = tci & 0xFFF;
/* Add the VLAN Id if it's the first one*/
if (pinfo->vlan_id == 0) {
pinfo->vlan_id = vlan_id;
}
columns_set_vlan(pinfo->cinfo, tci);
@ -156,7 +161,7 @@ dissect_vlan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
if (vlan_summary_in_tree) {
proto_item_append_text(ti, ", PRI: %u, CFI: %u, ID: %u",
(tci >> 13), ((tci >> 12) & 1), (tci & 0xFFF));
(tci >> 13), ((tci >> 12) & 1), vlan_id);
}
vlan_tree = proto_item_add_subtree(ti, ett_vlan);

View File

@ -59,6 +59,7 @@ typedef struct _packet_info {
address net_dst; /**< network-layer destination address */
address src; /**< source address (net if present, DL otherwise )*/
address dst; /**< destination address (net if present, DL otherwise )*/
guint32 vlan_id; /**< First encountered VLAN Id if pressent otherwise 0 */
circuit_type ctype; /**< type of circuit, for protocols with a VC identifier */
guint32 circuit_id; /**< circuit ID, for protocols with a VC identifier */
const char *noreassembly_reason; /**< reason why reassembly wasn't done, if any */