*/
#ifndef lint
-static char rcsid[] = "$Id: sys-osf.c,v 1.20 1999/03/16 22:53:48 paulus Exp $";
+static char rcsid[] = "$Id: sys-osf.c,v 1.23 1999/03/22 05:55:38 paulus Exp $";
#endif
#include <stdio.h>
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
*/
/*
* add_fd - add an fd to the set that wait_input waits for.
*/
-void add_fd(int fd)
+void add_fd(fd)
+ int fd;
{
int n;
/*
* remove_fd - remove an fd from the set that wait_input waits for.
*/
-void remove_fd(int fd)
+void remove_fd(fd)
+ int fd;
{
int n;
return strioctl(pppfd, PPPIO_GIDLE, ip, 0, sizeof(struct ppp_idle)) >= 0;
}
+/*
+ * get_ppp_stats - return statistics for the link.
+ */
+int
+get_ppp_stats(u, stats)
+ int u;
+ struct pppd_stats *stats;
+{
+ struct ppp_stats s;
+
+ if (strioctl(pppfd, PPPIO_GETSTAT, &s, 0, sizeof(s)) < 0) {
+ error("Couldn't get link statistics: %m");
+ return 0;
+ }
+ stats->bytes_in = s.p.ppp_ibytes;
+ stats->bytes_out = s.p.ppp_obytes;
+ return 1;
+}
+
/*
* ccp_fatal_error - returns 1 if decompression was disabled as a
{
struct ifreq ifr;
- strlcpy(ifr.ifr_name, sizeof(ifr.ifr_name), ifname);
+ strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
if (ioctl(sockfd, SIOCGIFFLAGS, &ifr) < 0) {
error("Couldn't mark interface up (get): %m");
return 0;
{
struct ifreq ifr;
- strlcpy(ifr.ifr_name, sizeof(ifr.ifr_name), ifname);
+ strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
if (ioctl(sockfd, SIOCGIFFLAGS, &ifr) < 0) {
error("Couldn't mark interface down (get): %m");
return 0;
/* flush old address, if any
*/
bzero(&ifr, sizeof (ifr));
- strlcpy(ifr.ifr_name, sizeof (ifr.ifr_name), ifname);
+ strlcpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
SET_SA_FAMILY(ifr.ifr_addr, AF_INET);
((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr.s_addr = o;
if ((ioctl(sockfd, (int)SIOCDIFADDR, (caddr_t) &ifr) < 0)
}
bzero(&addreq, sizeof (addreq));
- strlcpy(addreq.ifra_name, sizeof (addreq.ifra_name), ifname);
+ strlcpy(addreq.ifra_name, ifname, sizeof (addreq.ifra_name));
SET_SA_FAMILY(addreq.ifra_addr, AF_INET);
SET_SA_FAMILY(addreq.ifra_broadaddr, AF_INET);
((struct sockaddr_in *)&addreq.ifra_addr)->sin_addr.s_addr = o;
ifaddrs[0] = 0;
ifaddrs[1] = 0;
bzero(&ifr, sizeof (ifr));
- strlcpy(ifr.ifr_name, sizeof (ifr.ifr_name), ifname);
+ strlcpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
SET_SA_FAMILY(ifr.ifr_addr, AF_INET);
((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr.s_addr = o;
if (ioctl(sockfd, (int)SIOCDIFADDR, (caddr_t) &ifr) < 0) {
* Check that the interface is up, and not point-to-point
* or loopback.
*/
- strlcpy(ifreq.ifr_name, sizeof(ifreq.ifr_name), ifr->ifr_name);
+ strlcpy(ifreq.ifr_name, ifr->ifr_name, sizeof(ifreq.ifr_name));
if (ioctl(sockfd, SIOCGIFFLAGS, &ifreq) < 0)
continue;
if ((ifreq.ifr_flags &
return 0;
info("found interface %s for proxy arp", ifr->ifr_name);
- strlcpy(ifdevreq.ifr_name, sizeof(ifdevreq.ifr_name), ifr->ifr_name);
+ strlcpy(ifdevreq.ifr_name, ifr->ifr_name, sizeof(ifdevreq.ifr_name));
if (ioctl(sockfd, (int)SIOCRPHYSADDR, &ifdevreq) < 0) {
perror("ioctl(SIOCRPHYSADDR)");
if ((fd = open(WTMPFILE, O_WRONLY|O_APPEND, 0)) < 0)
return;
if (!fstat(fd, &buf)) {
- 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);
+ strlcpy(ut.ut_line, line, sizeof(ut.ut_line));
+ strlcpy(ut.ut_name, name, sizeof(ut.ut_name));
+ strlcpy(ut.ut_host, host, sizeof(ut.ut_host));
(void)time(&ut.ut_time);
if (write(fd, (char *)&ut, sizeof(struct utmp)) != sizeof(struct utmp))
(void)ftruncate(fd, buf.st_size);
/*
* Check that the interface is up, and not point-to-point or loopback.
*/
- strlcpy(ifreq.ifr_name, sizeof(ifreq.ifr_name), ifr->ifr_name);
+ strlcpy(ifreq.ifr_name, ifr->ifr_name, sizeof(ifreq.ifr_name));
if (ioctl(sockfd, SIOCGIFFLAGS, &ifreq) < 0)
continue;
if ((ifreq.ifr_flags & (IFF_UP|IFF_POINTOPOINT|IFF_LOOPBACK))