forked from osmocom/wireshark
From Luis Ontanon:
add some fields for filtering on radius attributes. svn path=/trunk/; revision=11830
This commit is contained in:
parent
f122136663
commit
ed93214bc5
|
@ -49,6 +49,17 @@
|
|||
#include "crypt-md5.h"
|
||||
|
||||
static int proto_radius = -1;
|
||||
static int hf_radius_cisco_cai = -1;
|
||||
static int hf_radius_callingStationId = -1;
|
||||
static int hf_radius_calledStationId = -1;
|
||||
static int hf_radius_framedAddress = -1;
|
||||
static int hf_radius_class = -1;
|
||||
static int hf_radius_nasIp = -1;
|
||||
static int hf_radius_acctStatusType = -1;
|
||||
static int hf_radius_acctSessionId = -1;
|
||||
static int hf_radius_3gpp_SgsnIpAddr = -1;
|
||||
static int hf_radius_3gpp_GgsnIpAddr = -1;
|
||||
|
||||
static int hf_radius_length = -1;
|
||||
static int hf_radius_code = -1;
|
||||
static int hf_radius_id =-1;
|
||||
|
@ -95,6 +106,9 @@ typedef struct _rd_vsa_table {
|
|||
} rd_vsa_table;
|
||||
|
||||
typedef struct _rd_vsa_buffer {
|
||||
gchar *val_str;
|
||||
int val_offset;
|
||||
guint val_len;
|
||||
gchar *str;
|
||||
int offset;
|
||||
guint8 length;
|
||||
|
@ -203,6 +217,7 @@ static const value_string radius_vals[] =
|
|||
{RADIUS_CHANGE_FILTER_REQUEST_ACK, "Change Filter Request ACK"},
|
||||
{RADIUS_CHANGE_FILTER_REQUEST_NAK, "Change Filter Request NAK"},
|
||||
{RADIUS_RESERVED, "Reserved"},
|
||||
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
|
@ -2904,7 +2919,9 @@ static void rd_value_to_str(gchar *dest, rd_vsa_buffer (*vsabuffer)[VSABUFFER],
|
|||
case( RADIUS_STRING ):
|
||||
rdconvertbufftostr(cont,tvb,offset+2,avph->avp_length-2);
|
||||
break;
|
||||
|
||||
gchar *val_str;
|
||||
guint32 val_addr;
|
||||
|
||||
case( RADIUS_BINSTRING ):
|
||||
rdconvertbufftobinstr(cont,tvb,offset+2,avph->avp_length-2);
|
||||
break;
|
||||
|
@ -2960,11 +2977,35 @@ static void rd_value_to_str(gchar *dest, rd_vsa_buffer (*vsabuffer)[VSABUFFER],
|
|||
rdconvertbufftostr(cont,tvb,offset+3,avph->avp_length-3);
|
||||
break;
|
||||
}
|
||||
rdconvertbufftostr(cont,tvb,offset+2,avph->avp_length-2);
|
||||
rdconvertbufftostr(cont,tvb,offset+2,avph->avp_length-2);
|
||||
switch ( avph->avp_type ) {
|
||||
case (31): /* calling station id */
|
||||
val_str = tvb_get_string(tvb,offset+2,avph->avp_length-2);
|
||||
proto_tree_add_string_hidden(tree, hf_radius_callingStationId, tvb, offset+8,avph->avp_length-8, val_str);
|
||||
g_free(val_str);
|
||||
break;
|
||||
case (30): /* called station id */
|
||||
val_str = tvb_get_string(tvb,offset+2,avph->avp_length-2);
|
||||
proto_tree_add_string_hidden(tree, hf_radius_calledStationId, tvb, offset+8,avph->avp_length-8, val_str);
|
||||
g_free(val_str);
|
||||
break;
|
||||
case(44): /* accounting session id */
|
||||
val_str = tvb_get_string(tvb,offset+2,avph->avp_length-2);
|
||||
proto_tree_add_string_hidden(tree, hf_radius_acctSessionId, tvb, offset+8,avph->avp_length-8, val_str);
|
||||
g_free(val_str);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case ( RADIUS_VENDOR_SPECIFIC ):
|
||||
intval = tvb_get_ntohl(tvb,offset+2);
|
||||
switch ( avph->avp_type ) {
|
||||
case(25): /* class */
|
||||
val_str = tvb_get_string(tvb,offset+2,avph->avp_length-2);
|
||||
proto_tree_add_string_hidden(tree, hf_radius_class, tvb, offset+8,avph->avp_length-8, val_str);
|
||||
g_free(val_str);
|
||||
break;
|
||||
}
|
||||
sprintf(dest, "Vendor:%s(%u)", rd_match_strval(intval,radius_vendor_specific_vendors), intval);
|
||||
cont = &dest[strlen(dest)];
|
||||
vsa_length = avph->avp_length;
|
||||
|
@ -2977,6 +3018,11 @@ static void rd_value_to_str(gchar *dest, rd_vsa_buffer (*vsabuffer)[VSABUFFER],
|
|||
avph->avp_length-vsa_len);
|
||||
if (vsa_attr_info_table)
|
||||
next_attr_info = find_radius_attr_info(vsa_avph->avp_type,
|
||||
switch ( avph->avp_type ) {
|
||||
case(40): /*accounting status type */
|
||||
proto_tree_add_uint_hidden(tree, hf_radius_acctStatusType, tvb,offset+2,1, intval);
|
||||
break;
|
||||
}
|
||||
vsa_attr_info_table);
|
||||
else
|
||||
next_attr_info = NULL;
|
||||
|
@ -3077,7 +3123,17 @@ static void rd_value_to_str(gchar *dest, rd_vsa_buffer (*vsabuffer)[VSABUFFER],
|
|||
|
||||
case( RADIUS_UNKNOWN ):
|
||||
strcpy(cont,"Unknown Value Type");
|
||||
break;
|
||||
switch ( avph->avp_type ) {
|
||||
case(8): /* framed address */
|
||||
tvb_memcpy(tvb,(guint8 *)&val_addr,offset+2,4);
|
||||
proto_tree_add_ipv4_hidden(tree, hf_radius_framedAddress, tvb,offset+2,4, val_addr);
|
||||
break;
|
||||
case(4): /* nas ip */
|
||||
tvb_memcpy(tvb,(guint8 *)&val_addr,offset+2,4);
|
||||
proto_tree_add_ipv4_hidden(tree, hf_radius_nasIp, tvb,offset+2,4, val_addr);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
}
|
||||
|
@ -3150,6 +3206,31 @@ dissect_attribute_value_pairs(tvbuff_t *tvb, int offset,proto_tree *tree,
|
|||
if (tree)
|
||||
eap_tree = proto_item_add_subtree(ti, ett_radius_eap);
|
||||
tvb_len = tvb_length_remaining(tvb, offset+2);
|
||||
|
||||
if ( next_attr_info ) {
|
||||
switch ( intval) {
|
||||
case (VENDOR_CISCO):
|
||||
switch ( vsa_avph->avp_type ) {
|
||||
case (250): /* account information */
|
||||
val_str = tvb_get_string(tvb,offset+8,avph->avp_length-8);
|
||||
proto_tree_add_string_hidden(tree, hf_radius_cisco_cai, tvb, offset+8,avph->avp_length-8, val_str);
|
||||
g_free(val_str);
|
||||
break;
|
||||
}
|
||||
case ( VENDOR_THE3GPP ) :
|
||||
switch (vsa_avph->avp_type) {
|
||||
case (6): /* sgsn ip addr*/
|
||||
tvb_memcpy(tvb,(guint8 *)&val_addr,offset+8,4);
|
||||
proto_tree_add_ipv4_hidden(tree, hf_radius_3gpp_SgsnIpAddr, tvb,offset+2,4, val_addr);
|
||||
break;
|
||||
case (7): /* sgsn ip addr*/
|
||||
tvb_memcpy(tvb,(guint8 *)&val_addr,offset+8,4);
|
||||
proto_tree_add_ipv4_hidden(tree, hf_radius_3gpp_GgsnIpAddr, tvb,offset+2,4, val_addr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
data_len = avph.avp_length-2;
|
||||
if (data_len < tvb_len)
|
||||
tvb_len = data_len;
|
||||
|
@ -3262,9 +3343,10 @@ dissect_attribute_value_pairs(tvbuff_t *tvb, int offset,proto_tree *tree,
|
|||
rd_value_to_str(textbuffer, &vsabuffer, &avph, tvb, offset,
|
||||
attr_info, vsa_tree);
|
||||
proto_item_append_text(ti, ", %s", textbuffer);
|
||||
for (i = 0; vsabuffer[i].str && i < VSABUFFER; i++)
|
||||
for (i = 0; vsabuffer[i].str && i < VSABUFFER; i++) {
|
||||
proto_tree_add_text(vsa_tree, tvb, vsabuffer[i].offset,
|
||||
vsabuffer[i].length, "%s", vsabuffer[i].str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3384,11 +3466,51 @@ proto_register_radius(void)
|
|||
{ &hf_radius_id,
|
||||
{ "Identifier", "radius.id", FT_UINT8, BASE_DEC, NULL, 0x0,
|
||||
"", HFILL }},
|
||||
|
||||
{ &hf_radius_cisco_cai,
|
||||
{ "Cisco Account Info", "radius.vsa.cisco.cai", FT_STRING, BASE_DEC, NULL, 0x0,
|
||||
"", HFILL }},
|
||||
|
||||
{ &hf_radius_callingStationId,
|
||||
{ "Calling Station Id", "radius.calling", FT_STRING, BASE_DEC, NULL, 0x0,
|
||||
"", HFILL }},
|
||||
|
||||
{ &hf_radius_calledStationId,
|
||||
{ "Called Station Id", "radius.called", FT_STRING, BASE_DEC, NULL, 0x0,
|
||||
"", HFILL }},
|
||||
|
||||
{ &hf_radius_class,
|
||||
{ "Class", "radius.class", FT_STRING, BASE_DEC, NULL, 0x0,
|
||||
"", HFILL }},
|
||||
|
||||
{ &hf_radius_acctSessionId,
|
||||
{ "Accounting Session Id", "radius.acct.sessionid", FT_STRING, BASE_DEC, NULL, 0x0,
|
||||
"", HFILL }},
|
||||
|
||||
{ &hf_radius_framedAddress,
|
||||
{ "Framed Address", "radius.framed_addr", FT_IPv4, BASE_DEC, NULL, 0x0,
|
||||
"", HFILL }},
|
||||
|
||||
{ &hf_radius_nasIp,
|
||||
{ "Nas IP Address", "radius.nas_ip", FT_IPv4, BASE_DEC, NULL, 0x0,
|
||||
"", HFILL }},
|
||||
|
||||
{ &hf_radius_3gpp_SgsnIpAddr,
|
||||
{ "SGSN IP Address", "radius.vsa.3gpp.sgsn_ip", FT_IPv4, BASE_DEC, NULL, 0x0,
|
||||
"", HFILL }},
|
||||
|
||||
{ &hf_radius_3gpp_GgsnIpAddr,
|
||||
{ "GGSN IP Address", "radius.vsa.3gpp.ggsn_ip", FT_IPv4, BASE_DEC, NULL, 0x0,
|
||||
"", HFILL }},
|
||||
|
||||
{ &hf_radius_acctStatusType,
|
||||
{ "Accounting Status Type", "radius.acct.status_type", FT_UINT32, BASE_DEC, VALS(radius_accounting_status_type_vals), 0x0,
|
||||
"", HFILL }},
|
||||
|
||||
{ &hf_radius_length,
|
||||
{ "Length","radius.length", FT_UINT16, BASE_DEC, NULL, 0x0,
|
||||
"", HFILL }}
|
||||
};
|
||||
};
|
||||
static gint *ett[] = {
|
||||
&ett_radius,
|
||||
&ett_radius_avp,
|
||||
|
|
Loading…
Reference in New Issue