From 33b5d6981592d3d89cde2ed6b9a6a4de0f2dc3af Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Wed, 23 Apr 2025 07:31:46 -0400 Subject: [PATCH] add -e ignore_count=N --- src/bin/radclient.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/bin/radclient.c b/src/bin/radclient.c index bb03a8c79c..51a7b0d2e5 100644 --- a/src/bin/radclient.c +++ b/src/bin/radclient.c @@ -77,6 +77,7 @@ static uint16_t server_port = 0; static int packet_code = FR_RADIUS_CODE_UNDEFINED; static fr_ipaddr_t server_ipaddr; static int resend_count = 1; +static int ignore_count = 0; static bool done = true; static bool print_filename = false; static bool blast_radius = false; @@ -1519,6 +1520,11 @@ retry: RDEBUG("%s response code %d", request->files->packets, reply->code); } + if (request->tries < ignore_count) { + RDEBUG("Ignoring response %d due to -e ignore_count=%d", request->tries, ignore_count); + goto packet_done; + } + deallocate_id(request); request->reply = reply; reply = NULL; @@ -1656,7 +1662,7 @@ int main(int argc, char **argv) default_log.fd = STDOUT_FILENO; default_log.print_level = false; - while ((c = getopt(argc, argv, "46bc:A:C:d:D:f:Fhi:n:o:p:P:r:sS:t:vx")) != -1) switch (c) { + while ((c = getopt(argc, argv, "46bc:A:C:d:D:e:f:Fhi:n:o:p:P:r:sS:t:vx")) != -1) switch (c) { case '4': force_af = AF_INET; break; @@ -1709,6 +1715,13 @@ int main(int argc, char **argv) raddb_dir = optarg; break; + case 'e': /* magical extra stuff */ + if (strncmp(optarg, "ignore_count=", 13) == 0) { + ignore_count = atoi(optarg + 13); + break; + } + usage(); + /* * packet,filter,coa_reply,coa_filter */ -- 2.47.3