diff options
-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 *); |