IP: Make dissection of ip.frag_offset RFC 791 compliant

The v2.5.0rc0-478-g558fe23226, the dissection of ip.frag_offset changed
to be listed under "Flags", this is not correct. The Fragmentation
Offset is a separate field according to the RFC. This change corrects
that behavior. Also, the raw value from the header was shown instead of
the real byte offset, this is also corrected.

Change-Id: I1d6dfc4314091eb6f3eef418c5a17ed37f7a1200
Fixes: v2.5.0rc0-478-g558fe23226 ("[IP] Simplify paring of flags field by using proto_tree_add_bitmask_with_flags().")
Reviewed-on: https://code.wireshark.org/review/33422
Petri-Dish: Sake Blok <sake.blok@SYN-bit.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Sake Blok <sake.blok@SYN-bit.nl>
This commit is contained in:
Sake Blok 2019-05-30 13:11:21 +02:00 committed by Sake Blok
parent 49b6523c6c
commit 237ec1349f
4 changed files with 40 additions and 39 deletions

View File

@ -1869,7 +1869,6 @@ dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
&hf_ip_flags_rf,
&hf_ip_flags_df,
&hf_ip_flags_mf,
&hf_ip_frag_offset,
NULL
};
/* XXX do we realy want decoding of an april fools joke? */
@ -1877,7 +1876,6 @@ dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
&hf_ip_flags_sf,
&hf_ip_flags_df,
&hf_ip_flags_mf,
&hf_ip_frag_offset,
NULL
};
@ -2042,6 +2040,9 @@ dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
ett_ip_off, ip_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_TFS | BMT_NO_INT);
}
proto_tree_add_uint(ip_tree, hf_ip_frag_offset, tvb, offset + 6, 2, (iph->ip_off & IP_OFFSET)*8);
iph->ip_ttl = tvb_get_guint8(tvb, offset + 8);
if (tree) {
ttl_item = proto_tree_add_item(ip_tree, hf_ip_ttl, tvb, offset + 8, 1, ENC_BIG_ENDIAN);

View File

@ -5,4 +5,4 @@
{"index":{"_index":"packets-2004-12-05","_type":"doc"}}
{"timestamp":"1102274184387","layers":{"frame":{"frame_frame_encap_type":"1","frame_frame_time":"Dec 5, 2004 19:16:24.387484000 UTC","frame_frame_offset_shift":"0.000000000","frame_frame_time_epoch":"1102274184.387484000","frame_frame_time_delta":"0.069736000","frame_frame_time_delta_displayed":"0.069736000","frame_frame_time_relative":"0.070031000","frame_frame_number":"3","frame_frame_len":"314","frame_frame_cap_len":"314","frame_frame_marked":false,"frame_frame_ignored":false,"frame_frame_protocols":"eth:ethertype:ip:udp:dhcp"},"eth":{"eth_eth_dst":"ff:ff:ff:ff:ff:ff","eth_eth_dst_resolved":"Broadcast","eth_eth_addr":"ff:ff:ff:ff:ff:ff","eth_eth_addr_resolved":"Broadcast","eth_eth_lg":true,"eth_eth_ig":true,"eth_eth_src":"00:0b:82:01:fc:42","eth_eth_src_resolved":"Grandstr_01:fc:42","eth_eth_addr":"00:0b:82:01:fc:42","eth_eth_addr_resolved":"Grandstr_01:fc:42","eth_eth_lg":false,"eth_eth_ig":false,"eth_eth_type":"0x00000800"},"ip":{"ip_ip_version":"4","ip_ip_hdr_len":"20","ip_ip_dsfield":"0x00000000","ip_ip_dsfield_dscp":"0","ip_ip_dsfield_ecn":"0","ip_ip_len":"300","ip_ip_id":"0x0000a837","ip_ip_flags":"0x00000000","ip_ip_flags_rb":false,"ip_ip_flags_df":false,"ip_ip_flags_mf":false,"ip_ip_frag_offset":"0","ip_ip_ttl":"250","ip_ip_proto":"17","ip_ip_checksum":"0x0000178a","ip_ip_checksum_status":"2","ip_ip_src":"0.0.0.0","ip_ip_addr":["0.0.0.0","255.255.255.255"],"ip_ip_src_host":"0.0.0.0","ip_ip_host":["0.0.0.0","255.255.255.255"],"ip_ip_dst":"255.255.255.255","ip_ip_dst_host":"255.255.255.255"},"udp":{"udp_udp_srcport":"68","udp_udp_dstport":"67","udp_udp_port":["68","67"],"udp_udp_length":"280","udp_udp_checksum":"0x00009fbd","udp_udp_checksum_status":"2","udp_udp_stream":"0","text":"Timestamps","udp_udp_time_relative":"0.070031000","udp_udp_time_delta":"0.070031000"},"dhcp":{"dhcp_dhcp_type":"1","dhcp_dhcp_hw_type":"0x00000001","dhcp_dhcp_hw_len":"6","dhcp_dhcp_hops":"0","dhcp_dhcp_id":"0x00003d1e","dhcp_dhcp_secs":"0","dhcp_dhcp_flags":"0x00000000","dhcp_dhcp_flags_bc":false,"dhcp_dhcp_flags_reserved":"0x00000000","dhcp_dhcp_ip_client":"0.0.0.0","dhcp_dhcp_ip_your":"0.0.0.0","dhcp_dhcp_ip_server":"0.0.0.0","dhcp_dhcp_ip_relay":"0.0.0.0","dhcp_dhcp_hw_mac_addr":"00:0b:82:01:fc:42","dhcp_dhcp_hw_addr_padding":"00:00:00:00:00:00:00:00:00:00","dhcp_dhcp_server":"","dhcp_dhcp_file":"","dhcp_dhcp_cookie":"99.130.83.99","dhcp_dhcp_option_type":["53","61","50","54","55","0"],"dhcp_dhcp_option_length":["1","7","4","4","4"],"dhcp_dhcp_option_value":["03","01:00:0b:82:01:fc:42","c0:a8:00:0a","c0:a8:00:01","01:03:06:2a"],"dhcp_dhcp_option_dhcp":"3","dhcp_dhcp_hw_type":"0x00000001","dhcp_dhcp_hw_mac_addr":"00:0b:82:01:fc:42","dhcp_dhcp_option_requested_ip_address":"192.168.0.10","dhcp_dhcp_option_dhcp_server_id":"192.168.0.1","dhcp_dhcp_option_request_list_item":["1","3","6","42"],"dhcp_dhcp_option_end":"255","dhcp_dhcp_option_padding":"00"}}}
{"index":{"_index":"packets-2004-12-05","_type":"doc"}}
{"timestamp":"1102274184387","layers":{"frame":{"frame_frame_encap_type":"1","frame_frame_time":"Dec 5, 2004 19:16:24.387798000 UTC","frame_frame_offset_shift":"0.000000000","frame_frame_time_epoch":"1102274184.387798000","frame_frame_time_delta":"0.000314000","frame_frame_time_delta_displayed":"0.000314000","frame_frame_time_relative":"0.070345000","frame_frame_number":"4","frame_frame_len":"342","frame_frame_cap_len":"342","frame_frame_marked":false,"frame_frame_ignored":false,"frame_frame_protocols":"eth:ethertype:ip:udp:dhcp"},"eth":{"eth_eth_dst":"00:0b:82:01:fc:42","eth_eth_dst_resolved":"Grandstr_01:fc:42","eth_eth_addr":"00:0b:82:01:fc:42","eth_eth_addr_resolved":"Grandstr_01:fc:42","eth_eth_lg":true,"eth_eth_ig":false,"eth_eth_src":"00:08:74:ad:f1:9b","eth_eth_src_resolved":"Dell_ad:f1:9b","eth_eth_addr":"00:08:74:ad:f1:9b","eth_eth_addr_resolved":"Dell_ad:f1:9b","eth_eth_lg":false,"eth_eth_ig":false,"eth_eth_type":"0x00000800"},"ip":{"ip_ip_version":"4","ip_ip_hdr_len":"20","ip_ip_dsfield":"0x00000000","ip_ip_dsfield_dscp":"0","ip_ip_dsfield_ecn":"0","ip_ip_len":"328","ip_ip_id":"0x00000446","ip_ip_flags":"0x00000000","ip_ip_flags_rb":false,"ip_ip_flags_df":false,"ip_ip_flags_mf":false,"ip_ip_frag_offset":"0","ip_ip_ttl":"128","ip_ip_proto":"17","ip_ip_checksum":"0x00000000","ip_ip_checksum_status":"2","ip_ip_src":"192.168.0.1","ip_ip_addr":["192.168.0.1","192.168.0.10"],"ip_ip_src_host":"192.168.0.1","ip_ip_host":["192.168.0.1","192.168.0.10"],"ip_ip_dst":"192.168.0.10","ip_ip_dst_host":"192.168.0.10"},"udp":{"udp_udp_srcport":"67","udp_udp_dstport":"68","udp_udp_port":["67","68"],"udp_udp_length":"308","udp_udp_checksum":"0x0000dfdb","udp_udp_checksum_status":"2","udp_udp_stream":"1","text":"Timestamps","udp_udp_time_relative":"0.070050000","udp_udp_time_delta":"0.070050000"},"dhcp":{"dhcp_dhcp_type":"2","dhcp_dhcp_hw_type":"0x00000001","dhcp_dhcp_hw_len":"6","dhcp_dhcp_hops":"0","dhcp_dhcp_id":"0x00003d1e","dhcp_dhcp_secs":"0","dhcp_dhcp_flags":"0x00000000","dhcp_dhcp_flags_bc":false,"dhcp_dhcp_flags_reserved":"0x00000000","dhcp_dhcp_ip_client":"0.0.0.0","dhcp_dhcp_ip_your":"192.168.0.10","dhcp_dhcp_ip_server":"0.0.0.0","dhcp_dhcp_ip_relay":"0.0.0.0","dhcp_dhcp_hw_mac_addr":"00:0b:82:01:fc:42","dhcp_dhcp_hw_addr_padding":"00:00:00:00:00:00:00:00:00:00","dhcp_dhcp_server":"","dhcp_dhcp_file":"","dhcp_dhcp_cookie":"99.130.83.99","dhcp_dhcp_option_type":["53","58","59","51","54","1","0"],"dhcp_dhcp_option_length":["1","4","4","4","4","4"],"dhcp_dhcp_option_value":["05","00:00:07:08","00:00:0c:4e","00:00:0e:10","c0:a8:00:01","ff:ff:ff:00"],"dhcp_dhcp_option_dhcp":"5","dhcp_dhcp_option_renewal_time_value":"1800","dhcp_dhcp_option_rebinding_time_value":"3150","dhcp_dhcp_option_ip_address_lease_time":"3600","dhcp_dhcp_option_dhcp_server_id":"192.168.0.1","dhcp_dhcp_option_subnet_mask":"255.255.255.0","dhcp_dhcp_option_end":"255","dhcp_dhcp_option_padding":"00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00"}}}
{"timestamp":"1102274184387","layers":{"frame":{"frame_frame_encap_type":"1","frame_frame_time":"Dec 5, 2004 19:16:24.387798000 UTC","frame_frame_offset_shift":"0.000000000","frame_frame_time_epoch":"1102274184.387798000","frame_frame_time_delta":"0.000314000","frame_frame_time_delta_displayed":"0.000314000","frame_frame_time_relative":"0.070345000","frame_frame_number":"4","frame_frame_len":"342","frame_frame_cap_len":"342","frame_frame_marked":false,"frame_frame_ignored":false,"frame_frame_protocols":"eth:ethertype:ip:udp:dhcp"},"eth":{"eth_eth_dst":"00:0b:82:01:fc:42","eth_eth_dst_resolved":"Grandstr_01:fc:42","eth_eth_addr":"00:0b:82:01:fc:42","eth_eth_addr_resolved":"Grandstr_01:fc:42","eth_eth_lg":false,"eth_eth_ig":false,"eth_eth_src":"00:08:74:ad:f1:9b","eth_eth_src_resolved":"Dell_ad:f1:9b","eth_eth_addr":"00:08:74:ad:f1:9b","eth_eth_addr_resolved":"Dell_ad:f1:9b","eth_eth_lg":false,"eth_eth_ig":false,"eth_eth_type":"0x00000800"},"ip":{"ip_ip_version":"4","ip_ip_hdr_len":"20","ip_ip_dsfield":"0x00000000","ip_ip_dsfield_dscp":"0","ip_ip_dsfield_ecn":"0","ip_ip_len":"328","ip_ip_id":"0x00000446","ip_ip_flags":"0x00000000","ip_ip_flags_rb":false,"ip_ip_flags_df":false,"ip_ip_flags_mf":false,"ip_ip_frag_offset":"0","ip_ip_ttl":"128","ip_ip_proto":"17","ip_ip_checksum":"0x00000000","ip_ip_checksum_status":"2","ip_ip_src":"192.168.0.1","ip_ip_addr":["192.168.0.1","192.168.0.10"],"ip_ip_src_host":"192.168.0.1","ip_ip_host":["192.168.0.1","192.168.0.10"],"ip_ip_dst":"192.168.0.10","ip_ip_dst_host":"192.168.0.10"},"udp":{"udp_udp_srcport":"67","udp_udp_dstport":"68","udp_udp_port":["67","68"],"udp_udp_length":"308","udp_udp_checksum":"0x0000dfdb","udp_udp_checksum_status":"2","udp_udp_stream":"1","text":"Timestamps","udp_udp_time_relative":"0.070050000","udp_udp_time_delta":"0.070050000"},"dhcp":{"dhcp_dhcp_type":"2","dhcp_dhcp_hw_type":"0x00000001","dhcp_dhcp_hw_len":"6","dhcp_dhcp_hops":"0","dhcp_dhcp_id":"0x00003d1e","dhcp_dhcp_secs":"0","dhcp_dhcp_flags":"0x00000000","dhcp_dhcp_flags_bc":false,"dhcp_dhcp_flags_reserved":"0x00000000","dhcp_dhcp_ip_client":"0.0.0.0","dhcp_dhcp_ip_your":"192.168.0.10","dhcp_dhcp_ip_server":"0.0.0.0","dhcp_dhcp_ip_relay":"0.0.0.0","dhcp_dhcp_hw_mac_addr":"00:0b:82:01:fc:42","dhcp_dhcp_hw_addr_padding":"00:00:00:00:00:00:00:00:00:00","dhcp_dhcp_server":"","dhcp_dhcp_file":"","dhcp_dhcp_cookie":"99.130.83.99","dhcp_dhcp_option_type":["53","58","59","51","54","1","0"],"dhcp_dhcp_option_length":["1","4","4","4","4","4"],"dhcp_dhcp_option_value":["05","00:00:07:08","00:00:0c:4e","00:00:0e:10","c0:a8:00:01","ff:ff:ff:00"],"dhcp_dhcp_option_dhcp":"5","dhcp_dhcp_option_renewal_time_value":"1800","dhcp_dhcp_option_rebinding_time_value":"3150","dhcp_dhcp_option_ip_address_lease_time":"3600","dhcp_dhcp_option_dhcp_server_id":"192.168.0.1","dhcp_dhcp_option_subnet_mask":"255.255.255.0","dhcp_dhcp_option_end":"255","dhcp_dhcp_option_padding":"00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00"}}}

View File

@ -53,9 +53,9 @@
"ip.flags_tree": {
"ip.flags.rb": "0",
"ip.flags.df": "0",
"ip.flags.mf": "0",
"ip.frag_offset": "0"
"ip.flags.mf": "0"
},
"ip.frag_offset": "0",
"ip.ttl": "250",
"ip.proto": "17",
"ip.checksum": "0x0000178b",
@ -195,9 +195,9 @@
"ip.flags_tree": {
"ip.flags.rb": "0",
"ip.flags.df": "0",
"ip.flags.mf": "0",
"ip.frag_offset": "0"
"ip.flags.mf": "0"
},
"ip.frag_offset": "0",
"ip.ttl": "128",
"ip.proto": "17",
"ip.checksum": "0x00000000",
@ -345,9 +345,9 @@
"ip.flags_tree": {
"ip.flags.rb": "0",
"ip.flags.df": "0",
"ip.flags.mf": "0",
"ip.frag_offset": "0"
"ip.flags.mf": "0"
},
"ip.frag_offset": "0",
"ip.ttl": "250",
"ip.proto": "17",
"ip.checksum": "0x0000178a",
@ -493,9 +493,9 @@
"ip.flags_tree": {
"ip.flags.rb": "0",
"ip.flags.df": "0",
"ip.flags.mf": "0",
"ip.frag_offset": "0"
"ip.flags.mf": "0"
},
"ip.frag_offset": "0",
"ip.ttl": "128",
"ip.proto": "17",
"ip.checksum": "0x00000000",

View File

@ -296,15 +296,15 @@
2,
8192,
2
],
"ip.frag_offset_raw": [
"0",
20,
2,
8191,
5
]
},
"ip.frag_offset_raw": [
"0",
20,
2,
8191,
5
],
"ip.ttl_raw": [
"fa",
22,
@ -1079,15 +1079,15 @@
2,
8192,
2
],
"ip.frag_offset_raw": [
"0",
20,
2,
8191,
5
]
},
"ip.frag_offset_raw": [
"0",
20,
2,
8191,
5
],
"ip.ttl_raw": [
"80",
22,
@ -1894,15 +1894,15 @@
2,
8192,
2
],
"ip.frag_offset_raw": [
"0",
20,
2,
8191,
5
]
},
"ip.frag_offset_raw": [
"0",
20,
2,
8191,
5
],
"ip.ttl_raw": [
"fa",
22,
@ -2707,15 +2707,15 @@
2,
8192,
2
],
"ip.frag_offset_raw": [
"0",
20,
2,
8191,
5
]
},
"ip.frag_offset_raw": [
"0",
20,
2,
8191,
5
],
"ip.ttl_raw": [
"80",
22,