]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/sys-linux.c
fixes from Al Longyear
[ppp.git] / pppd / sys-linux.c
index 42fadaa3dfad99b764295f86f26fbd2b479d2f9b..daaf612eccb69c4bfde9a029706ed5da0762b2ed 100644 (file)
@@ -25,6 +25,9 @@
 #include <stdio.h>
 #include <syslog.h>
 #include <string.h>
+#include <time.h>
+#include <memory.h>
+#include <utmp.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -37,7 +40,7 @@
 #include <linux/route.h>
 #include <linux/if_ether.h>
 #include <netinet/in.h>
-#include <net/if_ppp.h>
+#include <signal.h>
 
 #include "pppd.h"
 #include "ppp.h"
@@ -91,6 +94,12 @@ int set_kdebugflag (int requested_level)
 void establish_ppp (void)
 {
     int pppdisc = N_PPP;
+    int sig    = SIGIO;
+
+    if (ioctl(fd, PPPIOCSINPSIG, &sig) == -1) {
+       syslog(LOG_ERR, "ioctl(PPPIOCSINPSIG): %m");
+       die(1);
+    }
 
     if (ioctl(fd, TIOCEXCL, 0) < 0) {
        syslog (LOG_WARNING, "ioctl(TIOCEXCL): %m");
@@ -799,3 +808,19 @@ int ppp_available(void)
     
     return ok;
 }
+
+int
+logwtmp(line, name, host)
+       char *line, *name, *host;
+{
+    struct utmp ut;
+
+    memset (&ut, 0, sizeof (ut));
+    (void)strncpy(ut.ut_line, line, sizeof(ut.ut_line));
+    (void)strncpy(ut.ut_name, name, sizeof(ut.ut_name));
+    (void)strncpy(ut.ut_host, host, sizeof(ut.ut_host));
+    (void)time(&ut.ut_time);
+       
+    pututline (&ut);           /* Write the line to the proper place */
+    endutent();                        /* Indicate operation is complete */
+}