X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fsys-sunos4.c;h=74c0217ef2908d7c5ae160164b53dc0a42fec180;hp=2faa216fdc03c97c09eb2d9d49c54c95ef37da25;hb=e28f47d5e53abe7317d9a82703bbbee044482d4f;hpb=a548f454c25d6dc0ee2b4aad5ca4820a74dfcbda diff --git a/pppd/sys-sunos4.c b/pppd/sys-sunos4.c index 2faa216..74c0217 100644 --- a/pppd/sys-sunos4.c +++ b/pppd/sys-sunos4.c @@ -26,7 +26,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: sys-sunos4.c,v 1.4 1996/04/04 04:06:59 paulus Exp $"; +static char rcsid[] = "$Id: sys-sunos4.c,v 1.8 1997/04/30 05:58:52 paulus Exp $"; #endif #include @@ -63,6 +63,9 @@ static char rcsid[] = "$Id: sys-sunos4.c,v 1.4 1996/04/04 04:06:59 paulus Exp $" #if defined(sun) && defined(sparc) #include +#ifndef __GNUC__ +extern void *alloca(); +#endif #endif /*sparc*/ static int pppfd; @@ -103,11 +106,6 @@ sys_init() { int x; - 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"); @@ -189,7 +187,7 @@ 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); } @@ -203,7 +201,6 @@ sys_close() close(iffd); close(pppfd); close(sockfd); - closelog(); } /* @@ -239,19 +236,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 */ @@ -619,7 +603,7 @@ output(unit, p, len) struct pollfd pfd; if (debug) - log_packet(p, len, "sent "); + log_packet(p, len, "sent ", LOG_DEBUG); data.len = len; data.buf = (caddr_t) p; @@ -754,6 +738,7 @@ ppp_send_config(unit, mtu, asyncmap, pcomp, accomp) int pcomp, accomp; { int cf[2]; + struct ifreq ifr; link_mtu = mtu; if (strioctl(pppfd, PPPIO_MTU, &mtu, sizeof(mtu), 0) < 0) { @@ -769,6 +754,14 @@ ppp_send_config(unit, mtu, asyncmap, pcomp, accomp) if (strioctl(pppfd, PPPIO_CFLAGS, cf, sizeof(cf), sizeof(int)) < 0) { syslog(LOG_ERR, "Couldn't set prot/AC compression: %m"); } + + /* set mtu for ip as well */ + memset(&ifr, 0, sizeof(ifr)); + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + ifr.ifr_metric = link_mtu; + if (ioctl(sockfd, SIOCSIFMTU, &ifr) < 0) { + syslog(LOG_ERR, "Couldn't set IP MTU: %m"); + } } /* @@ -967,7 +960,7 @@ sifnpmode(u, proto, mode) npi[0] = proto; npi[1] = (int) mode; - if (strioctl(pppfd, PPPIO_NPMODE, &npi, 2 * sizeof(int), 0) < 0) { + if (strioctl(pppfd, PPPIO_NPMODE, npi, 2 * sizeof(int), 0) < 0) { syslog(LOG_ERR, "ioctl(set NP %d mode to %d): %m", proto, mode); return 0; } @@ -1003,10 +996,12 @@ sifaddr(u, o, h, m) if (ioctl(sockfd, SIOCSIFDSTADDR, &ifr) < 0) { syslog(LOG_ERR, "Couldn't set remote IP address: %m"); } +#if 0 /* now done in ppp_send_config */ ifr.ifr_metric = link_mtu; if (ioctl(sockfd, SIOCSIFMTU, &ifr) < 0) { syslog(LOG_ERR, "Couldn't set IP MTU: %m"); } +#endif ifaddrs[0] = o; ifaddrs[1] = h; @@ -1040,9 +1035,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 rtentry rt; @@ -1066,9 +1061,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 rtentry rt; @@ -1224,9 +1219,9 @@ get_ether_addr(ipaddr, hwaddr) #define WTMPFILE "/usr/adm/wtmp" -int +void logwtmp(line, name, host) - char *line, *name, *host; + const char *line, *name, *host; { int fd; struct stat buf; @@ -1443,3 +1438,21 @@ strtoul(str, ptr, base) { return (unsigned long) strtol(str, ptr, base); } + +/* + * Or strerror :-( + */ +extern char *sys_errlist[]; +extern int sys_nerr; + +char * +strerror(n) + int n; +{ + static char unknown[32]; + + if (n > 0 && n < sys_nerr) + return sys_errlist[n]; + sprintf(unknown, "Error %d", n); + return unknown; +}