X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fsys-bsd.c;h=4239d0fc8dc2628f0dfda3b2cfd85e585eb77a19;hp=0aee267b6b652fcbefddbbfbaf71b2fd38b8dc30;hb=4e3c66a04c0b86108858081d434bc45983471990;hpb=9cb20e5f15c7da0955c27b8a0ddf515629c5848b diff --git a/pppd/sys-bsd.c b/pppd/sys-bsd.c index 0aee267..4239d0f 100644 --- a/pppd/sys-bsd.c +++ b/pppd/sys-bsd.c @@ -21,7 +21,8 @@ */ #ifndef lint -static char rcsid[] = "$Id: sys-bsd.c,v 1.28 1997/04/30 05:57:46 paulus Exp $"; +static char rcsid[] = "$Id: sys-bsd.c,v 1.34 1998/11/07 06:59:30 paulus Exp $"; +/* $NetBSD: sys-bsd.c,v 1.1.1.3 1997/09/26 18:53:04 christos Exp $ */ #endif /* @@ -58,7 +59,16 @@ static char rcsid[] = "$Id: sys-bsd.c,v 1.28 1997/04/30 05:57:46 paulus Exp $"; #include #if RTM_VERSION >= 3 +#include +#if defined(NetBSD) && (NetBSD >= 199703) +#include +#else /* NetBSD 1.2D or later */ +#ifdef __FreeBSD__ #include +#else +#include +#endif +#endif #endif #include "pppd.h" @@ -149,9 +159,16 @@ sys_close() /* * sys_check_options - check the options that the user specified */ -void +int sys_check_options() { +#ifndef CDTRCTS + if (crtscts == 2) { + syslog(LOG_WARNING, "DTR/CTS flow control is not supported on this system"); + return 0; + } +#endif + return 1; } /* @@ -375,10 +392,19 @@ set_up_tty(fd, local) } tios.c_cflag &= ~(CSIZE | CSTOPB | PARENB | CLOCAL); - if (crtscts > 0 && !local) - tios.c_cflag |= CRTSCTS; - else if (crtscts < 0) + if (crtscts > 0 && !local) { + if (crtscts == 2) { +#ifdef CDTRCTS + tios.c_cflag |= CDTRCTS; +#endif + } else + tios.c_cflag |= CRTSCTS; + } else if (crtscts < 0) { tios.c_cflag &= ~CRTSCTS; +#ifdef CDTRCTS + tios.c_cflag &= ~CDTRCTS; +#endif + } tios.c_cflag |= CS8 | CREAD | HUPCL; if (local || !modem) @@ -946,6 +972,7 @@ sifaddr(u, o, h, m) u_int32_t o, h, m; { struct ifaliasreq ifra; + struct ifreq ifr; strncpy(ifra.ifra_name, ifname, sizeof(ifra.ifra_name)); SET_SA_FAMILY(ifra.ifra_addr, AF_INET); @@ -957,6 +984,12 @@ sifaddr(u, o, h, m) ((struct sockaddr_in *) &ifra.ifra_mask)->sin_addr.s_addr = m; } else BZERO(&ifra.ifra_mask, sizeof(ifra.ifra_mask)); + BZERO(&ifr, sizeof(ifr)); + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + if (ioctl(sockfd, SIOCDIFADDR, (caddr_t) &ifr) < 0) { + if (errno != EADDRNOTAVAIL) + syslog(LOG_WARNING, "Couldn't remove interface address: %m"); + } if (ioctl(sockfd, SIOCAIFADDR, (caddr_t) &ifra) < 0) { if (errno != EEXIST) { syslog(LOG_ERR, "Couldn't set interface address: %m"); @@ -1043,7 +1076,7 @@ dodefaultroute(g, cmd) memset(&rtmsg, 0, sizeof(rtmsg)); rtmsg.hdr.rtm_type = cmd == 's'? RTM_ADD: RTM_DELETE; - rtmsg.hdr.rtm_flags = RTF_UP | RTF_GATEWAY; + rtmsg.hdr.rtm_flags = RTF_UP | RTF_GATEWAY | RTF_STATIC; rtmsg.hdr.rtm_version = RTM_VERSION; rtmsg.hdr.rtm_seq = ++rtm_seq; rtmsg.hdr.rtm_addrs = RTA_DST | RTA_GATEWAY | RTA_NETMASK; @@ -1377,6 +1410,15 @@ GetMask(addr) return mask; } +/* + * Use the hostid as part of the random number seed. + */ +int +get_host_seed() +{ + return gethostid(); +} + /* * lock - create a lock file for the named lock device */