forked from osmocom/wireshark
Vector BLF: WLAN frame supported
This commit is contained in:
parent
358df6c80d
commit
bf1039a529
|
@ -34168,7 +34168,14 @@ dissect_ieee80211_pv0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
encap_type = ENCAP_ETHERNET;
|
||||
else if ((octet1 == 0xff) && (octet2 == 0xff))
|
||||
encap_type = ENCAP_IPX;
|
||||
else if (((octet1 == 0x00) && (octet2 == 0x00)) ||
|
||||
else if (((octet1 == 0x00) && (octet2 == 0x00)) &&
|
||||
tvb_bytes_exist(next_tvb, 0, 18) &&
|
||||
(tvb_memeql(next_tvb, 6, (const guint8*)pinfo->dl_dst.data, 6) == 0) &&
|
||||
(tvb_memeql(next_tvb, 12, (const guint8*)pinfo->dl_src.data, 6) == 0)) {
|
||||
proto_tree_add_item(tree, hf_ieee80211_mysterious_extra_stuff, next_tvb, 0, 6, ENC_NA);
|
||||
next_tvb = tvb_new_subset_remaining(next_tvb, 6);
|
||||
encap_type = ENCAP_ETHERNET;
|
||||
} else if (((octet1 == 0x00) && (octet2 == 0x00)) ||
|
||||
(((octet2 << 8) | octet1) == seq_control)) {
|
||||
proto_tree_add_item(tree, hf_ieee80211_mysterious_extra_stuff, next_tvb, 0, 2, ENC_NA);
|
||||
next_tvb = tvb_new_subset_remaining(next_tvb, 2);
|
||||
|
@ -48654,7 +48661,7 @@ proto_register_ieee80211(void)
|
|||
NULL, HFILL }},
|
||||
|
||||
{&hf_ieee80211_mysterious_extra_stuff,
|
||||
{"Mysterious extra OLPC/Ruckus/Atheros/??? stuff", "wlan.mysterious_extra_stuff",
|
||||
{"Mysterious extra OLPC/Ruckus/Atheros/Vector/??? stuff", "wlan.mysterious_extra_stuff",
|
||||
FT_NONE, BASE_NONE, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
|
|
|
@ -256,6 +256,15 @@ fix_endianness_blf_ethernetframeheader_ex(blf_ethernetframeheader_ex_t *header)
|
|||
header->error = GUINT32_FROM_LE(header->error);
|
||||
}
|
||||
|
||||
static void
|
||||
fix_endianness_blf_wlanframeheader(blf_wlanframeheader_t* header) {
|
||||
header->channel = GUINT16_FROM_LE(header->channel);
|
||||
header->flags = GUINT16_FROM_LE(header->flags);
|
||||
header->signal_strength = GUINT16_FROM_LE(header->signal_strength);
|
||||
header->signal_quality = GUINT16_FROM_LE(header->signal_quality);
|
||||
header->frame_length = GUINT16_FROM_LE(header->frame_length);
|
||||
}
|
||||
|
||||
static void
|
||||
fix_endianness_blf_canmessage(blf_canmessage_t *header) {
|
||||
header->channel = GUINT16_FROM_LE(header->channel);
|
||||
|
@ -819,6 +828,53 @@ blf_read_ethernetframe_ext(blf_params_t *params, int *err, gchar **err_info, gin
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
blf_read_wlanframe(blf_params_t* params, int* err, gchar** err_info, gint64 block_start, gint64 header2_start, gint64 data_start, gint64 object_length) {
|
||||
blf_logobjectheader_t logheader;
|
||||
blf_wlanframeheader_t wlanheader;
|
||||
|
||||
if (data_start - header2_start < (gint64)sizeof(blf_logobjectheader_t)) {
|
||||
ws_debug("blf_read_wlanframe: not enough bytes for timestamp header");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!blf_read_bytes_or_eof(params, header2_start, &logheader, sizeof(logheader), err, err_info)) {
|
||||
ws_debug("blf_read_wlanframe: not enough bytes for logheader");
|
||||
return FALSE;
|
||||
}
|
||||
fix_endianness_blf_logobjectheader(&logheader);
|
||||
|
||||
if (object_length < (data_start - block_start) + (int)sizeof(blf_wlanframeheader_t)) {
|
||||
ws_debug("blf_read_wlanframe: not enough bytes for wlan frame header in object");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!blf_read_bytes_or_eof(params, data_start, &wlanheader, sizeof(blf_wlanframeheader_t), err, err_info)) {
|
||||
ws_debug("blf_read_wlanframe: not enough bytes for wlan frame header in file");
|
||||
return FALSE;
|
||||
}
|
||||
fix_endianness_blf_wlanframeheader(&wlanheader);
|
||||
|
||||
ws_buffer_assure_space(params->buf, wlanheader.frame_length);
|
||||
|
||||
if (object_length - (data_start - block_start) - sizeof(blf_wlanframeheader_t) < wlanheader.frame_length) {
|
||||
ws_debug("blf_read_wlanframe: frame too short");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!blf_read_bytes_or_eof(params, data_start + sizeof(blf_wlanframeheader_t), ws_buffer_start_ptr(params->buf), wlanheader.frame_length, err, err_info)) {
|
||||
ws_debug("blf_read_wlanframe: copying wlan frame failed");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
blf_init_rec(params, &logheader, WTAP_ENCAP_IEEE_802_11, wlanheader.channel);
|
||||
params->rec->presence_flags = WTAP_HAS_TS | WTAP_HAS_CAP_LEN | WTAP_HAS_INTERFACE_ID;
|
||||
params->rec->block = wtap_block_create(WTAP_BLOCK_PACKET);
|
||||
params->rec->rec_header.packet_header.caplen = wlanheader.frame_length;
|
||||
params->rec->rec_header.packet_header.len = wlanheader.frame_length;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static guint8 can_dlc_to_length[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 8, 8, 8, 8 };
|
||||
static guint8 canfd_dlc_to_length[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 20, 24, 32, 48, 64 };
|
||||
|
||||
|
@ -1424,6 +1480,11 @@ blf_read_block(blf_params_t *params, gint64 start_pos, int *err, gchar **err_inf
|
|||
start_pos + header.header_length, header.object_length);
|
||||
break;
|
||||
|
||||
case BLF_OBJTYPE_WLAN_FRAME:
|
||||
return blf_read_wlanframe(params, err, err_info, start_pos, start_pos + sizeof(blf_blockheader_t),
|
||||
start_pos + header.header_length, header.object_length);
|
||||
break;
|
||||
|
||||
case BLF_OBJTYPE_CAN_MESSAGE:
|
||||
return blf_read_canmessage(params, err, err_info, start_pos, start_pos + sizeof(blf_blockheader_t),
|
||||
start_pos + header.header_length, header.object_length, FALSE);
|
||||
|
|
|
@ -109,6 +109,17 @@ typedef struct blf_ethernetframeheader_ex {
|
|||
guint32 error;
|
||||
} blf_ethernetframeheader_ex_t;
|
||||
|
||||
typedef struct blf_wlanframeheader {
|
||||
guint16 channel;
|
||||
guint16 flags;
|
||||
guint8 direction;
|
||||
guint8 radio_channel;
|
||||
guint16 signal_strength;
|
||||
guint16 signal_quality;
|
||||
guint16 frame_length;
|
||||
guint32 res;
|
||||
} blf_wlanframeheader_t;
|
||||
|
||||
/* see https://bitbucket.org/tobylorenz/vector_blf/src/master/src/Vector/BLF/CanMessage.h */
|
||||
|
||||
/* shared for CAN message and CAN message2 and CANFD message */
|
||||
|
|
Loading…
Reference in New Issue