X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fsys-linux.c;h=306ae4a8bca14468b89c64dc61a689e15545f1e6;hp=42fadaa3dfad99b764295f86f26fbd2b479d2f9b;hb=a115760c2c03a34dd5aa1ed7274ac49810d7dd45;hpb=25f18053feac88f6f7251f5f64630f39bdca423b diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c index 42fadaa..306ae4a 100644 --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c @@ -25,6 +25,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -37,7 +40,7 @@ #include #include #include -#include +#include #include "pppd.h" #include "ppp.h" @@ -91,6 +94,12 @@ int set_kdebugflag (int requested_level) 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"); @@ -766,16 +775,20 @@ int get_ether_addr (u_long ipaddr, struct sockaddr *hwaddr) } 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; } @@ -799,3 +812,19 @@ int ppp_available(void) 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 */ +}