summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--accel-pppd/accel-ppp.conf1
-rw-r--r--accel-pppd/extra/CMakeLists.txt2
-rw-r--r--accel-pppd/extra/logwtmp.c33
3 files changed, 36 insertions, 0 deletions
diff --git a/accel-pppd/accel-ppp.conf b/accel-pppd/accel-ppp.conf
index ee01891c..0e7960d9 100644
--- a/accel-pppd/accel-ppp.conf
+++ b/accel-pppd/accel-ppp.conf
@@ -20,6 +20,7 @@ pppd_compat
#net-snmp
#ipv6_nd
#ipv6_dhcp
+#logwtmp
[core]
log-error=/var/log/accel-ppp/core.log
diff --git a/accel-pppd/extra/CMakeLists.txt b/accel-pppd/extra/CMakeLists.txt
index 60fe1115..4baf4921 100644
--- a/accel-pppd/extra/CMakeLists.txt
+++ b/accel-pppd/extra/CMakeLists.txt
@@ -3,6 +3,8 @@ ADD_LIBRARY(ippool SHARED ippool.c)
ADD_LIBRARY(ipv6pool SHARED ipv6pool.c)
ADD_LIBRARY(sigchld SHARED sigchld.c)
ADD_LIBRARY(chap-secrets SHARED chap-secrets.c)
+ADD_LIBRARY(logwtmp SHARED logwtmp.c)
+TARGET_LINK_LIBRARIES(logwtmp util)
INSTALL(TARGETS pppd_compat ippool ipv6pool sigchld chap-secrets
LIBRARY DESTINATION lib/accel-ppp
diff --git a/accel-pppd/extra/logwtmp.c b/accel-pppd/extra/logwtmp.c
new file mode 100644
index 00000000..5848102e
--- /dev/null
+++ b/accel-pppd/extra/logwtmp.c
@@ -0,0 +1,33 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <utmp.h>
+
+#include "ppp.h"
+#include "events.h"
+#include "triton.h"
+#include "log.h"
+
+#include "memdebug.h"
+
+
+static void ev_ppp_started(struct ppp_t *ppp)
+{
+ logwtmp(ppp->ifname, ppp->username, ppp->ctrl->calling_station_id);
+}
+
+static void ev_ppp_finished(struct ppp_t *ppp)
+{
+ logwtmp(ppp->ifname, "", "");
+}
+
+static void init(void)
+{
+ triton_event_register_handler(EV_PPP_STARTED, (triton_event_func)ev_ppp_started);
+ triton_event_register_handler(EV_PPP_FINISHED, (triton_event_func)ev_ppp_finished);
+}
+
+DEFINE_INIT(200, init);