Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
packet-radius.h
1/*
2 * packet-radius.h
3 *
4 * Definitions for RADIUS packet disassembly
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <[email protected]>
7 * Copyright 1998 Gerald Combs
8 *
9 * SPDX-License-Identifier: GPL-2.0-or-later
10 */
11
12#include <epan/proto.h>
13
14/* radius packet-type codes */
15/* 09/12/2011: Updated from IANA:
16 * http://www.iana.org/assignments/radius-types/radius-types.xml#radius-types-27
17 */
18#define RADIUS_PKT_TYPE_ACCESS_REQUEST 1
19#define RADIUS_PKT_TYPE_ACCESS_ACCEPT 2
20#define RADIUS_PKT_TYPE_ACCESS_REJECT 3
21#define RADIUS_PKT_TYPE_ACCOUNTING_REQUEST 4
22#define RADIUS_PKT_TYPE_ACCOUNTING_RESPONSE 5
23#define RADIUS_PKT_TYPE_ACCOUNTING_STATUS 6
24#define RADIUS_PKT_TYPE_PASSWORD_REQUEST 7
25#define RADIUS_PKT_TYPE_PASSWORD_ACK 8
26#define RADIUS_PKT_TYPE_PASSWORD_REJECT 9
27#define RADIUS_PKT_TYPE_ACCOUNTING_MESSAGE 10
28#define RADIUS_PKT_TYPE_ACCESS_CHALLENGE 11
29#define RADIUS_PKT_TYPE_STATUS_SERVER 12
30#define RADIUS_PKT_TYPE_STATUS_CLIENT 13
31
32#define RADIUS_PKT_TYPE_RESOURCE_FREE_REQUEST 21
33#define RADIUS_PKT_TYPE_RESOURCE_FREE_RESPONSE 22
34#define RADIUS_PKT_TYPE_RESOURCE_QUERY_REQUEST 23
35#define RADIUS_PKT_TYPE_RESOURCE_QUERY_RESPONSE 24
36#define RADIUS_PKT_TYPE_ALTERNATE_RESOURCE_RECLAIM_REQUEST 25
37#define RADIUS_PKT_TYPE_NAS_REBOOT_REQUEST 26
38#define RADIUS_PKT_TYPE_NAS_REBOOT_RESPONSE 27
39
40#define RADIUS_PKT_TYPE_NEXT_PASSCODE 29
41#define RADIUS_PKT_TYPE_NEW_PIN 30
42#define RADIUS_PKT_TYPE_TERMINATE_SESSION 31
43#define RADIUS_PKT_TYPE_PASSWORD_EXPIRED 32
44#define RADIUS_PKT_TYPE_EVENT_REQUEST 33
45#define RADIUS_PKT_TYPE_EVENT_RESPONSE 34
46
47#define RADIUS_PKT_TYPE_DISCONNECT_REQUEST 40
48#define RADIUS_PKT_TYPE_DISCONNECT_ACK 41
49#define RADIUS_PKT_TYPE_DISCONNECT_NAK 42
50#define RADIUS_PKT_TYPE_COA_REQUEST 43
51#define RADIUS_PKT_TYPE_COA_ACK 44
52#define RADIUS_PKT_TYPE_COA_NAK 45
53
54#define RADIUS_PKT_TYPE_IP_ADDRESS_ALLOCATE 50
55#define RADIUS_PKT_TYPE_IP_ADDRESS_RELEASE 51
56
57/* ALU proprietary packet type codes */
58#define RADIUS_PKT_TYPE_ALU_STATE_REQUEST 129
59#define RADIUS_PKT_TYPE_ALU_STATE_ACCEPT 130
60#define RADIUS_PKT_TYPE_ALU_STATE_REJECT 131
61#define RADIUS_PKT_TYPE_ALU_STATE_ERROR 132
62
63/* Radius Attribute Types*/
64/* 09/12/2011: Updated from IANA:
65 * http://www.iana.org/assignments/radius-types/radius-types.xml#radius-types-1
66 */
67#define RADIUS_ATTR_TYPE_VENDOR_SPECIFIC 26
68#define RADIUS_ATTR_TYPE_EAP_MESSAGE 79
69#define RADIUS_ATTR_TYPE_MESSAGE_AUTHENTICATOR 80
70#define RADIUS_ATTR_TYPE_EXTENDED_1 241
71#define RADIUS_ATTR_TYPE_EXTENDED_2 242
72#define RADIUS_ATTR_TYPE_EXTENDED_3 243
73#define RADIUS_ATTR_TYPE_EXTENDED_4 244
74#define RADIUS_ATTR_TYPE_EXTENDED_5 245
75#define RADIUS_ATTR_TYPE_EXTENDED_6 246
76
77#define RADIUS_ATTR_TYPE_IS_EXTENDED(avp_type) \
78 ((avp_type) == RADIUS_ATTR_TYPE_EXTENDED_1 || \
79 (avp_type) == RADIUS_ATTR_TYPE_EXTENDED_2 || \
80 (avp_type) == RADIUS_ATTR_TYPE_EXTENDED_3 || \
81 (avp_type) == RADIUS_ATTR_TYPE_EXTENDED_4 || \
82 (avp_type) == RADIUS_ATTR_TYPE_EXTENDED_5 || \
83 (avp_type) == RADIUS_ATTR_TYPE_EXTENDED_6)
84
85#define RADIUS_ATTR_TYPE_IS_EXTENDED_LONG(avp_type) \
86 ((avp_type) == RADIUS_ATTR_TYPE_EXTENDED_5 || \
87 (avp_type) == RADIUS_ATTR_TYPE_EXTENDED_6)
88
89
90typedef struct _radius_vendor_info_t {
91 char *name;
92 unsigned code;
93 GHashTable* attrs_by_id;
94 int ett;
95 unsigned type_octets;
96 unsigned length_octets;
97 bool has_flags;
99
100typedef struct _radius_call_t
101{
102 unsigned code;
103 unsigned ident;
104 uint8_t req_authenticator[16];
105
106 uint32_t req_num; /* frame number request seen */
107 uint32_t rsp_num; /* frame number response seen */
108 uint32_t rspcode;
109 nstime_t req_time;
110 bool responded;
112
114typedef void (radius_attr_dissector_t)(radius_attr_info_t*, proto_tree*, packet_info*, tvbuff_t*, int, int, proto_item* );
115
116typedef const char* (radius_avp_dissector_t)(proto_tree*,tvbuff_t*, packet_info*);
117
118typedef union _radius_attr_type_t {
119 uint8_t u8_code[2];
120 unsigned value;
122
124 char *name;
126 unsigned encrypt; /* 0 or value for "encrypt=" option */
127 bool tagged;
128 bool concat;
129 radius_attr_dissector_t* type;
130 radius_avp_dissector_t* dissector;
131 const value_string *vs;
132 int ett;
133 int hf;
134 int hf_alt; /* 64-bit version for integers, IPv6 for radius_combo_ip */
135 int hf_enc; /* version for encrypted attributes */
136 int hf_tag;
137 int hf_len;
138 GHashTable* tlvs_by_id;
139};
140
141/*
142 * Attributes and Vendors are a mapping between IDs and names. Names
143 * are normally uniquely identified by a number. Identifiers for
144 * Vendor-Specific Attributes (VSA) are scoped within the vendor.
145 *
146 * The attribute/vendor structures are owned by the by_id tables,
147 * the by_name tables point to the same data.
148 */
149typedef struct _radius_dictionary_t {
150 GHashTable* attrs_by_id;
151 GHashTable* attrs_by_name;
152 GHashTable* vendors_by_id;
153 GHashTable* vendors_by_name;
154 GHashTable* tlvs_by_name;
156
157radius_attr_dissector_t radius_integer;
158radius_attr_dissector_t radius_string;
159radius_attr_dissector_t radius_octets;
160radius_attr_dissector_t radius_ipaddr;
161radius_attr_dissector_t radius_ipv6addr;
162radius_attr_dissector_t radius_ipv6prefix;
163radius_attr_dissector_t radius_ipxnet;
164radius_attr_dissector_t radius_date;
165radius_attr_dissector_t radius_abinary;
166radius_attr_dissector_t radius_ether;
167radius_attr_dissector_t radius_ifid;
168radius_attr_dissector_t radius_byte;
169radius_attr_dissector_t radius_short;
170radius_attr_dissector_t radius_signed;
171radius_attr_dissector_t radius_combo_ip;
172radius_attr_dissector_t radius_tlv;
173
174extern void radius_register_avp_dissector(uint32_t vendor_id, uint32_t attribute_id, radius_avp_dissector_t dissector);
175void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, int offset, unsigned length, radius_call_t *radius_call);
176extern void free_radius_attr_info(void *data);
177
178/* from radius_dict.l */
179bool radius_load_dictionary (radius_dictionary_t* dict, char* directory, const char* filename, char** err_str);
Definition packet_info.h:43
Definition proto.h:903
Definition packet-radius.h:123
GHashTable * tlvs_by_id
Definition packet-radius.h:138
Definition packet-radius.h:101
Definition packet-radius.h:149
GHashTable * tlvs_by_name
Definition packet-radius.h:154
Definition packet-radius.h:90
Definition value_string.h:25
Definition nstime.h:26
Definition tvbuff-int.h:35
Definition packet-radius.h:118