Skip to content
Permalink
Browse files Browse the repository at this point in the history
The WTAP_ENCAP_ETHERNET dissector needs to be passed a struct eth_phdr.
We now require that.  Make it so.

Bug: 12440
Change-Id: Iffee520976b013800699bde3c6092a3e86be0d76
Reviewed-on: https://code.wireshark.org/review/15424
Reviewed-by: Guy Harris <guy@alum.mit.edu>
  • Loading branch information
guyharris committed May 14, 2016
1 parent 7d8c723 commit 2c13e97
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 5 deletions.
19 changes: 17 additions & 2 deletions epan/dissectors/packet-pktap.c
Expand Up @@ -135,6 +135,9 @@ dissect_pktap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvbuff_t *next_tvb;
int offset = 0;
guint32 pkt_len, rectype, dlt;
int wtap_encap;
struct eth_phdr eth;
void *phdr;

col_set_str(pinfo->cinfo, COL_PROTOCOL, "PKTAP");
col_clear(pinfo->cinfo, COL_INFO);
Expand Down Expand Up @@ -202,8 +205,20 @@ dissect_pktap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)

if (rectype == PKT_REC_PACKET) {
next_tvb = tvb_new_subset_remaining(tvb, pkt_len);
dissector_try_uint(wtap_encap_dissector_table,
wtap_pcap_encap_to_wtap_encap(dlt), next_tvb, pinfo, tree);
wtap_encap = wtap_pcap_encap_to_wtap_encap(dlt);
switch (wtap_encap) {

case WTAP_ENCAP_ETHERNET:
eth.fcs_len = -1; /* Unknown whether we have an FCS */
phdr = &eth;
break;

default:
phdr = NULL;
break;
}
dissector_try_uint_new(wtap_encap_dissector_table,
wtap_encap, next_tvb, pinfo, tree, TRUE, phdr);
}
}

Expand Down
19 changes: 17 additions & 2 deletions epan/dissectors/packet-ppi.c
Expand Up @@ -857,6 +857,9 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint last_frame = 0;
gint len_remain, /*pad_len = 0,*/ ampdu_len = 0;
struct ieee_802_11_phdr phdr;
int wtap_encap;
struct eth_phdr eth;
void *phdrp;

col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPI");
col_clear(pinfo->cinfo, COL_INFO);
Expand Down Expand Up @@ -1137,8 +1140,20 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
call_dissector_with_data(ieee80211_radio_handle, next_tvb, pinfo, tree, &phdr);
} else {
/* Everything else. This will pass a NULL data argument. */
dissector_try_uint(wtap_encap_dissector_table,
wtap_pcap_encap_to_wtap_encap(dlt), next_tvb, pinfo, tree);
wtap_encap = wtap_pcap_encap_to_wtap_encap(dlt);
switch (wtap_encap) {

case WTAP_ENCAP_ETHERNET:
eth.fcs_len = -1; /* Unknown whether we have an FCS */
phdrp = &eth;
break;

default:
phdrp = NULL;
break;
}
dissector_try_uint_new(wtap_encap_dissector_table,
wtap_encap, next_tvb, pinfo, tree, TRUE, phdrp);
}
}

Expand Down
15 changes: 14 additions & 1 deletion epan/dissectors/packet-rpcap.c
Expand Up @@ -838,6 +838,8 @@ dissect_rpcap_packet (tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree,
tvbuff_t *new_tvb;
guint caplen, len, frame_no;
gint reported_length_remaining;
struct eth_phdr eth;
void *phdr;

ti = proto_tree_add_item (parent_tree, hf_packet, tvb, offset, 20, ENC_NA);
tree = proto_item_add_subtree (ti, ett_packet);
Expand Down Expand Up @@ -874,7 +876,18 @@ dissect_rpcap_packet (tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree,

new_tvb = tvb_new_subset (tvb, offset, caplen, len);
if (decode_content && linktype != WTAP_ENCAP_UNKNOWN) {
dissector_try_uint(wtap_encap_dissector_table, linktype, new_tvb, pinfo, top_tree);
switch (linktype) {

case WTAP_ENCAP_ETHERNET:
eth.fcs_len = -1; /* Unknown whether we have an FCS */
phdr = &eth;
break;

default:
phdr = NULL;
break;
}
dissector_try_uint_new(wtap_encap_dissector_table, linktype, new_tvb, pinfo, top_tree, TRUE, phdr);

if (!info_added) {
/* Only indicate when not added before */
Expand Down

0 comments on commit 2c13e97

Please sign in to comment.