Clean up CoA origination to not depend on CoA
authorAlan T. DeKok <aland@freeradius.org>
Mon, 19 Jan 2009 12:41:34 +0000 (13:41 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 19 Jan 2009 12:41:34 +0000 (13:41 +0100)
This makes the patch a little cleaner

src/main/event.c

index 9a9c304..0119b5a 100644 (file)
@@ -1201,6 +1201,7 @@ static void wait_a_bit(void *ctx)
                 */
                if (!request->in_request_hash &&
                    request->proxy &&
+                   (request->packet->code != request->proxy->code) &&
                    ((request->proxy->code == PW_COA_REQUEST) ||
                     (request->proxy->code == PW_DISCONNECT_REQUEST))) {
                        /*
@@ -1660,9 +1661,12 @@ static int process_proxy_reply(REQUEST *request)
        }
 
 #ifdef WITH_COA
-       if ((request->proxy->code != PW_COA_REQUEST) &&
-           (request->proxy->code != PW_DISCONNECT_REQUEST))
-               /* quietly follow the next if request->proxy_reply */
+       if (request->packet->code == request->proxy->code)
+         /*
+          *    Don't run the next bit if we originated a CoA
+          *    packet, after receiving an Access-Request or
+          *    Accounting-Request.
+          */
 #endif
        
        /*
@@ -2876,8 +2880,7 @@ REQUEST *received_proxy_response(RADIUS_PACKET *packet)
         *      This is a response to a CoA packet that we originated.
         *      It's handled differently from normal proxied packets.
         */
-       if ((request->proxy->code == PW_COA_REQUEST) ||
-           (request->proxy->code == PW_DISCONNECT_REQUEST)) {
+       if (request->packet->code != request->proxy->code) {
                /*
                 *      The parent request is done, but we haven't
                 *      figured that out yet.  Separate the two