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 | |
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')
-rw-r--r-- | usr.sbin/ppp/ipcp.c | 1 | ||||
-rw-r--r-- | usr.sbin/ppp/ipv6cp.c | 1 | ||||
-rw-r--r-- | usr.sbin/ppp/radius.c | 20 | ||||
-rw-r--r-- | usr.sbin/ppp/radius.h | 1 |
4 files changed, 23 insertions, 0 deletions
diff --git a/usr.sbin/ppp/ipcp.c b/usr.sbin/ppp/ipcp.c index 3a410d1..e2da0e5 100644 --- a/usr.sbin/ppp/ipcp.c +++ b/usr.sbin/ppp/ipcp.c @@ -871,6 +871,7 @@ IpcpLayerDown(struct fsm *fp) log_Printf(LogIPCP, "%s: LayerDown: %s\n", fp->link->name, addr); #ifndef NORADIUS + radius_Flush(&fp->bundle->radius); radius_Account(&fp->bundle->radius, &fp->bundle->radacct, fp->bundle->links, RAD_STOP, &ipcp->throughput); diff --git a/usr.sbin/ppp/ipv6cp.c b/usr.sbin/ppp/ipv6cp.c index e7ba5a5..06b003b 100644 --- a/usr.sbin/ppp/ipv6cp.c +++ b/usr.sbin/ppp/ipv6cp.c @@ -528,6 +528,7 @@ ipv6cp_LayerDown(struct fsm *fp) log_Printf(LogIPV6CP, "%s: LayerDown: %s\n", fp->link->name, addr); #ifndef NORADIUS + radius_Flush(&fp->bundle->radius); radius_Account(&fp->bundle->radius, &fp->bundle->radacct6, fp->bundle->links, RAD_STOP, &ipv6cp->throughput); 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 diff --git a/usr.sbin/ppp/radius.h b/usr.sbin/ppp/radius.h index 2d7d692..bba7e45 100644 --- a/usr.sbin/ppp/radius.h +++ b/usr.sbin/ppp/radius.h @@ -97,6 +97,7 @@ struct radacct { struct bundle; +extern void radius_Flush(struct radius *); extern void radius_Init(struct radius *); extern void radius_Destroy(struct radius *); |