]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
remove "originate-coa" functionality.
authorAlan T. DeKok <aland@freeradius.org>
Thu, 29 Jun 2017 18:01:04 +0000 (14:01 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 29 Jun 2017 18:01:04 +0000 (14:01 -0400)
This can now (or soon will be) done via fork / radius-client module

raddb/clients.conf
raddb/sites-available/originate-coa [deleted file]
src/include/radiusd.h
src/include/tmpl.h
src/main/map.c
src/main/process.c
src/main/request.c
src/main/tmpl.c
src/main/util.c
src/tests/unit/xlat.txt

index 76b300d3c55f1c5c052289b76bf28ac3a370bbb2..8e4f1cb0bf70d274680fff338b8bcf56599a2ef8 100644 (file)
@@ -163,13 +163,6 @@ client localhost {
        #
 #      virtual_server = home1
 
-       #
-       #  A pointer to the "home_server_pool" OR a "home_server"
-       #  section that contains the CoA configuration for this
-       #  client.  For an example of a coa home server or pool,
-       #  see raddb/sites-available/originate-coa
-#      coa_server = coa
-
        #
        #  Response window for proxied packets.  If non-zero,
        #  then the lower of (home, client) response_window
diff --git a/raddb/sites-available/originate-coa b/raddb/sites-available/originate-coa
deleted file mode 100644 (file)
index 3325b88..0000000
+++ /dev/null
@@ -1,185 +0,0 @@
-# -*- text -*-
-######################################################################
-#
-#  The server can originate Change of Authorization (CoA) or
-#  Disconnect request packets.  These packets are used to dynamically
-#  change the parameters of a users session (bandwidth, etc.), or
-#  to forcibly disconnect the user.
-#
-#  There are some caveats.  Not all NAS vendors support this
-#  functionality.  Even for the ones that do, it may be difficult to
-#  find out what needs to go into a CoA-Request or Disconnect-Request
-#  packet.  All we can suggest is to read the NAS documentation
-#  available from the vendor.  That documentation SHOULD describe
-#  what information their equipment needs to see in a CoA packet.
-#
-#  This information is usually a list of attributes such as:
-#
-#      NAS-IP-Address (or NAS-IPv6 address)
-#      NAS-Identifier
-#      User-Name
-#      Acct-Session-Id
-#
-#  CoA packets can be originated when a normal Access-Request or
-#  Accounting-Request packet is received.  Simply update the
-#  "coa" list:
-#
-#      update coa {
-#             &User-Name = "%{User-Name}"
-#             &Acct-Session-Id = "%{Acct-Session-Id}"
-#             &NAS-IP-Address = "%{NAS-IP-Address}"
-#      }
-#
-#  And the CoA packet will be sent.  You can also send Disconnect
-#  packets by using "update disconnect { ...".
-#
-#  This "update coa" entry can be placed in any section (authorize,
-#  preacct, etc.), EXCEPT for pre-proxy and post-proxy.  The CoA
-#  packets CANNOT be sent if the original request has been proxied.
-#
-#  The CoA functionality works best when the RADIUS server and
-#  the NAS receiving CoA packets are on the same network.
-#
-#  If "update coa { ... " is used, and then later it becomes necessary
-#  to not send a CoA request, the following example can suppress the
-#  CoA packet:
-#
-#      update control {
-#              &Send-CoA-Request = No
-#      }
-#
-#  The default destination of a CoA packet is the NAS (or client)
-#  the sent the original Access-Request or Accounting-Request.  See
-#  raddb/clients.conf for a "coa_server" configuration that ties
-#  a client to a specific home server, or to a home server pool.
-#
-#  If you need to send the packet to a different destination, update
-#  the "coa" list with one of:
-#
-#      Packet-Dst-IP-Address = ...
-#      Packet-Dst-IPv6-Address = ...
-#      Home-Server-Pool = ...
-#
-#  That specifies an Ipv4 or IPv6 address, or a home server pool
-#  (such as the "coa" pool example below).  This use is not
-#  recommended, however,  It is much better to point the client
-#  configuration directly at the CoA server/pool, as outlined
-#  earlier.
-#
-#  If the CoA port is non-standard, you can also set:
-#
-#      Packet-Dst-Port
-#
-#  to have the value of the port.
-#
-######################################################################
-
-#
-#  When CoA packets are sent to a NAS, the NAS is acting as a
-#  server (see RFC 5176).  i.e. it has a type (accepts CoA and/or
-#  Disconnect packets), an IP address (or IPv6 address), a
-#  destination port, and a shared secret.
-#
-home_server example-coa {
-       type = coa
-
-       #
-       #  Note that a home server of type "coa" MUST be a real NAS,
-       #  with an ipaddr or ipv6addr.  It CANNOT point to a virtual
-       #  server.
-       #
-       #  Change this IP address to the IP address of the NAS.
-       #
-       ipaddr = 192.0.2.42
-       port = 3799
-
-       #  This secret SHOULD NOT be the same as the shared
-       #  secret in a "client" section.
-       secret = testing1234
-
-       #  CoA specific parameters.  See raddb/proxy.conf for details.
-       coa {
-               irt = 2
-               mrt = 16
-               mrc = 5
-               mrd = 30
-       }
-}
-
-#
-#  CoA servers can be put into pools, just like normal servers.
-#
-home_server_pool coa {
-       type = fail-over
-
-       # Point to the CoA server above.
-       home_server = example-coa
-
-       #  CoA requests are run through the pre-proxy section.
-       #  CoA responses are run through the post-proxy section.
-       virtual_server = originate-coa.example.com
-
-       #
-       #  Home server pools of type "coa" cannot (currently) have
-       #  a "fallback" configuration.
-       #
-}
-
-#
-#  When this virtual server is run, the original request has FINISHED
-#  processing.  i.e. the reply has already been sent to the NAS.
-#  You can access the attributes in the original packet, reply, and
-#  control items, but changing them will have NO EFFECT.
-#
-#  The CoA packet is in the "proxy-request" attribute list.
-#  The CoA reply (if any) is in the "proxy-reply" attribute list.
-#
-server originate-coa.example.com {
-  pre-proxy {
-       update proxy-request {
-               NAS-IP-Address = 192.0.2.42
-       }
-  }
-
-  #
-  # Handle the responses here.
-  #
-  post-proxy {
-       switch &proxy-reply:Packet-Type {
-               case CoA-ACK {
-                       ok
-               }
-
-               case CoA-NAK {
-                       # the NAS didn't like the CoA request
-                       ok
-               }
-
-               case Disconnect-ACK {
-                       ok
-               }
-
-               case Disconnect-NAK {
-                       # the NAS didn't like the Disconnect request
-                       ok
-               }
-
-               # Invalid packet type.  This shouldn't happen.
-               case {
-                    fail
-               }
-       }
-
-       #
-       #  These methods are run when there is NO response
-       #  to the request.
-       #
-       Post-Proxy-Type Fail-CoA {
-               ok
-       }
-
-       Post-Proxy-Type Fail-Disconnect {
-               ok
-       }
-  }
-}
index 9fe62e2890bdd2451bf1b6271caf5746b6b19890..03d1c1843b190be8818c9d3495e0d9868ad827fa 100644 (file)
@@ -319,10 +319,6 @@ struct rad_request {
 
        uint32_t                options;        //!< mainly for proxying EAP-MSCHAPv2.
 
-#ifdef WITH_COA
-       REQUEST                 *coa;           //!< CoA request originated by this request.
-#endif
-
        fr_async_t              *async;         //!< for new async listeners
 };                             /* REQUEST typedef */
 
@@ -332,7 +328,6 @@ struct rad_request {
 #define RAD_REQUEST_LVL_DEBUG3 (3)
 #define RAD_REQUEST_LVL_DEBUG4 (4)
 
-#define RAD_REQUEST_OPTION_COA (1 << 0)
 #define RAD_REQUEST_OPTION_CTX (1 << 1)
 #define RAD_REQUEST_OPTION_DETAIL (1 << 2)
 
@@ -423,7 +418,6 @@ void                talloc_const_free(void const *ptr);
 char           *rad_ajoin(TALLOC_CTX *ctx, char const **argv, int argc, char c);
 REQUEST                *request_alloc(TALLOC_CTX *ctx);
 REQUEST                *request_alloc_fake(REQUEST *oldreq);
-REQUEST                *request_alloc_coa(REQUEST *request);
 REQUEST                *request_alloc_proxy(REQUEST *request);
 int            request_data_add(REQUEST *request, void const *unique_ptr, int unique_int, void *opaque,
                                 bool free_on_replace, bool free_on_parent, bool persist);
index ec99870f4e257d8b3ee79f6bacc75b25b8edddb3..b47aafe440465168f76f15556a0b2df87300ca7b 100644 (file)
@@ -91,14 +91,6 @@ typedef enum pair_lists {
        PAIR_LIST_PROXY_REPLY,          //!< Attributes sent in response to the proxied
                                        ///< request.
 #endif
-#ifdef WITH_COA
-       PAIR_LIST_COA,                  //!< Attributes to send in a forked CoA-Request.
-       PAIR_LIST_COA_REPLY,            //!< Attributes sent in response to the forked
-                                       ///< CoA-Request.
-       PAIR_LIST_DM,                   //!< Attributes to send in a forked Disconnect-Request.
-       PAIR_LIST_DM_REPLY              //!< Attributes sent in response to the forked
-                                       //!< Disconnect-Request.
-#endif
 } pair_lists_t;
 
 extern const FR_NAME_NUMBER pair_lists[];
index 59abc862ba82ee0d1936f512e2d88484aa75580c..8347f8be92aff4007e866f2fc5af8ac39655860a 100644 (file)
@@ -1063,22 +1063,6 @@ int map_to_request(REQUEST *request, vp_map_t const *map, radius_map_getvalue_t
                goto finish;
        }
 
-       /*
-        *      If there's no CoA packet and we're updating it,
-        *      auto-allocate it.
-        */
-       if (((map->lhs->tmpl_list == PAIR_LIST_COA) ||
-            (map->lhs->tmpl_list == PAIR_LIST_DM)) && !request->coa) {
-               if (!request_alloc_coa(context)) {
-                       REDEBUG("Failed to create a CoA/Disconnect Request message");
-                       rcode = -2;
-                       goto finish;
-               }
-               context->coa->proxy->packet->code = (map->lhs->tmpl_list == PAIR_LIST_COA) ?
-                                           FR_CODE_COA_REQUEST :
-                                           FR_CODE_DISCONNECT_REQUEST;
-       }
-
        list = radius_list(context, map->lhs->tmpl_list);
        if (!list) {
                REDEBUG("Mapping \"%.*s\" -> \"%.*s\" invalid in this context",
index 4e62cf2b87976ed0d64c8f055cf6dece8a05b8ac..c75d3599b3b34f7763e2c838c35f0901ee122957 100644 (file)
@@ -363,18 +363,6 @@ static int insert_into_proxy_hash(REQUEST *request) CC_HINT(nonnull);
 
 static int request_pre_handler(REQUEST *request, UNUSED fr_state_action_t action) CC_HINT(nonnull);
 
-#ifdef WITH_COA
-static void request_coa_originate(REQUEST *request) CC_HINT(nonnull);
-STATE_MACHINE_DECL(coa_wait_for_reply) CC_HINT(nonnull);
-STATE_MACHINE_DECL(coa_queued) CC_HINT(nonnull);
-STATE_MACHINE_DECL(coa_no_reply) CC_HINT(nonnull);
-STATE_MACHINE_DECL(coa_running) CC_HINT(nonnull);
-static void coa_separate(REQUEST *request) CC_HINT(nonnull);
-#  define COA_SEPARATE if (request->coa) coa_separate(request->coa);
-#else
-#  define COA_SEPARATE
-#endif
-
 #define CHECK_FOR_STOP do { if (request->master_state == REQUEST_STOP_PROCESSING) {action = FR_ACTION_DONE;}} while (0)
 #define CHECK_FOR_PROXY_CANCELLED do { if (!request->proxy->listener) {action = FR_ACTION_DONE;}} while (0)
 
@@ -648,17 +636,6 @@ static void request_done(REQUEST *request, fr_state_action_t action)
                return;
        }
 
-#ifdef WITH_COA
-       /*
-        *      Move the CoA request to its own handler.
-        */
-       if (request->coa) {
-               coa_separate(request->coa);
-       } else if (request->parent && (request->parent->coa == request)) {
-               coa_separate(request);
-       }
-#endif
-
        switch (action) {
        case FR_ACTION_DUP:
 #ifdef WITH_DETAIL
@@ -930,7 +907,6 @@ static void request_cleanup_delay(REQUEST *request, fr_state_action_t action)
 
        TRACE_STATE_MACHINE;
        ASSERT_MASTER;
-       COA_SEPARATE;
        CHECK_FOR_STOP;
 
        switch (action) {
@@ -1012,7 +988,6 @@ static void request_response_delay(REQUEST *request, fr_state_action_t action)
 
        TRACE_STATE_MACHINE;
        ASSERT_MASTER;
-       COA_SEPARATE;
        CHECK_FOR_STOP;
 
        switch (action) {
@@ -1142,7 +1117,7 @@ static int request_pre_handler(REQUEST *request, UNUSED fr_state_action_t action
  *  Various cleanups, suppress responses, copy Proxy-State, and set
  *  response_delay or cleanup_delay;
  */
-static void request_finish(REQUEST *request, fr_state_action_t action)
+static void request_finish(REQUEST *request, UNUSED fr_state_action_t action)
 {
        VALUE_PAIR *vp;
 
@@ -1155,15 +1130,6 @@ static void request_finish(REQUEST *request, fr_state_action_t action)
                return;
        }
 
-#ifdef WITH_COA
-       /*
-        *      Don't do post-auth if we're a CoA request originated
-        *      from an Access-Request.  See request_alloc_coa() for
-        *      details.
-        */
-       if ((request->options & RAD_REQUEST_OPTION_COA) != 0) goto done;
-#endif
-
        /*
         *      Override the response code if a control:Response-Packet-Type attribute is present.
         */
@@ -1224,15 +1190,6 @@ static void request_finish(REQUEST *request, fr_state_action_t action)
                if (vp) rad_postauth(request);
        }
 
-#ifdef WITH_COA
-       /*
-        *      Maybe originate a CoA request.
-        */
-       if ((action == FR_ACTION_RUN) && !request->proxy && request->coa) {
-               request_coa_originate(request);
-       }
-#endif
-
        /*
         *      Clean up.  These are no longer needed.
         */
@@ -1398,7 +1355,6 @@ static void request_running(REQUEST *request, fr_state_action_t action)
 
        switch (action) {
        case FR_ACTION_TIMER:
-               COA_SEPARATE;
                (void) request_max_time(request);
                break;
 
@@ -3047,16 +3003,6 @@ static int request_will_proxy(REQUEST *request)
 do_home:
        home_server_update_request(home, request);
 
-#ifdef WITH_COA
-       if (request->coa) {
-               REQUEST *coa = request->coa;
-
-               request->coa = NULL;
-               coa->parent = NULL;
-               request_free(coa);
-       }
-#endif
-
        /*
         *      Remember that we sent the request to a Realm.
         */
@@ -4094,631 +4040,6 @@ static void proxy_wait_for_reply(REQUEST *request, fr_state_action_t action)
 #endif /* WITH_PROXY */
 
 
-/***********************************************************************
- *
- *  CoA code
- *
- ***********************************************************************/
-#ifdef WITH_COA
-static rlm_rcode_t null_handler(UNUSED REQUEST *request)
-{
-       return 0;
-}
-
-/*
- *     See if we need to originate a CoA request.
- */
-static void request_coa_originate(REQUEST *request)
-{
-       int rcode, pre_proxy_type = 0;
-       VALUE_PAIR *vp;
-       REQUEST *coa;
-       fr_ipaddr_t ipaddr;
-
-       VERIFY_REQUEST(request);
-
-       rad_assert(request->coa != NULL);
-       rad_assert(request->proxy == NULL);
-       rad_assert(!request->in_proxy_hash);
-
-       /*
-        *      Check whether we want to originate one, or cancel one.
-        */
-       vp = fr_pair_find_by_num(request->control, 0, FR_SEND_COA_REQUEST, TAG_ANY);
-       if (!vp) {
-               vp = fr_pair_find_by_num(request->coa->proxy->packet->vps, 0, FR_SEND_COA_REQUEST, TAG_ANY);
-       }
-
-       if (vp) {
-               if (vp->vp_uint32 == 0) {
-               fail:
-                       TALLOC_FREE(request->coa);
-                       return;
-               }
-       }
-
-       coa = request->coa;
-
-       /*
-        *      src_ipaddr will be set up in proxy_encode.
-        */
-       memset(&ipaddr, 0, sizeof(ipaddr));
-       vp = fr_pair_find_by_num(coa->proxy->packet->vps, 0, FR_PACKET_DST_IP_ADDRESS, TAG_ANY);
-       if (vp) {
-               memcpy(&ipaddr, &vp->vp_ip, sizeof(ipaddr));
-       } else if ((vp = fr_pair_find_by_num(coa->proxy->packet->vps, 0, FR_PACKET_DST_IPV6_ADDRESS, TAG_ANY)) != NULL) {
-               memcpy(&ipaddr, &vp->vp_ip, sizeof(ipaddr));
-       } else if ((vp = fr_pair_find_by_num(coa->proxy->packet->vps, 0, FR_HOME_SERVER_POOL, TAG_ANY)) != NULL) {
-               coa->home_pool = home_pool_byname(vp->vp_strvalue,
-                                                 HOME_TYPE_COA);
-               if (!coa->home_pool) {
-                       RWDEBUG2("No such home_server_pool %s",
-                              vp->vp_strvalue);
-                       goto fail;
-               }
-
-       } else {
-               /*
-                *      If all else fails, send it to the client that
-                *      originated this request.
-                */
-               memcpy(&ipaddr, &request->packet->src_ipaddr, sizeof(ipaddr));
-       }
-
-       /*
-        *      Use the pool, if it exists.
-        */
-       if (coa->home_pool) {
-               coa->home_server = home_server_ldb(NULL, coa->home_pool, coa);
-               if (!coa->home_server) {
-                       RWDEBUG("No live home server for home_server_pool %s", coa->home_pool->name);
-                       goto fail;
-               }
-               home_server_update_request(coa->home_server, coa);
-
-       } else if (!coa->home_server) {
-               uint16_t port = FR_COA_UDP_PORT;
-               char buffer[INET6_ADDRSTRLEN];
-
-               vp = fr_pair_find_by_num(coa->proxy->packet->vps, 0, FR_PACKET_DST_PORT, TAG_ANY);
-               if (vp) port = vp->vp_uint32;
-
-               coa->home_server = home_server_find(&ipaddr, port, IPPROTO_UDP);
-               if (!coa->home_server) {
-                       RWDEBUG2("Unknown destination %s:%d for CoA request",
-                                inet_ntop(ipaddr.af, &ipaddr.addr,
-                                          buffer, sizeof(buffer)), port);
-                       goto fail;
-               }
-       }
-
-       vp = fr_pair_find_by_num(coa->proxy->packet->vps, 0, FR_PACKET_TYPE, TAG_ANY);
-       if (vp) {
-               switch (vp->vp_uint32) {
-               case FR_CODE_COA_REQUEST:
-               case FR_CODE_DISCONNECT_REQUEST:
-                       coa->proxy->packet->code = vp->vp_uint32;
-                       break;
-
-               default:
-                       DEBUG("Cannot set CoA Packet-Type to code %d",
-                             vp->vp_uint32);
-                       goto fail;
-               }
-       }
-
-       if (!coa->proxy->packet->code) coa->proxy->packet->code = FR_CODE_COA_REQUEST;
-
-       /*
-        *      The rest of the server code assumes that
-        *      request->packet && request->reply exist.  Copy them
-        *      from the original request.
-        */
-       rad_assert(coa->packet != NULL);
-       rad_assert(coa->packet->vps == NULL);
-
-       coa->packet = fr_radius_copy(coa, request->packet);
-       coa->reply = fr_radius_copy(coa, request->reply);
-
-       coa->control = fr_pair_list_copy(coa, request->control);
-       coa->proxy->packet->count = 0;
-       coa->handle = null_handler;
-       coa->number = request->number; /* it's associated with the same request */
-       coa->seq_start = request->seq_start;
-
-       /*
-        *      Call the pre-proxy routines.
-        */
-       vp = fr_pair_find_by_num(request->control, 0, FR_PRE_PROXY_TYPE, TAG_ANY);
-       if (vp) {
-               fr_dict_enum_t const *dval = fr_dict_enum_by_value(NULL, vp->da, &vp->data);
-               /* Must be a validation issue */
-               rad_assert(dval);
-               RDEBUG2("Found Pre-Proxy-Type %s", dval->alias);
-               pre_proxy_type = vp->vp_uint32;
-       }
-
-       if (coa->home_pool && coa->home_pool->virtual_server) {
-               CONF_SECTION *old_server = coa->server_cs;
-
-               coa->proxy->server_cs = virtual_server_find(coa->home_pool->virtual_server);
-               coa->server_cs = coa->proxy->server_cs; /* @fixme 4.0 this shouldn't be necessary! */
-
-               RDEBUG2("server %s {", cf_section_name2(coa->server_cs));
-               RINDENT();
-               rcode = process_pre_proxy(pre_proxy_type, coa);
-               REXDENT();
-               RDEBUG2("}");
-               coa->server_cs = old_server;
-       } else {
-               rcode = process_pre_proxy(pre_proxy_type, coa);
-       }
-       switch (rcode) {
-       default:
-               goto fail;
-
-       /*
-        *      Only send the CoA packet if the pre-proxy code succeeded.
-        */
-       case RLM_MODULE_NOOP:
-       case RLM_MODULE_OK:
-       case RLM_MODULE_UPDATED:
-               break;
-       }
-
-       /*
-        *      Source IP / port is set when the proxy socket
-        *      is chosen.
-        */
-       coa->proxy->packet->dst_ipaddr = coa->home_server->ipaddr;
-       coa->proxy->packet->dst_port = coa->home_server->port;
-
-       if (!insert_into_proxy_hash(coa)) {
-               radlog_request(L_PROXY, 0, coa, "Failed to insert CoA request into proxy list");
-               goto fail;
-       }
-
-       /*
-        *      We CANNOT divorce the CoA request from the parent
-        *      request.  This function is running in a child thread,
-        *      and we need access to the main event loop in order to
-        *      to add the timers for the CoA packet.
-        *
-        *      Instead, we wait for the timer on the parent request
-        *      to fire.
-        */
-       gettimeofday(&coa->proxy->packet->timestamp, NULL);
-       coa->packet->timestamp = coa->proxy->packet->timestamp; /* for max_request_time */
-       coa->home_server->last_packet_sent = coa->proxy->packet->timestamp.tv_sec;
-       coa->delay = 0;         /* need to calculate a new delay */
-
-       /*
-        *      If requested, put a State attribute into the packet,
-        *      and cache the VPS.
-        */
-       fr_request_to_state(global_state, coa, NULL, coa->packet);
-
-       /*
-        *      Encode the packet before we do anything else.
-        */
-       coa->proxy->listener->encode(coa->proxy->listener, coa);
-       coa->proxy->listener->debug(coa, coa->proxy->packet, false);
-
-#ifdef DEBUG_STATE_MACHINE
-       if (rad_debug_lvl) printf("(%" PRIu64 ") ********\tSTATE %s C-%s -> C-%s\t********\n",
-                                 request->number, __FUNCTION__,
-                                 child_state_names[request->child_state],
-                                 child_state_names[REQUEST_PROXIED]);
-#endif
-
-       /*
-        *      Set the state function, then the state, no child, and
-        *      send the packet.
-        */
-       coa->process = coa_wait_for_reply;
-       coa->child_state = REQUEST_PROXIED;
-
-       coa->child_pid = NO_SUCH_CHILD_PID;
-
-       if (we_are_master()) coa_separate(request->coa);
-
-       /*
-        *      And send the packet.
-        */
-       coa->proxy->listener->send(coa->proxy->listener, coa);
-}
-
-
-static bool coa_keep_waiting(REQUEST *request)
-{
-       uint32_t delay, frac;
-       struct timeval now, when, mrd;
-       home_server_t *home = request->proxy->home_server;
-       char buffer[INET6_ADDRSTRLEN];
-
-       VERIFY_REQUEST(request);
-
-       /*
-        *      Use a new connection when the home server is
-        *      dead, or when there's no proxy listener, or
-        *      when the listener is failed or dead.
-        *
-        *      If the listener is known or frozen, use it for
-        *      retransmits.
-        */
-       if ((home->state == HOME_STATE_IS_DEAD) ||
-           !request->proxy->listener ||
-           (request->proxy->listener->status >= RAD_LISTEN_STATUS_EOL)) {
-               return false;
-       }
-
-       fr_event_list_time(&now, event_list);
-
-       if (request->delay == 0) {
-               /*
-                *      Implement re-transmit algorithm as per RFC 5080
-                *      Section 2.2.1.
-                *
-                *      We want IRT + RAND*IRT
-                *      or 0.9 IRT + rand(0,.2) IRT
-                *
-                *      2^20 ~ USEC, and we want 2.
-                *      rand(0,0.2) USEC ~ (rand(0,2^21) / 10)
-                */
-               delay = (fr_rand() & ((1 << 22) - 1)) / 10;
-               request->delay = delay * home->coa_irt;
-               delay = home->coa_irt * USEC;
-               delay -= delay / 10;
-               delay += request->delay;
-               request->delay = delay;
-
-               when = request->proxy->packet->timestamp;
-               tv_add(&when, delay);
-
-               if (fr_timeval_cmp(&when, &now) > 0) {
-                       STATE_MACHINE_TIMER;
-                       return true;
-               }
-       }
-
-       /*
-        *      Retransmit CoA request.
-        */
-
-       /*
-        *      Cap count at MRC, if it is non-zero.
-        */
-       if (home->coa_mrc &&
-           (request->proxy->packet->count >= home->coa_mrc)) {
-               RERROR("Failing request - originate-coa ID %u, due to lack of any response from coa server %s port %d",
-                      request->proxy->packet->id,
-                      inet_ntop(request->proxy->packet->dst_ipaddr.af,
-                                &request->proxy->packet->dst_ipaddr.addr,
-                                buffer, sizeof(buffer)),
-                      request->proxy->packet->dst_port);
-               return false;
-       }
-
-       /*
-        *      RFC 5080 Section 2.2.1
-        *
-        *      RT = 2*RTprev + RAND*RTprev
-        *         = 1.9 * RTprev + rand(0,.2) * RTprev
-        *         = 1.9 * RTprev + rand(0,1) * (RTprev / 5)
-        */
-       delay = fr_rand();
-       delay ^= (delay >> 16);
-       delay &= 0xffff;
-       frac = request->delay / 5;
-       delay = ((frac >> 16) * delay) + (((frac & 0xffff) * delay) >> 16);
-
-       delay += (2 * request->delay) - (request->delay / 10);
-
-       /*
-        *      Cap delay at MRT, if MRT is non-zero.
-        */
-       if (home->coa_mrt &&
-           (delay > (home->coa_mrt * USEC))) {
-               int mrt_usec = home->coa_mrt * USEC;
-
-               /*
-                *      delay = MRT + RAND * MRT
-                *            = 0.9 MRT + rand(0,.2)  * MRT
-                */
-               delay = fr_rand();
-               delay ^= (delay >> 15);
-               delay &= 0x1ffff;
-               delay = ((mrt_usec >> 16) * delay) + (((mrt_usec & 0xffff) * delay) >> 16);
-               delay += mrt_usec - (mrt_usec / 10);
-       }
-
-       request->delay = delay;
-       when = now;
-       tv_add(&when, request->delay);
-       mrd = request->proxy->packet->timestamp;
-       mrd.tv_sec += home->coa_mrd;
-
-       /*
-        *      Cap duration at MRD.
-        */
-       if (fr_timeval_cmp(&mrd, &when) < 0) {
-               when = mrd;
-       }
-       STATE_MACHINE_TIMER;
-
-       request->proxy->packet->count++;
-
-       FR_STATS_TYPE_INC(home->stats.total_requests);
-
-       RDEBUG2("Sending duplicate CoA request to home server %s port %d - ID: %d",
-               inet_ntop(request->proxy->packet->dst_ipaddr.af,
-                         &request->proxy->packet->dst_ipaddr.addr,
-                         buffer, sizeof(buffer)),
-               request->proxy->packet->dst_port,
-               request->proxy->packet->id);
-
-       request->proxy->listener->send(request->proxy->listener,
-                                     request);
-       return true;
-}
-
-
-/** Wait for a reply after originating a CoA a request.
- *
- *  Retransmit the proxied packet, or time out and go to
- *  coa_no_reply.  Mark the home server unresponsive, etc.
- *
- *  If we do receive a reply, we transition to coa_running.
- *
- *  \dot
- *     digraph coa_wait_for_reply {
- *             coa_wait_for_reply;
- *
- *             coa_wait_for_reply -> coa_no_reply [ label = "TIMER >= response_delay" ];
- *             coa_wait_for_reply -> timer [ label = "TIMER < max_request_time" ];
- *             coa_wait_for_reply -> coa_queued [ label = "PROXY_REPLY" arrowhead = "none"];
- *             coa_wait_for_reply -> done [ label = "TIMER >= max_request_time" ];
- *     }
- *  \enddot
- */
-static void coa_wait_for_reply(REQUEST *request, fr_state_action_t action)
-{
-       VERIFY_REQUEST(request);
-
-       TRACE_STATE_MACHINE;
-       ASSERT_MASTER;
-       CHECK_FOR_STOP;
-
-       if (request->parent) coa_separate(request);
-
-       switch (action) {
-       case FR_ACTION_TIMER:
-               if (request_max_time(request)) goto done;
-
-               /*
-                *      @fixme: for TCP, the socket may go away.
-                *      we probably want to do the checks for proxy_keep_waiting() ??
-                *
-                *      And maybe do fail-over, which would be nice!
-                */
-               if (coa_keep_waiting(request)) break;
-
-               /* FALL-THROUGH */
-
-       case FR_ACTION_PROXY_REPLY:
-               request_thread(request, coa_queued);
-               break;
-
-       case FR_ACTION_DONE:
-       done:
-               request->process = proxy_wait_for_id;
-               request->process(request, action);
-               break;
-
-       default:
-               RDEBUG3("%s: Ignoring action %s", __FUNCTION__, action_codes[action]);
-               break;
-       }
-}
-
-static void coa_separate(REQUEST *request)
-{
-       VERIFY_REQUEST(request);
-#ifdef DEBUG_STATE_MACHINE
-       fr_state_action_t action = FR_ACTION_TIMER;
-#endif
-
-       TRACE_STATE_MACHINE;
-       ASSERT_MASTER;
-
-       rad_assert(request->parent != NULL);
-       rad_assert(request->parent->coa == request);
-       rad_assert(request->ev == NULL);
-       rad_assert(!request->in_request_hash);
-       rad_assert(request->coa == NULL);
-
-       rad_assert(request->proxy->reply || request->proxy->listener);
-
-       (void) talloc_steal(NULL, request);
-       request->parent->coa = NULL;
-       request->parent = NULL;
-
-       if (we_are_master()) {
-               request->delay = 0;
-               (void) coa_keep_waiting(request);
-       }
-}
-
-
-/** Process a request after the CoA has timed out.
- *
- *  Run the packet through Post-Proxy-Type Fail
- *
- *  \dot
- *     digraph coa_no_reply {
- *             coa_no_reply;
- *
- *             coa_no_reply -> dup [ label = "DUP", arrowhead = "none" ];
- *             coa_no_reply -> timer [ label = "TIMER < max_request_time" ];
- *             coa_no_reply -> coa_reply_too_late [ label = "PROXY_REPLY" arrowhead = "none"];
- *             coa_no_reply -> process_proxy_reply [ label = "RUN" ];
- *             coa_no_reply -> done [ label = "TIMER >= timeout" ];
- *     }
- *  \enddot
- */
-static void coa_no_reply(REQUEST *request, fr_state_action_t action)
-{
-       char buffer[INET6_ADDRSTRLEN];
-
-       VERIFY_REQUEST(request);
-
-       TRACE_STATE_MACHINE;
-       CHECK_FOR_STOP;
-       CHECK_FOR_PROXY_CANCELLED;
-
-       switch (action) {
-       case FR_ACTION_TIMER:
-               (void) request_max_time(request);
-               break;
-
-       case FR_ACTION_PROXY_REPLY: /* too late! */
-               RDEBUG2("Reply from CoA server %s port %d  - ID: %d arrived too late.",
-                       inet_ntop(request->proxy->packet->src_ipaddr.af,
-                                 &request->proxy->packet->src_ipaddr.addr,
-                                 buffer, sizeof(buffer)),
-                       request->proxy->packet->dst_port, request->proxy->packet->id);
-               break;
-
-       case FR_ACTION_RUN:
-               if (process_proxy_reply(request, NULL)) {
-                       request->handle(request);
-               }
-               /* FALL-THROUGH */
-
-       case FR_ACTION_DONE:
-               request->process = proxy_wait_for_id;
-               request->process(request, action);
-               break;
-
-       default:
-               RDEBUG3("%s: Ignoring action %s", __FUNCTION__, action_codes[action]);
-               break;
-       }
-}
-
-
-/** Process the request after receiving a coa reply.
- *
- *  Throught the post-proxy section, and the through the handler
- *  function.
- *
- *  \dot
- *     digraph coa_running {
- *             coa_running;
- *
- *             coa_running -> timer [ label = "TIMER < max_request_time" ];
- *             coa_running -> process_proxy_reply [ label = "RUN" ];
- *             coa_running -> done [ label = "TIMER >= timeout" ];
- *     }
- *  \enddot
- */
-static void coa_running(REQUEST *request, fr_state_action_t action)
-{
-       VERIFY_REQUEST(request);
-
-       TRACE_STATE_MACHINE;
-       CHECK_FOR_STOP;
-       CHECK_FOR_PROXY_CANCELLED;
-
-       switch (action) {
-       case FR_ACTION_TIMER:
-               (void) request_max_time(request);
-               break;
-
-       case FR_ACTION_RUN:
-               if (request->proxy->listener->decode(request->proxy->listener, request) < 0) goto done;
-               request->proxy->listener->debug(request, request->proxy->reply, true);
-
-               if (process_proxy_reply(request, request->proxy->reply)) {
-                       request->handle(request);
-               }
-               /* FALL-THROUGH */
-
-       done:
-       case FR_ACTION_DONE:
-               request->process = proxy_wait_for_id;
-               request->process(request, action);
-               break;
-
-       default:
-               RDEBUG3("%s: Ignoring action %s", __FUNCTION__, action_codes[action]);
-               break;
-       }
-}
-
-/** Handle events while a CoA packet is in the queue.
- *
- *  \dot
- *     digraph coa_queued {
- *             coa_queued;
- *
- *             coa_queued -> timer [ label = "TIMER < max_request_time" ];
- *             coa_queued -> coa_queued [ label = "PROXY_REPLY" ];
- *             coa_queued -> coa_running [ label = "RUN with reply" ];
- *             coa_queued -> coa_no_reply [ label = "RUN without reply" ];
- *             coa_queued -> done [ label = "TIMER >= timeout" ];
- *     }
- *  \enddot
- */
-static void coa_queued(REQUEST *request, fr_state_action_t action)
-{
-       VERIFY_REQUEST(request);
-
-       TRACE_STATE_MACHINE;
-       CHECK_FOR_STOP;
-       CHECK_FOR_PROXY_CANCELLED;
-
-       switch (action) {
-       case FR_ACTION_TIMER:
-               (void) request_max_time(request);
-               break;
-
-               /*
-                *      We have a proxy reply, but wait for it to be
-                *      de-queued before doing anything.
-                */
-       case FR_ACTION_PROXY_REPLY:
-               break;
-
-       case FR_ACTION_RUN:
-               if (request->proxy->reply) {
-                       request->process = coa_running;
-                       request->process(request, FR_ACTION_RUN);
-                       break;
-
-               } else if (setup_post_proxy_fail(request)) {
-                       request->process = coa_no_reply;
-                       request->process(request, FR_ACTION_RUN);
-                       break;
-
-               } else {        /* no Post-Proxy-Type fail */
-                       goto done;
-               }
-
-       case FR_ACTION_DONE:
-               request_queue_extract(request);
-       done:
-               request->process = proxy_wait_for_id;
-                request->process(request, action);
-               break;
-
-       default:
-               RDEBUG3("%s: Ignoring action %s", __FUNCTION__, action_codes[action]);
-               break;
-       }
-}
-#endif /* WITH_COA */
-
 /***********************************************************************
  *
  *  End of the State machine.  Start of additional helper code.
@@ -5497,12 +4818,6 @@ static int request_delete_cb(UNUSED void *ctx, void *data)
                        (unsigned int) (request->packet->timestamp.tv_sec - fr_start_time));
        }
 
-#ifdef WITH_COA
-       if (request->coa) {
-               rad_assert(!request->coa->in_proxy_hash);
-       }
-#endif
-
        request_free(request);
 
        /*
index ffcc518eb31801ca453a83ab62018b057823d255..6441f894c7b5f5622211849e836d2ac0cf4982cf 100644 (file)
@@ -55,10 +55,6 @@ static int _request_free(REQUEST *request)
 #endif
        rad_assert(!request->ev);
 
-#ifdef WITH_COA
-       rad_assert(request->coa == NULL);
-#endif
-
 #ifndef NDEBUG
        request->magic = 0x01020304;    /* set the request to be nonsense */
 #endif
@@ -228,40 +224,6 @@ REQUEST *request_alloc_fake(REQUEST *request)
        return fake;
 }
 
-#ifdef WITH_COA
-REQUEST *request_alloc_coa(REQUEST *request)
-{
-       if (!request || request->coa) return NULL;
-
-       /*
-        *      Originate CoA requests only when necessary.
-        */
-       if ((request->packet->code != FR_CODE_ACCESS_REQUEST) &&
-           (request->packet->code != FR_CODE_ACCOUNTING_REQUEST)) return NULL;
-
-       request->coa = request_alloc_fake(request);
-       if (!request->coa) return NULL;
-
-       request->coa->parent = request;
-       request->coa->options = RAD_REQUEST_OPTION_COA; /* is a CoA packet */
-       request->coa->packet->code = 0; /* unknown, as of yet */
-       request->coa->child_state = REQUEST_RUNNING;
-       request->coa->proxy = request_alloc(request->coa);
-       if (!request->coa->proxy) {
-               TALLOC_FREE(request->coa);
-               return NULL;
-       }
-
-       request->coa->proxy->packet = fr_radius_alloc(request->coa->proxy, false);
-       if (!request->coa->proxy->packet) {
-               TALLOC_FREE(request->coa);
-               return NULL;
-       }
-
-       return request->coa;
-}
-#endif
-
 REQUEST *request_alloc_proxy(REQUEST *request)
 {
        request->proxy = request_alloc(request);
index 218afb775983c4093ecaa8a14409e07e62e7ab94..65be8dca5c0c42f516b0e2e8939ff7435a91e89b 100644 (file)
@@ -59,12 +59,6 @@ const FR_NAME_NUMBER pair_lists[] = {
 #ifdef WITH_PROXY
        { "proxy-request",      PAIR_LIST_PROXY_REQUEST },
        { "proxy-reply",        PAIR_LIST_PROXY_REPLY },
-#endif
-#ifdef WITH_COA
-       { "coa",                PAIR_LIST_COA },
-       { "coa-reply",          PAIR_LIST_COA_REPLY },
-       { "disconnect",         PAIR_LIST_DM },
-       { "disconnect-reply",   PAIR_LIST_DM_REPLY },
 #endif
        {  NULL , -1 }
 };
@@ -224,37 +218,6 @@ VALUE_PAIR **radius_list(REQUEST *request, pair_lists_t list)
        case PAIR_LIST_PROXY_REPLY:
                if (!request->proxy || !request->proxy->reply) break;
                return &request->proxy->reply->vps;
-#endif
-#ifdef WITH_COA
-       case PAIR_LIST_COA:
-               if (request->coa &&
-                   (request->coa->proxy->packet->code == FR_CODE_COA_REQUEST)) {
-                       return &request->coa->proxy->packet->vps;
-               }
-               break;
-
-       case PAIR_LIST_COA_REPLY:
-               if (request->coa && /* match reply with request */
-                   (request->coa->proxy->packet->code == FR_CODE_COA_REQUEST) &&
-                   request->coa->proxy->reply) {
-                       return &request->coa->proxy->reply->vps;
-               }
-               break;
-
-       case PAIR_LIST_DM:
-               if (request->coa &&
-                   (request->coa->proxy->packet->code == FR_CODE_DISCONNECT_REQUEST)) {
-                       return &request->coa->proxy->packet->vps;
-               }
-               break;
-
-       case PAIR_LIST_DM_REPLY:
-               if (request->coa && /* match reply with request */
-                   (request->coa->proxy->packet->code == FR_CODE_DISCONNECT_REQUEST) &&
-                   request->coa->proxy->reply) {
-                       return &request->coa->proxy->reply->vps;
-               }
-               break;
 #endif
        }
 
@@ -301,18 +264,6 @@ RADIUS_PACKET *radius_packet(REQUEST *request, pair_lists_t list)
                if (!request->proxy) return NULL;
                return request->proxy->reply;
 #endif
-
-#ifdef WITH_COA
-       case PAIR_LIST_COA:
-       case PAIR_LIST_DM:
-               if (!request->coa) return NULL;
-               return request->coa->proxy->packet;
-
-       case PAIR_LIST_COA_REPLY:
-       case PAIR_LIST_DM_REPLY:
-               if (!request->coa) return NULL;
-               return request->coa->proxy->reply;
-#endif
        }
 
        return NULL;
@@ -360,31 +311,6 @@ TALLOC_CTX *radius_list_ctx(REQUEST *request, pair_lists_t list)
                return request->proxy->reply;
 #endif
 
-#ifdef WITH_COA
-       case PAIR_LIST_COA:
-               if (!request->coa) return NULL;
-               rad_assert(request->coa->proxy != NULL);
-               if (request->coa->proxy->packet->code != FR_CODE_COA_REQUEST) return NULL;
-               return request->coa->proxy->packet;
-
-       case PAIR_LIST_COA_REPLY:
-               if (!request->coa) return NULL;
-               rad_assert(request->coa->proxy != NULL);
-               if (request->coa->proxy->packet->code != FR_CODE_COA_REQUEST) return NULL;
-               return request->coa->proxy->reply;
-
-       case PAIR_LIST_DM:
-               if (!request->coa) return NULL;
-               rad_assert(request->coa->proxy != NULL);
-               if (request->coa->proxy->packet->code != FR_CODE_DISCONNECT_REQUEST) return NULL;
-               return request->coa->proxy->packet;
-
-       case PAIR_LIST_DM_REPLY:
-               if (!request->coa) return NULL;
-               rad_assert(request->coa->proxy != NULL);
-               if (request->coa->proxy->packet->code != FR_CODE_DISCONNECT_REQUEST) return NULL;
-               return request->coa->proxy->reply;
-#endif
        /* Don't add default */
        case PAIR_LIST_UNKNOWN:
                break;
index 4723ae9e05253a7741c6897d16b583b7711b2b84..e2cbfc6a14d253ee6014457f84ab53de837c88d9 100644 (file)
@@ -911,15 +911,6 @@ void verify_request(char const *file, int line, REQUEST *request)
        }
 #endif
 
-#ifdef WITH_COA
-       if (request->coa) {
-               (void) talloc_get_type_abort(request->coa, REQUEST);
-
-               rad_assert(request == talloc_parent(request->coa));
-
-               verify_request(file, line, request->coa);
-       }
-#endif
 }
 #endif
 
index 5dc4893fcd219977cc8c283ca9f06ad70e618d64..f2535b4dda06d12b80c4e73733f82d1e8e819008 100644 (file)
@@ -77,12 +77,6 @@ data %{User-Name[*]}
 xlat %{request:User-Name[#]}
 data %{User-Name[#]}
 
-xlat %{coa:User-Name[#]}
-data %{coa:User-Name[#]}
-
-xlat %{coaX:User-Name[#]}
-data ERROR offset 2 'Unknown module'
-
 xlat %{3GPP-SGSN-Address}
 data %{3GPP-SGSN-Address}