*/
#ifndef lint
-static char rcsid[] = "$Id: sys-svr4.c,v 1.25 1999/03/16 02:57:07 paulus Exp $";
+static char rcsid[] = "$Id: sys-svr4.c,v 1.28 1999/03/19 04:23:52 paulus Exp $";
#endif
#include <limits.h>
/*
* establish_ppp - Turn the serial port into a ppp interface.
*/
-void
+int
establish_ppp(fd)
int fd;
{
/* Link the serial port under the PPP multiplexor. */
if ((fdmuxid = ioctl(pppfd, I_LINK, fd)) < 0)
fatal("Can't link tty to PPP mux: %m");
+
+ return pppfd;
}
/*
* in demand mode. Under Solaris 2, we use our existing fd
* to the ppp driver.
*/
-void
+int
open_ppp_loopback()
{
+ return pppfd;
}
/*
/*
* 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;
/* set the MTU for IP as well */
memset(&ifr, 0, sizeof(ifr));
- strlcpy(ifr.ifr_name, sizeof(ifr.ifr_name), ifname);
+ strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
ifr.ifr_metric = link_mtu;
if (ioctl(ipfd, SIOCSIFMTU, &ifr) < 0) {
error("Couldn't set IP MTU: %m");
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 ppp_stats *stats;
+{
+ if (strioctl(pppfd, PPPIO_GETSTAT, stats, 0, sizeof(*stats)) < 0) {
+ error("Couldn't get link statistics: %m");
+ return 0;
+ }
+ return 1;
+}
+
#if 0
/*
* set_filters - transfer the pass and active filters to the kernel.
{
struct ifreq ifr;
- strlcpy(ifr.ifr_name, sizeof(ifr.ifr_name), ifname);
+ strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
if (ioctl(ipfd, SIOCGIFFLAGS, &ifr) < 0) {
error("Couldn't mark interface up (get): %m");
return 0;
if (ipmuxid < 0)
return 1;
- strlcpy(ifr.ifr_name, sizeof(ifr.ifr_name), ifname);
+ strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
if (ioctl(ipfd, SIOCGIFFLAGS, &ifr) < 0) {
error("Couldn't mark interface down (get): %m");
return 0;
int ret = 1;
memset(&ifr, 0, sizeof(ifr));
- strlcpy(ifr.ifr_name, sizeof(ifr.ifr_name), ifname);
+ strlcpy(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) {
/*
* 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(ipfd, SIOCGIFFLAGS, &ifreq) < 0)
continue;
if ((ifreq.ifr_flags &
/*
* 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(ipfd, SIOCGIFFLAGS, &ifreq) < 0)
continue;
if ((ifreq.ifr_flags & (IFF_UP|IFF_POINTOPOINT|IFF_LOOPBACK))
if (name[0] != 0) {
/* logging in */
- strlcpy(utmpx.ut_user, sizeof(utmpx.ut_user), name);
- strlcpy(utmpx.ut_id, sizeof(utmpx.ut_id), ifname);
- strlcpy(utmpx.ut_line, sizeof(utmpx.ut_line), line);
+ strlcpy(utmpx.ut_user, name, sizeof(utmpx.ut_user));
+ strlcpy(utmpx.ut_id, ifname, sizeof(utmpx.ut_id));
+ strlcpy(utmpx.ut_line, line, sizeof(utmpx.ut_line));
utmpx.ut_pid = getpid();
utmpx.ut_type = USER_PROCESS;
} else {