RADIUS: Remove some shortcuts in how we handle Ascend-Data-Filter

Do it via type "abinary" like the comment suggests.

Note: VSA "abinary" code path untested.

Ping-Bug: 11630
Change-Id: Ie8ebbb2fdbc9f04faad40150652277f1396ea030
Reviewed-on: https://code.wireshark.org/review/22973
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
João Valverde 2017-08-06 16:03:00 +01:00 committed by Anders Broman
parent 71dd3658b7
commit e7284adcdf
1 changed files with 24 additions and 21 deletions

View File

@ -983,6 +983,9 @@ radius_decrypt_avp(gchar *dest, int dest_len, tvbuff_t *tvb, int offset, int len
gcry_md_close(old_md5_handle);
}
static void
add_avp_to_tree_with_dissector(proto_tree *avp_tree, proto_item *avp_item, packet_info *pinfo, tvbuff_t *tvb, radius_avp_dissector_t *avp_dissector, guint32 avp_length, guint32 offset);
void
radius_integer(radius_attr_info_t *a, proto_tree *tree, packet_info *pinfo _U_, tvbuff_t *tvb, int offset, int len, proto_item *avp_item)
@ -1220,6 +1223,10 @@ radius_date(radius_attr_info_t *a, proto_tree *tree, packet_info *pinfo _U_, tvb
void
radius_abinary(radius_attr_info_t *a, proto_tree *tree, packet_info *pinfo _U_, tvbuff_t *tvb, int offset, int len, proto_item *avp_item)
{
if (a->code.u8_code[0] == 242) {
add_avp_to_tree_with_dissector(tree, avp_item, pinfo, tvb, dissect_ascend_data_filter, len, offset);
return;
}
proto_tree_add_item(tree, a->hf, tvb, offset, len, ENC_NA);
proto_item_append_text(avp_item, "%s", tvb_bytes_to_str(wmem_packet_scope(), tvb, offset, len));
}
@ -1315,6 +1322,17 @@ radius_tlv(radius_attr_info_t *a, proto_tree *tree, packet_info *pinfo _U_, tvbu
proto_item_append_text(avp_item, "%d TLV(s) inside", tlv_num);
}
static void
add_avp_to_tree_with_dissector(proto_tree *avp_tree, proto_item *avp_item, packet_info *pinfo, tvbuff_t *tvb, radius_avp_dissector_t *avp_dissector, guint32 avp_length, guint32 offset)
{
tvbuff_t *tvb_value;
const gchar *str;
tvb_value = tvb_new_subset_length(tvb, offset, avp_length);
str = avp_dissector(avp_tree, tvb_value, pinfo);
proto_item_append_text(avp_item, "%s", str);
}
static void
add_avp_to_tree(proto_tree *avp_tree, proto_item *avp_item, packet_info *pinfo, tvbuff_t *tvb, radius_attr_info_t *dictionary_entry, guint32 avp_length, guint32 offset)
{
@ -1343,20 +1361,14 @@ add_avp_to_tree(proto_tree *avp_tree, proto_item *avp_item, packet_info *pinfo,
}
}
proto_item_append_text(avp_item, ": ");
if (dictionary_entry->dissector) {
tvbuff_t *tvb_value;
const gchar *str;
tvb_value = tvb_new_subset_length(tvb, offset, avp_length);
str = dictionary_entry->dissector(avp_tree, tvb_value, pinfo);
proto_item_append_text(avp_item, ": %s", str);
} else {
proto_item_append_text(avp_item, ": ");
dictionary_entry->type(dictionary_entry, avp_tree, pinfo, tvb, offset, avp_length, avp_item);
add_avp_to_tree_with_dissector(avp_tree, avp_item, pinfo, tvb, dictionary_entry->dissector, avp_length, offset);
return;
}
dictionary_entry->type(dictionary_entry, avp_tree, pinfo, tvb, offset, avp_length, avp_item);
}
static gboolean
@ -2797,15 +2809,6 @@ register_radius_fields(const char *unused _U_)
radius_register_avp_dissector(0, 58, dissect_rfc4675_egress_vlan_name);
radius_register_avp_dissector(VENDOR_COSINE, 5, dissect_cosine_vpvc);
/*
* XXX - should we just call dissect_ascend_data_filter()
* in radius_abinary()?
*
* Note that there is no attribute 242 in dictionary.redback.
*/
radius_register_avp_dissector(VENDOR_ASCEND, 242, dissect_ascend_data_filter);
radius_register_avp_dissector(VENDOR_REDBACK, 242, dissect_ascend_data_filter);
radius_register_avp_dissector(0, 242, dissect_ascend_data_filter);
/*
* XXX - we should special-case Cisco attribute 252; see the comment in