diff options
author | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2007-09-28 05:50:19 +0000 |
---|---|---|
committer | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2007-09-28 05:50:19 +0000 |
commit | 30b586ad61bbdccff66623f7b061b8624fefc1e4 (patch) | |
tree | bdcaf89fad02ab3a977909b5309147f6c2ae9e01 /epan | |
parent | 69ddd8a77382beb9a2f3dc12d2767d01f6f18ccd (diff) |
queue the ip/eth headers for tapping before calling any subdissectors
so that they can be tapped even if the subdissectors cause an exception
this fixes bug 1527
svn path=/trunk/; revision=23004
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-eth.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-ip.c | 13 |
2 files changed, 11 insertions, 14 deletions
diff --git a/epan/dissectors/packet-eth.c b/epan/dissectors/packet-eth.c index db4554dbb9..c604b2164d 100644 --- a/epan/dissectors/packet-eth.c +++ b/epan/dissectors/packet-eth.c @@ -208,6 +208,8 @@ dissect_eth_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, ehdr->type = tvb_get_ntohs(tvb, 12); + tap_queue_packet(eth_tap, pinfo, ehdr); + /* * In case the packet is a non-Ethernet packet inside * Ethernet framing, allow heuristic dissectors to take @@ -215,7 +217,7 @@ dissect_eth_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, * Ethernet packet. */ if (dissector_try_heuristic(heur_subdissector_list, tvb, pinfo, parent_tree)) - goto end_of_eth; + return; if (ehdr->type <= IEEE_802_3_MAX_LEN) { /* Oh, yuck. Cisco ISL frames require special interpretation of the @@ -229,7 +231,7 @@ dissect_eth_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, tvb_get_guint8(tvb, 3) == 0x00 && tvb_get_guint8(tvb, 4) == 0x00 ) { dissect_isl(tvb, pinfo, parent_tree, fcs_len); - goto end_of_eth; + return; } } @@ -311,7 +313,7 @@ dissect_eth_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, if ((dst_addr[0] == 'i') || (dst_addr[0] == 'I') || (dst_addr[0] == 'o') || (dst_addr[0] == 'O')) { call_dissector(fw1_handle, tvb, pinfo, parent_tree); - goto end_of_eth; + return; } } @@ -344,10 +346,6 @@ dissect_eth_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, ethertype(ehdr->type, tvb, ETH_HEADER_SIZE, pinfo, parent_tree, fh_tree, hf_eth_type, hf_eth_trailer, fcs_len); } - -end_of_eth: - tap_queue_packet(eth_tap, pinfo, ehdr); - return; } /* diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c index f3e2190b11..2b70df4835 100644 --- a/epan/dissectors/packet-ip.c +++ b/epan/dissectors/packet-ip.c @@ -1248,7 +1248,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) "Header length: %u bytes (bogus, must be at least %u)", hlen, IPH_MIN_LEN); } - goto end_of_ip; + return; } if (tree) { @@ -1313,7 +1313,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) "Total length: %u bytes (bogus, less than header length %u)", iph->ip_len, hlen); } - goto end_of_ip; + return; } if (tree) proto_tree_add_uint(ip_tree, hf_ip_len, tvb, offset + 2, 2, iph->ip_len); @@ -1417,6 +1417,9 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) SET_ADDRESS(&pinfo->dst, AT_IPv4, 4, dst_addr); SET_ADDRESS(&iph->ip_dst, AT_IPv4, 4, dst_addr); + tap_queue_packet(ip_tap, pinfo, iph); + + /* If an IP is destined for a IP address in the Local Network Control Block * (e.g. 224.0.0.0/24), the packet should never be routed and the TTL would * be expected to be 1. (see RFC 3171) So only flag a low TTL if the @@ -1533,7 +1536,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) call_dissector(data_handle, tvb_new_subset(tvb, offset, -1, -1), pinfo, parent_tree); pinfo->fragmented = save_fragmented; - goto end_of_ip; + return; } /* XXX This is an ugly hack because I didn't manage to make the IPIP @@ -1563,10 +1566,6 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) call_dissector(data_handle,next_tvb, pinfo, parent_tree); } pinfo->fragmented = save_fragmented; - -end_of_ip: - tap_queue_packet(ip_tap, pinfo, iph); - } #define ICMP_MIP_EXTENSION_PAD 0 |