You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because (current) OpenVPN 2.5 has different status log than the version used to compile radiusplugin no bytes sent/received is read from openvpn-status.log file. I changed in AcctScheduler.cpp file method parseStatusFile, so radiusplugin could parse file. Code:
void AcctScheduler::parseStatusFile(PluginContext *context, uint64_t *bytesin, uint64_t *bytesout, string key)
{
char line[512], newline[512];
memset(newline, 0, 512);
string AddKey;
char* RowVals[9];
int i;
//open the status file to read
ifstream file(context->conf.getStatusFile().c_str(), ios::in);
if (file.is_open())
{
if (DEBUG (context->getVerbosity()))
cerr << getTime() << "RADIUS-PLUGIN: BACKGROUND ACCT: Scheduler: Read Statusfile.\n";
//find the key, is delimited with a ',' from the informations
//loop until the name is found, there is no delimiter, the string
//"ROUTING TABLE" is found or EOF
// Added CLIENT_LIST as OpenVPN status-log format has changed.
AddKey = "CLIENT_LIST,"+key;
i = 0;
do
{
file.getline(line, 512);
}
while (line!=NULL && strncmp(line,AddKey.c_str(),AddKey.length())!=0 && strcmp(line,"HEADER,ROUTING_TABLE,Virtual Address,Common Name,Real Address,Last Ref,Last Ref (time_t)")!=0 && file.eof()==false);
if (line!=NULL && strncmp(line,AddKey.c_str(),AddKey.length())==0) {
memcpy(newline, line+AddKey.length(), strlen(line)-AddKey.length()+1);
char* res = strtok(newline, ",");
while (res != NULL) {
RowVals[i] = res;
res = strtok(NULL, ",");
i = i + 1;
}
*bytesin=strtoull(RowVals[1],NULL,10);
*bytesout=strtoull(RowVals[2],NULL,10);
} else {
cerr << getTime() << "RADIUS-PLUGIN: BACKGROUND ACCT: No accounting data was found for "<< key << " in file " << context->conf.getStatusFile() << endl;
}
file.close();
}
else
{
cerr << getTime() << "RADIUS-PLUGIN: BACKGROUND-ACCT: Statusfile "<< context->conf.getStatusFile() <<" could not opened.\n";
}
}
The text was updated successfully, but these errors were encountered:
Because (current) OpenVPN 2.5 has different status log than the version used to compile radiusplugin no bytes sent/received is read from openvpn-status.log file. I changed in AcctScheduler.cpp file method parseStatusFile, so radiusplugin could parse file. Code:
The text was updated successfully, but these errors were encountered: