*/
#ifndef lint
-static char rcsid[] = "$Id: sys-aix4.c,v 1.12 1997/04/30 05:57:19 paulus Exp $";
+static char rcsid[] = "$Id: sys-aix4.c,v 1.15 1999/03/12 06:07:21 paulus Exp $";
#endif
/*
#include <net/if.h>
#include <net/ppp_defs.h>
-#include <net/ppp_str.h>
#include <net/route.h>
#include <net/if_arp.h>
#include <netinet/in.h>
struct ifreq ifr;
if (if_is_up) {
- strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
+ strlcpy(ifr.ifr_name, sizeof(ifr.ifr_name), ifname);
if (ioctl(sockfd, SIOCGIFFLAGS, &ifr) >= 0
&& ((ifr.ifr_flags & IFF_UP) != 0)) {
ifr.ifr_flags &= ~IFF_UP;
cifproxyarp(0, proxy_arp_addr);
}
+/*
+ * have_route_to - determine if the system has any route to
+ * a given IP address.
+ * For demand mode to work properly, we have to ignore routes
+ * through our own interface.
+ */
+int have_route_to(u_int32_t addr)
+{
+ return -1;
+}
+
/*
* daemon - Detach us from the terminal session.
int c;
struct ifreq ifr;
- strncpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
+ strlcpy(ifr.ifr_name, sizeof (ifr.ifr_name), ifname);
ifr.ifr_mtu = mtu;
if (ioctl(sockfd, SIOCSIFMTU, (caddr_t) &ifr) < 0) {
syslog(LOG_ERR, "ioctl(SIOCSIFMTU): %m");
{
struct ifreq ifr;
- strncpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
+ strlcpy(ifr.ifr_name, sizeof (ifr.ifr_name), ifname);
if (ioctl(sockfd, SIOCGIFFLAGS, (caddr_t) &ifr) < 0) {
syslog(LOG_ERR, "ioctl (SIOCGIFFLAGS): %m");
return 0;
ioctl(ttyfd, SIOCSETNPMODE, &npi);
/* ignore errors, because ttyfd might have been closed by now. */
- strncpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
+ strlcpy(ifr.ifr_name, sizeof (ifr.ifr_name), ifname);
if (ioctl(sockfd, SIOCGIFFLAGS, (caddr_t) &ifr) < 0) {
syslog(LOG_ERR, "ioctl (SIOCGIFFLAGS): %m");
rv = 0;
struct ifreq ifr;
ret = 1;
- strncpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
+ strlcpy(ifr.ifr_name, sizeof (ifr.ifr_name), ifname);
SET_SA_FAMILY(ifr.ifr_addr, AF_INET);
if (m != 0) {
syslog(LOG_INFO, "Setting interface mask to %s\n", ip_ntoa(m));
/*
* Check that the interface is up, and not point-to-point or loopback.
*/
- strncpy(ifreq.ifr_name, ifr->ifr_name, sizeof(ifreq.ifr_name));
+ strlcpy(ifreq.ifr_name, sizeof(ifreq.ifr_name), ifr->ifr_name);
if (ioctl(sockfd, SIOCGIFFLAGS, &ifreq) < 0)
continue;
if ((ifreq.ifr_flags & (IFF_UP|IFF_POINTOPOINT|IFF_LOOPBACK))
if ((fd = open(WTMPFILE, O_WRONLY|O_APPEND, 0)) < 0)
return;
if (!fstat(fd, &buf)) {
- (void)strncpy(ut.ut_line, line, sizeof(ut.ut_line));
- (void)strncpy(ut.ut_name, name, sizeof(ut.ut_name));
- (void)strncpy(ut.ut_host, host, sizeof(ut.ut_host));
+ strlcpy(ut.ut_line, sizeof(ut.ut_line), line);
+ strlcpy(ut.ut_name, sizeof(ut.ut_name), name);
+ strlcpy(ut.ut_host, sizeof(ut.ut_host), host);
(void)time(&ut.ut_time);
if (write(fd, (char *)&ut, sizeof(struct utmp)) != sizeof(struct utmp))
(void)ftruncate(fd, buf.st_size);
close(fd);
}
+/*
+ * Use the hostid as part of the random number seed.
+ */
+int
+get_host_seed()
+{
+ return gethostid();
+}
+
/*
* Code for locking/unlocking the serial device.
*/