19 #include "../utils/attributes.h"
60 #define RADIUS_MAX_ATTR_LEN (255 - sizeof(struct radius_attr_hdr))
131 #define RADIUS_SERVICE_TYPE_FRAMED 2
134 #define RADIUS_TERMINATION_ACTION_DEFAULT 0
135 #define RADIUS_TERMINATION_ACTION_RADIUS_REQUEST 1
138 #define RADIUS_NAS_PORT_TYPE_IEEE_802_11 19
141 #define RADIUS_ACCT_STATUS_TYPE_START 1
142 #define RADIUS_ACCT_STATUS_TYPE_STOP 2
143 #define RADIUS_ACCT_STATUS_TYPE_INTERIM_UPDATE 3
144 #define RADIUS_ACCT_STATUS_TYPE_ACCOUNTING_ON 7
145 #define RADIUS_ACCT_STATUS_TYPE_ACCOUNTING_OFF 8
148 #define RADIUS_ACCT_AUTHENTIC_RADIUS 1
149 #define RADIUS_ACCT_AUTHENTIC_LOCAL 2
150 #define RADIUS_ACCT_AUTHENTIC_REMOTE 3
153 #define RADIUS_ACCT_TERMINATE_CAUSE_USER_REQUEST 1
154 #define RADIUS_ACCT_TERMINATE_CAUSE_LOST_CARRIER 2
155 #define RADIUS_ACCT_TERMINATE_CAUSE_LOST_SERVICE 3
156 #define RADIUS_ACCT_TERMINATE_CAUSE_IDLE_TIMEOUT 4
157 #define RADIUS_ACCT_TERMINATE_CAUSE_SESSION_TIMEOUT 5
158 #define RADIUS_ACCT_TERMINATE_CAUSE_ADMIN_RESET 6
159 #define RADIUS_ACCT_TERMINATE_CAUSE_ADMIN_REBOOT 7
160 #define RADIUS_ACCT_TERMINATE_CAUSE_PORT_ERROR 8
161 #define RADIUS_ACCT_TERMINATE_CAUSE_NAS_ERROR 9
162 #define RADIUS_ACCT_TERMINATE_CAUSE_NAS_REQUEST 10
163 #define RADIUS_ACCT_TERMINATE_CAUSE_NAS_REBOOT 11
164 #define RADIUS_ACCT_TERMINATE_CAUSE_PORT_UNNEEDED 12
165 #define RADIUS_ACCT_TERMINATE_CAUSE_PORT_PREEMPTED 13
166 #define RADIUS_ACCT_TERMINATE_CAUSE_PORT_SUSPENDED 14
167 #define RADIUS_ACCT_TERMINATE_CAUSE_SERVICE_UNAVAILABLE 15
168 #define RADIUS_ACCT_TERMINATE_CAUSE_CALLBACK 16
169 #define RADIUS_ACCT_TERMINATE_CAUSE_USER_ERROR 17
170 #define RADIUS_ACCT_TERMINATE_CAUSE_HOST_REQUEST 18
172 #define RADIUS_TUNNEL_TAGS 32
175 #define RADIUS_TUNNEL_TYPE_PPTP 1
176 #define RADIUS_TUNNEL_TYPE_L2TP 3
177 #define RADIUS_TUNNEL_TYPE_IPIP 7
178 #define RADIUS_TUNNEL_TYPE_GRE 10
179 #define RADIUS_TUNNEL_TYPE_VLAN 13
182 #define RADIUS_TUNNEL_MEDIUM_TYPE_IPV4 1
183 #define RADIUS_TUNNEL_MEDIUM_TYPE_IPV6 2
184 #define RADIUS_TUNNEL_MEDIUM_TYPE_802 6
191 #define RADIUS_VENDOR_ID_CISCO 9
192 #define RADIUS_CISCO_AV_PAIR 1
195 #define RADIUS_VENDOR_ID_MICROSOFT 311
203 #define RADIUS_VENDOR_ID_WFA 40808
232 #define RADIUS_DEFAULT_MSG_SIZE 1024
235 #define RADIUS_DEFAULT_ATTR_COUNT 16
239 #define RADIUS_MAX_MSG_LEN 4096
243 #define RADIUS_802_1X_ADDR_FORMAT "%02X-%02X-%02X-%02X-%02X-%02X"
245 #define RADIUS_ADDR_FORMAT "%02x%02x%02x%02x%02x%02x"
255 size_t secret_len,
const u8 *req_authenticator);
263 const u8 *req_authenticator);
268 int require_message_authenticator);
270 const u8 *data,
size_t data_len);
275 size_t secret_len,
struct radius_msg *sent_msg,
int auth);
277 size_t secret_len,
const u8 *req_auth);
287 const u8 *secret,
size_t secret_len);
289 const u8 *req_authenticator,
const u8 *secret,
290 size_t secret_len,
const u8 *send_key,
291 size_t send_key_len,
const u8 *recv_key,
292 size_t recv_key_len);
296 size_t data_len,
const u8 *secret,
297 size_t secret_len,
u8 *buf,
size_t buf_len);
300 size_t data_len,
const u8 *secret,
306 const u8 *secret,
size_t secret_len,
309 static inline int radius_msg_add_attr_int32(
struct radius_msg *msg,
u8 type,
311 u32 val = htonl(value);
315 static inline int radius_msg_get_attr_int32(
struct radius_msg *msg,
u8 type,
327 size_t *len,
const u8 *start);
350 const u8 *req_authenticator,
const u8 *secret,
351 size_t secret_len,
u8 *ebuf,
size_t *elen);
File containing the common definitions used by radius and eap.
u16 __bitwise be16
Definition: common.h:45
uint8_t u8
Definition: common.h:25
uint16_t u16
Definition: common.h:24
uint32_t u32
Definition: common.h:23
File containing the definition of the os functionalities.
struct wpabuf * radius_msg_get_eap(struct radius_msg *msg)
int radius_msg_get_attr_ptr(struct radius_msg *msg, u8 type, u8 **buf, size_t *len, const u8 *start)
struct radius_attr_hdr * radius_msg_add_attr(struct radius_msg *msg, u8 type, const u8 *data, size_t data_len)
void radius_msg_dump(struct radius_msg *msg)
struct radius_attr_hdr * radius_msg_add_attr_user_password(struct radius_msg *msg, const u8 *data, size_t data_len, const u8 *secret, size_t secret_len)
int radius_msg_verify_acct_req(struct radius_msg *msg, const u8 *secret, size_t secret_len)
struct radius_msg * radius_msg_parse(const u8 *data, size_t len)
void encrypt_ms_key(const u8 *key, size_t key_len, u16 salt, const u8 *req_authenticator, const u8 *secret, size_t secret_len, u8 *ebuf, size_t *elen)
int radius_msg_get_vlanid(struct radius_msg *msg, int *untagged, int numtagged, int *tagged)
struct radius_ms_mppe_keys * radius_msg_get_cisco_keys(struct radius_msg *msg, struct radius_msg *sent_msg, const u8 *secret, size_t secret_len)
int radius_msg_verify(struct radius_msg *msg, const u8 *secret, size_t secret_len, struct radius_msg *sent_msg, int auth)
void radius_free_class(struct radius_class_data *c)
int radius_user_password_hide(struct radius_msg *msg, const u8 *data, size_t data_len, const u8 *secret, size_t secret_len, u8 *buf, size_t buf_len)
int radius_msg_verify_das_req(struct radius_msg *msg, const u8 *secret, size_t secret_len, int require_message_authenticator)
struct wpabuf * radius_msg_get_buf(struct radius_msg *msg)
Definition: radius.c:67
struct radius_hdr * radius_msg_get_hdr(struct radius_msg *msg)
Definition: radius.c:63
@ RADIUS_VENDOR_ATTR_WFA_HS20_ROAMING_CONSORTIUM
Definition: radius.h:211
@ RADIUS_VENDOR_ATTR_WFA_HS20_T_C_URL
Definition: radius.h:215
@ RADIUS_VENDOR_ATTR_WFA_HS20_T_C_FILENAME
Definition: radius.h:212
@ RADIUS_VENDOR_ATTR_WFA_HS20_SUBSCR_REMEDIATION
Definition: radius.h:206
@ RADIUS_VENDOR_ATTR_WFA_HS20_AP_VERSION
Definition: radius.h:207
@ RADIUS_VENDOR_ATTR_WFA_HS20_DEAUTH_REQ
Definition: radius.h:209
@ RADIUS_VENDOR_ATTR_WFA_HS20_TIMESTAMP
Definition: radius.h:213
@ RADIUS_VENDOR_ATTR_WFA_HS20_STA_VERSION
Definition: radius.h:208
@ RADIUS_VENDOR_ATTR_WFA_HS20_T_C_FILTERING
Definition: radius.h:214
@ RADIUS_VENDOR_ATTR_WFA_HS20_SESSION_INFO_URL
Definition: radius.h:210
int radius_msg_finish(struct radius_msg *msg, const u8 *secret, size_t secret_len)
int radius_msg_finish_srv(struct radius_msg *msg, const u8 *secret, size_t secret_len, const u8 *req_authenticator)
u8 radius_msg_find_unlisted_attr(struct radius_msg *msg, u8 *attrs)
int radius_msg_count_attr(struct radius_msg *msg, u8 type, int min_len)
int radius_msg_add_wfa(struct radius_msg *msg, u8 subtype, const u8 *data, size_t len)
struct radius_hdr STRUCT_PACKED
int radius_msg_make_authenticator(struct radius_msg *msg)
@ RADIUS_CODE_ACCESS_REJECT
Definition: radius.h:39
@ RADIUS_CODE_ACCOUNTING_REQUEST
Definition: radius.h:40
@ RADIUS_CODE_COA_NAK
Definition: radius.h:50
@ RADIUS_CODE_DISCONNECT_NAK
Definition: radius.h:47
@ RADIUS_CODE_ACCESS_REQUEST
Definition: radius.h:37
@ RADIUS_CODE_DISCONNECT_REQUEST
Definition: radius.h:45
@ RADIUS_CODE_STATUS_CLIENT
Definition: radius.h:44
@ RADIUS_CODE_ACCESS_CHALLENGE
Definition: radius.h:42
@ RADIUS_CODE_RESERVED
Definition: radius.h:51
@ RADIUS_CODE_STATUS_SERVER
Definition: radius.h:43
@ RADIUS_CODE_ACCESS_ACCEPT
Definition: radius.h:38
@ RADIUS_CODE_COA_ACK
Definition: radius.h:49
@ RADIUS_CODE_COA_REQUEST
Definition: radius.h:48
@ RADIUS_CODE_ACCOUNTING_RESPONSE
Definition: radius.h:41
@ RADIUS_CODE_DISCONNECT_ACK
Definition: radius.h:46
int radius_msg_add_eap(struct radius_msg *msg, const u8 *data, size_t data_len)
void radius_msg_finish_acct(struct radius_msg *msg, const u8 *secret, size_t secret_len)
@ RADIUS_ATTR_FRAMED_MTU
Definition: radius.h:69
@ RADIUS_ATTR_BASIC_LOCATION_POLICY_RULES
Definition: radius.h:113
@ RADIUS_ATTR_NAS_IPV6_ADDRESS
Definition: radius.h:107
@ RADIUS_ATTR_EAP_KEY_NAME
Definition: radius.h:109
@ RADIUS_ATTR_EXTENDED_LOCATION_POLICY_RULES
Definition: radius.h:114
@ RADIUS_ATTR_GSS_ACCEPTOR_HOST_NAME
Definition: radius.h:118
@ RADIUS_ATTR_IDLE_TIMEOUT
Definition: radius.h:75
@ RADIUS_ATTR_ACCT_INPUT_GIGAWORDS
Definition: radius.h:93
@ RADIUS_ATTR_USER_PASSWORD
Definition: radius.h:64
@ RADIUS_ATTR_STATE
Definition: radius.h:71
@ RADIUS_ATTR_ERROR_CAUSE
Definition: radius.h:108
@ RADIUS_ATTR_EAP_MESSAGE
Definition: radius.h:102
@ RADIUS_ATTR_ACCT_DELAY_TIME
Definition: radius.h:82
@ RADIUS_ATTR_EVENT_TIMESTAMP
Definition: radius.h:95
@ RADIUS_ATTR_ACCT_OUTPUT_PACKETS
Definition: radius.h:89
@ RADIUS_ATTR_TUNNEL_PASSWORD
Definition: radius.h:100
@ RADIUS_ATTR_VENDOR_SPECIFIC
Definition: radius.h:73
@ RADIUS_ATTR_REQUESTED_LOCATION_INFO
Definition: radius.h:116
@ RADIUS_ATTR_REPLY_MESSAGE
Definition: radius.h:70
@ RADIUS_ATTR_ACCT_SESSION_TIME
Definition: radius.h:87
@ RADIUS_ATTR_ACCT_MULTI_SESSION_ID
Definition: radius.h:91
@ RADIUS_ATTR_ACCT_SESSION_ID
Definition: radius.h:85
@ RADIUS_ATTR_CALLING_STATION_ID
Definition: radius.h:78
@ RADIUS_ATTR_TUNNEL_MEDIUM_TYPE
Definition: radius.h:99
@ RADIUS_ATTR_ACCT_INPUT_OCTETS
Definition: radius.h:83
@ RADIUS_ATTR_NAS_IP_ADDRESS
Definition: radius.h:65
@ RADIUS_ATTR_NAS_IDENTIFIER
Definition: radius.h:79
@ RADIUS_ATTR_WLAN_HESSID
Definition: radius.h:122
@ RADIUS_ATTR_ACCT_OUTPUT_OCTETS
Definition: radius.h:84
@ RADIUS_ATTR_LOCATION_CAPABLE
Definition: radius.h:115
@ RADIUS_ATTR_CALLED_STATION_ID
Definition: radius.h:77
@ RADIUS_ATTR_EGRESS_VLANID
Definition: radius.h:96
@ RADIUS_ATTR_GSS_ACCEPTOR_SERVICE_NAME
Definition: radius.h:117
@ RADIUS_ATTR_NAS_PORT
Definition: radius.h:66
@ RADIUS_ATTR_OPERATOR_NAME
Definition: radius.h:110
@ RADIUS_ATTR_ACCT_STATUS_TYPE
Definition: radius.h:81
@ RADIUS_ATTR_FRAMED_IP_ADDRESS
Definition: radius.h:68
@ RADIUS_ATTR_ACCT_AUTHENTIC
Definition: radius.h:86
@ RADIUS_ATTR_WLAN_AKM_SUITE
Definition: radius.h:126
@ RADIUS_ATTR_LOCATION_INFO
Definition: radius.h:111
@ RADIUS_ATTR_USER_NAME
Definition: radius.h:63
@ RADIUS_ATTR_SERVICE_TYPE
Definition: radius.h:67
@ RADIUS_ATTR_TERMINATION_ACTION
Definition: radius.h:76
@ RADIUS_ATTR_ACCT_INTERIM_INTERVAL
Definition: radius.h:105
@ RADIUS_ATTR_LOCATION_DATA
Definition: radius.h:112
@ RADIUS_ATTR_CHARGEABLE_USER_IDENTITY
Definition: radius.h:106
@ RADIUS_ATTR_ACCT_LINK_COUNT
Definition: radius.h:92
@ RADIUS_ATTR_MESSAGE_AUTHENTICATOR
Definition: radius.h:103
@ RADIUS_ATTR_ACCT_OUTPUT_GIGAWORDS
Definition: radius.h:94
@ RADIUS_ATTR_TUNNEL_TYPE
Definition: radius.h:98
@ RADIUS_ATTR_GSS_ACCEPTOR_SERVICE_SPECIFICS
Definition: radius.h:119
@ RADIUS_ATTR_ACCT_TERMINATE_CAUSE
Definition: radius.h:90
@ RADIUS_ATTR_WLAN_PAIRWISE_CIPHER
Definition: radius.h:124
@ RADIUS_ATTR_CONNECT_INFO
Definition: radius.h:101
@ RADIUS_ATTR_CLASS
Definition: radius.h:72
@ RADIUS_ATTR_GSS_ACCEPTOR_REALM_NAME
Definition: radius.h:120
@ RADIUS_ATTR_WLAN_GROUP_CIPHER
Definition: radius.h:125
@ RADIUS_ATTR_PROXY_STATE
Definition: radius.h:80
@ RADIUS_ATTR_TUNNEL_PRIVATE_GROUP_ID
Definition: radius.h:104
@ RADIUS_ATTR_WLAN_REASON_CODE
Definition: radius.h:123
@ RADIUS_ATTR_ACCT_INPUT_PACKETS
Definition: radius.h:88
@ RADIUS_ATTR_NAS_PORT_TYPE
Definition: radius.h:97
@ RADIUS_ATTR_WLAN_GROUP_MGMT_CIPHER
Definition: radius.h:127
@ RADIUS_ATTR_MOBILITY_DOMAIN_ID
Definition: radius.h:121
@ RADIUS_ATTR_SESSION_TIMEOUT
Definition: radius.h:74
int radius_msg_verify_msg_auth(struct radius_msg *msg, const u8 *secret, size_t secret_len, const u8 *req_auth)
int radius_msg_finish_das_resp(struct radius_msg *msg, const u8 *secret, size_t secret_len, const struct radius_hdr *req_hdr)
int radius_msg_add_mppe_keys(struct radius_msg *msg, const u8 *req_authenticator, const u8 *secret, size_t secret_len, const u8 *send_key, size_t send_key_len, const u8 *recv_key, size_t recv_key_len)
void radius_msg_free(struct radius_msg *msg)
int radius_copy_class(struct radius_class_data *dst, const struct radius_class_data *src)
int radius_msg_copy_attr(struct radius_msg *dst, struct radius_msg *src, u8 type)
@ RADIUS_VENDOR_ATTR_MS_MPPE_SEND_KEY
Definition: radius.h:198
@ RADIUS_VENDOR_ATTR_MS_MPPE_RECV_KEY
Definition: radius.h:199
void radius_msg_finish_acct_resp(struct radius_msg *msg, const u8 *secret, size_t secret_len, const u8 *req_authenticator)
struct radius_msg * radius_msg_new(u8 code, u8 identifier)
int radius_gen_session_id(u8 *id, size_t len)
int radius_msg_get_attr(struct radius_msg *msg, u8 type, u8 *buf, size_t len)
char * radius_msg_get_tunnel_password(struct radius_msg *msg, int *keylen, const u8 *secret, size_t secret_len, struct radius_msg *sent_msg, size_t n)
struct radius_ms_mppe_keys * radius_msg_get_ms_keys(struct radius_msg *msg, struct radius_msg *sent_msg, const u8 *secret, size_t secret_len)
u8 * data
Definition: radius.h:331
size_t len
Definition: radius.h:332
u8 type
Definition: radius.h:55
u8 length
Definition: radius.h:56
u8 vendor_length
Definition: radius.h:188
u8 vendor_type
Definition: radius.h:187
struct radius_attr_data * attr
Definition: radius.h:336
size_t count
Definition: radius.h:337
u8 code
Definition: radius.h:29
u8 authenticator[16]
Definition: radius.h:32
be16 length
Definition: radius.h:31
u8 identifier
Definition: radius.h:30
u8 * recv
Definition: radius.h:225
size_t send_len
Definition: radius.h:224
u8 * send
Definition: radius.h:223
size_t recv_len
Definition: radius.h:226