In packet-sflow.c, don't pass a NULL value pointer to
proto_tree_add_ipv6(). Add tree items for the extended router source and dest mask, and fix offsets. These changes appear to be correct, but I don't have a valid capture with extended router data. In proto.c, throw a dissector error if we try to pass a NULL value to various proto_tree_set_*() routines. Fixes bug 356. svn path=/trunk/; revision=15375
This commit is contained in:
parent
75f38fa0a5
commit
2f2a3fedd3
|
@ -283,6 +283,8 @@ static int hf_sflow_pri_in = -1; /* incominging 802.1p priority */
|
|||
static int hf_sflow_pri_out = -1; /* outgoing 802.1p priority */
|
||||
static int hf_sflow_nexthop_v4 = -1; /* nexthop address */
|
||||
static int hf_sflow_nexthop_v6 = -1; /* nexthop address */
|
||||
static int hf_sflow_nexthop_src_mask = -1;
|
||||
static int hf_sflow_nexthop_dst_mask = -1;
|
||||
static int hf_sflow_ifindex = -1;
|
||||
static int hf_sflow_iftype = -1;
|
||||
static int hf_sflow_ifspeed = -1;
|
||||
|
@ -462,33 +464,31 @@ dissect_sflow_extended_router(tvbuff_t *tvb, proto_tree *tree, gint offset)
|
|||
guint32 address_type, mask_bits;
|
||||
|
||||
address_type = tvb_get_ntohl(tvb, offset);
|
||||
len += 4;
|
||||
switch (address_type) {
|
||||
case ADDRESS_IPV4:
|
||||
proto_tree_add_ipv4(tree, hf_sflow_nexthop_v4, tvb, offset + len,
|
||||
8, FALSE);
|
||||
len += 8;
|
||||
proto_tree_add_item(tree, hf_sflow_nexthop_v4, tvb, offset + len,
|
||||
4, FALSE);
|
||||
len += 4;
|
||||
break;
|
||||
case ADDRESS_IPV6:
|
||||
proto_tree_add_ipv6(tree, hf_sflow_nexthop_v6, tvb, offset + len,
|
||||
20, FALSE);
|
||||
len += 20;
|
||||
proto_tree_add_item(tree, hf_sflow_nexthop_v6, tvb, offset + len,
|
||||
16, FALSE);
|
||||
len += 16;
|
||||
break;
|
||||
default:
|
||||
proto_tree_add_text(tree, tvb, offset + len, 4,
|
||||
proto_tree_add_text(tree, tvb, offset + len - 4, 4,
|
||||
"Unknown address type (%d)", address_type);
|
||||
len += 4; /* not perfect, but what else to do? */
|
||||
return len; /* again, this is wrong. but... ? */
|
||||
break;
|
||||
};
|
||||
|
||||
mask_bits = tvb_get_ntohl(tvb, offset + len);
|
||||
proto_tree_add_text(tree, tvb, offset + len, 4,
|
||||
"Source address prefix is %d bits long", mask_bits);
|
||||
proto_tree_add_item(tree, hf_sflow_nexthop_src_mask, tvb, offset + len,
|
||||
4, FALSE);
|
||||
len += 4;
|
||||
mask_bits = tvb_get_ntohl(tvb, offset + len);
|
||||
proto_tree_add_text(tree, tvb, offset + len, 4,
|
||||
"Destination address prefix is %d bits long",
|
||||
mask_bits);
|
||||
proto_tree_add_item(tree, hf_sflow_nexthop_dst_mask, tvb, offset + len,
|
||||
4, FALSE);
|
||||
len += 4;
|
||||
return len;
|
||||
}
|
||||
|
@ -953,14 +953,24 @@ proto_register_sflow(void)
|
|||
"Outgoing 802.1p priority", HFILL }
|
||||
},
|
||||
{ &hf_sflow_nexthop_v4,
|
||||
{ "Next Hop", "sflow.nexthop",
|
||||
{ "Next hop", "sflow.nexthop",
|
||||
FT_IPv4, BASE_DEC, NULL, 0x0,
|
||||
"Next Hop address", HFILL }
|
||||
"Next hop address", HFILL }
|
||||
},
|
||||
{ &hf_sflow_nexthop_v6,
|
||||
{ "Next Hop", "sflow.nexthop",
|
||||
{ "Next hop", "sflow.nexthop",
|
||||
FT_IPv6, BASE_HEX, NULL, 0x0,
|
||||
"Next Hop address", HFILL }
|
||||
"Next hop address", HFILL }
|
||||
},
|
||||
{ &hf_sflow_nexthop_src_mask,
|
||||
{ "Next hop source mask", "sflow.nexthop.src_mask",
|
||||
FT_UINT32, BASE_DEC, NULL, 0x0,
|
||||
"Next hop source mask bits", HFILL }
|
||||
},
|
||||
{ &hf_sflow_nexthop_dst_mask,
|
||||
{ "Next hop destination mask", "sflow.nexthop.dst_mask",
|
||||
FT_UINT32, BASE_DEC, NULL, 0x0,
|
||||
"Next hop destination mask bits", HFILL }
|
||||
},
|
||||
{ &hf_sflow_ifindex,
|
||||
{ "Interface index", "sflow.ifindex",
|
||||
|
|
|
@ -1201,6 +1201,7 @@ proto_tree_add_time_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint st
|
|||
static void
|
||||
proto_tree_set_time(field_info *fi, nstime_t *value_ptr)
|
||||
{
|
||||
DISSECTOR_ASSERT(value_ptr != NULL);
|
||||
fvalue_set(&fi->value, value_ptr, FALSE);
|
||||
}
|
||||
|
||||
|
@ -1390,6 +1391,7 @@ proto_tree_add_ipv6_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint st
|
|||
static void
|
||||
proto_tree_set_ipv6(field_info *fi, const guint8* value_ptr)
|
||||
{
|
||||
DISSECTOR_ASSERT(value_ptr != NULL);
|
||||
fvalue_set(&fi->value, (gpointer) value_ptr, FALSE);
|
||||
}
|
||||
|
||||
|
@ -1459,6 +1461,7 @@ proto_tree_add_guid_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint st
|
|||
static void
|
||||
proto_tree_set_guid(field_info *fi, const guint8* value_ptr)
|
||||
{
|
||||
DISSECTOR_ASSERT(value_ptr != NULL);
|
||||
fvalue_set(&fi->value, (gpointer) value_ptr, FALSE);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue