2 * radclient.c General radius packet debug tool.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 * Copyright 2000,2006 The FreeRADIUS server project
21 * Copyright 2000 Miquel van Smoorenburg <miquels@cistron.nl>
22 * Copyright 2000 Alan DeKok <aland@ox.org>
25 #include <freeradius-devel/ident.h>
28 #include <freeradius-devel/autoconf.h>
41 #ifdef HAVE_SYS_SELECT_H
42 # include <sys/select.h>
51 #include <freeradius-devel/conf.h>
52 #include <freeradius-devel/radpaths.h>
53 #include <freeradius-devel/missing.h>
54 #include <freeradius-devel/libradius.h>
56 static int retries = 10;
57 static float timeout = 3;
58 static const char *secret = NULL;
59 static int do_output = 1;
60 static int totalapp = 0;
61 static int totaldeny = 0;
62 static int totallost = 0;
64 static int server_port = 0;
65 static int packet_code = 0;
66 static lrad_ipaddr_t server_ipaddr;
67 static int resend_count = 1;
70 static lrad_ipaddr_t client_ipaddr;
71 static int client_port = 0;
74 static int last_used_id = -1;
76 static rbtree_t *filename_tree = NULL;
77 static lrad_packet_list_t *pl = NULL;
79 static int sleep_time = -1;
81 typedef struct radclient_t {
82 struct radclient_t *prev;
83 struct radclient_t *next;
86 int packet_number; /* in the file */
89 RADIUS_PACKET *request;
96 static radclient_t *radclient_head = NULL;
97 static radclient_t *radclient_tail = NULL;
100 static void NEVER_RETURNS usage(void)
102 fprintf(stderr, "Usage: radclient [options] server[:port] <command> [<secret>]\n");
104 fprintf(stderr, " <command> One of auth, acct, status, coa, or disconnect.\n");
105 fprintf(stderr, " -c count Send each packet 'count' times.\n");
106 fprintf(stderr, " -d raddb Set dictionary directory.\n");
107 fprintf(stderr, " -f file Read packets from file, not stdin.\n");
108 fprintf(stderr, " -i id Set request id to 'id'. Values may be 0..255\n");
109 fprintf(stderr, " -n num Send N requests/s\n");
110 fprintf(stderr, " -p num Send 'num' packets from a file in parallel.\n");
111 fprintf(stderr, " -q Do not print anything out.\n");
112 fprintf(stderr, " -r retries If timeout, retry sending the packet 'retries' times.\n");
113 fprintf(stderr, " -s Print out summary information of auth results.\n");
114 fprintf(stderr, " -S file read secret from file, not command line.\n");
115 fprintf(stderr, " -t timeout Wait 'timeout' seconds before retrying (may be a floating point number).\n");
116 fprintf(stderr, " -v Show program version information.\n");
117 fprintf(stderr, " -x Debugging mode.\n");
118 fprintf(stderr, " -4 Use IPv4 address of server\n");
119 fprintf(stderr, " -6 Use IPv6 address of server.\n");
125 * Free a radclient struct, which may (or may not)
126 * already be in the list.
128 static void radclient_free(radclient_t *radclient)
130 radclient_t *prev, *next;
132 if (radclient->request) rad_free(&radclient->request);
133 if (radclient->reply) rad_free(&radclient->reply);
135 prev = radclient->prev;
136 next = radclient->next;
139 assert(radclient_head != radclient);
141 } else if (radclient_head) {
142 assert(radclient_head == radclient);
143 radclient_head = next;
147 assert(radclient_tail != radclient);
149 } else if (radclient_tail) {
150 assert(radclient_tail == radclient);
151 radclient_tail = prev;
158 * Initialize a radclient data structure
160 static radclient_t *radclient_init(const char *filename)
164 radclient_t *start, *radclient, *prev = NULL;
166 int packet_number = 1;
169 assert(filename != NULL);
172 * Determine where to read the VP's from.
174 if (strcmp(filename, "-") != 0) {
175 fp = fopen(filename, "r");
177 fprintf(stderr, "radclient: Error opening %s: %s\n",
178 filename, strerror(errno));
186 * Loop until the file is done.
192 radclient = malloc(sizeof(*radclient));
194 perror("radclient: X");
195 return NULL; /* memory leak "start" */
197 memset(radclient, 0, sizeof(*radclient));
199 radclient->request = rad_alloc(1);
200 if (!radclient->request) {
201 librad_perror("radclient: Y");
202 radclient_free(radclient);
203 return NULL; /* memory leak "start" */
206 radclient->filename = filename;
207 radclient->request->id = -1; /* allocate when sending */
208 radclient->packet_number = packet_number++;
213 radclient->request->vps = readvp2(fp, &filedone, "radclient:");
214 if (!radclient->request->vps) {
215 radclient_free(radclient);
216 return start; /* done: return the list */
220 * Keep a copy of the the User-Password attribute.
222 if ((vp = pairfind(radclient->request->vps, PW_USER_PASSWORD)) != NULL) {
223 strlcpy(radclient->password, vp->vp_strvalue,
224 sizeof(radclient->password));
226 * Otherwise keep a copy of the CHAP-Password attribute.
228 } else if ((vp = pairfind(radclient->request->vps, PW_CHAP_PASSWORD)) != NULL) {
229 strlcpy(radclient->password, vp->vp_strvalue,
230 sizeof(radclient->password));
232 radclient->password[0] = '\0';
236 * Fix up Digest-Attributes issues
238 for (vp = radclient->request->vps; vp != NULL; vp = vp->next) {
239 switch (vp->attribute) {
244 * Allow it to set the packet type in
245 * the attributes read from the file.
248 radclient->request->code = vp->lvalue;
251 case PW_PACKET_DST_PORT:
252 radclient->request->dst_port = (vp->lvalue & 0xffff);
255 case PW_PACKET_DST_IP_ADDRESS:
256 radclient->request->dst_ipaddr.af = AF_INET;
257 radclient->request->dst_ipaddr.ipaddr.ip4addr.s_addr = vp->lvalue;
260 case PW_PACKET_DST_IPV6_ADDRESS:
261 radclient->request->dst_ipaddr.af = AF_INET6;
262 radclient->request->dst_ipaddr.ipaddr.ip6addr = vp->vp_ipv6addr;
265 case PW_PACKET_SRC_PORT:
266 radclient->request->src_port = (vp->lvalue & 0xffff);
269 case PW_PACKET_SRC_IP_ADDRESS:
270 radclient->request->src_ipaddr.af = AF_INET;
271 radclient->request->src_ipaddr.ipaddr.ip4addr.s_addr = vp->lvalue;
274 case PW_PACKET_SRC_IPV6_ADDRESS:
275 radclient->request->src_ipaddr.af = AF_INET6;
276 radclient->request->src_ipaddr.ipaddr.ip6addr = vp->vp_ipv6addr;
279 case PW_DIGEST_REALM:
280 case PW_DIGEST_NONCE:
281 case PW_DIGEST_METHOD:
284 case PW_DIGEST_ALGORITHM:
285 case PW_DIGEST_BODY_DIGEST:
286 case PW_DIGEST_CNONCE:
287 case PW_DIGEST_NONCE_COUNT:
288 case PW_DIGEST_USER_NAME:
290 memmove(&vp->vp_octets[2], &vp->vp_octets[0],
292 vp->vp_octets[0] = vp->attribute - PW_DIGEST_REALM + 1;
294 vp->vp_octets[1] = vp->length;
295 vp->attribute = PW_DIGEST_ATTRIBUTES;
298 } /* loop over the VP's we read in */
304 prev->next = radclient;
305 radclient->prev = prev;
308 } while (!filedone); /* loop until the file is done. */
310 if (fp != stdin) fclose(fp);
320 * Sanity check each argument.
322 static int radclient_sane(radclient_t *radclient)
324 if (radclient->request->dst_port == 0) {
325 radclient->request->dst_port = server_port;
327 if (radclient->request->dst_ipaddr.af == AF_UNSPEC) {
328 if (server_ipaddr.af == AF_UNSPEC) {
329 fprintf(stderr, "radclient: No server was given, but request %d in file %s did not contain Packet-Dst-IP-Address\n",
330 radclient->packet_number, radclient->filename);
333 radclient->request->dst_ipaddr = server_ipaddr;
335 if (radclient->request->code == 0) {
336 if (packet_code == -1) {
337 fprintf(stderr, "radclient: Request was \"auto\", but request %d in file %s did not contain Packet-Type\n",
338 radclient->packet_number, radclient->filename);
342 radclient->request->code = packet_code;
344 radclient->request->sockfd = -1;
351 * For request handline.
353 static int filename_cmp(const void *one, const void *two)
355 return strcmp((const char *) one, (const char *) two);
358 static int filename_walk(void *context, void *data)
360 const char *filename = data;
361 radclient_t *radclient;
363 context = context; /* -Wunused */
366 * Initialize the request we're about
369 radclient = radclient_init(filename);
374 if (!radclient_head) {
375 assert(radclient_tail == NULL);
376 radclient_head = radclient;
378 assert(radclient_tail->next == NULL);
379 radclient_tail->next = radclient;
380 radclient->prev = radclient_tail;
384 * We may have had a list of "radclient" structures
387 while (radclient->next) radclient = radclient->next;
388 radclient_tail = radclient;
395 * Deallocate packet ID, etc.
397 static void deallocate_id(radclient_t *radclient)
399 if (!radclient || !radclient->request ||
400 (radclient->request->id < 0)) {
405 * One more unused RADIUS ID.
407 lrad_packet_list_id_free(pl, radclient->request);
408 radclient->request->id = -1;
411 * If we've already sent a packet, free up the old one,
412 * and ensure that the next packet has a unique
413 * authentication vector.
415 if (radclient->request->data) {
416 free(radclient->request->data);
417 radclient->request->data = NULL;
420 if (radclient->reply) rad_free(&radclient->reply);
424 static void print_hex(RADIUS_PACKET *packet)
428 if (!packet->data) return;
430 printf(" Code:\t\t%u\n", packet->data[0]);
431 printf(" Id:\t\t%u\n", packet->data[1]);
432 printf(" Length:\t%u\n", ((packet->data[2] << 8) |
434 printf(" Vector:\t");
435 for (i = 4; i < 20; i++) {
436 printf("%02x", packet->data[i]);
440 if (packet->data_len > 20) {
445 total = packet->data_len - 20;
446 ptr = packet->data + 20;
452 if (total < 2) { /* too short */
453 printf("%02x\n", *ptr);
457 if (ptr[1] > total) { /* too long */
458 for (i = 0; i < total; i++) {
459 printf("%02x ", ptr[i]);
464 printf("%02x %02x ", ptr[0], ptr[1]);
465 attrlen = ptr[1] - 2;
469 for (i = 0; i < attrlen; i++) {
470 if ((i > 0) && ((i & 0x0f) == 0x00))
472 printf("%02x ", ptr[i]);
473 if ((i & 0x0f) == 0x0f) printf("\n");
476 if ((attrlen & 0x0f) != 0x00) printf("\n");
488 static int send_one_packet(radclient_t *radclient)
490 assert(radclient->done == 0);
493 * Remember when we have to wake up, to re-send the
494 * request, of we didn't receive a response.
496 if ((sleep_time == -1) ||
497 (sleep_time > (int) timeout)) {
498 sleep_time = (int) timeout;
502 * Haven't sent the packet yet. Initialize it.
504 if (radclient->request->id == -1) {
507 assert(radclient->reply == NULL);
510 * Didn't find a free packet ID, we're not done,
511 * we don't sleep, and we stop trying to process
515 rcode = lrad_packet_list_id_alloc(pl, radclient->request);
519 mysockfd = lrad_socket(&client_ipaddr, 0);
521 fprintf(stderr, "radclient: Can't open new socket\n");
524 if (!lrad_packet_list_socket_add(pl, mysockfd)) {
525 fprintf(stderr, "radclient: Can't add new socket\n");
537 assert(radclient->request->id != -1);
538 assert(radclient->request->data == NULL);
540 for (i = 0; i < 4; i++) {
541 *((uint32_t *) radclient->request->vector) = lrad_rand();
545 * Update the password, so it can be encrypted with the
546 * new authentication vector.
548 if (radclient->password[0] != '\0') {
551 if ((vp = pairfind(radclient->request->vps, PW_USER_PASSWORD)) != NULL) {
552 strlcpy(vp->vp_strvalue, radclient->password,
553 sizeof(vp->vp_strvalue));
554 vp->length = strlen(vp->vp_strvalue);
556 } else if ((vp = pairfind(radclient->request->vps, PW_CHAP_PASSWORD)) != NULL) {
558 * FIXME: AND there's no CHAP-Challenge,
559 * AND vp->length != 17
560 * AND rad_chap_encode() != vp->vp_octets
562 strlcpy(vp->vp_strvalue, radclient->password,
563 sizeof(vp->vp_strvalue));
564 vp->length = strlen(vp->vp_strvalue);
566 rad_chap_encode(radclient->request,
568 radclient->request->id, vp);
573 radclient->timestamp = time(NULL);
574 radclient->tries = 1;
578 * Duplicate found. Serious error!
580 if (!lrad_packet_list_insert(pl, &radclient->request)) {
585 } else { /* radclient->request->id >= 0 */
586 time_t now = time(NULL);
589 * FIXME: Accounting packets are never retried!
590 * The Acct-Delay-Time attribute is updated to
591 * reflect the delay, and the packet is re-sent
596 * Not time for a retry, do so.
598 if ((now - radclient->timestamp) < timeout) {
600 * When we walk over the tree sending
601 * packets, we update the minimum time
604 if ((sleep_time == -1) ||
605 (sleep_time > (now - radclient->timestamp))) {
606 sleep_time = now - radclient->timestamp;
612 * We're not trying later, maybe the packet is done.
614 if (radclient->tries == retries) {
615 assert(radclient->request->id >= 0);
618 * Delete the request from the tree of
619 * outstanding requests.
621 lrad_packet_list_yank(pl, radclient->request);
623 fprintf(stderr, "radclient: no response from server for ID %d socket %d\n", radclient->request->id, radclient->request->sockfd);
624 deallocate_id(radclient);
627 * Normally we mark it "done" when we've received
628 * the response, but this is a special case.
630 if (radclient->resend == resend_count) {
638 * We are trying later.
640 radclient->timestamp = now;
648 if (rad_send(radclient->request, NULL, secret) < 0) {
649 fprintf(stderr, "radclient: Failed to send packet for ID %d: %s\n",
650 radclient->request->id, librad_errstr);
653 if (librad_debug > 2) print_hex(radclient->request);
659 * Receive one packet, maybe.
661 static int recv_one_packet(int wait_time)
665 radclient_t *radclient;
666 RADIUS_PACKET *reply, **request_p;
669 /* And wait for reply, timing out as necessary */
672 max_fd = lrad_packet_list_fd_set(pl, &set);
673 if (max_fd < 0) exit(1); /* no sockets to listen on! */
675 if (wait_time <= 0) {
678 tv.tv_sec = wait_time;
683 * No packet was received.
685 if (select(max_fd, &set, NULL, NULL, &tv) <= 0) {
690 * Look for the packet.
692 reply = lrad_packet_list_recv(pl, &set);
694 fprintf(stderr, "radclient: received bad packet: %s\n",
696 return -1; /* bad packet */
699 if (librad_debug > 2) print_hex(reply);
701 request_p = lrad_packet_list_find_byreply(pl, reply);
703 fprintf(stderr, "radclient: received response to request we did not send. (id=%d socket %d)\n", reply->id, reply->sockfd);
705 return -1; /* got reply to packet we didn't send */
707 radclient = lrad_packet2myptr(radclient_t, request, request_p);
710 * Fails the signature validation: not a real reply.
711 * FIXME: Silently drop it and listen for another packet.
713 if (rad_verify(reply, radclient->request, secret) < 0) {
714 librad_perror("rad_verify");
716 goto packet_done; /* shared secret is incorrect */
719 lrad_packet_list_yank(pl, radclient->request);
720 deallocate_id(radclient);
721 radclient->reply = reply;
724 * If this fails, we're out of memory.
726 if (rad_decode(reply, radclient->request, secret) != 0) {
727 librad_perror("rad_decode");
732 /* libradius debug already prints out the value pairs for us */
733 if (!librad_debug && do_output) {
734 printf("Received response ID %d, code %d, length = %d\n",
735 reply->id, reply->code, reply->data_len);
736 vp_printlist(stdout, reply->vps);
738 if (reply->code != PW_AUTHENTICATION_REJECT) {
745 rad_free(&radclient->reply);
748 * Once we've sent the packet as many times as requested,
751 if (radclient->resend == resend_count) {
752 assert(lrad_packet_list_find(pl, radclient->request) == NULL);
760 static int getport(const char *name)
764 svp = getservbyname (name, "udp");
769 return ntohs(svp->s_port);
772 int main(int argc, char **argv)
776 const char *radius_dir = RADDBDIR;
777 char filesecret[256];
783 int force_af = AF_UNSPEC;
787 filename_tree = rbtree_create(filename_cmp, NULL, 0);
788 if (!filename_tree) {
789 fprintf(stderr, "radclient: Out of memory\n");
793 while ((c = getopt(argc, argv, "46c:d:f:hi:n:p:qr:sS:t:vx")) != EOF) switch(c) {
801 if (!isdigit((int) *optarg))
803 resend_count = atoi(optarg);
809 rbtree_insert(filename_tree, optarg);
811 case 'i': /* currently broken */
812 if (!isdigit((int) *optarg))
814 last_used_id = atoi(optarg);
815 if ((last_used_id < 0) || (last_used_id > 255)) {
821 persec = atoi(optarg);
822 if (persec <= 0) usage();
826 * Note that sending MANY requests in
827 * parallel can over-run the kernel
828 * queues, and Linux will happily discard
829 * packets. So even if the server responds,
830 * the client may not see the response.
833 parallel = atoi(optarg);
834 if (parallel <= 0) usage();
841 if (!isdigit((int) *optarg))
843 retries = atoi(optarg);
844 if ((retries == 0) || (retries > 1000)) usage();
850 fp = fopen(optarg, "r");
852 fprintf(stderr, "radclient: Error opening %s: %s\n",
853 optarg, strerror(errno));
856 if (fgets(filesecret, sizeof(filesecret), fp) == NULL) {
857 fprintf(stderr, "radclient: Error reading %s: %s\n",
858 optarg, strerror(errno));
863 /* truncate newline */
864 p = filesecret + strlen(filesecret) - 1;
865 while ((p >= filesecret) &&
871 if (strlen(filesecret) < 2) {
872 fprintf(stderr, "radclient: Secret in %s is too short\n", optarg);
878 if (!isdigit((int) *optarg))
880 timeout = atof(optarg);
883 printf("radclient: $Id$ built on " __DATE__ " at " __TIME__ "\n");
894 argc -= (optind - 1);
895 argv += (optind - 1);
898 ((secret == NULL) && (argc < 4))) {
902 if (dict_init(radius_dir, RADIUS_DICTIONARY) < 0) {
903 librad_perror("radclient");
910 server_ipaddr.af = force_af;
911 if (strcmp(argv[1], "-") != 0) {
912 const char *hostname = argv[1];
913 const char *portname = argv[1];
916 if (*argv[1] == '[') { /* IPv6 URL encoded */
917 p = strchr(argv[1], ']');
918 if ((p - argv[1]) >= sizeof(buffer)) {
922 memcpy(buffer, argv[1] + 1, p - argv[1] - 1);
923 buffer[p - argv[1] - 1] = '\0';
929 p = strchr(portname, ':');
930 if (p && (strchr(p + 1, ':') == NULL)) {
937 if (ip_hton(hostname, force_af, &server_ipaddr) < 0) {
938 fprintf(stderr, "radclient: Failed to find IP address for host %s: %s\n", hostname, strerror(errno));
943 * Strip port from hostname if needed.
945 if (portname) server_port = atoi(portname);
949 * See what kind of request we want to send.
951 if (strcmp(argv[2], "auth") == 0) {
952 if (server_port == 0) server_port = getport("radius");
953 if (server_port == 0) server_port = PW_AUTH_UDP_PORT;
954 packet_code = PW_AUTHENTICATION_REQUEST;
956 } else if (strcmp(argv[2], "challenge") == 0) {
957 if (server_port == 0) server_port = getport("radius");
958 if (server_port == 0) server_port = PW_AUTH_UDP_PORT;
959 packet_code = PW_ACCESS_CHALLENGE;
961 } else if (strcmp(argv[2], "acct") == 0) {
962 if (server_port == 0) server_port = getport("radacct");
963 if (server_port == 0) server_port = PW_ACCT_UDP_PORT;
964 packet_code = PW_ACCOUNTING_REQUEST;
967 } else if (strcmp(argv[2], "status") == 0) {
968 if (server_port == 0) server_port = getport("radius");
969 if (server_port == 0) server_port = PW_AUTH_UDP_PORT;
970 packet_code = PW_STATUS_SERVER;
972 } else if (strcmp(argv[2], "disconnect") == 0) {
973 if (server_port == 0) server_port = PW_POD_UDP_PORT;
974 packet_code = PW_DISCONNECT_REQUEST;
976 } else if (strcmp(argv[2], "coa") == 0) {
977 if (server_port == 0) server_port = PW_POD_UDP_PORT;
978 packet_code = PW_COA_REQUEST;
980 } else if (strcmp(argv[2], "auto") == 0) {
983 } else if (isdigit((int) argv[2][0])) {
984 if (server_port == 0) server_port = getport("radius");
985 if (server_port == 0) server_port = PW_AUTH_UDP_PORT;
986 packet_code = atoi(argv[2]);
994 if (argv[3]) secret = argv[3];
997 * If no '-f' is specified, we're reading from stdin.
999 if (rbtree_num_elements(filename_tree) == 0) {
1000 rbtree_insert(filename_tree, "-");
1004 * Walk over the list of filenames, creating the requests.
1006 if (rbtree_walk(filename_tree, InOrder, filename_walk, NULL) != 0) {
1011 * No packets read. Die.
1013 if (!radclient_head) {
1014 fprintf(stderr, "radclient: Nothing to send.\n");
1019 * Bind to the first specified IP address and port.
1020 * This means we ignore later ones.
1022 if (radclient_head->request->src_ipaddr.af == AF_UNSPEC) {
1023 memset(&client_ipaddr, 0, sizeof(client_ipaddr));
1024 client_ipaddr.af = server_ipaddr.af;
1027 client_ipaddr = radclient_head->request->src_ipaddr;
1028 client_port = radclient_head->request->src_port;
1030 sockfd = lrad_socket(&client_ipaddr, client_port);
1032 fprintf(stderr, "radclient: socket: %s\n", librad_errstr);
1036 pl = lrad_packet_list_create(1);
1038 fprintf(stderr, "radclient: Out of memory\n");
1042 if (!lrad_packet_list_socket_add(pl, sockfd)) {
1043 fprintf(stderr, "radclient: Out of memory\n");
1048 * Walk over the list of packets, sanity checking
1051 for (this = radclient_head; this != NULL; this = this->next) {
1052 this->request->src_ipaddr = client_ipaddr;
1053 this->request->src_port = client_port;
1054 if (radclient_sane(this) != 0) {
1060 * Walk over the packets to send, until
1063 * FIXME: This currently busy-loops until it receives
1064 * all of the packets. It should really have some sort of
1065 * send packet, get time to wait, select for time, etc.
1071 const char *filename = NULL;
1077 * Walk over the packets, sending them.
1080 for (this = radclient_head; this != NULL; this = next) {
1084 * If there's a packet to receive,
1085 * receive it, but don't wait for a
1091 * This packet is done. Delete it.
1094 radclient_free(this);
1099 * Packets from multiple '-f' are sent
1102 * Packets from one file are sent in
1103 * series, unless '-p' is specified, in
1104 * which case N packets from each file
1105 * are sent in parallel.
1107 if (this->filename != filename) {
1108 filename = this->filename;
1116 * Send the current packet.
1118 send_one_packet(this);
1121 * Wait a little before sending
1122 * the next packet, if told to.
1128 * Don't sleep elsewhere.
1137 tv.tv_usec = 1000000/persec;
1141 * Sleep for milliseconds,
1144 * If we get an error or
1145 * a signal, treat it like
1148 select(0, NULL, NULL, NULL, &tv);
1152 * If we haven't sent this packet
1153 * often enough, we're not done,
1154 * and we shouldn't sleep.
1156 if (this->resend < resend_count) {
1160 } else { /* haven't sent this packet, we're not done */
1161 assert(this->done == 0);
1162 assert(this->reply == NULL);
1168 * Still have outstanding requests.
1170 if (lrad_packet_list_num_elements(pl) > 0) {
1177 * Nothing to do until we receive a request, so
1178 * sleep until then. Once we receive one packet,
1179 * we go back, and walk through the whole list again,
1180 * sending more packets (if necessary), and updating
1183 if (!done && (sleep_time > 0)) {
1184 recv_one_packet(sleep_time);
1188 rbtree_free(filename_tree);
1189 lrad_packet_list_free(pl);
1193 printf("\n\t Total approved auths: %d\n", totalapp);
1194 printf("\t Total denied auths: %d\n", totaldeny);
1195 printf("\t Total lost auths: %d\n", totallost);