2004-03-31 20:57:42 +00:00
|
|
|
/* packet-radius.c
|
|
|
|
*
|
|
|
|
* Routines for RADIUS packet disassembly
|
|
|
|
* Copyright 1999 Johan Feyaerts
|
|
|
|
* Changed 03/12/2003 Rui Carmo (http://the.taoofmac.com - added all 3GPP VSAs, some parsing)
|
2008-08-05 21:03:46 +00:00
|
|
|
* Changed 07/2005 Luis Ontanon <luis@ontanon.org> - use FreeRADIUS' dictionary
|
2006-10-24 05:21:00 +00:00
|
|
|
* Changed 10/2006 Alejandro Vaquero <alejandrovaquero@yahoo.com> - add Conversations support
|
2004-03-31 20:57:42 +00:00
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
2004-03-31 20:57:42 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2004-03-31 20:57:42 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
2004-10-04 20:13:35 +00:00
|
|
|
*
|
2004-09-20 19:20:05 +00:00
|
|
|
* References:
|
2004-10-04 20:13:35 +00:00
|
|
|
*
|
|
|
|
* RFC 2865 - Remote Authentication Dial In User Service (RADIUS)
|
|
|
|
* RFC 2866 - RADIUS Accounting
|
|
|
|
* RFC 2867 - RADIUS Accounting Modifications for Tunnel Protocol Support
|
|
|
|
* RFC 2868 - RADIUS Attributes for Tunnel Protocol Support
|
|
|
|
* RFC 2869 - RADIUS Extensions
|
2005-07-15 21:12:27 +00:00
|
|
|
* RFC 3162 - RADIUS and IPv6
|
|
|
|
* RFC 3576 - Dynamic Authorization Extensions to RADIUS
|
2004-10-05 08:09:58 +00:00
|
|
|
*
|
|
|
|
* See also
|
|
|
|
*
|
|
|
|
* http://www.iana.org/assignments/radius-types
|
2004-10-04 20:13:35 +00:00
|
|
|
*/
|
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
|
2004-10-04 20:13:35 +00:00
|
|
|
/*
|
2005-07-15 21:12:27 +00:00
|
|
|
TO (re)DO: (see svn rev 14786)
|
|
|
|
- dissect_3gpp_ipv6_dns_servers()
|
2004-03-31 20:57:42 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <ctype.h>
|
2005-07-15 21:12:27 +00:00
|
|
|
#include <errno.h>
|
2004-03-31 20:57:42 +00:00
|
|
|
#include <epan/packet.h>
|
2005-07-15 21:12:27 +00:00
|
|
|
#include <epan/prefs.h>
|
|
|
|
#include <epan/report_err.h>
|
2007-01-02 22:49:57 +00:00
|
|
|
#include <epan/crypt/crypt-md5.h>
|
2004-09-30 20:27:47 +00:00
|
|
|
#include <epan/sminmpec.h>
|
2005-07-15 21:12:27 +00:00
|
|
|
#include <epan/filesystem.h>
|
2006-10-24 05:21:00 +00:00
|
|
|
#include <epan/conversation.h>
|
|
|
|
#include <epan/tap.h>
|
2005-09-26 08:48:19 +00:00
|
|
|
#include <epan/addr_resolv.h>
|
2005-07-24 02:53:09 +00:00
|
|
|
#include <epan/emem.h>
|
2007-04-30 19:24:25 +00:00
|
|
|
#include <epan/garrayfix.h>
|
2004-03-31 20:57:42 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
#include "packet-radius.h"
|
2004-08-25 05:14:17 +00:00
|
|
|
|
2008-09-30 14:46:48 +00:00
|
|
|
void proto_reg_handoff_radius(void);
|
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
typedef struct _e_radiushdr {
|
|
|
|
guint8 rh_code;
|
|
|
|
guint8 rh_ident;
|
|
|
|
guint16 rh_pktlength;
|
|
|
|
} e_radiushdr;
|
2004-10-04 20:13:35 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
typedef struct {
|
|
|
|
GArray* hf;
|
|
|
|
GArray* ett;
|
|
|
|
GArray* vend_vs;
|
|
|
|
} hfett_t;
|
2004-03-31 20:57:42 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
#define AUTHENTICATOR_LENGTH 16
|
|
|
|
#define RD_HDR_LENGTH 4
|
2005-07-24 20:39:19 +00:00
|
|
|
#define HDR_LENGTH (RD_HDR_LENGTH + AUTHENTICATOR_LENGTH)
|
2004-03-31 20:57:42 +00:00
|
|
|
|
|
|
|
#define UDP_PORT_RADIUS 1645
|
|
|
|
#define UDP_PORT_RADIUS_NEW 1812
|
|
|
|
#define UDP_PORT_RADACCT 1646
|
|
|
|
#define UDP_PORT_RADACCT_NEW 1813
|
2009-06-09 10:52:28 +00:00
|
|
|
#define UDP_PORT_DAE 3799 /* DAE: rfc3576 */
|
2004-03-31 20:57:42 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
static radius_dictionary_t* dict = NULL;
|
2004-10-01 07:01:53 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
static int proto_radius = -1;
|
2006-10-24 05:21:00 +00:00
|
|
|
|
|
|
|
static int hf_radius_req = -1;
|
|
|
|
static int hf_radius_rsp = -1;
|
|
|
|
static int hf_radius_req_frame = -1;
|
|
|
|
static int hf_radius_rsp_frame = -1;
|
|
|
|
static int hf_radius_time = -1;
|
|
|
|
|
|
|
|
static int hf_radius_dup = -1;
|
|
|
|
static int hf_radius_req_dup = -1;
|
|
|
|
static int hf_radius_rsp_dup = -1;
|
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
static int hf_radius_id = -1;
|
|
|
|
static int hf_radius_code = -1;
|
|
|
|
static int hf_radius_length = -1;
|
|
|
|
static int hf_radius_authenticator = -1;
|
2004-03-31 20:57:42 +00:00
|
|
|
|
2005-09-26 08:48:19 +00:00
|
|
|
static int hf_radius_framed_ip_address = -1;
|
|
|
|
static int hf_radius_login_ip_host = -1;
|
|
|
|
static int hf_radius_framed_ipx_network = -1;
|
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
static int hf_radius_cosine_vpi = -1;
|
|
|
|
static int hf_radius_cosine_vci = -1;
|
2004-03-31 20:57:42 +00:00
|
|
|
|
2008-12-29 15:24:08 +00:00
|
|
|
static int hf_radius_ascend_data_filter = -1;
|
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
static gint ett_radius = -1;
|
|
|
|
static gint ett_radius_avp = -1;
|
|
|
|
static gint ett_eap = -1;
|
2004-03-31 20:57:42 +00:00
|
|
|
|
2006-10-24 05:21:00 +00:00
|
|
|
/*
|
|
|
|
* Define the tap for radius
|
|
|
|
*/
|
|
|
|
static int radius_tap = -1;
|
|
|
|
|
2009-04-02 19:05:52 +00:00
|
|
|
radius_vendor_info_t no_vendor = {"Unknown Vendor",0,NULL,-1,1,1,FALSE};
|
2004-03-31 20:57:42 +00:00
|
|
|
|
2009-04-02 19:05:52 +00:00
|
|
|
radius_attr_info_t no_dictionary_entry = {"Unknown-Attribute",0,FALSE,FALSE,radius_octets, NULL, NULL, -1, -1, -1, -1, -1, NULL };
|
2004-03-31 20:57:42 +00:00
|
|
|
|
2006-12-07 20:34:08 +00:00
|
|
|
static dissector_handle_t eap_handle;
|
2004-03-31 20:57:42 +00:00
|
|
|
|
2005-07-24 19:01:28 +00:00
|
|
|
static const gchar* shared_secret = "";
|
2005-09-19 17:42:02 +00:00
|
|
|
static gboolean show_length = FALSE;
|
|
|
|
static guint alt_port_pref = 0;
|
2009-08-26 07:26:17 +00:00
|
|
|
static guint request_ttl = 5;
|
2004-03-31 20:57:42 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
static guint8 authenticator[AUTHENTICATOR_LENGTH];
|
2004-03-31 20:57:42 +00:00
|
|
|
|
2007-07-13 20:00:38 +00:00
|
|
|
/* http://www.iana.org/assignments/radius-types */
|
2005-07-15 21:12:27 +00:00
|
|
|
static const value_string radius_vals[] =
|
2004-03-31 20:57:42 +00:00
|
|
|
{
|
2009-10-12 00:01:59 +00:00
|
|
|
{RADIUS_ACCESS_REQUEST, "Access-Request"}, /* 1 RFC2865 */
|
|
|
|
{RADIUS_ACCESS_ACCEPT, "Access-Accept"}, /* 2 RFC2865 */
|
|
|
|
{RADIUS_ACCESS_REJECT, "Access-Reject"}, /* 3 RFC2865 */
|
|
|
|
{RADIUS_ACCOUNTING_REQUEST, "Accounting-Request"}, /* 4 RFC2865 */
|
|
|
|
{RADIUS_ACCOUNTING_RESPONSE, "Accounting-Response"}, /* 5 RFC2865 */
|
|
|
|
{RADIUS_ACCOUNTING_STATUS, "Accounting-Status"}, /* 6 RFC2865 */
|
|
|
|
{RADIUS_ACCESS_PASSWORD_REQUEST, "Password-Request"}, /* 7 RFC3575 */
|
|
|
|
{RADIUS_ACCESS_PASSWORD_ACK, "Password-Ack"}, /* 8 RFC3575 */
|
|
|
|
{RADIUS_ACCESS_PASSWORD_REJECT, "Password-Reject"}, /* 9 RFC3575 */
|
|
|
|
{RADIUS_ACCOUNTING_MESSAGE, "Accounting-Message"}, /* 10 RFC3575 */
|
|
|
|
{RADIUS_ACCESS_CHALLENGE, "Access-challenge"}, /* 11 RFC2865 */
|
|
|
|
{RADIUS_STATUS_SERVER, "Status-Server"}, /* 12 RFC2865 */
|
|
|
|
{RADIUS_STATUS_CLIENT, "Status-Client"}, /* 13 RFC2865 */
|
2007-07-13 20:00:38 +00:00
|
|
|
/*
|
|
|
|
21 Resource-Free-Request [RFC3575]
|
|
|
|
22 Resource-Free-Response [RFC3575]
|
|
|
|
23 Resource-Query-Request [RFC3575]
|
|
|
|
24 Resource-Query-Response [RFC3575]
|
|
|
|
25 Alternate-Resource-
|
|
|
|
Reclaim-Request [RFC3575]
|
|
|
|
26 NAS-Reboot-Request [RFC3575]
|
|
|
|
*/
|
2009-10-12 00:01:59 +00:00
|
|
|
{RADIUS_VENDOR_SPECIFIC_CODE, "Vendor-Specific"}, /* 26 */
|
2007-07-13 20:00:38 +00:00
|
|
|
/*
|
|
|
|
27 NAS-Reboot-Response [RFC3575]
|
|
|
|
28 Reserved
|
|
|
|
*/
|
2009-10-12 00:01:59 +00:00
|
|
|
{RADIUS_ASCEND_ACCESS_NEXT_CODE, "Next-Passcode"}, /* 29 RFC3575 */
|
|
|
|
{RADIUS_ASCEND_ACCESS_NEW_PIN, "New-Pin"}, /* 30 RFC3575 */
|
|
|
|
{31, "Terminate-Session"}, /* 31 RFC3575 */
|
|
|
|
{RADIUS_ASCEND_PASSWORD_EXPIRED, "Password-Expired"}, /* 32 RFC3575 */
|
|
|
|
{RADIUS_ASCEND_ACCESS_EVENT_REQUEST, "Event-Request"}, /* 33 RFC3575 */
|
|
|
|
{RADIUS_ASCEND_ACCESS_EVENT_RESPONSE, "Event-Response"}, /* 34 RFC3575 */
|
|
|
|
{RADIUS_DISCONNECT_REQUEST, "Disconnect-Request"}, /* 40 RFC3575 */
|
|
|
|
{RADIUS_DISCONNECT_REQUEST_ACK, "Disconnect-ACK"}, /* 41 RFC3575 */
|
|
|
|
{RADIUS_DISCONNECT_REQUEST_NAK, "Disconnect-NAK"}, /* 42 RFC3575 */
|
|
|
|
{RADIUS_CHANGE_FILTER_REQUEST, "CoA-Request"}, /* 43 */
|
|
|
|
{RADIUS_CHANGE_FILTER_REQUEST_ACK, "CoA-ACK"}, /* 44 */
|
|
|
|
{RADIUS_CHANGE_FILTER_REQUEST_NAK, "CoA-NAK"}, /* 45 */
|
2007-07-13 20:00:38 +00:00
|
|
|
/*
|
|
|
|
50 IP-Address-Allocate [RFC3575]
|
|
|
|
51 IP-Address-Release [RFC3575]
|
|
|
|
250-253 Experimental Use [RFC3575]
|
|
|
|
254 Reserved [RFC3575]
|
|
|
|
*/
|
2009-10-12 00:01:59 +00:00
|
|
|
{RADIUS_RESERVED, "Reserved"},
|
2005-07-15 21:12:27 +00:00
|
|
|
{0, NULL}
|
|
|
|
};
|
2004-03-31 20:57:42 +00:00
|
|
|
|
2006-10-24 05:21:00 +00:00
|
|
|
/*
|
|
|
|
* Init Hash table stuff for converation
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct _radius_call_info_key
|
|
|
|
{
|
|
|
|
guint code;
|
|
|
|
guint ident;
|
|
|
|
conversation_t *conversation;
|
|
|
|
nstime_t req_time;
|
|
|
|
} radius_call_info_key;
|
|
|
|
|
|
|
|
static GHashTable *radius_calls;
|
|
|
|
|
2009-04-02 19:05:52 +00:00
|
|
|
typedef struct _radius_vsa_buffer_key
|
|
|
|
{
|
|
|
|
guint32 vendor_id;
|
|
|
|
guint32 vsa_type;
|
|
|
|
} radius_vsa_buffer_key;
|
|
|
|
|
|
|
|
typedef struct _radius_vsa_buffer
|
|
|
|
{
|
2009-10-12 00:01:59 +00:00
|
|
|
radius_vsa_buffer_key key;
|
|
|
|
guint8* data;
|
|
|
|
guint seg_num;
|
|
|
|
guint len;
|
2009-04-02 19:05:52 +00:00
|
|
|
} radius_vsa_buffer;
|
|
|
|
|
|
|
|
static gint radius_vsa_equal(gconstpointer k1, gconstpointer k2)
|
|
|
|
{
|
|
|
|
const radius_vsa_buffer_key* key1 = (const radius_vsa_buffer_key*) k1;
|
|
|
|
const radius_vsa_buffer_key* key2 = (const radius_vsa_buffer_key*) k2;
|
|
|
|
|
|
|
|
return (((key1->vendor_id == key2->vendor_id) &&
|
|
|
|
(key1->vsa_type == key2->vsa_type)
|
|
|
|
) ? TRUE : FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static guint radius_vsa_hash(gconstpointer k)
|
|
|
|
{
|
|
|
|
const radius_vsa_buffer_key* key = (const radius_vsa_buffer_key*) k;
|
|
|
|
|
|
|
|
return key->vendor_id + key->vsa_type;
|
|
|
|
}
|
|
|
|
|
2006-10-24 05:21:00 +00:00
|
|
|
/* Compare 2 keys */
|
|
|
|
static gint radius_call_equal(gconstpointer k1, gconstpointer k2)
|
|
|
|
{
|
|
|
|
const radius_call_info_key* key1 = (const radius_call_info_key*) k1;
|
|
|
|
const radius_call_info_key* key2 = (const radius_call_info_key*) k2;
|
|
|
|
|
|
|
|
if (key1->ident == key2->ident && key1->conversation == key2->conversation) {
|
|
|
|
nstime_t delta;
|
|
|
|
|
|
|
|
nstime_delta(&delta, &key1->req_time, &key2->req_time);
|
2009-08-26 07:26:17 +00:00
|
|
|
if (abs( (int) nstime_to_sec(&delta)) > (double) request_ttl) return 0;
|
2006-10-24 05:21:00 +00:00
|
|
|
|
|
|
|
if (key1->code == key2->code)
|
|
|
|
return 1;
|
|
|
|
/* check the request and response are of the same code type */
|
|
|
|
if (key1->code == RADIUS_ACCESS_REQUEST && ( key2->code == RADIUS_ACCESS_ACCEPT || key2->code == RADIUS_ACCESS_REJECT ) )
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (key1->code == RADIUS_ACCOUNTING_REQUEST && key2->code == RADIUS_ACCOUNTING_RESPONSE )
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (key1->code == RADIUS_ACCESS_PASSWORD_REQUEST && ( key2->code == RADIUS_ACCESS_PASSWORD_ACK || key2->code == RADIUS_ACCESS_PASSWORD_REJECT ) )
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (key1->code == RADIUS_ASCEND_ACCESS_EVENT_REQUEST && key2->code == RADIUS_ASCEND_ACCESS_EVENT_RESPONSE )
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (key1->code == RADIUS_DISCONNECT_REQUEST && ( key2->code == RADIUS_DISCONNECT_REQUEST_ACK || key2->code == RADIUS_DISCONNECT_REQUEST_NAK ) )
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (key1->code == RADIUS_CHANGE_FILTER_REQUEST && ( key2->code == RADIUS_CHANGE_FILTER_REQUEST_ACK || key2->code == RADIUS_CHANGE_FILTER_REQUEST_NAK ) )
|
|
|
|
return 1;
|
2007-01-02 22:49:57 +00:00
|
|
|
}
|
2006-10-24 05:21:00 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Calculate a hash key */
|
|
|
|
static guint radius_call_hash(gconstpointer k)
|
|
|
|
{
|
|
|
|
const radius_call_info_key* key = (const radius_call_info_key*) k;
|
|
|
|
|
|
|
|
return key->ident + /*key->code + */ key->conversation->index;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-09-26 08:48:19 +00:00
|
|
|
static const gchar *dissect_framed_ip_address(proto_tree* tree, tvbuff_t* tvb) {
|
|
|
|
int len;
|
|
|
|
guint32 ip;
|
|
|
|
guint32 ip_h;
|
|
|
|
const gchar *str;
|
|
|
|
|
|
|
|
len = tvb_length(tvb);
|
|
|
|
if (len != 4)
|
|
|
|
return "[wrong length for IP address]";
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-09-26 08:48:19 +00:00
|
|
|
ip=tvb_get_ipv4(tvb,0);
|
|
|
|
ip_h=g_ntohl(ip);
|
|
|
|
|
|
|
|
if (ip_h == 0xFFFFFFFF) {
|
|
|
|
str = "Negotiated";
|
|
|
|
proto_tree_add_ipv4_format(tree, hf_radius_framed_ip_address,
|
2009-10-12 00:01:59 +00:00
|
|
|
tvb, 0, len, ip, "Framed-IP-Address: %s", str);
|
2005-09-26 08:48:19 +00:00
|
|
|
} else if (ip_h == 0xFFFFFFFE) {
|
|
|
|
str = "Assigned";
|
|
|
|
proto_tree_add_ipv4_format(tree, hf_radius_framed_ip_address,
|
2009-10-12 00:01:59 +00:00
|
|
|
tvb, 0, len, ip, "Framed-IP-Address: %s", str);
|
2005-09-26 08:48:19 +00:00
|
|
|
} else {
|
|
|
|
str = ip_to_str((guint8 *)&ip);
|
|
|
|
proto_tree_add_ipv4_format(tree, hf_radius_framed_ip_address,
|
2009-10-12 00:01:59 +00:00
|
|
|
tvb, 0, len, ip, "Framed-IP-Address: %s (%s)",
|
|
|
|
get_hostname(ip), str);
|
2005-09-26 08:48:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const gchar *dissect_login_ip_host(proto_tree* tree, tvbuff_t* tvb) {
|
|
|
|
int len;
|
|
|
|
guint32 ip;
|
|
|
|
guint32 ip_h;
|
|
|
|
const gchar *str;
|
|
|
|
|
|
|
|
len = tvb_length(tvb);
|
|
|
|
if (len != 4)
|
|
|
|
return "[wrong length for IP address]";
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-09-26 08:48:19 +00:00
|
|
|
ip=tvb_get_ipv4(tvb,0);
|
|
|
|
ip_h=g_ntohl(ip);
|
|
|
|
|
|
|
|
if (ip_h == 0xFFFFFFFF) {
|
|
|
|
str = "User-selected";
|
|
|
|
proto_tree_add_ipv4_format(tree, hf_radius_login_ip_host,
|
2009-10-12 00:01:59 +00:00
|
|
|
tvb, 0, len, ip, "Login-IP-Host: %s", str);
|
2005-09-26 08:48:19 +00:00
|
|
|
} else if (ip_h == 0) {
|
|
|
|
str = "NAS-selected";
|
|
|
|
proto_tree_add_ipv4_format(tree, hf_radius_login_ip_host,
|
2009-10-12 00:01:59 +00:00
|
|
|
tvb, 0, len, ip, "Login-IP-Host: %s", str);
|
2005-09-26 08:48:19 +00:00
|
|
|
} else {
|
|
|
|
str = ip_to_str((guint8 *)&ip);
|
|
|
|
proto_tree_add_ipv4_format(tree, hf_radius_framed_ip_address,
|
2009-10-12 00:01:59 +00:00
|
|
|
tvb, 0, len, ip, "Login-IP-Host: %s (%s)",
|
|
|
|
get_hostname(ip), str);
|
2005-09-26 08:48:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
2008-12-29 15:24:08 +00:00
|
|
|
static const value_string ascenddf_filtertype[] = { {0, "generic"}, {1, "ip"}, {0, NULL} };
|
|
|
|
static const value_string ascenddf_filteror[] = { {0, "drop"}, {1, "forward"}, {0, NULL} };
|
|
|
|
static const value_string ascenddf_inout[] = { {0, "out"}, {1, "in"}, {0, NULL} };
|
|
|
|
static const value_string ascenddf_proto[] = { {1, "icmp"}, {6, "tcp"}, {17, "udp"}, {0, NULL} };
|
|
|
|
static const value_string ascenddf_portq[] = { {1, "lt"}, {2, "eq"}, {3, "gt"}, {4, "ne"}, {0, NULL} };
|
|
|
|
|
|
|
|
static const gchar *dissect_ascend_data_filter(proto_tree* tree, tvbuff_t* tvb) {
|
|
|
|
const gchar *str;
|
|
|
|
GString *filterstr;
|
|
|
|
int len;
|
|
|
|
guint8 proto, srclen, dstlen;
|
|
|
|
guint32 srcip, dstip;
|
|
|
|
guint16 srcport, dstport;
|
|
|
|
guint8 srcportq, dstportq;
|
|
|
|
|
|
|
|
len=tvb_length(tvb);
|
|
|
|
|
|
|
|
if (len != 24) {
|
|
|
|
str = ep_strdup_printf("Wrong attribute length %d", len);
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
filterstr=g_string_sized_new(64);
|
|
|
|
|
|
|
|
proto_tree_add_item(tree, hf_radius_ascend_data_filter, tvb, 0, -1, FALSE);
|
|
|
|
|
|
|
|
g_string_printf(filterstr, "%s %s %s",
|
|
|
|
val_to_str(tvb_get_guint8(tvb, 0), ascenddf_filtertype, "%u"),
|
|
|
|
val_to_str(tvb_get_guint8(tvb, 2), ascenddf_inout, "%u"),
|
|
|
|
val_to_str(tvb_get_guint8(tvb, 1), ascenddf_filteror, "%u"));
|
|
|
|
|
|
|
|
proto=tvb_get_guint8(tvb, 14);
|
|
|
|
if (proto) {
|
|
|
|
str=val_to_str(proto, ascenddf_proto, "%u");
|
|
|
|
g_string_append_printf(filterstr, " %s", str);
|
|
|
|
}
|
|
|
|
|
|
|
|
srcip=tvb_get_ipv4(tvb, 4);
|
|
|
|
srclen=tvb_get_guint8(tvb, 12);
|
|
|
|
srcport=tvb_get_ntohs(tvb, 16);
|
|
|
|
srcportq=tvb_get_guint8(tvb, 20);
|
|
|
|
|
|
|
|
if (srcip || srclen || srcportq) {
|
|
|
|
g_string_append_printf(filterstr, " srcip %s/%d", ip_to_str((guint8 *) &srcip), srclen);
|
|
|
|
if (srcportq)
|
|
|
|
g_string_append_printf(filterstr, " srcport %s %d",
|
|
|
|
val_to_str(srcportq, ascenddf_portq, "%u"), srcport);
|
|
|
|
}
|
|
|
|
|
|
|
|
dstip=tvb_get_ipv4(tvb, 8);
|
|
|
|
dstlen=tvb_get_guint8(tvb, 13);
|
|
|
|
dstport=tvb_get_ntohs(tvb, 18);
|
|
|
|
dstportq=tvb_get_guint8(tvb, 21);
|
|
|
|
|
|
|
|
if (dstip || dstlen || dstportq) {
|
|
|
|
g_string_append_printf(filterstr, " dstip %s/%d", ip_to_str((guint8 *) &dstip), dstlen);
|
|
|
|
if (dstportq)
|
|
|
|
g_string_append_printf(filterstr, " dstport %s %d",
|
|
|
|
val_to_str(dstportq, ascenddf_portq, "%u"), dstport);
|
|
|
|
}
|
|
|
|
|
|
|
|
str=ep_strdup(filterstr->str);
|
|
|
|
g_string_free(filterstr, TRUE);
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
2005-09-26 08:48:19 +00:00
|
|
|
static const gchar *dissect_framed_ipx_network(proto_tree* tree, tvbuff_t* tvb) {
|
|
|
|
int len;
|
|
|
|
guint32 net;
|
|
|
|
const gchar *str;
|
|
|
|
|
|
|
|
len = tvb_length(tvb);
|
|
|
|
if (len != 4)
|
|
|
|
return "[wrong length for IPX network]";
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-09-26 08:48:19 +00:00
|
|
|
net=tvb_get_ntohl(tvb,0);
|
|
|
|
|
|
|
|
if (net == 0xFFFFFFFE)
|
|
|
|
str = "NAS-selected";
|
|
|
|
else
|
|
|
|
str = ep_strdup_printf("0x%08X", net);
|
|
|
|
proto_tree_add_ipxnet_format(tree, hf_radius_framed_ipx_network, tvb, 0,
|
2009-10-12 00:01:59 +00:00
|
|
|
len, net, "Framed-IPX-Network: %s", str);
|
2005-09-26 08:48:19 +00:00
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
2005-07-30 02:22:22 +00:00
|
|
|
static const gchar* dissect_cosine_vpvc(proto_tree* tree, tvbuff_t* tvb) {
|
2005-07-15 21:12:27 +00:00
|
|
|
guint vpi, vci;
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
if ( tvb_length(tvb) != 4 )
|
2005-07-24 20:39:19 +00:00
|
|
|
return "[Wrong Length for VP/VC AVP]";
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
vpi = tvb_get_ntohs(tvb,0);
|
|
|
|
vci = tvb_get_ntohs(tvb,2);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
proto_tree_add_uint(tree,hf_radius_cosine_vpi,tvb,0,2,vpi);
|
|
|
|
proto_tree_add_uint(tree,hf_radius_cosine_vci,tvb,2,2,vci);
|
|
|
|
|
2007-01-02 22:49:57 +00:00
|
|
|
return ep_strdup_printf("%u/%u",vpi,vci);
|
2004-03-31 20:57:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-08-27 01:05:14 +00:00
|
|
|
radius_decrypt_avp(gchar *dest,int dest_len,tvbuff_t *tvb,int offset,int length)
|
2004-03-31 20:57:42 +00:00
|
|
|
{
|
2009-10-12 00:01:59 +00:00
|
|
|
md5_state_t md_ctx;
|
|
|
|
md5_byte_t digest[16];
|
|
|
|
int i;
|
|
|
|
gint totlen, returned_length;
|
|
|
|
const guint8 *pd;
|
|
|
|
guchar c;
|
|
|
|
|
|
|
|
DISSECTOR_ASSERT(dest_len > 2); /* \"\"\0 */
|
|
|
|
dest[0] = '"';
|
|
|
|
dest[1] = '\0';
|
|
|
|
totlen = 1;
|
|
|
|
dest_len -= 1; /* Need to add trailing \" */
|
|
|
|
|
|
|
|
md5_init(&md_ctx);
|
|
|
|
md5_append(&md_ctx,(const guint8*)shared_secret,(int)strlen(shared_secret));
|
|
|
|
md5_append(&md_ctx,authenticator, AUTHENTICATOR_LENGTH);
|
|
|
|
md5_finish(&md_ctx,digest);
|
|
|
|
|
|
|
|
pd = tvb_get_ptr(tvb,offset,length);
|
|
|
|
for( i = 0 ; i < AUTHENTICATOR_LENGTH && i < length ; i++ ) {
|
2005-07-15 21:12:27 +00:00
|
|
|
c = pd[i] ^ digest[i];
|
2006-01-16 07:59:44 +00:00
|
|
|
if ( isprint(c) ) {
|
|
|
|
returned_length = g_snprintf(&dest[totlen], dest_len-totlen,
|
2009-10-12 00:01:59 +00:00
|
|
|
"%c",c);
|
2006-01-16 07:59:44 +00:00
|
|
|
totlen += MIN(returned_length, dest_len-totlen-1);
|
2005-07-15 21:12:27 +00:00
|
|
|
} else {
|
2006-01-16 07:59:44 +00:00
|
|
|
returned_length = g_snprintf(&dest[totlen], dest_len-totlen,
|
2009-10-12 00:01:59 +00:00
|
|
|
"\\%03o",c);
|
2006-01-16 07:59:44 +00:00
|
|
|
totlen += MIN(returned_length, dest_len-totlen-1);
|
2005-07-15 21:12:27 +00:00
|
|
|
}
|
2009-10-12 00:01:59 +00:00
|
|
|
}
|
|
|
|
while(i<length) {
|
2005-07-15 21:12:27 +00:00
|
|
|
if ( isprint(pd[i]) ) {
|
2006-01-16 07:59:44 +00:00
|
|
|
returned_length = g_snprintf(&dest[totlen], dest_len-totlen,
|
2009-10-12 00:01:59 +00:00
|
|
|
"%c", pd[i]);
|
2006-01-16 07:59:44 +00:00
|
|
|
totlen += MIN(returned_length, dest_len-totlen-1);
|
2005-07-15 21:12:27 +00:00
|
|
|
} else {
|
2006-01-16 07:59:44 +00:00
|
|
|
returned_length = g_snprintf(&dest[totlen], dest_len-totlen,
|
2009-10-12 00:01:59 +00:00
|
|
|
"\\%03o", pd[i]);
|
2006-01-16 07:59:44 +00:00
|
|
|
totlen += MIN(returned_length, dest_len-totlen-1);
|
2005-07-15 21:12:27 +00:00
|
|
|
}
|
|
|
|
i++;
|
2009-10-12 00:01:59 +00:00
|
|
|
}
|
|
|
|
g_snprintf(&dest[totlen], dest_len+1-totlen, "%c", '"');
|
2004-03-31 20:57:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
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) {
|
|
|
|
guint32 uint;
|
2004-09-19 11:39:48 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
switch (len) {
|
2009-04-02 19:05:52 +00:00
|
|
|
case 1:
|
|
|
|
uint = tvb_get_guint8(tvb,offset);
|
|
|
|
break;
|
2005-07-15 21:12:27 +00:00
|
|
|
case 2:
|
|
|
|
uint = tvb_get_ntohs(tvb,offset);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
uint = tvb_get_ntoh24(tvb,offset);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
uint = tvb_get_ntohl(tvb,offset);
|
|
|
|
break;
|
|
|
|
case 8: {
|
|
|
|
guint64 uint64 = tvb_get_ntoh64(tvb,offset);
|
|
|
|
proto_tree_add_uint64(tree,a->hf64,tvb,offset,len,uint64);
|
2007-05-29 18:52:42 +00:00
|
|
|
proto_item_append_text(avp_item, "%" G_GINT64_MODIFIER "u", uint64);
|
2005-07-15 21:12:27 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
proto_item_append_text(avp_item, "[unhandled integer length(%u)]", len);
|
|
|
|
return;
|
|
|
|
}
|
2008-09-11 19:34:29 +00:00
|
|
|
proto_tree_add_item(tree,a->hf,tvb, offset, len, FALSE);
|
2004-09-19 11:39:48 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
if (a->vs) {
|
|
|
|
proto_item_append_text(avp_item, "%s(%u)", val_to_str(uint, a->vs, "Unknown"),uint);
|
|
|
|
} else {
|
|
|
|
proto_item_append_text(avp_item, "%u", uint);
|
|
|
|
}
|
2004-09-19 11:39:48 +00:00
|
|
|
}
|
|
|
|
|
2009-04-02 19:05:52 +00:00
|
|
|
void radius_signed(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_, tvbuff_t* tvb, int offset, int len, proto_item* avp_item) {
|
|
|
|
guint32 uint;
|
|
|
|
|
|
|
|
switch (len) {
|
|
|
|
case 1:
|
|
|
|
uint = tvb_get_guint8(tvb,offset);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
uint = tvb_get_ntohs(tvb,offset);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
uint = tvb_get_ntoh24(tvb,offset);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
uint = tvb_get_ntohl(tvb,offset);
|
|
|
|
break;
|
|
|
|
case 8: {
|
|
|
|
guint64 uint64 = tvb_get_ntoh64(tvb,offset);
|
|
|
|
proto_tree_add_int64(tree,a->hf64,tvb,offset,len,uint64);
|
|
|
|
proto_item_append_text(avp_item, "%" G_GINT64_MODIFIER "u", uint64);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
proto_item_append_text(avp_item, "[unhandled signed integer length(%u)]", len);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
proto_tree_add_int(tree,a->hf,tvb,offset,len,uint);
|
|
|
|
|
|
|
|
if (a->vs) {
|
|
|
|
proto_item_append_text(avp_item, "%s(%d)", val_to_str(uint, a->vs, "Unknown"),uint);
|
|
|
|
} else {
|
|
|
|
proto_item_append_text(avp_item, "%d", uint);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
void radius_string(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->encrypt) {
|
|
|
|
if (*shared_secret == '\0') {
|
|
|
|
proto_item_append_text(avp_item, "Encrypted");
|
|
|
|
proto_tree_add_item(tree, a->hf, tvb, offset, len, FALSE);
|
|
|
|
} else {
|
2007-01-02 22:49:57 +00:00
|
|
|
gchar *buffer;
|
2005-08-27 01:05:14 +00:00
|
|
|
buffer=ep_alloc(1024); /* an AVP value can be at most 253 bytes */
|
|
|
|
radius_decrypt_avp(buffer,1024,tvb,offset,len);
|
2005-07-15 21:12:27 +00:00
|
|
|
proto_item_append_text(avp_item, "Decrypted: %s", buffer);
|
|
|
|
proto_tree_add_string(tree, a->hf, tvb, offset, len, buffer);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
proto_tree_add_item(tree, a->hf, tvb, offset, len, FALSE);
|
|
|
|
proto_item_append_text(avp_item, "%s", tvb_format_text(tvb, offset, len));
|
|
|
|
}
|
2004-12-22 00:23:55 +00:00
|
|
|
}
|
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
void radius_octets(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_, tvbuff_t* tvb, int offset, int len, proto_item* avp_item) {
|
|
|
|
proto_tree_add_item(tree, a->hf, tvb, offset, len, FALSE);
|
|
|
|
proto_item_append_text(avp_item, "%s", tvb_bytes_to_str(tvb, offset, len));
|
|
|
|
}
|
2004-03-31 20:57:42 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
void radius_ipaddr(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_, tvbuff_t* tvb, int offset, int len, proto_item* avp_item) {
|
2005-09-13 00:50:43 +00:00
|
|
|
guint32 ip;
|
2007-01-29 20:25:26 +00:00
|
|
|
gchar buf[MAX_IP_STR_LEN];
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
if (len != 4) {
|
2005-07-24 20:39:19 +00:00
|
|
|
proto_item_append_text(avp_item, "[wrong length for IP address]");
|
2005-07-15 21:12:27 +00:00
|
|
|
return;
|
|
|
|
}
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-09-13 00:50:43 +00:00
|
|
|
ip=tvb_get_ipv4(tvb,offset);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
proto_tree_add_item(tree, a->hf, tvb, offset, len, FALSE);
|
2004-03-31 20:57:42 +00:00
|
|
|
|
2007-01-29 20:25:26 +00:00
|
|
|
ip_to_str_buf((guint8 *)&ip, buf, MAX_IP_STR_LEN);
|
2005-07-15 21:12:27 +00:00
|
|
|
proto_item_append_text(avp_item, "%s", buf);
|
|
|
|
}
|
2004-10-04 20:13:35 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
void radius_ipv6addr(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_, tvbuff_t* tvb, int offset, int len, proto_item* avp_item) {
|
2005-09-13 00:50:43 +00:00
|
|
|
struct e_in6_addr ipv6_buff;
|
2005-07-15 21:12:27 +00:00
|
|
|
gchar txtbuf[256];
|
2004-03-31 20:57:42 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
if (len != 16) {
|
2005-07-24 20:39:19 +00:00
|
|
|
proto_item_append_text(avp_item, "[wrong length for IPv6 address]");
|
2005-07-15 21:12:27 +00:00
|
|
|
return;
|
|
|
|
}
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
proto_tree_add_item(tree, a->hf, tvb, offset, len, FALSE);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-09-13 00:50:43 +00:00
|
|
|
tvb_get_ipv6(tvb, offset, &ipv6_buff);
|
|
|
|
ip6_to_str_buf(&ipv6_buff, txtbuf);
|
2005-07-15 21:12:27 +00:00
|
|
|
proto_item_append_text(avp_item, "%s", txtbuf);
|
|
|
|
}
|
2004-10-04 20:13:35 +00:00
|
|
|
|
2009-03-18 07:31:35 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-04-02 19:05:52 +00:00
|
|
|
void radius_combo_ip(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_, tvbuff_t* tvb, int offset, int len, proto_item* avp_item) {
|
|
|
|
guint32 ip;
|
|
|
|
struct e_in6_addr ipv6_buff;
|
|
|
|
gchar buf[256];
|
|
|
|
|
|
|
|
if (len == 4){
|
|
|
|
ip=tvb_get_ipv4(tvb,offset);
|
|
|
|
|
|
|
|
proto_tree_add_item(tree, a->hf, tvb, offset, len, FALSE);
|
|
|
|
|
|
|
|
ip_to_str_buf((guint8 *)&ip, buf, MAX_IP_STR_LEN);
|
|
|
|
proto_item_append_text(avp_item, "%s", buf);
|
|
|
|
} else if (len == 16) {
|
|
|
|
proto_tree_add_item(tree, a->hf64, tvb, offset, len, FALSE);
|
|
|
|
|
|
|
|
tvb_get_ipv6(tvb, offset, &ipv6_buff);
|
|
|
|
ip6_to_str_buf(&ipv6_buff, buf);
|
|
|
|
proto_item_append_text(avp_item, "%s", buf);
|
|
|
|
} else {
|
|
|
|
proto_item_append_text(avp_item, "[wrong length for both of IPv4 and IPv6 address]");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-26 08:48:19 +00:00
|
|
|
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;
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-09-26 08:48:19 +00:00
|
|
|
if (len != 4) {
|
|
|
|
proto_item_append_text(avp_item, "[wrong length for IPX network]");
|
|
|
|
return;
|
|
|
|
}
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-09-26 08:48:19 +00:00
|
|
|
net=tvb_get_ntohl(tvb,offset);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-09-26 08:48:19 +00:00
|
|
|
proto_tree_add_item(tree, a->hf, tvb, offset, len, FALSE);
|
|
|
|
|
|
|
|
proto_item_append_text(avp_item, "0x%08X", net);
|
|
|
|
}
|
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
void radius_date(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_, tvbuff_t* tvb, int offset, int len, proto_item* avp_item) {
|
2007-01-02 22:49:57 +00:00
|
|
|
nstime_t time_ptr;
|
2004-03-31 20:57:42 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
if (len != 4) {
|
2005-07-24 20:39:19 +00:00
|
|
|
proto_item_append_text(avp_item, "[wrong length for timestamp]");
|
2005-07-15 21:12:27 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
time_ptr.secs = tvb_get_ntohl(tvb,offset);
|
|
|
|
time_ptr.nsecs = 0;
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
proto_tree_add_time(tree, a->hf, tvb, offset, len, &time_ptr);
|
2009-12-10 22:19:29 +00:00
|
|
|
proto_item_append_text(avp_item, "%s", abs_time_to_str(&time_ptr, FALSE));
|
2005-07-15 21:12:27 +00:00
|
|
|
}
|
2004-03-31 20:57:42 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
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) {
|
|
|
|
proto_tree_add_item(tree, a->hf, tvb, offset, len, FALSE);
|
|
|
|
proto_item_append_text(avp_item, "%s", tvb_bytes_to_str(tvb, offset, len));
|
|
|
|
}
|
2004-03-31 20:57:42 +00:00
|
|
|
|
2009-07-06 14:05:37 +00:00
|
|
|
void radius_ether(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_, tvbuff_t* tvb, int offset, int len, proto_item* avp_item) {
|
|
|
|
if (len != 6) {
|
|
|
|
proto_item_append_text(avp_item, "[wrong length for ethernet address]");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
proto_tree_add_item(tree, a->hf, tvb, offset, len, FALSE);
|
|
|
|
proto_item_append_text(avp_item, "%s", ether_to_str(tvb_get_ptr(tvb, offset, len)));
|
|
|
|
}
|
|
|
|
|
2007-01-02 22:49:57 +00:00
|
|
|
void radius_ifid(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_, tvbuff_t* tvb, int offset, int len, proto_item* avp_item) {
|
2005-07-15 21:12:27 +00:00
|
|
|
proto_tree_add_item(tree, a->hf, tvb, offset, len, FALSE);
|
|
|
|
proto_item_append_text(avp_item, "%s", tvb_bytes_to_str(tvb, offset, len));
|
|
|
|
}
|
2004-03-31 20:57:42 +00:00
|
|
|
|
2009-04-02 19:05:52 +00:00
|
|
|
static void add_tlv_to_tree(proto_tree* tlv_tree, proto_item* tlv_item, packet_info* pinfo, tvbuff_t* tvb, radius_attr_info_t* dictionary_entry, guint32 tlv_length, guint32 offset) {
|
|
|
|
proto_item_append_text(tlv_item, ": ");
|
|
|
|
dictionary_entry->type(dictionary_entry,tlv_tree,pinfo,tvb,offset,tlv_length,tlv_item);
|
|
|
|
}
|
|
|
|
|
|
|
|
void radius_tlv(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_, tvbuff_t* tvb, int offset, int len, proto_item* avp_item) {
|
2009-10-12 00:01:59 +00:00
|
|
|
proto_item* item;
|
|
|
|
gint tlv_num = 0;
|
|
|
|
|
|
|
|
while (len > 0) {
|
|
|
|
radius_attr_info_t* dictionary_entry = NULL;
|
|
|
|
guint32 tlv_type;
|
|
|
|
guint32 tlv_length;
|
|
|
|
|
|
|
|
proto_item* tlv_item;
|
|
|
|
proto_item* tlv_len_item;
|
|
|
|
proto_tree* tlv_tree;
|
|
|
|
|
|
|
|
if (len < 2) {
|
|
|
|
item = proto_tree_add_text(tree, tvb, offset, 0,
|
|
|
|
"Not enough room in packet for TLV header");
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
tlv_type = tvb_get_guint8(tvb,offset);
|
|
|
|
tlv_length = tvb_get_guint8(tvb,offset+1);
|
|
|
|
|
|
|
|
if (tlv_length < 2) {
|
|
|
|
item = proto_tree_add_text(tree, tvb, offset, 0,
|
|
|
|
"TLV too short: length %u < 2", tlv_length);
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (len < (gint)tlv_length) {
|
|
|
|
item = proto_tree_add_text(tree, tvb, offset, 0,
|
|
|
|
"Not enough room in packet for TLV");
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
len -= tlv_length;
|
|
|
|
|
|
|
|
dictionary_entry = g_hash_table_lookup(a->tlvs_by_id,GUINT_TO_POINTER(tlv_type));
|
|
|
|
|
|
|
|
if (! dictionary_entry ) {
|
|
|
|
dictionary_entry = &no_dictionary_entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
tlv_item = proto_tree_add_text(tree, tvb, offset, tlv_length,
|
|
|
|
"TLV: l=%u t=%s(%u)", tlv_length,
|
|
|
|
dictionary_entry->name, tlv_type);
|
|
|
|
|
|
|
|
tlv_length -= 2;
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
tlv_tree = proto_item_add_subtree(tlv_item,dictionary_entry->ett);
|
|
|
|
|
|
|
|
if (show_length) {
|
|
|
|
tlv_len_item = proto_tree_add_uint(tlv_tree,
|
|
|
|
dictionary_entry->hf_len,
|
|
|
|
tvb,0,0,tlv_length);
|
|
|
|
PROTO_ITEM_SET_GENERATED(tlv_len_item);
|
|
|
|
}
|
|
|
|
|
|
|
|
add_tlv_to_tree(tlv_tree, tlv_item, pinfo, tvb, dictionary_entry,
|
|
|
|
tlv_length, offset);
|
|
|
|
offset += tlv_length;
|
|
|
|
tlv_num++;
|
|
|
|
}
|
|
|
|
|
|
|
|
proto_item_append_text(avp_item, "%d TLV(s) inside", tlv_num);
|
2009-04-02 19:05:52 +00:00
|
|
|
}
|
|
|
|
|
2005-09-19 17:42:02 +00:00
|
|
|
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) {
|
2009-10-12 00:01:59 +00:00
|
|
|
proto_item* pi;
|
2005-09-19 17:42:02 +00:00
|
|
|
|
2009-10-12 00:01:59 +00:00
|
|
|
if (dictionary_entry->tagged) {
|
|
|
|
guint tag;
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2009-10-12 00:01:59 +00:00
|
|
|
if (avp_length == 0) {
|
|
|
|
pi = proto_tree_add_text(avp_tree, tvb, offset,
|
|
|
|
0, "AVP too short for tag");
|
|
|
|
PROTO_ITEM_SET_GENERATED(pi);
|
|
|
|
return;
|
|
|
|
}
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2009-10-12 00:01:59 +00:00
|
|
|
tag = tvb_get_guint8(tvb, offset);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2009-10-12 00:01:59 +00:00
|
|
|
if (tag <= 0x1f) {
|
|
|
|
proto_tree_add_uint(avp_tree,
|
|
|
|
dictionary_entry->hf_tag,
|
|
|
|
tvb, offset, 1, tag);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2009-10-12 00:01:59 +00:00
|
|
|
proto_item_append_text(avp_item,
|
|
|
|
" Tag=0x%.2x", tag);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2009-10-12 00:01:59 +00:00
|
|
|
offset++;
|
|
|
|
avp_length--;
|
|
|
|
}
|
|
|
|
}
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2009-10-12 00:01:59 +00:00
|
|
|
if ( dictionary_entry->dissector ) {
|
|
|
|
tvbuff_t* tvb_value;
|
|
|
|
const gchar* str;
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2009-10-12 00:01:59 +00:00
|
|
|
tvb_value = tvb_new_subset(tvb, offset, avp_length, (gint) avp_length);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2009-10-12 00:01:59 +00:00
|
|
|
str = dictionary_entry->dissector(avp_tree,tvb_value);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2009-10-12 00:01:59 +00:00
|
|
|
proto_item_append_text(avp_item, ": %s",str);
|
|
|
|
} else {
|
|
|
|
proto_item_append_text(avp_item, ": ");
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2009-10-12 00:01:59 +00:00
|
|
|
dictionary_entry->type(dictionary_entry,avp_tree,pinfo,tvb,offset,avp_length,avp_item);
|
|
|
|
}
|
2005-09-19 17:42:02 +00:00
|
|
|
}
|
2004-03-31 20:57:42 +00:00
|
|
|
|
2009-04-02 19:05:52 +00:00
|
|
|
static gboolean vsa_buffer_destroy(gpointer k _U_, gpointer v, gpointer p _U_) {
|
|
|
|
radius_vsa_buffer* vsa_buffer = (radius_vsa_buffer*)v;
|
|
|
|
g_free((gpointer)vsa_buffer->data);
|
|
|
|
g_free(v);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2009-06-30 13:57:26 +00:00
|
|
|
static void vsa_buffer_table_destroy(void *table) {
|
2009-04-02 19:05:52 +00:00
|
|
|
if (table) {
|
2009-06-30 13:57:26 +00:00
|
|
|
g_hash_table_foreach_remove((GHashTable *)table, vsa_buffer_destroy, NULL);
|
|
|
|
g_hash_table_destroy((GHashTable *)table);
|
2009-04-02 19:05:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-30 13:57:26 +00:00
|
|
|
|
2005-07-24 20:39:19 +00:00
|
|
|
static void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, int offset, guint length) {
|
2009-10-12 00:01:59 +00:00
|
|
|
proto_item* item;
|
|
|
|
gboolean last_eap = FALSE;
|
|
|
|
guint8* eap_buffer = NULL;
|
|
|
|
guint eap_seg_num = 0;
|
|
|
|
guint eap_tot_len_captured = 0;
|
|
|
|
guint eap_tot_len = 0;
|
|
|
|
proto_tree* eap_tree = NULL;
|
|
|
|
tvbuff_t* eap_tvb = NULL;
|
|
|
|
|
|
|
|
GHashTable* vsa_buffer_table = NULL;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* In case we throw an exception, clean up whatever stuff we've
|
|
|
|
* allocated (if any).
|
|
|
|
*/
|
|
|
|
CLEANUP_PUSH(g_free, eap_buffer);
|
|
|
|
CLEANUP_PUSH(vsa_buffer_table_destroy, (void *)vsa_buffer_table);
|
|
|
|
|
|
|
|
while (length > 0) {
|
|
|
|
radius_attr_info_t* dictionary_entry = NULL;
|
|
|
|
gint tvb_len;
|
|
|
|
guint32 avp_type;
|
|
|
|
guint32 avp_length;
|
|
|
|
guint32 vendor_id;
|
|
|
|
|
|
|
|
proto_item* avp_item;
|
|
|
|
proto_item* avp_len_item;
|
|
|
|
proto_tree* avp_tree;
|
|
|
|
|
|
|
|
if (length < 2) {
|
|
|
|
item = proto_tree_add_text(tree, tvb, offset, 0,
|
|
|
|
"Not enough room in packet for AVP header");
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
break; /* exit outer loop, then cleanup & return */
|
|
|
|
}
|
|
|
|
avp_type = tvb_get_guint8(tvb,offset);
|
|
|
|
avp_length = tvb_get_guint8(tvb,offset+1);
|
|
|
|
|
|
|
|
if (avp_length < 2) {
|
|
|
|
item = proto_tree_add_text(tree, tvb, offset, 0,
|
|
|
|
"AVP too short: length %u < 2", avp_length);
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
break; /* exit outer loop, then cleanup & return */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (length < avp_length) {
|
|
|
|
item = proto_tree_add_text(tree, tvb, offset, 0,
|
|
|
|
"Not enough room in packet for AVP");
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
break; /* exit outer loop, then cleanup & return */
|
|
|
|
}
|
|
|
|
|
|
|
|
length -= avp_length;
|
|
|
|
|
|
|
|
dictionary_entry = g_hash_table_lookup(dict->attrs_by_id,GUINT_TO_POINTER(avp_type));
|
|
|
|
|
|
|
|
if (! dictionary_entry ) {
|
|
|
|
dictionary_entry = &no_dictionary_entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
avp_item = proto_tree_add_text(tree, tvb, offset, avp_length,
|
|
|
|
"AVP: l=%u t=%s(%u)", avp_length,
|
|
|
|
dictionary_entry->name, avp_type);
|
|
|
|
|
|
|
|
avp_length -= 2;
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
if (avp_type == RADIUS_VENDOR_SPECIFIC_CODE) {
|
|
|
|
radius_vendor_info_t* vendor;
|
|
|
|
proto_tree* vendor_tree;
|
|
|
|
gint max_offset = offset + avp_length;
|
|
|
|
const gchar* vendor_str;
|
|
|
|
|
|
|
|
/* XXX TODO: handle 2 byte codes for USR */
|
|
|
|
|
|
|
|
if (avp_length < 4) {
|
|
|
|
proto_item_append_text(avp_item, " [AVP too short; no room for vendor ID]");
|
|
|
|
offset += avp_length;
|
|
|
|
continue; /* while (length > 0) */
|
2009-04-02 19:05:52 +00:00
|
|
|
}
|
2009-10-12 00:01:59 +00:00
|
|
|
vendor_id = tvb_get_ntohl(tvb,offset);
|
|
|
|
|
|
|
|
avp_length -= 4;
|
|
|
|
offset += 4;
|
2009-04-02 19:05:52 +00:00
|
|
|
|
2009-10-12 00:01:59 +00:00
|
|
|
vendor = g_hash_table_lookup(dict->vendors_by_id,GUINT_TO_POINTER(vendor_id));
|
|
|
|
if (vendor) {
|
|
|
|
vendor_str = vendor->name;
|
|
|
|
} else {
|
|
|
|
vendor_str = val_to_str(vendor_id, sminmpec_values, "Unknown");
|
|
|
|
vendor = &no_vendor;
|
2009-04-02 19:05:52 +00:00
|
|
|
}
|
2009-10-12 00:01:59 +00:00
|
|
|
proto_item_append_text(avp_item, " v=%s(%u)", vendor_str,
|
|
|
|
vendor_id);
|
|
|
|
|
|
|
|
vendor_tree = proto_item_add_subtree(avp_item,vendor->ett);
|
|
|
|
|
|
|
|
while (offset < max_offset) {
|
|
|
|
guint32 avp_vsa_type;
|
|
|
|
guint32 avp_vsa_len;
|
|
|
|
guint8 avp_vsa_flags = 0;
|
|
|
|
guint32 avp_vsa_header_len = vendor->type_octets + vendor->length_octets + (vendor->has_flags ? 1 : 0);
|
|
|
|
|
|
|
|
switch (vendor->type_octets) {
|
|
|
|
case 1:
|
|
|
|
avp_vsa_type = tvb_get_guint8(tvb,offset++);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
avp_vsa_type = tvb_get_ntohs(tvb,offset);
|
|
|
|
offset += 2;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
avp_vsa_type = tvb_get_ntohl(tvb,offset);
|
|
|
|
offset += 4;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
avp_vsa_type = tvb_get_guint8(tvb,offset++);
|
|
|
|
}
|
2009-04-02 19:05:52 +00:00
|
|
|
|
2009-10-12 00:01:59 +00:00
|
|
|
switch (vendor->length_octets) {
|
|
|
|
case 1:
|
|
|
|
avp_vsa_len = tvb_get_guint8(tvb,offset++);
|
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
avp_vsa_len = avp_length;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
avp_vsa_len = tvb_get_ntohs(tvb,offset);
|
|
|
|
offset += 2;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
avp_vsa_len = tvb_get_guint8(tvb,offset++);
|
2009-04-02 19:05:52 +00:00
|
|
|
}
|
2009-10-12 00:01:59 +00:00
|
|
|
|
|
|
|
if (vendor->has_flags) {
|
|
|
|
avp_vsa_flags = tvb_get_guint8(tvb,offset++);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (avp_vsa_len < avp_vsa_header_len) {
|
|
|
|
proto_tree_add_text(tree, tvb, offset+1, 1,
|
|
|
|
"[VSA too short]");
|
|
|
|
break; /* exit while (offset < max_offset) loop */
|
|
|
|
}
|
|
|
|
|
|
|
|
avp_vsa_len -= avp_vsa_header_len;
|
|
|
|
|
|
|
|
dictionary_entry = g_hash_table_lookup(vendor->attrs_by_id,GUINT_TO_POINTER(avp_vsa_type));
|
|
|
|
|
|
|
|
if ( !dictionary_entry ) {
|
|
|
|
dictionary_entry = &no_dictionary_entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (vendor->has_flags){
|
|
|
|
avp_item = proto_tree_add_text(vendor_tree,tvb,offset-avp_vsa_header_len,avp_vsa_len+avp_vsa_header_len,
|
|
|
|
"VSA: l=%u t=%s(%u) C=0x%02x",
|
|
|
|
avp_vsa_len+avp_vsa_header_len, dictionary_entry->name, avp_vsa_type, avp_vsa_flags);
|
|
|
|
} else {
|
|
|
|
avp_item = proto_tree_add_text(vendor_tree,tvb,offset-avp_vsa_header_len,avp_vsa_len+avp_vsa_header_len,
|
|
|
|
"VSA: l=%u t=%s(%u)",
|
|
|
|
avp_vsa_len+avp_vsa_header_len, dictionary_entry->name, avp_vsa_type);
|
|
|
|
}
|
|
|
|
|
|
|
|
avp_tree = proto_item_add_subtree(avp_item,dictionary_entry->ett);
|
|
|
|
|
|
|
|
if (show_length) {
|
|
|
|
avp_len_item = proto_tree_add_uint(avp_tree,
|
|
|
|
dictionary_entry->hf_len,
|
|
|
|
tvb,0,0,avp_length);
|
|
|
|
PROTO_ITEM_SET_GENERATED(avp_len_item);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (vendor->has_flags) {
|
|
|
|
radius_vsa_buffer_key key;
|
|
|
|
radius_vsa_buffer* vsa_buffer = NULL;
|
|
|
|
key.vendor_id = vendor_id;
|
|
|
|
key.vsa_type = avp_vsa_type;
|
|
|
|
|
|
|
|
if (!vsa_buffer_table) {
|
|
|
|
vsa_buffer_table = g_hash_table_new(radius_vsa_hash, radius_vsa_equal);
|
|
|
|
}
|
|
|
|
|
|
|
|
vsa_buffer = g_hash_table_lookup(vsa_buffer_table, &key);
|
|
|
|
if (vsa_buffer) {
|
|
|
|
vsa_buffer->data = g_realloc(vsa_buffer->data, vsa_buffer->len + avp_vsa_len);
|
|
|
|
tvb_memcpy(tvb, vsa_buffer->data + vsa_buffer->len, offset, avp_vsa_len);
|
|
|
|
vsa_buffer->len += avp_vsa_len;
|
|
|
|
vsa_buffer->seg_num++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (avp_vsa_flags & 0x80) {
|
|
|
|
if (!vsa_buffer) {
|
|
|
|
vsa_buffer = g_malloc(sizeof(radius_vsa_buffer));
|
|
|
|
vsa_buffer->key.vendor_id = vendor_id;
|
|
|
|
vsa_buffer->key.vsa_type = avp_vsa_type;
|
|
|
|
vsa_buffer->len = avp_vsa_len;
|
|
|
|
vsa_buffer->seg_num = 1;
|
|
|
|
vsa_buffer->data = g_malloc(avp_vsa_len);
|
|
|
|
tvb_memcpy(tvb, vsa_buffer->data, offset, avp_vsa_len);
|
|
|
|
g_hash_table_insert(vsa_buffer_table, &(vsa_buffer->key), vsa_buffer);
|
|
|
|
}
|
|
|
|
proto_tree_add_text(avp_tree, tvb, offset, avp_vsa_len, "VSA fragment");
|
|
|
|
proto_item_append_text(avp_item, ": VSA fragment[%u]", vsa_buffer->seg_num);
|
|
|
|
} else {
|
|
|
|
if (vsa_buffer) {
|
|
|
|
tvbuff_t* vsa_tvb = NULL;
|
|
|
|
proto_tree_add_text(avp_tree, tvb, offset, avp_vsa_len, "VSA fragment");
|
|
|
|
proto_item_append_text(avp_item, ": Last VSA fragment[%u]", vsa_buffer->seg_num);
|
|
|
|
vsa_tvb = tvb_new_child_real_data(tvb, vsa_buffer->data, vsa_buffer->len, vsa_buffer->len);
|
|
|
|
tvb_set_free_cb(vsa_tvb, g_free);
|
|
|
|
add_new_data_source(pinfo, vsa_tvb, "Reassembled VSA");
|
|
|
|
add_avp_to_tree(avp_tree, avp_item, pinfo, vsa_tvb, dictionary_entry, vsa_buffer->len, 0);
|
|
|
|
g_hash_table_remove(vsa_buffer_table, &(vsa_buffer->key));
|
|
|
|
g_free(vsa_buffer);
|
2009-04-02 19:05:52 +00:00
|
|
|
|
2009-10-12 00:01:59 +00:00
|
|
|
} else {
|
|
|
|
add_avp_to_tree(avp_tree, avp_item, pinfo, tvb, dictionary_entry, avp_vsa_len, offset);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
add_avp_to_tree(avp_tree, avp_item, pinfo, tvb, dictionary_entry, avp_vsa_len, offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
offset += avp_vsa_len;
|
|
|
|
}; /* while (offset < max_offset) */
|
|
|
|
continue; /* while (length > 0) */
|
|
|
|
}
|
|
|
|
|
|
|
|
avp_tree = proto_item_add_subtree(avp_item,dictionary_entry->ett);
|
|
|
|
|
|
|
|
if (show_length) {
|
|
|
|
avp_len_item = proto_tree_add_uint(avp_tree,
|
|
|
|
dictionary_entry->hf_len,
|
|
|
|
tvb,0,0,avp_length);
|
|
|
|
PROTO_ITEM_SET_GENERATED(avp_len_item);
|
|
|
|
}
|
|
|
|
|
|
|
|
tvb_len = tvb_length_remaining(tvb, offset);
|
|
|
|
|
|
|
|
if ((gint)avp_length < tvb_len)
|
|
|
|
tvb_len = avp_length;
|
|
|
|
|
|
|
|
if (avp_type == RADIUS_EAP_MESSAGE_CODE) {
|
|
|
|
eap_seg_num++;
|
|
|
|
|
|
|
|
/* Show this as an EAP fragment. */
|
|
|
|
if (tree)
|
|
|
|
proto_tree_add_text(avp_tree, tvb, offset, tvb_len,
|
|
|
|
"EAP fragment");
|
|
|
|
|
|
|
|
if (eap_tvb != NULL) {
|
|
|
|
/*
|
|
|
|
* Oops, a non-consecutive EAP-Message
|
|
|
|
* attribute.
|
|
|
|
*/
|
|
|
|
proto_item_append_text(avp_item, " (non-consecutive)");
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* RFC 2869 says, in section 5.13, describing
|
|
|
|
* the EAP-Message attribute:
|
|
|
|
*
|
|
|
|
* The NAS places EAP messages received
|
|
|
|
* from the authenticating peer into one
|
|
|
|
* or more EAP-Message attributes and
|
|
|
|
* forwards them to the RADIUS Server
|
|
|
|
* within an Access-Request message.
|
|
|
|
* If multiple EAP-Messages are
|
|
|
|
* contained within an Access-Request or
|
|
|
|
* Access-Challenge packet, they MUST be
|
|
|
|
* in order and they MUST be consecutive
|
|
|
|
* attributes in the Access-Request or
|
|
|
|
* Access-Challenge packet.
|
|
|
|
*
|
|
|
|
* ...
|
|
|
|
*
|
|
|
|
* The String field contains EAP packets,
|
|
|
|
* as defined in [3]. If multiple
|
|
|
|
* EAP-Message attributes are present
|
|
|
|
* in a packet their values should be
|
|
|
|
* concatenated; this allows EAP packets
|
|
|
|
* longer than 253 octets to be passed
|
|
|
|
* by RADIUS.
|
|
|
|
*
|
|
|
|
* Do reassembly of EAP-Message attributes.
|
|
|
|
* We just concatenate all the attributes,
|
|
|
|
* and when we see either the end of the
|
|
|
|
* attribute list or a non-EAP-Message
|
|
|
|
* attribute, we know we're done.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (eap_buffer == NULL)
|
|
|
|
eap_buffer = g_malloc(eap_tot_len_captured + tvb_len);
|
|
|
|
else
|
|
|
|
eap_buffer = g_realloc(eap_buffer,
|
|
|
|
eap_tot_len_captured + tvb_len);
|
|
|
|
tvb_memcpy(tvb, eap_buffer + eap_tot_len_captured, offset,
|
|
|
|
tvb_len);
|
|
|
|
eap_tot_len_captured += tvb_len;
|
|
|
|
eap_tot_len += avp_length;
|
|
|
|
|
|
|
|
if ( tvb_bytes_exist(tvb, offset + avp_length + 1, 1) ) {
|
|
|
|
guint8 next_type = tvb_get_guint8(tvb, offset + avp_length);
|
|
|
|
|
|
|
|
if ( next_type != RADIUS_EAP_MESSAGE_CODE ) {
|
|
|
|
/* Non-EAP-Message attribute */
|
|
|
|
last_eap = TRUE;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* No more attributes, either because
|
|
|
|
* we're at the end of the packet or
|
|
|
|
* because we're at the end of the
|
|
|
|
* captured packet data.
|
|
|
|
*/
|
|
|
|
last_eap = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (last_eap && eap_buffer) {
|
|
|
|
gboolean save_writable;
|
|
|
|
|
|
|
|
proto_item_append_text(avp_item, " Last Segment[%u]",
|
|
|
|
eap_seg_num);
|
|
|
|
|
|
|
|
eap_tree = proto_item_add_subtree(avp_item,ett_eap);
|
|
|
|
|
|
|
|
eap_tvb = tvb_new_child_real_data(tvb, eap_buffer,
|
|
|
|
eap_tot_len_captured,
|
|
|
|
eap_tot_len);
|
|
|
|
tvb_set_free_cb(eap_tvb, g_free);
|
|
|
|
add_new_data_source(pinfo, eap_tvb, "Reassembled EAP");
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Don't free this when we're done -
|
|
|
|
* it's associated with a tvbuff.
|
|
|
|
*/
|
|
|
|
eap_buffer = NULL;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set the columns non-writable,
|
|
|
|
* so that the packet list shows
|
|
|
|
* this as an RADIUS packet, not
|
|
|
|
* as an EAP packet.
|
|
|
|
*/
|
|
|
|
save_writable = col_get_writable(pinfo->cinfo);
|
|
|
|
col_set_writable(pinfo->cinfo, FALSE);
|
|
|
|
|
|
|
|
call_dissector(eap_handle, eap_tvb, pinfo, eap_tree);
|
|
|
|
|
|
|
|
col_set_writable(pinfo->cinfo, save_writable);
|
2009-04-02 19:05:52 +00:00
|
|
|
} else {
|
2009-10-12 00:01:59 +00:00
|
|
|
proto_item_append_text(avp_item, " Segment[%u]",
|
|
|
|
eap_seg_num);
|
2009-04-02 19:05:52 +00:00
|
|
|
}
|
|
|
|
}
|
2009-10-12 00:01:59 +00:00
|
|
|
|
|
|
|
offset += avp_length;
|
2009-04-02 19:05:52 +00:00
|
|
|
} else {
|
2009-10-12 00:01:59 +00:00
|
|
|
add_avp_to_tree(avp_tree, avp_item, pinfo, tvb, dictionary_entry,
|
|
|
|
avp_length, offset);
|
|
|
|
offset += avp_length;
|
2009-04-02 19:05:52 +00:00
|
|
|
}
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2009-10-12 00:01:59 +00:00
|
|
|
} /* while (length > 0) */
|
|
|
|
|
|
|
|
CLEANUP_CALL_AND_POP; /* vsa_buffer_table_destroy(vsa_buffer_table) */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Call the cleanup handler to free any reassembled data we haven't
|
|
|
|
* attached to a tvbuff, and pop the handler.
|
|
|
|
*/
|
|
|
|
CLEANUP_CALL_AND_POP;
|
2004-10-04 20:13:35 +00:00
|
|
|
}
|
|
|
|
|
2007-09-30 23:14:18 +00:00
|
|
|
/* This function tries to determine whether a packet is radius or not */
|
|
|
|
static gboolean
|
|
|
|
is_radius(tvbuff_t *tvb)
|
|
|
|
{
|
|
|
|
guint8 code;
|
|
|
|
guint16 length;
|
|
|
|
|
|
|
|
code=tvb_get_guint8(tvb, 0);
|
|
|
|
switch(code){
|
|
|
|
case RADIUS_ACCESS_REQUEST:
|
|
|
|
case RADIUS_ACCESS_ACCEPT:
|
|
|
|
case RADIUS_ACCESS_REJECT:
|
|
|
|
case RADIUS_ACCOUNTING_REQUEST:
|
|
|
|
case RADIUS_ACCOUNTING_RESPONSE:
|
|
|
|
case RADIUS_ACCOUNTING_STATUS:
|
|
|
|
case RADIUS_ACCESS_PASSWORD_REQUEST:
|
|
|
|
case RADIUS_ACCESS_PASSWORD_ACK:
|
|
|
|
case RADIUS_ACCESS_PASSWORD_REJECT:
|
|
|
|
case RADIUS_ACCOUNTING_MESSAGE:
|
|
|
|
case RADIUS_ACCESS_CHALLENGE:
|
|
|
|
case RADIUS_STATUS_SERVER:
|
|
|
|
case RADIUS_STATUS_CLIENT:
|
|
|
|
case RADIUS_VENDOR_SPECIFIC_CODE:
|
|
|
|
case RADIUS_ASCEND_ACCESS_NEXT_CODE:
|
|
|
|
case RADIUS_ASCEND_ACCESS_NEW_PIN:
|
|
|
|
case RADIUS_ASCEND_PASSWORD_EXPIRED:
|
|
|
|
case RADIUS_ASCEND_ACCESS_EVENT_REQUEST:
|
|
|
|
case RADIUS_ASCEND_ACCESS_EVENT_RESPONSE:
|
|
|
|
case RADIUS_DISCONNECT_REQUEST:
|
|
|
|
case RADIUS_DISCONNECT_REQUEST_ACK:
|
|
|
|
case RADIUS_DISCONNECT_REQUEST_NAK:
|
|
|
|
case RADIUS_CHANGE_FILTER_REQUEST:
|
|
|
|
case RADIUS_CHANGE_FILTER_REQUEST_ACK:
|
|
|
|
case RADIUS_CHANGE_FILTER_REQUEST_NAK:
|
|
|
|
case RADIUS_EAP_MESSAGE_CODE:
|
|
|
|
case RADIUS_MESSAGE_AUTHENTICATOR:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check for valid length value:
|
|
|
|
* Length
|
|
|
|
*
|
|
|
|
* The Length field is two octets. It indicates the length of the
|
|
|
|
* packet including the Code, Identifier, Length, Authenticator and
|
|
|
|
* Attribute fields. Octets outside the range of the Length field
|
|
|
|
* MUST be treated as padding and ignored on reception. If the
|
|
|
|
* packet is shorter than the Length field indicates, it MUST be
|
|
|
|
* silently discarded. The minimum length is 20 and maximum length
|
|
|
|
* is 4096.
|
|
|
|
*/
|
|
|
|
length=tvb_get_ntohs(tvb, 2);
|
|
|
|
if ( (length<20) || (length>4096) ) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2008-04-03 22:13:52 +00:00
|
|
|
static void register_radius_fields(const char*);
|
|
|
|
|
2007-09-30 23:14:18 +00:00
|
|
|
static int
|
|
|
|
dissect_radius(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
2004-03-31 20:57:42 +00:00
|
|
|
{
|
2005-07-15 21:12:27 +00:00
|
|
|
proto_tree *radius_tree = NULL;
|
|
|
|
proto_tree *avptree = NULL;
|
2008-05-14 01:47:41 +00:00
|
|
|
proto_item *ti, *hidden_item;
|
2005-07-15 21:12:27 +00:00
|
|
|
proto_item *avptf;
|
2005-07-24 20:39:19 +00:00
|
|
|
guint avplength;
|
2005-07-15 21:12:27 +00:00
|
|
|
e_radiushdr rh;
|
2007-09-30 23:14:18 +00:00
|
|
|
radius_info_t *rad_info;
|
2008-04-03 22:13:52 +00:00
|
|
|
|
2006-10-24 05:21:00 +00:00
|
|
|
|
|
|
|
conversation_t* conversation;
|
|
|
|
radius_call_info_key radius_call_key;
|
2009-10-12 00:01:59 +00:00
|
|
|
radius_call_info_key *new_radius_call_key;
|
2009-10-12 00:32:34 +00:00
|
|
|
radius_call_t *radius_call = NULL;
|
2006-10-24 05:21:00 +00:00
|
|
|
nstime_t delta;
|
|
|
|
static address null_address = { AT_NONE, 0, NULL };
|
2008-04-03 22:13:52 +00:00
|
|
|
|
2006-10-24 05:21:00 +00:00
|
|
|
|
2007-09-30 23:14:18 +00:00
|
|
|
/* does this look like radius ? */
|
|
|
|
if(!is_radius(tvb)){
|
|
|
|
return 0;
|
|
|
|
}
|
2008-04-03 22:13:52 +00:00
|
|
|
|
2006-10-24 05:21:00 +00:00
|
|
|
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RADIUS");
|
2009-08-09 07:36:13 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2007-09-30 23:14:18 +00:00
|
|
|
rh.rh_code=tvb_get_guint8(tvb,0);
|
|
|
|
rh.rh_ident=tvb_get_guint8(tvb,1);
|
|
|
|
rh.rh_pktlength=tvb_get_ntohs(tvb,2);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2007-09-30 23:14:18 +00:00
|
|
|
|
|
|
|
/* Initialise stat info for passing to tap */
|
|
|
|
rad_info = ep_alloc(sizeof(radius_info_t));
|
|
|
|
rad_info->code = 0;
|
|
|
|
rad_info->ident = 0;
|
|
|
|
rad_info->req_time.secs = 0;
|
|
|
|
rad_info->req_time.nsecs = 0;
|
|
|
|
rad_info->is_duplicate = FALSE;
|
|
|
|
rad_info->request_available = FALSE;
|
|
|
|
rad_info->req_num = 0; /* frame number request seen */
|
|
|
|
rad_info->rspcode = 0;
|
2006-10-24 05:21:00 +00:00
|
|
|
/* tap stat info */
|
2007-09-30 23:14:18 +00:00
|
|
|
rad_info->code = rh.rh_code;
|
|
|
|
rad_info->ident = rh.rh_ident;
|
|
|
|
tap_queue_packet(radius_tap, pinfo, rad_info);
|
|
|
|
|
2006-10-24 05:21:00 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
|
|
|
{
|
2005-07-24 20:39:19 +00:00
|
|
|
col_add_fstr(pinfo->cinfo,COL_INFO,"%s(%d) (id=%d, l=%d)",
|
2007-09-30 23:14:18 +00:00
|
|
|
val_to_str(rh.rh_code,radius_vals,"Unknown Packet"),
|
|
|
|
rh.rh_code, rh.rh_ident, rh.rh_pktlength);
|
2005-07-15 21:12:27 +00:00
|
|
|
}
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2008-04-03 22:13:52 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
if (tree)
|
|
|
|
{
|
2009-06-14 05:35:35 +00:00
|
|
|
/* Forces load of header fields, if not already done so */
|
|
|
|
DISSECTOR_ASSERT(proto_registrar_get_byname("radius.code"));
|
2008-04-03 22:13:52 +00:00
|
|
|
|
2007-09-30 23:14:18 +00:00
|
|
|
ti = proto_tree_add_item(tree,proto_radius, tvb, 0, rh.rh_pktlength, FALSE);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-24 20:39:19 +00:00
|
|
|
radius_tree = proto_item_add_subtree(ti, ett_radius);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
proto_tree_add_uint(radius_tree,hf_radius_code, tvb, 0, 1, rh.rh_code);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-24 20:39:19 +00:00
|
|
|
proto_tree_add_uint_format(radius_tree,hf_radius_id, tvb, 1, 1, rh.rh_ident,
|
2007-09-30 23:14:18 +00:00
|
|
|
"Packet identifier: 0x%01x (%d)", rh.rh_ident, rh.rh_ident);
|
2005-07-24 20:39:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Make sure the length is sane.
|
|
|
|
*/
|
2007-09-30 23:14:18 +00:00
|
|
|
if (rh.rh_pktlength < HDR_LENGTH)
|
2005-07-24 20:39:19 +00:00
|
|
|
{
|
|
|
|
if (tree)
|
|
|
|
{
|
|
|
|
proto_tree_add_uint_format(radius_tree, hf_radius_length,
|
2007-09-30 23:14:18 +00:00
|
|
|
tvb, 2, 2, rh.rh_pktlength,
|
2005-07-24 20:39:19 +00:00
|
|
|
"Length: %u (bogus, < %u)",
|
2007-09-30 23:14:18 +00:00
|
|
|
rh.rh_pktlength, HDR_LENGTH);
|
2005-07-15 21:12:27 +00:00
|
|
|
}
|
2007-09-30 23:14:18 +00:00
|
|
|
goto end_of_radius;
|
2005-07-24 20:39:19 +00:00
|
|
|
}
|
2007-09-30 23:14:18 +00:00
|
|
|
avplength = rh.rh_pktlength - HDR_LENGTH;
|
2005-07-24 20:39:19 +00:00
|
|
|
if (tree)
|
|
|
|
{
|
|
|
|
proto_tree_add_uint(radius_tree, hf_radius_length, tvb,
|
2007-09-30 23:14:18 +00:00
|
|
|
2, 2, rh.rh_pktlength);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
proto_tree_add_item(radius_tree, hf_radius_authenticator, tvb, 4,AUTHENTICATOR_LENGTH,FALSE);
|
2005-07-24 20:39:19 +00:00
|
|
|
}
|
2005-12-30 18:41:56 +00:00
|
|
|
tvb_memcpy(tvb,authenticator,4,AUTHENTICATOR_LENGTH);
|
2005-07-15 21:12:27 +00:00
|
|
|
|
2006-10-24 05:21:00 +00:00
|
|
|
if (tree) {
|
|
|
|
|
|
|
|
/* Conversation support REQUEST/RESPONSES */
|
2007-09-30 23:14:18 +00:00
|
|
|
switch (rh.rh_code)
|
2006-10-24 05:21:00 +00:00
|
|
|
{
|
|
|
|
case RADIUS_ACCESS_REQUEST:
|
|
|
|
case RADIUS_ACCOUNTING_REQUEST:
|
|
|
|
case RADIUS_ACCESS_PASSWORD_REQUEST:
|
|
|
|
case RADIUS_ASCEND_ACCESS_EVENT_REQUEST:
|
|
|
|
case RADIUS_DISCONNECT_REQUEST:
|
|
|
|
case RADIUS_CHANGE_FILTER_REQUEST:
|
2008-05-14 01:47:41 +00:00
|
|
|
hidden_item = proto_tree_add_boolean(radius_tree, hf_radius_req, tvb, 0, 0, TRUE);
|
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
2006-10-24 05:21:00 +00:00
|
|
|
/* Keep track of the address and port whence the call came
|
|
|
|
* so that we can match up requests with replies.
|
2007-01-02 22:49:57 +00:00
|
|
|
*
|
2006-10-24 05:21:00 +00:00
|
|
|
* Because it is UDP and the reply can come from any IP
|
2007-01-02 22:49:57 +00:00
|
|
|
* and port (not necessarly the request dest), we only
|
|
|
|
* track the source IP and port of the request to match
|
|
|
|
* the reply.
|
2006-10-24 05:21:00 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* XXX - can we just use NO_ADDR_B? Unfortunately,
|
|
|
|
* you currently still have to pass a non-null
|
|
|
|
* pointer for the second address argument even
|
|
|
|
* if you do that.
|
|
|
|
*/
|
|
|
|
conversation = find_conversation(pinfo->fd->num, &pinfo->src,
|
2009-10-12 00:01:59 +00:00
|
|
|
&null_address, pinfo->ptype, pinfo->srcport,
|
|
|
|
pinfo->destport, 0);
|
2006-10-24 05:21:00 +00:00
|
|
|
if (conversation == NULL)
|
|
|
|
{
|
|
|
|
/* It's not part of any conversation - create a new one. */
|
|
|
|
conversation = conversation_new(pinfo->fd->num, &pinfo->src,
|
2009-10-12 00:01:59 +00:00
|
|
|
&null_address, pinfo->ptype, pinfo->srcport,
|
|
|
|
pinfo->destport, 0);
|
2006-10-24 05:21:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Prepare the key data */
|
2007-09-30 23:14:18 +00:00
|
|
|
radius_call_key.code = rh.rh_code;
|
|
|
|
radius_call_key.ident = rh.rh_ident;
|
2006-10-24 05:21:00 +00:00
|
|
|
radius_call_key.conversation = conversation;
|
|
|
|
radius_call_key.req_time = pinfo->fd->abs_ts;
|
|
|
|
|
|
|
|
/* Look up the request */
|
|
|
|
radius_call = g_hash_table_lookup(radius_calls, &radius_call_key);
|
|
|
|
if (radius_call != NULL)
|
|
|
|
{
|
2007-01-02 22:49:57 +00:00
|
|
|
/* We've seen a request with this ID, with the same
|
2006-10-24 05:21:00 +00:00
|
|
|
destination, before - but was it *this* request? */
|
|
|
|
if (pinfo->fd->num != radius_call->req_num)
|
|
|
|
{
|
|
|
|
/* No, so it's a duplicate request. Mark it as such. */
|
2007-09-30 23:14:18 +00:00
|
|
|
rad_info->is_duplicate = TRUE;
|
|
|
|
rad_info->req_num = radius_call->req_num;
|
2006-10-24 05:21:00 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
|
|
|
{
|
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO,
|
2009-10-12 00:01:59 +00:00
|
|
|
", Duplicate Request ID:%u",
|
|
|
|
rh.rh_ident);
|
2006-10-24 05:21:00 +00:00
|
|
|
}
|
|
|
|
if (tree)
|
|
|
|
{
|
|
|
|
proto_item* item;
|
2008-05-14 01:47:41 +00:00
|
|
|
hidden_item = proto_tree_add_uint(radius_tree, hf_radius_dup, tvb, 0,0, rh.rh_ident);
|
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
2007-09-30 23:14:18 +00:00
|
|
|
item = proto_tree_add_uint(radius_tree, hf_radius_req_dup, tvb, 0,0, rh.rh_ident);
|
2006-10-24 05:21:00 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Prepare the value data.
|
|
|
|
"req_num" and "rsp_num" are frame numbers;
|
|
|
|
frame numbers are 1-origin, so we use 0
|
|
|
|
to mean "we don't yet know in which frame
|
|
|
|
the reply for this call appears". */
|
2009-10-12 00:01:59 +00:00
|
|
|
new_radius_call_key = se_alloc(sizeof(radius_call_info_key));
|
2006-10-24 05:21:00 +00:00
|
|
|
*new_radius_call_key = radius_call_key;
|
2009-10-12 00:01:59 +00:00
|
|
|
radius_call = se_alloc(sizeof(radius_call_t));
|
2006-10-24 05:21:00 +00:00
|
|
|
radius_call->req_num = pinfo->fd->num;
|
|
|
|
radius_call->rsp_num = 0;
|
2007-09-30 23:14:18 +00:00
|
|
|
radius_call->ident = rh.rh_ident;
|
|
|
|
radius_call->code = rh.rh_code;
|
2006-10-24 05:21:00 +00:00
|
|
|
radius_call->responded = FALSE;
|
|
|
|
radius_call->req_time=pinfo->fd->abs_ts;
|
|
|
|
radius_call->rspcode = 0;
|
|
|
|
|
|
|
|
/* Store it */
|
|
|
|
g_hash_table_insert(radius_calls, new_radius_call_key, radius_call);
|
|
|
|
}
|
|
|
|
if (radius_call && radius_call->rsp_num)
|
|
|
|
{
|
|
|
|
proto_item* item = proto_tree_add_uint_format(radius_tree, hf_radius_rsp_frame,
|
2009-10-12 00:01:59 +00:00
|
|
|
tvb, 0, 0, radius_call->rsp_num,
|
|
|
|
"The response to this request is in frame %u",
|
|
|
|
radius_call->rsp_num);
|
2006-10-24 05:21:00 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RADIUS_ACCESS_ACCEPT:
|
|
|
|
case RADIUS_ACCESS_REJECT:
|
|
|
|
case RADIUS_ACCOUNTING_RESPONSE:
|
|
|
|
case RADIUS_ACCESS_PASSWORD_ACK:
|
|
|
|
case RADIUS_ACCESS_PASSWORD_REJECT:
|
|
|
|
case RADIUS_ASCEND_ACCESS_EVENT_RESPONSE:
|
|
|
|
case RADIUS_DISCONNECT_REQUEST_ACK:
|
|
|
|
case RADIUS_DISCONNECT_REQUEST_NAK:
|
|
|
|
case RADIUS_CHANGE_FILTER_REQUEST_ACK:
|
|
|
|
case RADIUS_CHANGE_FILTER_REQUEST_NAK:
|
2008-05-14 01:47:41 +00:00
|
|
|
hidden_item = proto_tree_add_boolean(radius_tree, hf_radius_rsp, tvb, 0, 0, TRUE);
|
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
2006-10-24 05:21:00 +00:00
|
|
|
/* Check for RADIUS response. A response must match a call that
|
|
|
|
* we've seen, and the response must be sent to the same
|
|
|
|
* port and address that the call came from.
|
|
|
|
*
|
|
|
|
* Because it is UDP and the reply can come from any IP
|
2007-01-02 22:49:57 +00:00
|
|
|
* and port (not necessarly the request dest), we only
|
|
|
|
* track the source IP and port of the request to match
|
|
|
|
* the reply.
|
2006-10-24 05:21:00 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* XXX - can we just use NO_ADDR_B? Unfortunately,
|
|
|
|
* you currently still have to pass a non-null
|
|
|
|
* pointer for the second address argument even
|
|
|
|
* if you do that.
|
|
|
|
*/
|
|
|
|
conversation = find_conversation(pinfo->fd->num, &null_address,
|
2009-10-12 00:01:59 +00:00
|
|
|
&pinfo->dst, pinfo->ptype, pinfo->srcport,
|
|
|
|
pinfo->destport, 0);
|
2006-10-24 05:21:00 +00:00
|
|
|
if (conversation != NULL)
|
|
|
|
{
|
|
|
|
/* Look only for matching request, if
|
|
|
|
matching conversation is available. */
|
|
|
|
/* Prepare the key data */
|
2007-09-30 23:14:18 +00:00
|
|
|
radius_call_key.code = rh.rh_code;
|
|
|
|
radius_call_key.ident = rh.rh_ident;
|
2006-10-24 05:21:00 +00:00
|
|
|
radius_call_key.conversation = conversation;
|
|
|
|
radius_call_key.req_time = pinfo->fd->abs_ts;
|
|
|
|
|
|
|
|
radius_call = g_hash_table_lookup(radius_calls, &radius_call_key);
|
|
|
|
if (radius_call)
|
|
|
|
{
|
|
|
|
/* Indicate the frame to which this is a reply. */
|
|
|
|
if (radius_call->req_num)
|
|
|
|
{
|
|
|
|
proto_item* item;
|
2007-09-30 23:14:18 +00:00
|
|
|
rad_info->request_available = TRUE;
|
|
|
|
rad_info->req_num = radius_call->req_num;
|
2006-10-24 05:21:00 +00:00
|
|
|
radius_call->responded = TRUE;
|
|
|
|
|
|
|
|
item = proto_tree_add_uint_format(radius_tree, hf_radius_req_frame,
|
2009-10-12 00:01:59 +00:00
|
|
|
tvb, 0, 0, radius_call->req_num,
|
|
|
|
"This is a response to a request in frame %u",
|
|
|
|
radius_call->req_num);
|
2006-10-24 05:21:00 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
nstime_delta(&delta, &pinfo->fd->abs_ts, &radius_call->req_time);
|
|
|
|
item = proto_tree_add_time(radius_tree, hf_radius_time, tvb, 0, 0, &delta);
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (radius_call->rsp_num == 0)
|
|
|
|
{
|
|
|
|
/* We have not yet seen a response to that call, so
|
|
|
|
this must be the first response; remember its
|
|
|
|
frame number. */
|
|
|
|
radius_call->rsp_num = pinfo->fd->num;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* We have seen a response to this call - but was it
|
|
|
|
*this* response? (disregard provisional responses) */
|
2007-09-30 23:14:18 +00:00
|
|
|
if ( (radius_call->rsp_num != pinfo->fd->num) && (radius_call->rspcode == rh.rh_code) )
|
2006-10-24 05:21:00 +00:00
|
|
|
{
|
|
|
|
/* No, so it's a duplicate response. Mark it as such. */
|
2007-09-30 23:14:18 +00:00
|
|
|
rad_info->is_duplicate = TRUE;
|
2006-10-24 05:21:00 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
|
|
|
{
|
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO,
|
2009-10-12 00:01:59 +00:00
|
|
|
", Duplicate Response ID:%u",
|
|
|
|
rh.rh_ident);
|
2006-10-24 05:21:00 +00:00
|
|
|
}
|
|
|
|
if (tree)
|
|
|
|
{
|
|
|
|
proto_item* item;
|
2008-05-14 01:47:41 +00:00
|
|
|
hidden_item = proto_tree_add_uint(radius_tree, hf_radius_dup, tvb, 0,0, rh.rh_ident);
|
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
2006-10-24 05:21:00 +00:00
|
|
|
item = proto_tree_add_uint(radius_tree, hf_radius_rsp_dup,
|
2009-10-12 00:01:59 +00:00
|
|
|
tvb, 0, 0, rh.rh_ident);
|
2006-10-24 05:21:00 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Now store the response code (after comparison above) */
|
2007-09-30 23:14:18 +00:00
|
|
|
radius_call->rspcode = rh.rh_code;
|
|
|
|
rad_info->rspcode = rh.rh_code;
|
2006-10-24 05:21:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2006-10-24 05:21:00 +00:00
|
|
|
if (radius_call)
|
|
|
|
{
|
2007-09-30 23:14:18 +00:00
|
|
|
rad_info->req_time.secs = radius_call->req_time.secs;
|
|
|
|
rad_info->req_time.nsecs = radius_call->req_time.nsecs;
|
2006-10-24 05:21:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (avplength > 0) {
|
|
|
|
/* list the attribute value pairs */
|
|
|
|
avptf = proto_tree_add_text(radius_tree, tvb, HDR_LENGTH,
|
|
|
|
avplength, "Attribute Value Pairs");
|
|
|
|
avptree = proto_item_add_subtree(avptf, ett_radius_avp);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2006-10-24 05:21:00 +00:00
|
|
|
dissect_attribute_value_pairs(avptree, pinfo, tvb, HDR_LENGTH,
|
|
|
|
avplength);
|
|
|
|
}
|
2005-07-15 21:12:27 +00:00
|
|
|
}
|
2006-10-24 05:21:00 +00:00
|
|
|
|
2007-09-30 23:14:18 +00:00
|
|
|
end_of_radius:
|
|
|
|
return tvb_length(tvb);
|
2007-01-02 22:49:57 +00:00
|
|
|
}
|
2004-03-31 20:57:42 +00:00
|
|
|
|
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
static void register_attrs(gpointer k _U_, gpointer v, gpointer p) {
|
|
|
|
radius_attr_info_t* a = v;
|
|
|
|
int i;
|
|
|
|
gint* ett = &(a->ett);
|
2007-11-30 11:46:13 +00:00
|
|
|
gchar* abbrev = g_strconcat("radius.",a->name,NULL);
|
2005-07-15 21:12:27 +00:00
|
|
|
hf_register_info hfri[] = {
|
2009-07-07 07:46:57 +00:00
|
|
|
{ NULL, { NULL,NULL, FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
|
|
|
{ NULL, { NULL,NULL, FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
|
|
|
{ NULL, { NULL,NULL, FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
|
|
|
{ NULL, { NULL,NULL, FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }}
|
2005-07-15 21:12:27 +00:00
|
|
|
};
|
|
|
|
guint len_hf = 2;
|
|
|
|
hfett_t* ri = p;
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
for(i=0; abbrev[i]; i++) {
|
|
|
|
if(abbrev[i] == '-') abbrev[i] = '_';
|
2009-10-12 00:01:59 +00:00
|
|
|
if(abbrev[i] == '/') abbrev[i] = '_';
|
2004-12-08 15:19:10 +00:00
|
|
|
}
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
hfri[0].p_id = &(a->hf);
|
|
|
|
hfri[1].p_id = &(a->hf_len);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
hfri[0].hfinfo.name = a->name;
|
|
|
|
hfri[0].hfinfo.abbrev = abbrev;
|
|
|
|
|
|
|
|
hfri[1].hfinfo.name = "Length";
|
2007-11-30 11:46:13 +00:00
|
|
|
hfri[1].hfinfo.abbrev = g_strconcat(abbrev,".len",NULL);
|
|
|
|
hfri[1].hfinfo.blurb = g_strconcat(a->name," Length",NULL);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
if (a->type == radius_integer) {
|
|
|
|
hfri[0].hfinfo.type = FT_UINT32;
|
|
|
|
hfri[0].hfinfo.display = BASE_DEC;
|
|
|
|
|
|
|
|
hfri[2].p_id = &(a->hf64);
|
|
|
|
hfri[2].hfinfo.name = g_strdup(a->name);
|
|
|
|
hfri[2].hfinfo.abbrev = abbrev;
|
|
|
|
hfri[2].hfinfo.type = FT_UINT64;
|
|
|
|
hfri[2].hfinfo.display = BASE_DEC;
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
if (a->vs) {
|
|
|
|
hfri[0].hfinfo.strings = VALS(a->vs);
|
|
|
|
}
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
len_hf++;
|
2009-04-02 19:05:52 +00:00
|
|
|
}else if (a->type == radius_signed) {
|
|
|
|
hfri[0].hfinfo.type = FT_INT32;
|
|
|
|
hfri[0].hfinfo.display = BASE_DEC;
|
|
|
|
|
|
|
|
hfri[2].p_id = &(a->hf64);
|
|
|
|
hfri[2].hfinfo.name = g_strdup(a->name);
|
|
|
|
hfri[2].hfinfo.abbrev = abbrev;
|
|
|
|
hfri[2].hfinfo.type = FT_INT64;
|
|
|
|
hfri[2].hfinfo.display = BASE_DEC;
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2009-04-02 19:05:52 +00:00
|
|
|
if (a->vs) {
|
|
|
|
hfri[0].hfinfo.strings = VALS(a->vs);
|
|
|
|
}
|
|
|
|
|
|
|
|
len_hf++;
|
2005-07-15 21:12:27 +00:00
|
|
|
} else if (a->type == radius_string) {
|
|
|
|
hfri[0].hfinfo.type = FT_STRING;
|
|
|
|
hfri[0].hfinfo.display = BASE_NONE;
|
|
|
|
} else if (a->type == radius_octets) {
|
|
|
|
hfri[0].hfinfo.type = FT_BYTES;
|
|
|
|
hfri[0].hfinfo.display = BASE_NONE;
|
|
|
|
} else if (a->type == radius_ipaddr) {
|
|
|
|
hfri[0].hfinfo.type = FT_IPv4;
|
2005-09-26 08:48:19 +00:00
|
|
|
hfri[0].hfinfo.display = BASE_NONE;
|
2005-07-15 21:12:27 +00:00
|
|
|
} else if (a->type == radius_ipv6addr) {
|
|
|
|
hfri[0].hfinfo.type = FT_IPv6;
|
2005-09-26 08:48:19 +00:00
|
|
|
hfri[0].hfinfo.display = BASE_NONE;
|
2009-03-18 07:31:35 +00:00
|
|
|
} else if (a->type == radius_ipv6prefix) {
|
|
|
|
hfri[0].hfinfo.type = FT_BYTES;
|
|
|
|
hfri[0].hfinfo.display = BASE_NONE;
|
2005-09-26 08:48:19 +00:00
|
|
|
} else if (a->type == radius_ipxnet) {
|
|
|
|
hfri[0].hfinfo.type = FT_IPXNET;
|
|
|
|
hfri[0].hfinfo.display = BASE_NONE;
|
2005-07-15 21:12:27 +00:00
|
|
|
} else if (a->type == radius_date) {
|
|
|
|
hfri[0].hfinfo.type = FT_ABSOLUTE_TIME;
|
2009-12-19 03:17:44 +00:00
|
|
|
hfri[0].hfinfo.display = ABSOLUTE_TIME_LOCAL;
|
2005-07-15 21:12:27 +00:00
|
|
|
} else if (a->type == radius_abinary) {
|
|
|
|
hfri[0].hfinfo.type = FT_BYTES;
|
|
|
|
hfri[0].hfinfo.display = BASE_NONE;
|
|
|
|
} else if (a->type == radius_ifid) {
|
|
|
|
hfri[0].hfinfo.type = FT_BYTES;
|
|
|
|
hfri[0].hfinfo.display = BASE_NONE;
|
2009-04-02 19:05:52 +00:00
|
|
|
} else if (a->type == radius_combo_ip) {
|
|
|
|
hfri[0].hfinfo.type = FT_IPv4;
|
|
|
|
hfri[0].hfinfo.display = BASE_NONE;
|
|
|
|
|
|
|
|
hfri[2].p_id = &(a->hf64);
|
|
|
|
hfri[2].hfinfo.name = g_strdup(a->name);
|
|
|
|
hfri[2].hfinfo.abbrev = g_strdup(abbrev);
|
|
|
|
hfri[2].hfinfo.type = FT_IPv6;
|
|
|
|
hfri[2].hfinfo.display = BASE_NONE;
|
|
|
|
|
|
|
|
len_hf++;
|
|
|
|
} else if (a->type == radius_tlv) {
|
|
|
|
hfri[0].hfinfo.type = FT_BYTES;
|
|
|
|
hfri[0].hfinfo.display = BASE_NONE;
|
2005-07-15 21:12:27 +00:00
|
|
|
} else {
|
|
|
|
hfri[0].hfinfo.type = FT_BYTES;
|
|
|
|
hfri[0].hfinfo.display = BASE_NONE;
|
2004-03-31 20:57:42 +00:00
|
|
|
}
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
if (a->tagged) {
|
|
|
|
hfri[len_hf].p_id = &(a->hf_tag);
|
|
|
|
hfri[len_hf].hfinfo.name = "Tag";
|
2007-11-30 11:46:13 +00:00
|
|
|
hfri[len_hf].hfinfo.abbrev = g_strconcat(abbrev,".tag",NULL);
|
|
|
|
hfri[len_hf].hfinfo.blurb = g_strconcat(a->name," Tag",NULL);
|
2005-07-15 21:12:27 +00:00
|
|
|
hfri[len_hf].hfinfo.type = FT_UINT8;
|
|
|
|
hfri[len_hf].hfinfo.display = BASE_HEX;
|
|
|
|
len_hf++;
|
2004-03-31 20:57:42 +00:00
|
|
|
}
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
g_array_append_vals(ri->hf,hfri,len_hf);
|
|
|
|
g_array_append_val(ri->ett,ett);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2009-04-02 19:05:52 +00:00
|
|
|
if (a->tlvs_by_id) {
|
|
|
|
g_hash_table_foreach(a->tlvs_by_id,register_attrs,ri);
|
|
|
|
}
|
2005-07-15 21:12:27 +00:00
|
|
|
}
|
2004-03-31 20:57:42 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
static void register_vendors(gpointer k _U_, gpointer v, gpointer p) {
|
|
|
|
radius_vendor_info_t* vnd = v;
|
|
|
|
hfett_t* ri = p;
|
|
|
|
value_string vnd_vs;
|
2005-09-19 17:42:02 +00:00
|
|
|
gint* ett_p = &(vnd->ett);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
vnd_vs.value = vnd->code;
|
|
|
|
vnd_vs.strptr = vnd->name;
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
g_array_append_val(ri->vend_vs,vnd_vs);
|
2005-09-19 17:42:02 +00:00
|
|
|
g_array_append_val(ri->ett,ett_p);
|
2005-07-15 21:12:27 +00:00
|
|
|
|
|
|
|
g_hash_table_foreach(vnd->attrs_by_id,register_attrs,ri);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
}
|
2004-03-31 20:57:42 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
extern void radius_register_avp_dissector(guint32 vendor_id, guint32 attribute_id, radius_avp_dissector_t radius_avp_dissector) {
|
|
|
|
radius_vendor_info_t* vendor;
|
|
|
|
radius_attr_info_t* dictionary_entry;
|
|
|
|
GHashTable* by_id;
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2007-04-10 14:48:06 +00:00
|
|
|
DISSECTOR_ASSERT(radius_avp_dissector != NULL);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
if (vendor_id) {
|
|
|
|
vendor = g_hash_table_lookup(dict->vendors_by_id,GUINT_TO_POINTER(vendor_id));
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
if ( ! vendor ) {
|
|
|
|
vendor = g_malloc(sizeof(radius_vendor_info_t));
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-10-01 11:16:17 +00:00
|
|
|
vendor->name = g_strdup_printf("%s-%u",val_to_str(vendor_id, sminmpec_values, "Unknown"),vendor_id);
|
2005-07-15 21:12:27 +00:00
|
|
|
vendor->code = vendor_id;
|
|
|
|
vendor->attrs_by_id = g_hash_table_new(g_direct_hash,g_direct_equal);
|
2005-10-01 11:16:17 +00:00
|
|
|
vendor->ett = no_vendor.ett;
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2009-07-03 16:03:02 +00:00
|
|
|
/* XXX: Default "standard" values: Should be parameters ? */
|
|
|
|
vendor->type_octets = 1;
|
|
|
|
vendor->length_octets = 1;
|
|
|
|
vendor->has_flags = FALSE;
|
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
g_hash_table_insert(dict->vendors_by_id,GUINT_TO_POINTER(vendor->code),vendor);
|
2006-08-27 11:27:47 +00:00
|
|
|
g_hash_table_insert(dict->vendors_by_name,(gpointer)(vendor->name),vendor);
|
2005-07-15 21:12:27 +00:00
|
|
|
}
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
dictionary_entry = g_hash_table_lookup(vendor->attrs_by_id,GUINT_TO_POINTER(attribute_id));
|
|
|
|
by_id = vendor->attrs_by_id;
|
|
|
|
} else {
|
|
|
|
dictionary_entry = g_hash_table_lookup(dict->attrs_by_id,GUINT_TO_POINTER(attribute_id));
|
|
|
|
by_id = dict->attrs_by_id;
|
|
|
|
}
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
if (!dictionary_entry) {
|
|
|
|
dictionary_entry = g_malloc(sizeof(radius_attr_info_t));;
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
dictionary_entry->name = g_strdup_printf("Unknown-Attribute-%u",attribute_id);
|
|
|
|
dictionary_entry->code = attribute_id;
|
|
|
|
dictionary_entry->encrypt = FALSE;
|
|
|
|
dictionary_entry->type = NULL;
|
|
|
|
dictionary_entry->vs = NULL;
|
|
|
|
dictionary_entry->hf = no_dictionary_entry.hf;
|
2009-05-13 19:46:11 +00:00
|
|
|
dictionary_entry->tagged = 0;
|
|
|
|
dictionary_entry->hf_tag = -1;
|
2005-07-15 21:12:27 +00:00
|
|
|
dictionary_entry->hf_len = no_dictionary_entry.hf_len;
|
|
|
|
dictionary_entry->ett = no_dictionary_entry.ett;
|
2009-12-10 18:13:38 +00:00
|
|
|
dictionary_entry->tlvs_by_id = NULL;
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
g_hash_table_insert(by_id,GUINT_TO_POINTER(dictionary_entry->code),dictionary_entry);
|
|
|
|
}
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
dictionary_entry->dissector = radius_avp_dissector;
|
2004-03-31 20:57:42 +00:00
|
|
|
|
|
|
|
}
|
2005-07-15 21:12:27 +00:00
|
|
|
|
2006-10-24 05:21:00 +00:00
|
|
|
/* Discard and init any state we've saved */
|
2007-01-02 22:49:57 +00:00
|
|
|
static void
|
2006-10-24 05:21:00 +00:00
|
|
|
radius_init_protocol(void)
|
|
|
|
{
|
|
|
|
if (radius_calls != NULL)
|
|
|
|
{
|
|
|
|
g_hash_table_destroy(radius_calls);
|
|
|
|
radius_calls = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
radius_calls = g_hash_table_new(radius_call_hash, radius_call_equal);
|
|
|
|
}
|
|
|
|
|
2008-04-03 22:13:52 +00:00
|
|
|
static void register_radius_fields(const char* unused _U_) {
|
|
|
|
hf_register_info base_hf[] = {
|
|
|
|
{ &hf_radius_req,
|
|
|
|
{ "Request", "radius.req", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
|
|
|
"TRUE if RADIUS request", HFILL }},
|
|
|
|
{ &hf_radius_rsp,
|
|
|
|
{ "Response", "radius.rsp", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
|
|
|
"TRUE if RADIUS response", HFILL }},
|
|
|
|
{ &hf_radius_req_frame,
|
|
|
|
{ "Request Frame", "radius.reqframe", FT_FRAMENUM, BASE_NONE, NULL, 0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2008-04-03 22:13:52 +00:00
|
|
|
{ &hf_radius_rsp_frame,
|
|
|
|
{ "Response Frame", "radius.rspframe", FT_FRAMENUM, BASE_NONE, NULL, 0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2008-04-03 22:13:52 +00:00
|
|
|
{ &hf_radius_time,
|
|
|
|
{ "Time from request", "radius.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0,
|
|
|
|
"Timedelta between Request and Response", HFILL }},
|
|
|
|
{ &hf_radius_code,
|
|
|
|
{ "Code","radius.code", FT_UINT8, BASE_DEC, VALS(radius_vals), 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2008-04-03 22:13:52 +00:00
|
|
|
{ &hf_radius_id,
|
|
|
|
{ "Identifier", "radius.id", FT_UINT8, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2008-04-03 22:13:52 +00:00
|
|
|
{ &hf_radius_authenticator,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Authenticator", "radius.authenticator", FT_BYTES, BASE_NONE, NULL, 0x0,
|
|
|
|
NULL, HFILL }},
|
2008-04-03 22:13:52 +00:00
|
|
|
{ &hf_radius_length,
|
|
|
|
{ "Length","radius.length", FT_UINT16, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2008-04-03 22:13:52 +00:00
|
|
|
{ &(no_dictionary_entry.hf),
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Unknown-Attribute","radius.Unknown_Attribute", FT_BYTES, BASE_NONE, NULL, 0x0,
|
|
|
|
NULL, HFILL }},
|
2008-04-03 22:13:52 +00:00
|
|
|
{ &(no_dictionary_entry.hf_len),
|
|
|
|
{ "Unknown-Attribute Length","radius.Unknown_Attribute.length", FT_UINT8, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2008-04-03 22:13:52 +00:00
|
|
|
{ &hf_radius_framed_ip_address,
|
|
|
|
{ "Framed-IP-Address","radius.Framed-IP-Address", FT_IPv4, BASE_NONE, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2008-04-03 22:13:52 +00:00
|
|
|
{ &hf_radius_login_ip_host,
|
|
|
|
{ "Login-IP-Host","radius.Login-IP-Host", FT_IPv4, BASE_NONE, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2008-04-03 22:13:52 +00:00
|
|
|
{ &hf_radius_framed_ipx_network,
|
|
|
|
{ "Framed-IPX-Network","radius.Framed-IPX-Network", FT_IPXNET, BASE_NONE, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2008-04-03 22:13:52 +00:00
|
|
|
{ &hf_radius_cosine_vpi,
|
|
|
|
{ "Cosine-VPI","radius.Cosine-Vpi", FT_UINT16, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2008-04-03 22:13:52 +00:00
|
|
|
{ &hf_radius_cosine_vci,
|
|
|
|
{ "Cosine-VCI","radius.Cosine-Vci", FT_UINT16, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2008-04-03 22:13:52 +00:00
|
|
|
{ &hf_radius_dup,
|
|
|
|
{ "Duplicate Message", "radius.dup", FT_UINT32, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2008-04-03 22:13:52 +00:00
|
|
|
{ &hf_radius_req_dup,
|
|
|
|
{ "Duplicate Request", "radius.req.dup", FT_UINT32, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2008-04-03 22:13:52 +00:00
|
|
|
{ &hf_radius_rsp_dup,
|
|
|
|
{ "Duplicate Response", "radius.rsp.dup", FT_UINT32, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2008-12-29 15:24:08 +00:00
|
|
|
{ &hf_radius_ascend_data_filter,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Ascend Data Filter", "radius.ascenddatafilter", FT_BYTES, BASE_NONE, NULL, 0x0,
|
|
|
|
NULL, HFILL }}
|
2008-04-03 22:13:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
gint *base_ett[] = {
|
|
|
|
&ett_radius,
|
|
|
|
&ett_radius_avp,
|
|
|
|
&ett_eap,
|
|
|
|
&(no_dictionary_entry.ett),
|
|
|
|
&(no_vendor.ett),
|
|
|
|
};
|
|
|
|
|
|
|
|
hfett_t ri;
|
|
|
|
char* dir = NULL;
|
|
|
|
gchar* dict_err_str = NULL;
|
|
|
|
|
|
|
|
ri.hf = g_array_new(FALSE,TRUE,sizeof(hf_register_info));
|
|
|
|
ri.ett = g_array_new(FALSE,TRUE,sizeof(gint *));
|
|
|
|
ri.vend_vs = g_array_new(TRUE,TRUE,sizeof(value_string));
|
|
|
|
|
|
|
|
g_array_append_vals(ri.hf, base_hf, array_length(base_hf));
|
|
|
|
g_array_append_vals(ri.ett, base_ett, array_length(base_ett));
|
|
|
|
|
|
|
|
dir = get_persconffile_path("radius", FALSE, FALSE);
|
|
|
|
|
|
|
|
if (test_for_directory(dir) != EISDIR) {
|
|
|
|
/* Although dir isn't a directory it may still use memory */
|
|
|
|
g_free(dir);
|
|
|
|
|
|
|
|
dir = get_datafile_path("radius");
|
|
|
|
|
|
|
|
if (test_for_directory(dir) != EISDIR) {
|
|
|
|
g_free(dir);
|
|
|
|
dir = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
if (dir) {
|
2008-04-03 22:13:52 +00:00
|
|
|
radius_load_dictionary(dict,dir,"dictionary",&dict_err_str);
|
|
|
|
|
|
|
|
if (dict_err_str) {
|
|
|
|
g_warning("radius: %s",dict_err_str);
|
|
|
|
g_free(dict_err_str);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_hash_table_foreach(dict->attrs_by_id,register_attrs,&ri);
|
|
|
|
g_hash_table_foreach(dict->vendors_by_id,register_vendors,&ri);
|
2005-07-15 21:12:27 +00:00
|
|
|
}
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2005-09-26 08:48:19 +00:00
|
|
|
g_free(dir);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2007-04-30 19:24:25 +00:00
|
|
|
proto_register_field_array(proto_radius,(hf_register_info*)g_array_data(ri.hf),ri.hf->len);
|
|
|
|
proto_register_subtree_array((gint**)g_array_data(ri.ett), ri.ett->len);
|
2004-10-04 20:13:35 +00:00
|
|
|
|
2005-07-15 21:12:27 +00:00
|
|
|
g_array_free(ri.hf,FALSE);
|
|
|
|
g_array_free(ri.ett,FALSE);
|
|
|
|
g_array_free(ri.vend_vs,FALSE);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2008-04-03 22:13:52 +00:00
|
|
|
no_vendor.attrs_by_id = g_hash_table_new(g_direct_hash,g_direct_equal);
|
2008-12-29 15:16:41 +00:00
|
|
|
|
|
|
|
radius_register_avp_dissector(0,8,dissect_framed_ip_address);
|
|
|
|
radius_register_avp_dissector(0,14,dissect_login_ip_host);
|
|
|
|
radius_register_avp_dissector(0,23,dissect_framed_ipx_network);
|
2008-12-29 15:24:08 +00:00
|
|
|
radius_register_avp_dissector(VENDOR_COSINE,5,dissect_cosine_vpvc);
|
|
|
|
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);
|
2008-04-03 22:13:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_radius(void)
|
|
|
|
{
|
|
|
|
module_t *radius_module;
|
|
|
|
|
|
|
|
proto_radius = proto_register_protocol("Radius Protocol", "RADIUS", "radius");
|
|
|
|
new_register_dissector("radius", dissect_radius, proto_radius);
|
|
|
|
register_init_routine(&radius_init_protocol);
|
2008-09-30 14:46:48 +00:00
|
|
|
radius_module = prefs_register_protocol(proto_radius, proto_reg_handoff_radius);
|
2004-03-31 20:57:42 +00:00
|
|
|
prefs_register_string_preference(radius_module,"shared_secret","Shared Secret",
|
2009-10-12 00:01:59 +00:00
|
|
|
"Shared secret used to decode User Passwords",
|
|
|
|
&shared_secret);
|
2006-01-05 13:01:08 +00:00
|
|
|
prefs_register_bool_preference(radius_module,"show_length","Show AVP Lengths",
|
2009-10-12 00:01:59 +00:00
|
|
|
"Whether to add or not to the tree the AVP's payload length",
|
|
|
|
&show_length);
|
2008-09-30 14:46:48 +00:00
|
|
|
prefs_register_uint_preference(radius_module, "alternate_port","Alternate Port",
|
2009-10-12 00:01:59 +00:00
|
|
|
"An alternate UDP port to decode as RADIUS", 10, &alt_port_pref);
|
2009-08-26 07:26:17 +00:00
|
|
|
prefs_register_uint_preference(radius_module, "request_ttl", "Request TimeToLive",
|
2009-10-12 00:01:59 +00:00
|
|
|
"Time to live for a radius request used for matching it with a response", 10, &request_ttl);
|
2006-10-24 05:21:00 +00:00
|
|
|
radius_tap = register_tap("radius");
|
2008-04-03 22:13:52 +00:00
|
|
|
proto_register_prefix("radius",register_radius_fields);
|
|
|
|
|
|
|
|
dict = g_malloc(sizeof(radius_dictionary_t));
|
2009-10-12 00:01:59 +00:00
|
|
|
dict->attrs_by_id = g_hash_table_new(g_direct_hash,g_direct_equal);
|
|
|
|
dict->attrs_by_name = g_hash_table_new(g_str_hash,g_str_equal);
|
|
|
|
dict->vendors_by_id = g_hash_table_new(g_direct_hash,g_direct_equal);
|
2008-04-03 22:13:52 +00:00
|
|
|
dict->vendors_by_name = g_hash_table_new(g_str_hash,g_str_equal);
|
2009-10-12 00:01:59 +00:00
|
|
|
dict->tlvs_by_name = g_hash_table_new(g_str_hash,g_str_equal);
|
2004-03-31 20:57:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_radius(void)
|
|
|
|
{
|
2008-09-30 14:46:48 +00:00
|
|
|
static gboolean initialized = FALSE;
|
|
|
|
static dissector_handle_t radius_handle;
|
|
|
|
static guint alt_port;
|
|
|
|
|
|
|
|
if (!initialized) {
|
|
|
|
radius_handle = find_dissector("radius");
|
|
|
|
dissector_add("udp.port", UDP_PORT_RADIUS, radius_handle);
|
|
|
|
dissector_add("udp.port", UDP_PORT_RADIUS_NEW, radius_handle);
|
|
|
|
dissector_add("udp.port", UDP_PORT_RADACCT, radius_handle);
|
|
|
|
dissector_add("udp.port", UDP_PORT_RADACCT_NEW, radius_handle);
|
2009-06-09 10:52:28 +00:00
|
|
|
dissector_add("udp.port", UDP_PORT_DAE, radius_handle);
|
2008-09-30 14:46:48 +00:00
|
|
|
|
|
|
|
eap_handle = find_dissector("eap");
|
|
|
|
|
|
|
|
initialized = TRUE;
|
|
|
|
} else {
|
|
|
|
if (alt_port != 0)
|
|
|
|
dissector_delete("udp.port", alt_port, radius_handle);
|
|
|
|
}
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2008-09-30 14:46:48 +00:00
|
|
|
if (alt_port_pref != 0)
|
|
|
|
dissector_add("udp.port", alt_port_pref, radius_handle);
|
2007-01-02 22:49:57 +00:00
|
|
|
|
2008-09-30 14:46:48 +00:00
|
|
|
alt_port = alt_port_pref;
|
2004-03-31 20:57:42 +00:00
|
|
|
}
|