From: Alan T. DeKok Date: Mon, 1 Apr 2019 15:34:32 +0000 (-0400) Subject: make provisions for non-radius packet tracking X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be48e633c0e5019839f66c7ed6fd76ea2ee67aaa;p=thirdparty%2Ffreeradius-server.git make provisions for non-radius packet tracking --- diff --git a/src/lib/io/app_io.h b/src/lib/io/app_io.h index dd07268fd4f..bc6d0a6ebcf 100644 --- a/src/lib/io/app_io.h +++ b/src/lib/io/app_io.h @@ -63,6 +63,12 @@ typedef struct { fr_io_nak_t nak; //!< Function to send a NAK. + /* + * @todo - this should compare two sets of track + * information, not packets. We also want a function + * that converts a packet to a tracking structure. + * Either in a buffer, or in a newly-allocated memory. + */ fr_io_data_cmp_t compare; //!< compare two packets fr_io_connection_set_t connection_set; //!< set src/dst IP/port of a connection diff --git a/src/lib/io/master.c b/src/lib/io/master.c index 815761c0b91..9d6150ec290 100644 --- a/src/lib/io/master.c +++ b/src/lib/io/master.c @@ -790,6 +790,11 @@ static fr_io_track_t *fr_io_track_add(fr_io_client_t *client, my_track.address = address; my_track.client = client; + + /* + * @todo - convert the packet to a tracking structure, + * and look that up instead of the packet. + */ memcpy(my_track.packet, packet, sizeof(my_track.packet)); if (client->inst->app_io->track_duplicates) track = rbtree_finddata(client->table, &my_track); @@ -806,6 +811,9 @@ static fr_io_track_t *fr_io_track_add(fr_io_client_t *client, track->address = client->connection->address; } + /* + * @todo - copy my_track structure, not the packet. + */ memcpy(track->packet, packet, sizeof(track->packet)); track->timestamp = recv_time; track->packets = 1; @@ -816,6 +824,8 @@ static fr_io_track_t *fr_io_track_add(fr_io_client_t *client, /* * Is it exactly the same packet? + * + * @todo - compare the tracking structure, not the packet */ if (memcmp(track->packet, my_track.packet, sizeof(my_track.packet)) == 0) { /* @@ -835,6 +845,8 @@ static fr_io_track_t *fr_io_track_add(fr_io_client_t *client, /* * The new packet is different from the old one. + * + * @todo - copy my_track structure, not the packet. */ memcpy(track->packet, my_track.packet, sizeof(my_track.packet)); track->timestamp = recv_time;