From: Alan T. DeKok Date: Wed, 7 Jun 2017 15:32:30 +0000 (-0400) Subject: move everything to local ctx X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1289937c46b0203e1151277e9ff2102cdad45f2;p=thirdparty%2Ffreeradius-server.git move everything to local ctx --- diff --git a/src/modules/proto_radius/proto_radius_udp.c b/src/modules/proto_radius/proto_radius_udp.c index d1c03afa6fe..64759acec00 100644 --- a/src/modules/proto_radius/proto_radius_udp.c +++ b/src/modules/proto_radius/proto_radius_udp.c @@ -30,19 +30,6 @@ #include #include "proto_radius.h" -typedef struct { - int sockfd; //!< Socket the packet was received on. - - uint8_t const *secret; - size_t secret_len; - - uint8_t original[20]; - uint8_t id; - - struct sockaddr_storage src; - socklen_t salen; -} fr_packet_ctx_t; - typedef struct { int sockfd; @@ -59,6 +46,17 @@ typedef struct { uint32_t recv_buff; //!< How big the kernel's receive buffer should be. bool recv_buff_is_set; //!< Whether we were provided with a receive //!< buffer value. + /* + * SHIT + */ + uint8_t const *secret; + size_t secret_len; + + uint8_t original[20]; + uint8_t id; + + struct sockaddr_storage src; + socklen_t salen; } fr_proto_radius_udp_ctx_t; static const CONF_PARSER udp_listen_conf[] = { @@ -78,7 +76,7 @@ static ssize_t mod_read(void *ctx, uint8_t *buffer, size_t buffer_len) { ssize_t data_size; size_t packet_len; - fr_packet_ctx_t *pc = ctx; + fr_proto_radius_udp_ctx_t *pc = ctx; decode_fail_t reason; pc->salen = sizeof(pc->src); @@ -112,7 +110,7 @@ static ssize_t mod_read(void *ctx, uint8_t *buffer, size_t buffer_len) static ssize_t mod_write(void *ctx, uint8_t *buffer, size_t buffer_len) { ssize_t data_size; - fr_packet_ctx_t *pc = ctx; + fr_proto_radius_udp_ctx_t *pc = ctx; pc->salen = sizeof(pc->src); @@ -164,6 +162,9 @@ static int mod_instantiate(CONF_SECTION *cs, void *instance) inst->port = ntohl(s->s_port); } + inst->secret = (uint8_t const *) "testing123"; + inst->secret_len = 10; + return 0; }