fr_trie_t *trie; //!< track networks for dynamic clients
RADCLIENT_LIST *clients; //!< local clients
+ RADCLIENT_LIST *pending; //!< pending local clients
fr_dlist_t packets; //!< list of accepted packets
* i.e. if the client takes 30s to define, well, too
* bad...
*/
- if (!client_add(inst->dynamic_clients.clients, client)) {
+ if (!client_add(inst->dynamic_clients.pending, client)) {
talloc_free(client);
return -1;
}
*/
if (!address.client) address.client = client_find(inst->dynamic_clients.clients, &address.src_ipaddr, IPPROTO_UDP);
+ /*
+ * Still no client, maybe it's pending?
+ *
+ * If it's pending, save the packet for later processing and return.
+ */
+ if (!address.client) {
+ address.client = client_find(inst->dynamic_clients.pending, &address.src_ipaddr, IPPROTO_UDP);
+ if (address.client) {
+ if (dynamic_client_packet_save(inst, buffer, packet_len, packet_time, &address, &track) < 0) {
+ goto unknown;
+ }
+
+ return 0;
+ }
+ }
+
/*
* Still no client (and we have dynamic clients), try to
* define the client.
*/
if (address.client->negative) goto unknown;
- /*
- * It's a dynamic client, BUT not yet active. Go save
- * the packet until the client definition comes back
- * either yay or nay.
- */
- if (address.client->dynamic && !address.client->active) {
- if (dynamic_client_packet_save(inst, buffer, packet_len, packet_time, &address, &track) < 0) {
- goto unknown;
- }
-
- return 0;
- }
-
/*
* Check for a socket that SHOULD be connected. If so,
* either create the socket, OR find it in the list of
dynamic_packet_t *saved;
/*
- * @todo - maybe just duplicate the new client fields,
- * and talloc_free(newclient).
+ * @todo - maybe just duplicate the new client
+ * fields, and talloc_free(newclient). That
+ * means we don't have to muck with pending
+ * packets.
*/
inst->dynamic_clients.num_pending_clients--;
+ /*
+ * Delete the "pending" client from the pending
+ * client list. Whatever we do next, this client
+ * is no longer "pending".
+ */
+ client_delete(inst->dynamic_clients.pending, address->client);
+
/*
* NAK: drop all packets.
*
*/
rad_assert(!inst->use_connected);
- /*
- * Delete the "pending" client from the client list.
- */
- client_delete(inst->dynamic_clients.clients, client);
-
DEBUG("%s - Defining new client %s", inst->name, client->shortname);
newclient->dynamic = true;
* Allow static clients for this virtual server.
*/
inst->dynamic_clients.clients = client_list_init(NULL); // client_list_parse_section(inst->parent->server_cs, false);
+ inst->dynamic_clients.pending = client_list_init(NULL);
FR_INTEGER_BOUND_CHECK("max_clients", inst->dynamic_clients.max_clients, >=, 1);
FR_INTEGER_BOUND_CHECK("max_clients", inst->dynamic_clients.max_clients, <=, (1 << 20));