diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2016-07-24 19:11:01 +0100 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2016-07-25 10:04:49 +0000 |
commit | 77915051685fee048571031769bbed05531fd852 (patch) | |
tree | 1c9bad7b813fc84ccdb142177b5e6a331581aa4e /epan/dissectors/packet-shim6.c | |
parent | 6cf9616df68a4db7e436bb77392586ff9ad84feb (diff) |
IPv6: Use ipv6_pinfo_t instead of ws_ip to keep some state
To perform IPv6 defragmentation we need to compute the IPv6 fragment header
payload length by subtracting the length of intermediate extension headers
from the IPv6 payload length.
Add a new frag_plen field to ipv6_pinfo_t to do that instead of (ab)using
struct ws_ip.
Note: The RFC 2460 rules for fragment header order are stricter than the code
suggests but that shouldn't be a problem here.
Change-Id: I76f3cb3a1a29d96b080d3d53c0f493f9d0b2786c
Reviewed-on: https://code.wireshark.org/review/16637
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
Diffstat (limited to 'epan/dissectors/packet-shim6.c')
-rw-r--r-- | epan/dissectors/packet-shim6.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/epan/dissectors/packet-shim6.c b/epan/dissectors/packet-shim6.c index e439a2c5b4..fe9b3fb575 100644 --- a/epan/dissectors/packet-shim6.c +++ b/epan/dissectors/packet-shim6.c @@ -572,7 +572,6 @@ dissect_shim6(tvbuff_t *tvb, packet_info * pinfo, proto_tree *tree, void* data) proto_item *ti, *ti_len; guint8 tmp[5]; tvbuff_t *next_tvb; - ws_ip *iph = (ws_ip *)data; tvb_memcpy(tvb, (guint8 *)&shim, offset, sizeof(shim)); len = (shim.ip6s_len + 1) << 3; @@ -589,6 +588,7 @@ dissect_shim6(tvbuff_t *tvb, packet_info * pinfo, proto_tree *tree, void* data) if (pinfo->dst.type == AT_IPv6) { ipv6_pinfo_t *ipv6_pinfo = p_get_ipv6_pinfo(pinfo); + ipv6_pinfo->frag_plen -= len; if (ipv6_pinfo->ipv6_tree != NULL) { root_tree = ipv6_pinfo->ipv6_tree; ipv6_pinfo->ipv6_item_len += len; @@ -663,12 +663,8 @@ dissect_shim6(tvbuff_t *tvb, packet_info * pinfo, proto_tree *tree, void* data) } } - if (iph != NULL) { - iph->ip_nxt = shim.ip6s_nxt; - iph->ip_len -= len; - } next_tvb = tvb_new_subset_remaining(tvb, len); - ipv6_dissect_next(shim.ip6s_nxt, next_tvb, pinfo, tree, iph); + ipv6_dissect_next(shim.ip6s_nxt, next_tvb, pinfo, tree, (ws_ip *)data); return tvb_captured_length(tvb); } |