X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fsys-svr4.c;h=258cfae7d9d6ee853b9747c8f8edadc862dc53e5;hp=cccfeaa1972902e33c967c243ef9285ae26ca76a;hb=c5871dbfa014bb554c101e65150c48fc8ba80c7b;hpb=410dec1de0ee4520be8fd6840dc5974bb627101b diff --git a/pppd/sys-svr4.c b/pppd/sys-svr4.c index cccfeaa..258cfae 100644 --- a/pppd/sys-svr4.c +++ b/pppd/sys-svr4.c @@ -26,7 +26,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: sys-svr4.c,v 1.9 1996/01/01 23:06:39 paulus Exp $"; +static char rcsid[] = "$Id: sys-svr4.c,v 1.11 1996/05/27 00:01:53 paulus Exp $"; #endif #include @@ -100,6 +100,7 @@ static int dlpi_info_req __P((int)); static int dlpi_get_reply __P((int, union DL_primitives *, int, int)); static int strioctl __P((int, int, void *, int, int)); + /* * sys_init - System-dependent initialization. */ @@ -115,11 +116,6 @@ sys_init() } reply; #endif - openlog("pppd", LOG_PID | LOG_NDELAY, LOG_PPP); - setlogmask(LOG_UPTO(LOG_INFO)); - if (debug) - setlogmask(LOG_UPTO(LOG_DEBUG)); - ipfd = open("/dev/ip", O_RDWR, 0); if (ipfd < 0) { syslog(LOG_ERR, "Couldn't open IP device: %m"); @@ -218,7 +214,6 @@ sys_close() close(ipfd); if (pppfd >= 0) close(pppfd); - closelog(); } /* @@ -254,19 +249,6 @@ daemon(nochdir, noclose) return 0; } -/* - * note_debug_level - note a change in the debug level. - */ -void -note_debug_level() -{ - if (debug) { - setlogmask(LOG_UPTO(LOG_DEBUG)); - } else { - setlogmask(LOG_UPTO(LOG_WARNING)); - } -} - /* * ppp_available - check whether the system has any ppp interfaces */ @@ -711,6 +693,7 @@ wait_input(timo) * loopback, for the length of time specified by *timo (indefinite * if timo is NULL). */ +void wait_loop_output(timo) struct timeval *timo; { @@ -721,6 +704,7 @@ wait_loop_output(timo) * wait_time - wait for a given length of time or until a * signal is received. */ +void wait_time(timo) struct timeval *timo; { @@ -904,6 +888,33 @@ get_idle_time(u, ip) return strioctl(pppfd, PPPIO_GIDLE, ip, 0, sizeof(struct ppp_idle)) >= 0; } +#if 0 +/* + * set_filters - transfer the pass and active filters to the kernel. + */ +int +set_filters(pass, active) + struct bpf_program *pass, *active; +{ + int ret = 1; + + if (pass->bf_len > 0) { + if (strioctl(pppfd, PPPIO_PASSFILT, pass, + sizeof(struct bpf_program), 0) < 0) { + syslog(LOG_ERR, "Couldn't set pass-filter in kernel: %m"); + ret = 0; + } + } + if (active->bf_len > 0) { + if (strioctl(pppfd, PPPIO_ACTIVEFILT, active, + sizeof(struct bpf_program), 0) < 0) { + syslog(LOG_ERR, "Couldn't set active-filter in kernel: %m"); + ret = 0; + } + } + return ret; +} +#endif /* * ccp_fatal_error - returns 1 if decompression was disabled as a @@ -1037,6 +1048,11 @@ sifaddr(u, o, h, m) memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); ifr.ifr_addr.sa_family = AF_INET; + INET_ADDR(ifr.ifr_addr) = m; + if (ioctl(ipfd, SIOCSIFNETMASK, &ifr) < 0) { + syslog(LOG_ERR, "Couldn't set IP netmask: %m"); + } + ifr.ifr_addr.sa_family = AF_INET; INET_ADDR(ifr.ifr_addr) = o; if (ioctl(ipfd, SIOCSIFADDR, &ifr) < 0) { syslog(LOG_ERR, "Couldn't set local IP address: %m"); @@ -1046,11 +1062,6 @@ sifaddr(u, o, h, m) if (ioctl(ipfd, SIOCSIFDSTADDR, &ifr) < 0) { syslog(LOG_ERR, "Couldn't set remote IP address: %m"); } - ifr.ifr_addr.sa_family = AF_INET; - INET_ADDR(ifr.ifr_addr) = m; - if (ioctl(ipfd, SIOCSIFNETMASK, &ifr) < 0) { - syslog(LOG_ERR, "Couldn't set IP netmask: %m"); - } ifr.ifr_metric = link_mtu; if (ioctl(ipfd, SIOCSIFMTU, &ifr) < 0) { syslog(LOG_ERR, "Couldn't set IP MTU: %m"); @@ -1090,6 +1101,7 @@ sifdefaultroute(u, g) { struct rtentry rt; + memset(&rt, 0, sizeof(rt)); rt.rt_dst.sa_family = AF_INET; INET_ADDR(rt.rt_dst) = 0; rt.rt_gateway.sa_family = AF_INET; @@ -1115,6 +1127,7 @@ cifdefaultroute(u, g) { struct rtentry rt; + memset(&rt, 0, sizeof(rt)); rt.rt_dst.sa_family = AF_INET; INET_ADDR(rt.rt_dst) = 0; rt.rt_gateway.sa_family = AF_INET;