From 053d8700e67ea25af22b063727f3831fee4f9e73 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Thu, 28 Oct 2004 00:21:48 +0000 Subject: [PATCH] Patch from Robert Vogelgesang: This patch avoids duplicate session IDs in RADIUS accounting, when the same pppd instance has multiple sessions during the same second. This can happen when you have a really fast RADIUS server and fast clients, e. g. when using pppd as a back-end for PPPoE (either directly or via L2TP). --- pppd/plugins/radius/radiusclient/lib/util.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pppd/plugins/radius/radiusclient/lib/util.c b/pppd/plugins/radius/radiusclient/lib/util.c index 813ec7e..491ef7f 100644 --- a/pppd/plugins/radius/radiusclient/lib/util.c +++ b/pppd/plugins/radius/radiusclient/lib/util.c @@ -1,5 +1,5 @@ /* - * $Id: util.c,v 1.2 2002/02/27 15:51:20 dfs Exp $ + * $Id: util.c,v 1.3 2004/10/28 00:21:48 paulus Exp $ * * Copyright (C) 1995,1996,1997 Lars Fenneberg * @@ -231,7 +231,12 @@ void rc_mdelay(int msecs) char * rc_mksid (void) { - static char buf[14]; - sprintf (buf, "%08lX%04X", (unsigned long int) time (NULL), (unsigned int) getpid ()); + static char buf[15]; + static unsigned short int cnt = 0; + sprintf (buf, "%08lX%04X%02hX", + (unsigned long int) time (NULL), + (unsigned int) getpid (), + cnt & 0xFF); + cnt++; return buf; } -- 2.39.2