From: Paul Mackerras Date: Sun, 26 May 1996 23:59:36 +0000 (+0000) Subject: syslog stuff back to main.c; take out npmode setting in sifup X-Git-Tag: RELEASE_2_3_6~473 X-Git-Url: https://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=7173a14a57e110a75b316d0ad6de58f2eea5057c syslog stuff back to main.c; take out npmode setting in sifup --- diff --git a/pppd/sys-NeXT.c b/pppd/sys-NeXT.c index 7a8d794..c8538d4 100644 --- a/pppd/sys-NeXT.c +++ b/pppd/sys-NeXT.c @@ -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 @@ -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; } diff --git a/pppd/sys-aix4.c b/pppd/sys-aix4.c index 46fad40..1f7fefc 100644 --- a/pppd/sys-aix4.c +++ b/pppd/sys-aix4.c @@ -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) { diff --git a/pppd/sys-osf.c b/pppd/sys-osf.c index b9b6d0e..3578f67 100644 --- a/pppd/sys-osf.c +++ b/pppd/sys-osf.c @@ -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) { diff --git a/pppd/sys-ultrix.c b/pppd/sys-ultrix.c index 50c91cf..ec05e7f 100644 --- a/pppd/sys-ultrix.c +++ b/pppd/sys-ultrix.c @@ -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; }