#include <sys/ethernet.h>
#endif
-#ifdef PPP_FILTER
+#ifdef PPP_WITH_FILTER
#include <pcap.h>
#endif
-#include "pppd.h"
+#include "pppd-private.h"
#include "fsm.h"
#include "lcp.h"
#include "ipcp.h"
#include "ccp.h"
+#ifdef PPP_WITH_IPV6CP
+#include "eui64.h"
+#endif
+
#if !defined(PPP_DRV_NAME)
#define PPP_DRV_NAME "ppp"
#endif /* !defined(PPP_DRV_NAME) */
* sys_close - Clean up in a child process before execing.
*/
void
-sys_close(void)
+ppp_sys_close(void)
{
close(ipfd);
#if defined(PPP_WITH_IPV6CP) && defined(SOL2)
#endif
/*
- * ppp_available - check whether the system has any ppp interfaces
+ * ppp_check_kernel_support - check whether the system has any ppp interfaces
*/
int
-ppp_available(void)
+ppp_check_kernel_support(void)
{
struct stat buf;
/* Push the async hdlc module and the compressor module. */
tty_npushed = 0;
- if(!sync_serial) {
+ if(!ppp_sync_serial()) {
if (ioctl(fd, I_PUSH, AHDLC_MOD_NAME) < 0) {
error("Couldn't push PPP Async HDLC module: %m");
return -1;
struct termiox tiox;
#endif
- if (!sync_serial && tcgetattr(fd, &tios) < 0)
+ if (!ppp_sync_serial() && tcgetattr(fd, &tios) < 0)
fatal("tcgetattr: %m");
#ifndef CRTSCTS
termiox_ok = 1;
- if (!sync_serial && ioctl (fd, TCGETX, &tiox) < 0) {
+ if (!ppp_sync_serial() && ioctl (fd, TCGETX, &tiox) < 0) {
termiox_ok = 0;
if (errno != ENOTTY)
error("TCGETX: %m");
#ifndef CRTSCTS
inittermiox = tiox;
#endif
- if (!sync_serial)
+ if (!ppp_sync_serial())
ioctl(fd, TIOCGWINSZ, &wsinfo);
}
* We can't proceed if the serial port speed is 0,
* since that implies that the serial port is disabled.
*/
- if ((speed == B0) && !sync_serial)
+ if ((speed == B0) && !ppp_sync_serial())
fatal("Baud rate for %s is 0; need explicit baud rate", devnam);
}
- if (!sync_serial && tcsetattr(fd, TCSAFLUSH, &tios) < 0)
+ if (!ppp_sync_serial() && tcsetattr(fd, TCSAFLUSH, &tios) < 0)
fatal("tcsetattr: %m");
#ifndef CRTSCTS
- if (!sync_serial && termiox_ok && ioctl (fd, TCSETXF, &tiox) < 0){
+ if (!ppp_sync_serial() && termiox_ok && ioctl (fd, TCSETXF, &tiox) < 0){
error("TCSETXF: %m");
}
#endif
baud_rate = inspeed = baud_rate_of(speed);
- if (!sync_serial)
+ if (!ppp_sync_serial())
restore_term = 1;
}
*/
inittermios.c_lflag &= ~(ECHO | ECHONL);
}
- if (!sync_serial && tcsetattr(fd, TCSAFLUSH, &inittermios) < 0)
+ if (!ppp_sync_serial() && tcsetattr(fd, TCSAFLUSH, &inittermios) < 0)
if (!hungup && errno != ENXIO)
warn("tcsetattr: %m");
#ifndef CRTSCTS
- if (!sync_serial && ioctl (fd, TCSETXF, &inittermiox) < 0){
+ if (!ppp_sync_serial() && ioctl (fd, TCSETXF, &inittermiox) < 0){
if (!hungup && errno != ENXIO)
error("TCSETXF: %m");
}
#endif
- if (!sync_serial)
+ if (!ppp_sync_serial())
ioctl(fd, TIOCSWINSZ, &wsinfo);
restore_term = 0;
}
}
/*
- * netif_set_mtu - set the MTU on the PPP network interface.
+ * ppp_set_mtu - set the MTU on the PPP network interface.
*/
void
-netif_set_mtu(int unit, int mtu)
+ppp_set_mtu(int unit, int mtu)
{
struct ifreq ifr;
#if defined(PPP_WITH_IPV6CP) && defined(SOL2)
/*
- * netif_get_mtu - get the MTU on the PPP network interface.
+ * ppp_get_mtu - get the MTU on the PPP network interface.
*/
int
-netif_get_mtu(int unit)
+ppp_get_mtu(int unit)
{
struct ifreq ifr;
error("Couldn't set MTU: %m");
}
if (fdmuxid >= 0) {
- if (!sync_serial) {
+ if (!ppp_sync_serial()) {
if (strioctl(pppfd, PPPIO_XACCM, &asyncmap, sizeof(asyncmap), 0) < 0)
error("Couldn't set transmit ACCM: %m");
}
void
tty_set_xaccm(ext_accm accm)
{
- if (sync_serial)
+ if (ppp_sync_serial())
return;
if (fdmuxid >= 0
error("Couldn't set MRU: %m");
}
if (fdmuxid >= 0) {
- if (!sync_serial) {
+ if (!ppp_sync_serial()) {
if (strioctl(pppfd, PPPIO_RACCM, &asyncmap, sizeof(asyncmap), 0) < 0)
error("Couldn't set receive ACCM: %m");
}
{
struct ppp_stats s;
- if (!sync_serial &&
+ if (!ppp_sync_serial() &&
strioctl(pppfd, PPPIO_GETSTAT, &s, 0, sizeof(s)) < 0) {
error("Couldn't get link statistics: %m");
return 0;
pfd.events = POLLIN | POLLPRI;
do {
n = poll(&pfd, 1, 1000);
- } while (n == -1 && errno == EINTR && !got_sigterm);
+ } while (n == -1 && errno == EINTR && !ppp_signaled(SIGTERM));
if (n <= 0)
return -1;
* get_time - Get current time, monotonic if possible.
*/
int
-get_time(struct timeval *tv)
+ppp_get_time(struct timeval *tv)
{
return gettimeofday(tv, NULL);
}