]> git.ozlabs.org Git - ppp.git/commitdiff
syslog stuff back to main.c; take out npmode setting in sifup
authorPaul Mackerras <paulus@samba.org>
Sun, 26 May 1996 23:59:36 +0000 (23:59 +0000)
committerPaul Mackerras <paulus@samba.org>
Sun, 26 May 1996 23:59:36 +0000 (23:59 +0000)
pppd/sys-NeXT.c
pppd/sys-aix4.c
pppd/sys-osf.c
pppd/sys-ultrix.c

index 7a8d7946d3638a4c39893b4c6a0d38618b2940a4..c8538d48d97b2d93b88db5a91b90e5bd3d9c27af 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: sys-NeXT.c,v 1.5 1996/04/04 04:04:17 paulus Exp $";
+static char rcsid[] = "$Id: sys-NeXT.c,v 1.6 1996/05/26 23:59:36 paulus Exp $";
 #endif
 
 #include <stdio.h>
@@ -100,11 +100,6 @@ static int ether_by_host __P((char *, struct ether_addr *));
 void
 sys_init()
 {
-    openlog("pppd", LOG_PID | LOG_NDELAY, LOG_PPP);
-    setlogmask(LOG_UPTO(LOG_INFO));
-    if (debug)
-       setlogmask(LOG_UPTO(LOG_DEBUG));
-
     /* Get an internet socket for doing socket ioctl's on. */
     if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
        syslog(LOG_ERR, "Couldn't create IP socket: %m");
@@ -149,7 +144,6 @@ sys_close()
        close(loop_slave);
        close(loop_master);
     }
-    closelog();
 }
 
 /*
@@ -161,20 +155,6 @@ sys_check_options()
 }
 
 
-/*
- * note_debug_level - note a change in the debug level.
- */
-void
-note_debug_level()
-{
-    if (debug) {
-       syslog(LOG_INFO, "Debug turned ON, Level %d", debug);
-       setlogmask(LOG_UPTO(LOG_DEBUG));
-    } else {
-       setlogmask(LOG_UPTO(LOG_WARNING));
-    }
-}
-
 /*
  * ppp_available - check whether the system has any ppp interfaces
  * (in fact we check whether we can do an ioctl on ppp0).
@@ -1015,7 +995,6 @@ sifup(u)
     int u;
 {
     struct ifreq ifr;
-    struct npioctl npi;
 
     strncpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
     if (ioctl(sockfd, SIOCGIFFLAGS, (caddr_t) &ifr) < 0) {
@@ -1028,12 +1007,6 @@ sifup(u)
        return 0;
     }
     if_is_up = 1;
-    npi.protocol = PPP_IP;
-    npi.mode = NPMODE_PASS;
-    if (ioctl(ppp_fd, PPPIOCSNPMODE, &npi) < 0) {
-       syslog(LOG_ERR, "ioctl(set IP mode to PASS): %m");
-       return 0;
-    }
     return 1;
 }
 
index 46fad402d7ffd7f23528cacdb42e6d218dd34ca3..1f7fefc1195e9ec506b777fb0498465f87869470 100644 (file)
@@ -21,7 +21,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: sys-aix4.c,v 1.9 1996/04/04 04:04:51 paulus Exp $";
+static char rcsid[] = "$Id: sys-aix4.c,v 1.10 1996/05/26 23:59:16 paulus Exp $";
 #endif
 
 /*
@@ -91,11 +91,6 @@ static int get_ether_addr __P((u_int32_t, struct sockaddr *));
 void
 sys_init()
 {
-    openlog("pppd", LOG_PID | LOG_NDELAY, LOG_PPP);
-    setlogmask(LOG_UPTO(LOG_INFO));
-    if (debug)
-       setlogmask(LOG_UPTO(LOG_DEBUG));
-
     /* Get an internet socket for doing socket ioctl's on. */
     if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
        syslog(LOG_ERR, "Couldn't create IP socket: %m");
@@ -129,19 +124,6 @@ sys_cleanup()
        cifproxyarp(0, proxy_arp_addr);
 }
 
-/*
- * note_debug_level - note a change in the debug level.
- */
-void
-note_debug_level()
-{
-    if (debug) {
-       syslog(LOG_INFO, "Debug turned ON, Level %d", debug);
-       setlogmask(LOG_UPTO(LOG_DEBUG));
-    } else {
-       setlogmask(LOG_UPTO(LOG_WARNING));
-    }
-}
 
 /*
  * daemon - Detach us from the terminal session.
@@ -800,7 +782,6 @@ sifup(u)
     int u;
 {
     struct ifreq ifr;
-    struct npioctl npi;
 
     strncpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
     if (ioctl(sockfd, SIOCGIFFLAGS, (caddr_t) &ifr) < 0) {
@@ -812,16 +793,28 @@ sifup(u)
        syslog(LOG_ERR, "ioctl(SIOCSIFFLAGS): %m");
        return 0;
     }
+
     if_is_up = 1;
-    npi.protocol = PPP_IP;
-    npi.mode = NPMODE_PASS;
-    if (ioctl(ttyfd, SIOCSETNPMODE, &npi) < 0) {
-        if (errno != ENOTTY) {
-            syslog(LOG_ERR, "ioctl(SIOCSETNPMODE): %m");
-            return 0;
-        }
-    }
+    return 1;
+}
+
+/*
+ * sifnpmode - Set the mode for handling packets for a given NP.
+ */
+int
+sifnpmode(u, proto, mode)
+    int u;
+    int proto;
+    enum NPmode mode;
+{
+    struct npioctl npi;
 
+    npi.protocol = proto;
+    npi.mode = mode;
+    if (ioctl(ppp_fd, PPPIOCSNPMODE, &npi) < 0) {
+       syslog(LOG_ERR, "ioctl(set NP %d mode to %d): %m", proto, mode);
+       return 0;
+    }
     return 1;
 }
 
