Skip to content

Commit

Permalink
logwtmp check
Browse files Browse the repository at this point in the history
  • Loading branch information
svlobanov committed Aug 22, 2024
1 parent 99bb6e0 commit adf43b3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
13 changes: 13 additions & 0 deletions accel-pppd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ IF (HAVE_GOOD_IFARP)
ADD_DEFINITIONS(-DHAVE_GOOD_IFARP)
ENDIF (HAVE_GOOD_IFARP)

INCLUDE (CheckCSourceCompiles)
CHECK_C_SOURCE_COMPILES("
#include <utmp.h>
int main(void)
{
logwtmp(\"\", \"\", \"\");
return 0;
}" HAVE_LOGWTMP)

IF (HAVE_LOGWTMP)
ADD_DEFINITIONS(-DHAVE_LOGWTMP)
ENDIF (HAVE_LOGWTMP)


ADD_SUBDIRECTORY(triton)
ADD_SUBDIRECTORY(vlan-mon)
Expand Down
7 changes: 7 additions & 0 deletions accel-pppd/extra/logwtmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "memdebug.h"


#ifdef HAVE_LOGWTMP
static void ev_ses_started(struct ap_session *ses)
{
logwtmp(ses->ifname, ses->username ?: "", ses->ctrl->calling_station_id);
Expand All @@ -29,5 +30,11 @@ static void init(void)
triton_event_register_handler(EV_SES_STARTED, (triton_event_func)ev_ses_started);
triton_event_register_handler(EV_SES_FINISHED, (triton_event_func)ev_ses_finished);
}
#else
static void init(void)
{
log_warn("logwtmp is not supported on your platfrom, check libc doc");
}
#endif

DEFINE_INIT(200, init);
2 changes: 1 addition & 1 deletion tests/accel-pppd/general/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def accel_pppd_config():
pppd_compat
shaper
#net-snmp
#logwtmp
logwtmp
ipv6_nd
ipv6_dhcp
Expand Down

0 comments on commit adf43b3

Please sign in to comment.