From: Alan T. DeKok Date: Fri, 2 Dec 2022 22:13:40 +0000 (-0500) Subject: add CoA filter and reply file to rc_file_pair_t X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=679ec7e05fa009e5418034f70bc0f175a94b6956;p=thirdparty%2Ffreeradius-server.git add CoA filter and reply file to rc_file_pair_t --- diff --git a/src/bin/radclient.c b/src/bin/radclient.c index 382d9a529c2..90bab668b5e 100644 --- a/src/bin/radclient.c +++ b/src/bin/radclient.c @@ -1365,6 +1365,7 @@ int main(int argc, char **argv) #endif fr_dlist_head_t filenames; rc_request_t *request; + rc_file_pair_t *coa_files = NULL; /* * It's easier having two sets of flags to set the @@ -1401,7 +1402,7 @@ int main(int argc, char **argv) default_log.fd = STDOUT_FILENO; default_log.print_level = false; - while ((c = getopt(argc, argv, "46c:A:C:d:D:f:Fhi:n:p:P:r:sS:t:vx")) != -1) switch (c) { + while ((c = getopt(argc, argv, "46c:A:C:d:D:f:Fhi:n:o:p:P:r:sS:t:vx")) != -1) switch (c) { case '4': force_af = AF_INET; break; @@ -1488,6 +1489,33 @@ int main(int argc, char **argv) if (persec <= 0) usage(); break; + case 'o': + if (!coa_files) { + coa_files = fr_dlist_head(&filenames); + } else { + coa_files = fr_dlist_next(&filenames, coa_files); + } + + if (!coa_files) { + ERROR("There are fewer client filenames than CoA filenames"); + fr_exit_now(1); + } + + { + char const *p; + + p = strchr(optarg, ':'); + if (p) { + coa_files->coa_reply = talloc_strndup(coa_files, optarg, p - optarg); + if (!coa_files->coa_reply) goto oom; + coa_files->coa_filter = p + 1; + } else { + coa_files->coa_reply = optarg; + coa_files->coa_filter = NULL; + } + } + break; + /* * Note that sending MANY requests in * parallel can over-run the kernel diff --git a/src/bin/radclient.h b/src/bin/radclient.h index 042da94cc44..c93b79f34c7 100644 --- a/src/bin/radclient.h +++ b/src/bin/radclient.h @@ -61,6 +61,8 @@ typedef struct { char const *packets; //!< The file containing the request packet char const *filters; //!< The file containing the definition of the //!< packet we want to match. + char const *coa_filter; //!< file containing the CoA filter we want to match + char const *coa_reply; //!< file containing the CoA filter we want to match } rc_file_pair_t; typedef struct rc_request rc_request_t;