@@ -839,12 +832,8 @@ sifdown(u)
     rv = 1;
     npi.protocol = PPP_IP;
     npi.mode = NPMODE_ERROR;
-    if (ioctl(ttyfd, SIOCSETNPMODE, &npi) < 0) {
-        if (errno != ENOTTY) {
-            syslog(LOG_ERR, "ioctl(SIOCSETNPMODE): %m");
-            rv = 0;
-        }
-    }
+    ioctl(ttyfd, SIOCSETNPMODE, &npi);
+    /* ignore errors, because ttyfd might have been closed by now. */
 
     strncpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
     if (ioctl(sockfd, SIOCGIFFLAGS, (caddr_t) &ifr) < 0) {
index b9b6d0e63f163da043cb8fade19fdad6a9d3a7cf..3578f67f861b3289d6326924910ba90e0bf77d70 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: sys-osf.c,v 1.8 1996/04/04 04:06:29 paulus Exp $";
+static char rcsid[] = "$Id: sys-osf.c,v 1.9 1996/05/26 23:58:46 paulus Exp $";
 #endif
 
 /*
@@ -90,11 +90,6 @@ static int get_ether_addr __P((u_int32_t, struct sockaddr *));
 void
 sys_init()
 {
-    openlog("pppd", LOG_PID | LOG_NDELAY, LOG_PPP);
-    setlogmask(LOG_UPTO(LOG_INFO));
-    if (debug)
-       setlogmask(LOG_UPTO(LOG_DEBUG));
-
     /* Get an internet socket for doing socket ioctl's on. */
     if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
         syslog(LOG_ERR, "Couldn't create IP socket: %m");
@@ -128,20 +123,6 @@ sys_cleanup()
        cifproxyarp(0, proxy_arp_addr);
 }
 
-/*
- * note_debug_level - note a change in the debug level.
- */
-void
-note_debug_level()
-{
-    if (debug) {
-       syslog(LOG_INFO, "Debug turned ON, Level %d", debug);
-       setlogmask(LOG_UPTO(LOG_DEBUG));
-    } else {
-       setlogmask(LOG_UPTO(LOG_WARNING));
-    }
-}
-
 /*
  * daemon - Detach us from the terminal session.
  */
@@ -930,7 +911,6 @@ sifup(u)
     int u;
 {
     struct ifreq ifr;
-    struct npioctl npi;
 
     strncpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
     if (ioctl(sockfd, (int)SIOCGIFFLAGS, (caddr_t) &ifr) < 0) {
@@ -943,14 +923,6 @@ sifup(u)
        return 0;
     }
     if_is_up = 1;
-    npi.protocol = PPP_IP;
-    npi.mode = NPMODE_PASS;
-    if (ioctl(ttyfd, (int)SIOCSETNPMODE, &npi) < 0) {
-       if (errno != ENOTTY) {
-           syslog(LOG_ERR, "ioctl(SIOCSETNPMODE): %m");
-           return 0;
-       }
-    }
     return 1;
 }
 
@@ -968,12 +940,7 @@ sifdown(u)
     rv = 1;
     npi.protocol = PPP_IP;
     npi.mode = NPMODE_ERROR;
-    if (ioctl(ttyfd, (int)SIOCSETNPMODE, (caddr_t) &npi) < 0) {
-       if (errno != ENOTTY) {
-           syslog(LOG_ERR, "ioctl(SIOCSETNPMODE): %m");
-           rv = 0;
-       }
-    }
+    ioctl(ttyfd, (int)SIOCSETNPMODE, (caddr_t) &npi);  /* ignore errors */
 
     strncpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
     if (ioctl(sockfd, (int)SIOCGIFFLAGS, (caddr_t) &ifr) < 0) {
index 50c91cf1e7ecca13dfe76a48229ef5fe2ebf6e13..ec05e7fb75d7e4d98122a56a1b9b7125bbad2859 100644 (file)
@@ -21,7 +21,7 @@
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: sys-ultrix.c,v 1.16 1996/04/04 04:04:19 paulus Exp $";
+static char rcsid[] = "$Id: sys-ultrix.c,v 1.17 1996/05/26 23:58:03 paulus Exp $";
 #endif
 
 /*
@@ -88,8 +88,6 @@ static int get_ether_addr __P((u_int32_t, struct sockaddr *));
 void
 sys_init()
 {
-    openlog("pppd", LOG_PID);
-
     /* Get an internet socket for doing socket ioctl's on. */
     if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
        syslog(LOG_ERR, "Couldn't create IP socket: %m");
@@ -134,7 +132,6 @@ sys_close()
        close(loop_slave);
        close(loop_master);
     }
-    closelog();
 }
 
 /*
@@ -151,15 +148,6 @@ sys_check_options()
 }
 
 
-/*
- * note_debug_level - note a change in the debug level.
- */
-void
-note_debug_level()
-{
-}
-
-
 /*
  * daemon - Detach us from the terminal session.
  */
@@ -874,7 +862,6 @@ sifup(u)
     int u;
 {
     struct ifreq ifr;
-    struct npioctl npi;
 
     strncpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
     if (ioctl(sockfd, SIOCGIFFLAGS, (caddr_t) &ifr) < 0) {
@@ -887,12 +874,6 @@ sifup(u)
        return 0;
     }
     if_is_up = 1;
-    npi.protocol = PPP_IP;
-    npi.mode = NPMODE_PASS;
-    if (ioctl(ppp_fd, PPPIOCSNPMODE, &npi) < 0) {
-       syslog(LOG_ERR, "ioctl(set IP mode to PASS): %m");
-       return 0;
-    }
     return 1;
 }