]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
move client src_ipaddr mangling to proto_radius
authorAlan T. DeKok <aland@freeradius.org>
Mon, 25 Sep 2017 15:13:33 +0000 (11:13 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 25 Sep 2017 15:17:00 +0000 (11:17 -0400)
so that the process functions are entirely protocol agnostic
almost... they still print src/dst IP information for debugging

src/modules/proto_radius/proto_radius.c
src/modules/proto_radius/proto_radius_acct.c
src/modules/proto_radius/proto_radius_auth.c
src/modules/proto_radius/proto_radius_coa.c
src/modules/proto_radius/proto_radius_status.c

index 417b17b4029c1c69e0ec09e198b6bfd407ec2568..bee7261bd6222a6fe40793584f9c854f92f4c704 100644 (file)
@@ -219,6 +219,18 @@ static ssize_t mod_encode(void const *instance, REQUEST *request, uint8_t *buffe
        client = inst->app_io_private->client(inst->app_io, request->async->packet_ctx);
        rad_assert(client);
 
+#ifdef WITH_UDPFROMTO
+       /*
+        *      Overwrite the src ip address on the outbound packet
+        *      with the one specified by the client.  This is useful
+        *      to work around broken DSR implementations and other
+        *      routing issues.
+        */
+       if (client->src_ipaddr.af != AF_UNSPEC) {
+               request->reply->src_ipaddr = client->src_ipaddr;
+       }
+#endif
+
        if (fr_radius_packet_encode(request->reply, request->packet, client->secret) < 0) {
                RDEBUG("Failed encoding RADIUS reply: %s", fr_strerror());
                return -1;
index 358448fe3a092b461abe87aa8dfae31a76813813..77909658c156a0a801cb6009241d9e0fad8889f0 100644 (file)
@@ -165,18 +165,6 @@ static fr_io_final_t mod_process(REQUEST *request, fr_io_action_t action)
                        return FR_IO_DONE;
                }
 
-#ifdef WITH_UDPFROMTO
-               /*
-                *      Overwrite the src ip address on the outbound packet
-                *      with the one specified by the client.
-                *      This is useful to work around broken DSR implementations
-                *      and other routing issues.
-                */
-               if (request->client->src_ipaddr.af != AF_UNSPEC) {
-                       request->reply->src_ipaddr = request->client->src_ipaddr;
-               }
-#endif
-
                if (RDEBUG_ENABLED) common_packet_debug(request, request->reply, false);
                break;
 
index 78dd25761ec9681ca6b700f82150946df8a13067..047c0b253026cb4b569f6e94a1871db61bac4146 100644 (file)
@@ -501,18 +501,6 @@ static fr_io_final_t mod_process(REQUEST *request, fr_io_action_t action)
                        return FR_IO_REPLY;
                }
 
-#ifdef WITH_UDPFROMTO
-               /*
-                *      Overwrite the src ip address on the outbound packet
-                *      with the one specified by the client.
-                *      This is useful to work around broken DSR implementations
-                *      and other routing issues.
-                */
-               if (request->client->src_ipaddr.af != AF_UNSPEC) {
-                       request->reply->src_ipaddr = request->client->src_ipaddr;
-               }
-#endif
-
                if (RDEBUG_ENABLED) common_packet_debug(request, request->reply, false);
                break;
 
index 557f3927f16a1738ad261b47c62fcf1864d14ba8..13e1bc8702094f80bede1f22ecba6539aa2659f9 100644 (file)
@@ -213,18 +213,6 @@ static fr_io_final_t mod_process(REQUEST *request, fr_io_action_t action)
                        return FR_IO_DONE;
                }
 
-#ifdef WITH_UDPFROMTO
-               /*
-                *      Overwrite the src ip address on the outbound packet
-                *      with the one specified by the client.
-                *      This is useful to work around broken DSR implementations
-                *      and other routing issues.
-                */
-               if (request->client->src_ipaddr.af != AF_UNSPEC) {
-                       request->reply->src_ipaddr = request->client->src_ipaddr;
-               }
-#endif
-
                if (RDEBUG_ENABLED) common_packet_debug(request, request->reply, false);
                break;
 
index 32137e104db655e91716f60cf6dc4fd840a444f1..6064b4fde9f46cb6a45fbff76f7359b330f4d566 100644 (file)
@@ -178,18 +178,6 @@ static fr_io_final_t mod_process(REQUEST *request, fr_io_action_t action)
                        return FR_IO_DONE;
                }
 
-#ifdef WITH_UDPFROMTO
-               /*
-                *      Overwrite the src ip address on the outbound packet
-                *      with the one specified by the client.
-                *      This is useful to work around broken DSR implementations
-                *      and other routing issues.
-                */
-               if (request->client && (request->client->src_ipaddr.af != AF_UNSPEC)) {
-                       request->reply->src_ipaddr = request->client->src_ipaddr;
-               }
-#endif
-
                if (RDEBUG_ENABLED) common_packet_debug(request, request->reply, false);
                break;