aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2017-08-06 16:03:00 +0100
committerAnders Broman <a.broman58@gmail.com>2017-08-16 08:09:24 +0000
commite7284adcdfc5302c46587890c62a28eaac5aedd7 (patch)
treee785f9c763d6fefa221fea3d634135ae471e8f67
parent71dd3658b727489a75c068d7bc8170078c9582a6 (diff)
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>
-rw-r--r--epan/dissectors/packet-radius.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/epan/dissectors/packet-radius.c b/epan/dissectors/packet-radius.c
index e1d89c6661..8c919da978 100644
--- a/epan/dissectors/packet-radius.c
+++ b/epan/dissectors/packet-radius.c
@@ -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));
}
@@ -1316,6 +1323,17 @@ radius_tlv(radius_attr_info_t *a, proto_tree *tree, packet_info *pinfo _U_, tvbu
}
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,
}
}
- if (dictionary_entry->dissector) {
- tvbuff_t *tvb_value;
- const gchar *str;
+ proto_item_append_text(avp_item, ": ");
- 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);
+ if (dictionary_entry->dissector) {
+ 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