diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2005-09-21 16:58:35 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2005-09-21 16:58:35 +0000 |
commit | ae85e90400c70bd1e90a8bea4d7d7ecc8f5104bc (patch) | |
tree | 96315f27bb9e1a2d835839bf1889bd64a6abe8c3 | |
parent | b5301dafe72ba329b53ac460c517d78d9bf73f7c (diff) |
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.
From brian FreeBSD
-rw-r--r-- | usr.sbin/ppp/ppp/ipcp.c | 3 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/ipv6cp.c | 3 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/radius.c | 21 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/radius.h | 3 |
4 files changed, 26 insertions, 4 deletions
diff --git a/usr.sbin/ppp/ppp/ipcp.c b/usr.sbin/ppp/ppp/ipcp.c index 217838d82da..535c5ad6443 100644 --- a/usr.sbin/ppp/ppp/ipcp.c +++ b/usr.sbin/ppp/ppp/ipcp.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: ipcp.c,v 1.43 2005/09/21 16:28:47 brad Exp $ + * $OpenBSD: ipcp.c,v 1.44 2005/09/21 16:58:34 brad Exp $ */ #include <sys/param.h> @@ -872,6 +872,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/ppp/ipv6cp.c b/usr.sbin/ppp/ppp/ipv6cp.c index 6adbdf2c840..2e6b6adb86e 100644 --- a/usr.sbin/ppp/ppp/ipv6cp.c +++ b/usr.sbin/ppp/ppp/ipv6cp.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: ipv6cp.c,v 1.8 2005/09/21 01:43:07 brad Exp $ + * $OpenBSD: ipv6cp.c,v 1.9 2005/09/21 16:58:34 brad Exp $ */ #include <sys/param.h> @@ -526,6 +526,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/ppp/radius.c b/usr.sbin/ppp/ppp/radius.c index 6a385739116..dd559316bfe 100644 --- a/usr.sbin/ppp/ppp/radius.c +++ b/usr.sbin/ppp/ppp/radius.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: radius.c,v 1.35 2005/09/21 16:28:47 brad Exp $ + * $OpenBSD: radius.c,v 1.36 2005/09/21 16:58:34 brad Exp $ * */ @@ -683,6 +683,25 @@ radius_Read(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) } /* + * 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/ppp/radius.h b/usr.sbin/ppp/ppp/radius.h index 11a7281ee8a..5263b5d35a7 100644 --- a/usr.sbin/ppp/ppp/radius.h +++ b/usr.sbin/ppp/ppp/radius.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: radius.h,v 1.15 2005/09/21 16:28:47 brad Exp $ + * $OpenBSD: radius.h,v 1.16 2005/09/21 16:58:34 brad Exp $ */ #define MPPE_POLICY_ALLOWED 1 @@ -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 *); |