Pass the next protocol value to ip_try_dissect() as an argument.

That way, we don't rely on the ws_ip pointer being non-null.

Based on changes from Ib73410fd8575ad6c836311bbda87a0580e5640ac.

Change-Id: If8c437572c725481ac4148c8095a1a479b4fb0f8
Reviewed-on: https://code.wireshark.org/review/16617
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2016-07-24 01:05:23 -07:00
parent 523e8c3cc5
commit 00961a0df2
3 changed files with 6 additions and 5 deletions

View File

@ -1963,7 +1963,7 @@ static const true_false_string flags_sf_set_evil = {
};
gboolean
ip_try_dissect(gboolean heur_first, tvbuff_t *tvb, packet_info *pinfo,
ip_try_dissect(gboolean heur_first, guint nxt, tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree, ws_ip *iph)
{
heur_dtbl_entry_t *hdtbl_entry;
@ -1973,7 +1973,7 @@ ip_try_dissect(gboolean heur_first, tvbuff_t *tvb, packet_info *pinfo,
return TRUE;
}
if (dissector_try_uint_new(ip_dissector_table, iph->ip_nxt, tvb, pinfo,
if (dissector_try_uint_new(ip_dissector_table, nxt, tvb, pinfo,
tree, TRUE, iph)) {
return TRUE;
}
@ -2436,7 +2436,8 @@ dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
even be labeled as an IP frame; ideally, if a frame being dissected
throws an exception, it'll be labeled as a mangled frame of the
type in question. */
if (!ip_try_dissect(try_heuristic_first, next_tvb, pinfo, parent_tree, iph)) {
if (!ip_try_dissect(try_heuristic_first, iph->ip_nxt, next_tvb, pinfo,
parent_tree, iph)) {
/* Unknown protocol */
if (update_col_info) {
col_add_fstr(pinfo->cinfo, COL_INFO, "%s (%u)",

View File

@ -53,7 +53,7 @@ typedef struct _ws_ip
gboolean capture_ip(const guchar *, int, int, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header);
gboolean ip_try_dissect(gboolean heur_first, tvbuff_t *tvb,
gboolean ip_try_dissect(gboolean heur_first, guint nxt, tvbuff_t *tvb,
packet_info *pinfo, proto_tree *tree, ws_ip *iph);
/* Export the DSCP/ECN extended value-string table for other protocols */

View File

@ -2240,7 +2240,7 @@ ipv6_dissect_next(guint nxt, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
ipv6_pinfo->ipv6_tree = NULL;
}
if (ip_try_dissect(try_heuristic_first, tvb, pinfo, tree, iph)) {
if (ip_try_dissect(try_heuristic_first, nxt, tvb, pinfo, tree, iph)) {
return;
}