guint8 ip_ver; /* 4 or 6 */
guint8 ip_tos; /* IPv4: type of service; IPv6: traffic class */
guint32 ip_flw; /* IPv4: (zero); IPv6: flow label */
- guint32 ip_len; /* IPv4: total length; IPv6: payload length (minus extensions) */
+ guint32 ip_len; /* IPv4: total length; IPv6: payload length */
guint16 ip_id; /* IPv4: identification; IPv6: (zero) */
guint16 ip_off; /* IPv4: fragment offset; IPv6: (zero) */
guint8 ip_ttl; /* IPv4: time-to-live; IPv6: hop limit */
tvbuff_t *next_tvb;
dissector_handle_t dissector_handle;
guint32 saved_match_uint;
- ws_ip *iph = (ws_ip *)data;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "AH");
col_clear(pinfo->cinfo, COL_INFO);
if (pinfo->dst.type == AT_IPv6) {
ipv6_pinfo_t *ipv6_pinfo = p_get_ipv6_pinfo(pinfo);
+ ipv6_pinfo->frag_plen -= ah_hdr_len;
if (ipv6_pinfo->ipv6_tree != NULL) {
root_tree = ipv6_pinfo->ipv6_tree;
ipv6_pinfo->ipv6_item_len += ah_hdr_len;
next_tvb = tvb_new_subset_remaining(tvb, ah_hdr_len);
- if (iph != NULL) {
- iph->ip_nxt = ah_nxt;
- iph->ip_len -= ah_hdr_len;
- }
-
if (pinfo->dst.type == AT_IPv6) {
- ipv6_dissect_next(ah_nxt, next_tvb, pinfo, tree, iph);
+ ipv6_dissect_next(ah_nxt, next_tvb, pinfo, tree, (ws_ip *)data);
} else {
/* do lookup with the subdissector table */
saved_match_uint = pinfo->match_uint;
int offset = 0;
tvbuff_t *next_tvb;
ipv6_pinfo_t *ipv6_pinfo = p_get_ipv6_pinfo(pinfo);
- ws_ip *iph = (ws_ip *)data;
col_append_sep_str(pinfo->cinfo, COL_INFO, " , ", "IPv6 routing");
len = (rt.ip6r_len + 1) << 3;
root_tree = tree;
+ ipv6_pinfo->frag_plen -= len;
if (ipv6_pinfo->ipv6_tree != NULL) {
root_tree = ipv6_pinfo->ipv6_tree;
ipv6_pinfo->ipv6_item_len += len;
break;
}
- if (iph != NULL) {
- iph->ip_nxt = rt.ip6r_nxt;
- iph->ip_len -= len;
- }
next_tvb = tvb_new_subset_remaining(tvb, len);
- ipv6_dissect_next(rt.ip6r_nxt, next_tvb, pinfo, tree, iph);
+ ipv6_dissect_next(rt.ip6r_nxt, next_tvb, pinfo, tree, (ws_ip *)data);
return tvb_captured_length(tvb);
}
gboolean show_data = FALSE;
gboolean reassembled;
tvbuff_t *next_tvb;
- ws_ip *iph = (ws_ip *)data;
nxt = tvb_get_guint8(tvb, offset);
offlg = tvb_get_ntohs(tvb, offset + 2);
frag_off, frag_flg ? "y" : "n", frag_ident, nxt);
root_tree = tree;
+ ipv6_pinfo->frag_plen -= 8;
if (ipv6_pinfo->ipv6_tree != NULL) {
root_tree = ipv6_pinfo->ipv6_tree;
ipv6_pinfo->ipv6_item_len += 8;
proto_tree_add_item(frag_tree, hf_ipv6_fraghdr_ident, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
- if (iph != NULL) {
+ if (ipv6_pinfo->frag_plen > 0) {
if ((frag_off != 0) || frag_flg) {
- reassembled = ipv6_reassemble_do(&tvb, &offset, pinfo, frag_tree, iph->ip_len - 8,
+ reassembled = ipv6_reassemble_do(&tvb, &offset, pinfo, frag_tree, ipv6_pinfo->frag_plen,
frag_off, frag_flg, frag_ident, &show_data);
if (show_data) {
next_tvb = tvb_new_subset_remaining(tvb, offset);
return tvb_captured_length(tvb);
}
if (reassembled) {
- iph->ip_nxt = nxt;
+ ipv6_pinfo->frag_plen = 0;
next_tvb = tvb_new_subset_remaining(tvb, offset);
- iph->ip_len = tvb_reported_length_remaining(next_tvb, 0);
- ipv6_dissect_next(nxt, next_tvb, pinfo, tree, iph);
+ ipv6_dissect_next(nxt, next_tvb, pinfo, tree, (ws_ip *)data);
return tvb_captured_length(tvb);
}
}
-
- iph->ip_nxt = nxt;
- iph->ip_len -= 8;
}
+
next_tvb = tvb_new_subset_remaining(tvb, offset);
- ipv6_dissect_next(nxt, next_tvb, pinfo, tree, iph);
+ ipv6_dissect_next(nxt, next_tvb, pinfo, tree, (ws_ip *)data);
return tvb_captured_length(tvb);
}
offset_end = offset + len;
root_tree = tree;
+ ipv6_pinfo->frag_plen -= len;
if (ipv6_pinfo->ipv6_tree != NULL) {
root_tree = ipv6_pinfo->ipv6_tree;
ipv6_pinfo->ipv6_item_len += len;
}
}
- if (iph != NULL) {
- iph->ip_nxt = nxt;
- iph->ip_len -= len;
- }
next_tvb = tvb_new_subset_remaining(tvb, len);
ipv6_dissect_next(nxt, next_tvb, pinfo, tree, iph);
return tvb_captured_length(tvb);
ipv6_pinfo->jumbo_plen = 0;
ipv6_pinfo->ip6_plen = g_ntohs(ipv6->ip6_plen);
+ ipv6_pinfo->frag_plen = ipv6_pinfo->ip6_plen;
if (!ipv6_exthdr_under_root) {
ipv6_pinfo->ipv6_tree = ipv6_tree;
ipv6_pinfo->ipv6_item_len = IPv6_HDR_SIZE;
typedef struct {
guint32 jumbo_plen;
guint16 ip6_plen;
+ gint frag_plen;
proto_tree *ipv6_tree;
gint ipv6_item_len;
} ipv6_pinfo_t;
guint len, offset = 0, start_offset = offset;
proto_item *ti, *header_item;
tvbuff_t *next_tvb;
- ws_ip *iph = (ws_ip *)data;
/* Make entries in Protocol column and Info column on summary display */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "MIPv6");
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;
dissect_mip6_options(tvb, mip6_tree, offset, len, pinfo);
}
- /*
- * XXX - why are we doing this? We're not guaranteed that there's
- * a ws_ip structure to modify here, as we can be called not only
- * from the IPv4 or IPv6 dissectors, but also from, for example,
- * the AH and ESP dissectors.
- *
- * This needs to be rethought.
- */
- if (iph != NULL)
- iph->ip_nxt = pproto;
-
if ((type == MIP6_FNA) && (pproto == IP_PROTO_IPV6)) {
col_set_str(pinfo->cinfo, COL_INFO, "Fast Neighbor Advertisement[Fast Binding Update]");
next_tvb = tvb_new_subset_remaining(tvb, len + 8);
- if (iph != NULL)
- iph->ip_len -= len + 8;
- ipv6_dissect_next(pproto, next_tvb, pinfo, tree, iph);
+ ipv6_dissect_next(pproto, next_tvb, pinfo, tree, (ws_ip *)data);
}
if ((type == MIP6_FBACK) && (pproto == IP_PROTO_AH)) {
col_set_str(pinfo->cinfo, COL_INFO, "Fast Binding Acknowledgment");
next_tvb = tvb_new_subset_remaining(tvb, len + offset);
- if (iph != NULL)
- iph->ip_len -= len + offset;
- ipv6_dissect_next(pproto, next_tvb, pinfo, tree, iph);
+ ipv6_dissect_next(pproto, next_tvb, pinfo, tree, (ws_ip *)data);
}
return tvb_captured_length(tvb);
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;
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;
}
}
- 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);
}