From: Alan T. DeKok Date: Thu, 12 Apr 2018 14:10:40 +0000 (-0400) Subject: pass packet_ct to NAK routine X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ea436cb33b1a0f56fb43044e868b4836d4c97e6a;p=thirdparty%2Ffreeradius-server.git pass packet_ct to NAK routine --- diff --git a/src/lib/io/io.h b/src/lib/io/io.h index 63798ad69b1..2e48f506e91 100644 --- a/src/lib/io/io.h +++ b/src/lib/io/io.h @@ -142,13 +142,14 @@ typedef ssize_t (*fr_io_encode_t)(void const *instance, REQUEST *request, uint8_ * "do not respond", even if duplicates come in. * * @param[in] instance the context for this function. + * @param[out] packet_ctx the packet_ctx struct containing request specific data. * @param[in] packet the packet to NAK * @param[in] packet_len length of the packet to NAK * @param[in] reply the NAK reply * @param[in] reply_len length of the buffer where the reply should be placed. * @return length of the data in the reply buffer. */ -typedef size_t (*fr_io_nak_t)(void const *instance, uint8_t *const packet, size_t packet_len, +typedef size_t (*fr_io_nak_t)(void const *instance, void *packet_ctx, uint8_t *const packet, size_t packet_len, uint8_t *reply, size_t reply_len); /** Read from a socket. diff --git a/src/lib/io/worker.c b/src/lib/io/worker.c index d709663be0d..a4f7c953cca 100644 --- a/src/lib/io/worker.c +++ b/src/lib/io/worker.c @@ -395,7 +395,7 @@ static void fr_worker_nak(fr_worker_t *worker, fr_channel_data_t *cd, fr_time_t * Encode a NAK */ if (listen->app_io->nak) { - size = listen->app_io->nak(listen->app_io_instance, cd->m.data, + size = listen->app_io->nak(listen->app_io_instance, cd->packet_ctx, cd->m.data, cd->m.data_size, reply->m.data, reply->m.rb_size); } else { size = 1; /* rely on them to figure it the heck out */ diff --git a/src/tests/util/radius1_test.c b/src/tests/util/radius1_test.c index 63b14e7f96e..2576c917caf 100644 --- a/src/tests/util/radius1_test.c +++ b/src/tests/util/radius1_test.c @@ -135,7 +135,7 @@ static ssize_t test_encode(UNUSED void const *instance, REQUEST *request, uint8_ return 20; } -static size_t test_nak(void const *instance, uint8_t *const packet, size_t packet_len, UNUSED uint8_t *reply, UNUSED size_t reply_len) +static size_t test_nak(void const *instance, UNUSED void *packet_ctx, uint8_t *const packet, size_t packet_len, UNUSED uint8_t *reply, UNUSED size_t reply_len) { MPRINT1("\t\tNAK !!! request %d - data %p %p size %zd\n", packet[1], instance, packet, packet_len); diff --git a/src/tests/util/radius_schedule_test.c b/src/tests/util/radius_schedule_test.c index 0ad378293a3..0fb66508284 100644 --- a/src/tests/util/radius_schedule_test.c +++ b/src/tests/util/radius_schedule_test.c @@ -105,7 +105,7 @@ static ssize_t test_encode(void const *instance, REQUEST *request, uint8_t *buff return 20; } -static size_t test_nak(void const *ctx, uint8_t *const packet, size_t packet_len, UNUSED uint8_t *reply, UNUSED size_t reply_len) +static size_t test_nak(void const *ctx, UNUSED void *packet_ctx, uint8_t *const packet, size_t packet_len, UNUSED uint8_t *reply, UNUSED size_t reply_len) { MPRINT1("\t\tNAK !!! request %d - data %p %p size %zd\n", packet[1], ctx, packet, packet_len); diff --git a/src/tests/util/worker_test.c b/src/tests/util/worker_test.c index 3989f41b372..f0b58e3754b 100644 --- a/src/tests/util/worker_test.c +++ b/src/tests/util/worker_test.c @@ -130,7 +130,7 @@ static ssize_t test_encode(void const *instance, REQUEST *request, uint8_t *cons return data_len; } -static size_t test_nak(void const *packet_ctx, uint8_t *const packet, size_t packet_len, uint8_t *reply, UNUSED size_t reply_len) +static size_t test_nak(UNUSED void const *instance, UNUSED void *packet_ctx, uint8_t *const packet, size_t packet_len, uint8_t *reply, UNUSED size_t reply_len) { uint32_t number;