Return wpabuf from radius_msg_get_eap()
This simplifies the implementation by using the buffer type to which the returned data will be converted anyway. This avoids one memory allocation for each processed RADIUS message. Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
95ac3bf49f
commit
e100828b76
5 changed files with 38 additions and 50 deletions
|
@ -689,8 +689,7 @@ static int radius_server_request(struct radius_server_data *data,
|
|||
const char *from_addr, int from_port,
|
||||
struct radius_session *force_sess)
|
||||
{
|
||||
u8 *eap = NULL;
|
||||
size_t eap_len;
|
||||
struct wpabuf *eap = NULL;
|
||||
int res, state_included = 0;
|
||||
u8 statebuf[4];
|
||||
unsigned int state;
|
||||
|
@ -754,7 +753,7 @@ static int radius_server_request(struct radius_server_data *data,
|
|||
return -1;
|
||||
}
|
||||
|
||||
eap = radius_msg_get_eap(msg, &eap_len);
|
||||
eap = radius_msg_get_eap(msg);
|
||||
if (eap == NULL) {
|
||||
RADIUS_DEBUG("No EAP-Message in RADIUS packet from %s",
|
||||
from_addr);
|
||||
|
@ -763,7 +762,7 @@ static int radius_server_request(struct radius_server_data *data,
|
|||
return -1;
|
||||
}
|
||||
|
||||
RADIUS_DUMP("Received EAP data", eap, eap_len);
|
||||
RADIUS_DUMP("Received EAP data", wpabuf_head(eap), wpabuf_len(eap));
|
||||
|
||||
/* FIX: if Code is Request, Success, or Failure, send Access-Reject;
|
||||
* RFC3579 Sect. 2.6.2.
|
||||
|
@ -773,10 +772,7 @@ static int radius_server_request(struct radius_server_data *data,
|
|||
* Or is this already done by the EAP state machine? */
|
||||
|
||||
wpabuf_free(sess->eap_if->eapRespData);
|
||||
sess->eap_if->eapRespData = wpabuf_alloc_ext_data(eap, eap_len);
|
||||
if (sess->eap_if->eapRespData == NULL)
|
||||
os_free(eap);
|
||||
eap = NULL;
|
||||
sess->eap_if->eapRespData = eap;
|
||||
sess->eap_if->eapResp = TRUE;
|
||||
eap_server_sm_step(sess->eap);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue