]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/sys-aix4.c
fix up MD4 stuff - interface is better now
[ppp.git] / pppd / sys-aix4.c
index 46fad402d7ffd7f23528cacdb42e6d218dd34ca3..d620b2fa37c46bf99013f5aef10676c75fb76dc2 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.12 1997/04/30 05:57:19 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");
@@ -124,24 +119,11 @@ sys_cleanup()
     if (ifaddrs[0])
        cifaddr(0, ifaddrs[0], ifaddrs[1]);
     if (default_route_gateway)
-       cifdefaultroute(0, default_route_gateway);
+       cifdefaultroute(0, 0, default_route_gateway);
     if (proxy_arp_addr)
        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.
@@ -564,7 +546,7 @@ output(unit, p, len)
     struct pollfd pfd;
 
     if (debug)
-       log_packet(p, len, "sent ");
+       log_packet(p, len, "sent ", LOG_DEBUG);
 
     str.len = len;
     str.buf = (caddr_t) p;
@@ -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) {
@@ -945,9 +934,9 @@ cifaddr(u, o, h)
  * sifdefaultroute - assign a default route through the address given.
  */
 int
-sifdefaultroute(u, g)
+sifdefaultroute(u, l, g)
     int u;
-    u_int32_t g;
+    u_int32_t l, g;
 {
     struct ortentry rt;
 
@@ -968,9 +957,9 @@ sifdefaultroute(u, g)
  * cifdefaultroute - delete a default route through the address given.
  */
 int
-cifdefaultroute(u, g)
+cifdefaultroute(u, l, g)
     int u;
-    u_int32_t g;
+    u_int32_t l, g;
 {
     struct ortentry rt;
 
@@ -1267,9 +1256,9 @@ GetMask(addr)
 
 #define        WTMPFILE        "/var/adm/wtmp"
 
-int
+void
 logwtmp(line, name, host)
-    char *line, *name, *host;
+    const char *line, *name, *host;
 {
     int fd;
     struct stat buf;