From: Alan T. DeKok Date: Wed, 24 Jan 2018 16:59:48 +0000 (-0500) Subject: initialize list for dynamic clients X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7db71a0804ab1e28e4812fa87d8c16b071a73f3b;p=thirdparty%2Ffreeradius-server.git initialize list for dynamic clients --- diff --git a/src/modules/proto_radius/notes.md b/src/modules/proto_radius/notes.md index 2c604f88f00..810a4c1a923 100644 --- a/src/modules/proto_radius/notes.md +++ b/src/modules/proto_radius/notes.md @@ -131,6 +131,27 @@ connection" code, and proceed as before. ## proto_radius_connected_udp +Pretty much implemented as documented below. + +### NAT + +NAT mostly works. The main limitation left is that the client list is +by source IP, and NOT by src/dst ip/port. So we probably need a +*separate* rbtree for NATed clients. + +i.e. `src/main/client.c`, struct `radclient_list` has to have a `rbtree_t *nat` + +Which is used ONLY if `client->behind_nat == true`. + +and the rbtree callback function compares src/dst ip/port. + +Since all of the calls are abstracted behind `client_add()`, etc. We +can just update `client.c`, and have it all automagically work. + +The one caveat is we don't + +### how it works + uses the `proto_radius_udp_t` for simplicity Which has added: diff --git a/src/modules/proto_radius/proto_radius_udp.c b/src/modules/proto_radius/proto_radius_udp.c index fb6737447ca..64564fce6ab 100644 --- a/src/modules/proto_radius/proto_radius_udp.c +++ b/src/modules/proto_radius/proto_radius_udp.c @@ -1334,6 +1334,8 @@ static ssize_t mod_write(void *instance, void *packet_ctx, rad_assert(buffer_len == sizeof(newclient)); memcpy(&newclient, buffer, sizeof(newclient)); + FR_DLIST_INIT(newclient->pending); + FR_DLIST_INIT(newclient->packets); /* * This client is ONLY for a particular