#include <stdio.h>
#include <syslog.h>
#include <string.h>
+#include <time.h>
+#include <memory.h>
+#include <utmp.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <linux/route.h>
#include <linux/if_ether.h>
#include <netinet/in.h>
-#include <net/if_ppp.h>
+#include <signal.h>
#include "pppd.h"
#include "ppp.h"
void establish_ppp (void)
{
int pppdisc = N_PPP;
+ int sig = SIGIO;
+
+ if (ioctl(fd, PPPIOCSINPSIG, &sig) == -1) {
+ syslog(LOG_ERR, "ioctl(PPPIOCSINPSIG): %m");
+ die(1);
+ }
if (ioctl(fd, TIOCEXCL, 0) < 0) {
syslog (LOG_WARNING, "ioctl(TIOCEXCL): %m");
}
hwaddr->sa_family = ARPHRD_ETHER;
- memcpy (&hwaddr->sa_data, &ifr->ifr_hwaddr, ETH_ALEN);
+#ifndef old_ifr_hwaddr
+ memcpy (&hwaddr->sa_data, &ifreq.ifr_hwaddr, ETH_ALEN);
+#else
+ memcpy (&hwaddr->sa_data, &ifreq.ifr_hwaddr.sa_data, ETH_ALEN);
+#endif
MAINDEBUG ((LOG_DEBUG,
"proxy arp: found hwaddr %02x:%02x:%02x:%02x:%02x:%02x",
- (int) ((unsigned char *) &ifr->ifr_hwaddr)[0],
- (int) ((unsigned char *) &ifr->ifr_hwaddr)[1],
- (int) ((unsigned char *) &ifr->ifr_hwaddr)[2],
- (int) ((unsigned char *) &ifr->ifr_hwaddr)[3],
- (int) ((unsigned char *) &ifr->ifr_hwaddr)[4],
- (int) ((unsigned char *) &ifr->ifr_hwaddr)[5]));
+ (int) ((unsigned char *) &hwaddr->sa_data)[0],
+ (int) ((unsigned char *) &hwaddr->sa_data)[1],
+ (int) ((unsigned char *) &hwaddr->sa_data)[2],
+ (int) ((unsigned char *) &hwaddr->sa_data)[3],
+ (int) ((unsigned char *) &hwaddr->sa_data)[4],
+ (int) ((unsigned char *) &hwaddr->sa_data)[5]));
return 1;
}
return ok;
}
+
+int
+logwtmp(line, name, host)
+ char *line, *name, *host;
+{
+ struct utmp ut;
+
+ memset (&ut, 0, sizeof (ut));
+ (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));
+ (void)time(&ut.ut_time);
+
+ pututline (&ut); /* Write the line to the proper place */
+ endutent(); /* Indicate operation is complete */
+}