aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-radius.c
diff options
context:
space:
mode:
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2009-03-18 07:31:35 +0000
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2009-03-18 07:31:35 +0000
commita6974c8c178382bcfb253fc920283b083579a9a3 (patch)
treede23aebb57eccd7780a73035d46e0443096088df /epan/dissectors/packet-radius.c
parent3e43eec3a28d5254183110b350af02a25ae55184 (diff)
From Bjørn Mork:
Decode ipv6prefix attributes in packet-radius. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27769 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-radius.c')
-rw-r--r--epan/dissectors/packet-radius.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/epan/dissectors/packet-radius.c b/epan/dissectors/packet-radius.c
index 1282baf5d7..2c5ae43876 100644
--- a/epan/dissectors/packet-radius.c
+++ b/epan/dissectors/packet-radius.c
@@ -558,6 +558,39 @@ void radius_ipv6addr(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo
proto_item_append_text(avp_item, "%s", txtbuf);
}
+void radius_ipv6prefix(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_, tvbuff_t* tvb, int offset, int len, proto_item* avp_item) {
+ struct e_in6_addr ipv6_buff;
+ gchar txtbuf[256];
+ guint8 n;
+
+ if ((len < 2) || (len > 18) ) {
+ proto_item_append_text(avp_item, "[wrong length for IPv6 prefix]");
+ return;
+ }
+
+ /* first byte is reserved == 0x00 */
+ if (tvb_get_guint8(tvb, offset)) {
+ proto_item_append_text(avp_item, "[invalid reserved byte for IPv6 prefix]");
+ return;
+ }
+
+ /* this is the prefix length */
+ n = tvb_get_guint8(tvb, offset + 1);
+ if (n > 128) {
+ proto_item_append_text(avp_item, "[invalid IPv6 prefix length]");
+ return;
+ }
+
+ proto_tree_add_item(tree, a->hf, tvb, offset, len, FALSE);
+
+ /* cannot use tvb_get_ipv6() here, since the prefix most likely is truncated */
+ memset(&ipv6_buff, 0, sizeof ipv6_buff);
+ tvb_memcpy(tvb, &ipv6_buff, offset + 2, len - 2);
+ ip6_to_str_buf(&ipv6_buff, txtbuf);
+ proto_item_append_text(avp_item, "%s/%u", txtbuf, n);
+}
+
+
void radius_ipxnet(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_, tvbuff_t* tvb, int offset, int len, proto_item* avp_item) {
guint32 net;
@@ -1363,6 +1396,9 @@ static void register_attrs(gpointer k _U_, gpointer v, gpointer p) {
} else if (a->type == radius_ipv6addr) {
hfri[0].hfinfo.type = FT_IPv6;
hfri[0].hfinfo.display = BASE_NONE;
+ } else if (a->type == radius_ipv6prefix) {
+ hfri[0].hfinfo.type = FT_BYTES;
+ hfri[0].hfinfo.display = BASE_NONE;
} else if (a->type == radius_ipxnet) {
hfri[0].hfinfo.type = FT_IPXNET;
hfri[0].hfinfo.display = BASE_NONE;