From: Alan T. DeKok Date: Thu, 15 Feb 2018 18:01:03 +0000 (-0500) Subject: remove erroneous NAT code X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=042dfd789f237133fb83c8b3ffe9b0aa20ee574a;p=thirdparty%2Ffreeradius-server.git remove erroneous NAT code this should now be handled automatically by mod_read() --- diff --git a/src/modules/proto_radius/proto_radius_udp.c b/src/modules/proto_radius/proto_radius_udp.c index 0d5d8eca070..e47482fee91 100644 --- a/src/modules/proto_radius/proto_radius_udp.c +++ b/src/modules/proto_radius/proto_radius_udp.c @@ -1443,73 +1443,6 @@ static ssize_t mod_write(void *instance, void *packet_ctx, FR_DLIST_INIT(newclient->pending); FR_DLIST_INIT(newclient->packets); - /* - * This client is ONLY for a particular - * connection. We have to find all matching - * packets by src/dst IP/port, and send them to - * the new connection. - */ - if (newclient->behind_nat) { - client->is_nat = true; - - while ((entry = FR_DLIST_FIRST(client->packets)) != NULL) { - proto_radius_udp_address_t *newaddress; - - saved = fr_ptr_to_type(dynamic_packet_t, entry, entry); - (void) talloc_get_type_abort(saved, dynamic_packet_t); - - fr_dlist_remove(&saved->entry); - fr_dlist_insert_tail(&inst->dynamic_clients.packets, &saved->entry); - - newaddress = (proto_radius_udp_address_t *) &saved->track->src_dst[0]; - if ((newaddress->src_port == address->src_port) && - (newaddress->dst_port == address->dst_port) && - (fr_ipaddr_cmp(&newaddress->src_ipaddr, &address->src_ipaddr) == 0) && - (fr_ipaddr_cmp(&newaddress->dst_ipaddr, &address->dst_ipaddr) == 0)) { - newaddress->client->received--; - newaddress->client = newclient; - newaddress->client->received++; - } - - rad_assert(inst->dynamic_clients.num_pending_packets > 0); - inst->dynamic_clients.num_pending_packets--; - } - - /* - * There are still saved packets from this source IP. - * - * @todo - figure out what to do here. - */ - if ((entry = FR_DLIST_FIRST(client->packets)) != NULL) { - rad_assert(0 == 1); - fr_exit_now(EXIT_FAILURE); - } - - /* - * No packets are outstanding for this - * dynamic client. Delete it. - */ - client_delete(inst->dynamic_clients.clients, client); - fr_dlist_remove(&client->pending); - talloc_free(client); - - /* - * Note that we do NOT add it to any - * list. Instead, mod_read() will clean - * it up. - */ - newclient->dynamic = true; - newclient->active = true; - - /* - * Do NOT delete the tracking table - * entry. The packet has to be - * re-injected!. - */ - fr_network_listen_read(inst->nr, inst->parent->listen); - return buffer_len; - } - /* * Delete the "pending" client from the client list. */