]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
move proxy_state random number to main module
authorAlan T. DeKok <aland@freeradius.org>
Sun, 6 Aug 2017 16:20:10 +0000 (18:20 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 6 Aug 2017 16:20:10 +0000 (18:20 +0200)
src/modules/rlm_radius/rlm_radius.c
src/modules/rlm_radius/rlm_radius.h
src/modules/rlm_radius/rlm_radius_udp.c

index 06d70f53b27c2d055ac02b6244d087168ef08a77..041a29ca01728e55d00960777a34eb5b32da4ec1 100644 (file)
@@ -485,6 +485,11 @@ static int mod_bootstrap(void *instance, CONF_SECTION *conf)
        rad_assert(inst->io->bootstrap != NULL);
        rad_assert(inst->io->instantiate != NULL);
 
+       /*
+        *      Get random Proxy-State identifier for this module.
+        */
+       inst->proxy_state = fr_rand();
+
        /*
         *      Bootstrap the submodule.
         */
index d0f4a95aa78fb7f5168ffe6179e26644d995bae5..5d01edf051c3c60af2e38e4d427b8c188722d8ee 100644 (file)
@@ -83,6 +83,8 @@ struct rlm_radius_t {
        void                    *io_instance;   //!< Easy access to the IO instance
        CONF_SECTION            *io_conf;       //!< Easy access to the IO config section
 
+       uint32_t                proxy_state;    //!< Unique ID (mostly) of this module.
+
        uint32_t                *types;         //!< array of allowed packet types
        int                     allowed[FR_MAX_PACKET_CODE];
        rlm_radius_retry_t      retry[FR_MAX_PACKET_CODE];
index 4aa934145b53d9dfa6ac43f2d0aa463592c3390f..f54db896c381b423dace869ec6acfb773018c917 100644 (file)
@@ -86,7 +86,6 @@ typedef struct rlm_radius_udp_connection_t {
        fr_connection_t         *conn;          //!< Connection to our destination.
        char const              *name;          //!< from IP PORT to IP PORT
 
-       uint32_t                proxy_state;    //!< ID of this connection
        fr_dlist_t              entry;          //!< in the linked list of connections
        int                     heap_id;        //!< for the active heap
        rlm_radius_udp_connection_state_t state; //!< state of the connection
@@ -719,7 +718,7 @@ static int conn_write(rlm_radius_udp_connection_t *c, rlm_radius_udp_request_t *
 
                attr[0] = FR_PROXY_STATE;
                attr[1] = 6;
-               memcpy(attr + 2, &c->proxy_state, 4);
+               memcpy(attr + 2, &c->inst->parent->proxy_state, 4);
 
                hdr_len = (c->buffer[2] << 8) | (c->buffer[3]);
                hdr_len += 6;
@@ -728,7 +727,7 @@ static int conn_write(rlm_radius_udp_connection_t *c, rlm_radius_udp_request_t *
 
                if (radlog_debug_enabled(L_DBG, L_DBG_LVL_2, request)) {
                        RINDENT();
-                       RDEBUG2("&Proxy-State := 0x%08x", c->proxy_state);
+                       RDEBUG2("&Proxy-State := 0x%08x", c->inst->parent->proxy_state);
                        REXDENT();
                }
 
@@ -940,7 +939,6 @@ static fr_connection_state_t conn_open(UNUSED fr_event_list_t *el, UNUSED int fd
        c->name = talloc_asprintf(c, "proto udp local %s port %u remote %s port %u",
                                  src_buf, c->src_port,
                                  dst_buf, c->dst_port);
-       c->proxy_state = fr_rand();
        c->state = CONN_OPENING;
 
        /*