diff options
author | brian <brian@FreeBSD.org> | 2005-01-27 14:09:33 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2005-01-27 14:09:33 +0000 |
commit | 20455e62c2eedc112ec8b6f390b89c9f70fb7d5f (patch) | |
tree | 2924cd4f31bcfe268b7303efd12bf5a0337e28cb /usr.sbin/ppp/radius.c | |
parent | 80f3d1cb457b8b12ec5b66dc0878a60229d7e187 (diff) | |
download | FreeBSD-src-20455e62c2eedc112ec8b6f390b89c9f70fb7d5f.zip FreeBSD-src-20455e62c2eedc112ec8b6f390b89c9f70fb7d5f.tar.gz |
Add a radius_Flush() function that waits for the response (or timeout) to
any pending RADIUS transaction. Use this before sending RAD_STOP RADIUS
messages so that we definitely ``stop'' the session.
It was discovered that sometimes when the link timed out, we got lucky
enough to have an un-ACK'd RADIUS accounting transaction in progress,
resulting in the RAD_STOP message failing to send.
Original report found on: A russion news group
Text translated by: glebius
Tested by: Alexey Popov llp at iteranet dot com
MFC after: 7 days
Diffstat (limited to 'usr.sbin/ppp/radius.c')
-rw-r--r-- | usr.sbin/ppp/radius.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/usr.sbin/ppp/radius.c b/usr.sbin/ppp/radius.c index 03d4555..8518396 100644 --- a/usr.sbin/ppp/radius.c +++ b/usr.sbin/ppp/radius.c @@ -30,6 +30,7 @@ #include <stdint.h> #include <sys/param.h> +#include <sys/select.h> #include <sys/socket.h> #include <netinet/in_systm.h> #include <netinet/in.h> @@ -681,6 +682,25 @@ radius_Read(struct fdescriptor *d, struct bundle *bundle __unused, } /* + * Flush any pending transactions + */ +void +radius_Flush(struct radius *r) +{ + struct timeval tv; + fd_set s; + + while (r->cx.fd != -1) { + FD_ZERO(&s); + FD_SET(r->cx.fd, &s); + tv.tv_sec = 0; + tv.tv_usec = TICKUNIT; + select(r->cx.fd + 1, &s, NULL, NULL, &tv); + radius_Continue(r, 1); + } +} + +/* * Behave as a struct fdescriptor (descriptor.h) */ static int |