path: root/src/radius
diff options
authorAnusha Datar <anusha@meter.com>2021-02-17 22:32:56 (GMT)
committerJouni Malinen <j@w1.fi>2021-02-19 22:08:17 (GMT)
commit7df089b56703279e18842796d8d25ffa9f3ae060 (patch)
tree752ef63cf551a37b82c879fc7112357cb77e0fe8 /src/radius
parent3811645e996591a68f98860a3c754c5266d9cd42 (diff)
Create RADIUS_MAX_MSG_LEN param in the shared radius.h
The RADIUS client currently uses a hardcoded value of 3000 for the maximum length of a RADIUS message, and the RADIUS server currently defines a constant value for the maximum length of the RADIUS message within its source. The client and the server should use the same maximum length value, so this change creates a shared parameter RADIUS_MAX_MSG_LEN within the header file radius.h and modifies both the client and the server to use that parameter instead of a locally set value. Signed-off-by: Anusha Datar <anusha@meter.com> Reviewed-by: Steve deRosier <derosier@cal-sierra.com> Reviewed-by: Julian Squires <julian@cipht.net>
Diffstat (limited to 'src/radius')
3 files changed, 3 insertions, 6 deletions
diff --git a/src/radius/radius.h b/src/radius/radius.h
index 630c0f9..e228688 100644
--- a/src/radius/radius.h
+++ b/src/radius/radius.h
@@ -225,6 +225,8 @@ struct radius_msg;
/* Default size to be allocated for attribute array */
+/* Maximum message length for incoming RADIUS messages */
+#define RADIUS_MAX_MSG_LEN 3000
/* MAC address ASCII format for IEEE 802.1X use
* (draft-congdon-radius-8021x-20.txt) */
diff --git a/src/radius/radius_client.c b/src/radius/radius_client.c
index 2b7a604..7484d61 100644
--- a/src/radius/radius_client.c
+++ b/src/radius/radius_client.c
@@ -816,7 +816,7 @@ static void radius_client_receive(int sock, void *eloop_ctx, void *sock_ctx)
struct hostapd_radius_servers *conf = radius->conf;
RadiusType msg_type = (RadiusType) sock_ctx;
int len, roundtrip;
- unsigned char buf[3000];
+ unsigned char buf[RADIUS_MAX_MSG_LEN + 1];
struct radius_msg *msg;
struct radius_hdr *hdr;
struct radius_rx_handler *handlers;
diff --git a/src/radius/radius_server.c b/src/radius/radius_server.c
index 971fe91..e02c215 100644
--- a/src/radius/radius_server.c
+++ b/src/radius/radius_server.c
@@ -35,11 +35,6 @@
- * RADIUS_MAX_MSG_LEN - Maximum message length for incoming RADIUS messages
- */
-#define RADIUS_MAX_MSG_LEN 3000
static const struct eapol_callbacks radius_server_eapol_cb;
struct radius_client;