file-pcapng: fix dissection of options in blocks

- fix the loop logic
- flags in EPB include link-layer-dependent errors

Change-Id: Iae0b4869b556abbf3c14f3b865d0f23cee182c84
Reviewed-on: https://code.wireshark.org/review/10132
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
Pascal Quantin 2015-08-19 21:48:46 +02:00
parent bc777f903c
commit 2046368574
1 changed files with 14 additions and 5 deletions

View File

@ -488,7 +488,6 @@ static gint dissect_options(proto_tree *tree, packet_info *pinfo,
proto_item *option_item;
proto_item *p_item;
gint offset = 0;
gint offset_option_start;
guint16 option_code;
gint option_length;
gint hfj_pcapng_option_code;
@ -508,8 +507,7 @@ static gint dissect_options(proto_tree *tree, packet_info *pinfo,
options_item = proto_tree_add_item(tree, hf_pcapng_options, tvb, offset, -1, ENC_NA);
options_tree = proto_item_add_subtree(options_item, ett_pcapng_options);
offset_option_start = offset;
while (tvb_reported_length(tvb) - (offset_option_start - offset) > 0) {
while (tvb_captured_length_remaining(tvb, offset)) {
str = NULL;
option_code = tvb_get_guint16(tvb, offset, encoding);
option_length = tvb_get_guint16(tvb, offset + 2, encoding);
@ -956,8 +954,19 @@ static gint dissect_options(proto_tree *tree, packet_info *pinfo,
break;
}
proto_tree_add_bitmask(option_tree, tvb, offset, hf_pcapng_option_data_packet_flags, ett_pcapng_option, hfx_pcapng_option_data_packet_flags, encoding);
offset += 4;
if (encoding == ENC_LITTLE_ENDIAN) {
proto_tree_add_bitmask(option_tree, tvb, offset, hf_pcapng_option_data_packet_flags, ett_pcapng_option, hfx_pcapng_option_data_packet_flags, encoding);
offset += 2;
proto_tree_add_bitmask(option_tree, tvb, offset, hf_pcapng_option_data_packet_flags_link_layer_errors, ett_pcapng_option, hfx_pcapng_option_data_packet_flags_link_layer_errors, encoding);
offset += 2;
} else {
proto_tree_add_bitmask(option_tree, tvb, offset, hf_pcapng_option_data_packet_flags_link_layer_errors, ett_pcapng_option, hfx_pcapng_option_data_packet_flags_link_layer_errors, encoding);
offset += 2;
proto_tree_add_bitmask(option_tree, tvb, offset, hf_pcapng_option_data_packet_flags, ett_pcapng_option, hfx_pcapng_option_data_packet_flags, encoding);
offset += 2;
}
break;
case 0x0003: