]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
move everything to local ctx
authorAlan T. DeKok <aland@freeradius.org>
Wed, 7 Jun 2017 15:32:30 +0000 (11:32 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 7 Jun 2017 15:32:30 +0000 (11:32 -0400)
src/modules/proto_radius/proto_radius_udp.c

index d1c03afa6fee98ceb7232fbe1c3b214c1bfa920b..64759acec00aeefe70751829c0cef0dc3ca57798 100644 (file)
 #include <freeradius-devel/rad_assert.h>
 #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;
 }