From 9cb20e5f15c7da0955c27b8a0ddf515629c5848b Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Wed, 30 Apr 1997 05:57:46 +0000 Subject: [PATCH] add log level arg for log_packet; added optional packet filtering --- pppd/sys-bsd.c | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/pppd/sys-bsd.c b/pppd/sys-bsd.c index 5f0d66d..0aee267 100644 --- a/pppd/sys-bsd.c +++ b/pppd/sys-bsd.c @@ -21,7 +21,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: sys-bsd.c,v 1.27 1997/03/04 03:43:53 paulus Exp $"; +static char rcsid[] = "$Id: sys-bsd.c,v 1.28 1997/04/30 05:57:46 paulus Exp $"; #endif /* @@ -42,6 +42,13 @@ static char rcsid[] = "$Id: sys-bsd.c,v 1.27 1997/03/04 03:43:53 paulus Exp $"; #include #include #include +#include +#ifdef NetBSD1_2 +#include +#endif +#ifdef PPP_FILTER +#include +#endif #include #include @@ -55,6 +62,8 @@ static char rcsid[] = "$Id: sys-bsd.c,v 1.27 1997/03/04 03:43:53 paulus Exp $"; #endif #include "pppd.h" +#include "fsm.h" +#include "ipcp.h" static int initdisc = -1; /* Initial TTY discipline for ppp_fd */ static int initfdflags = -1; /* Initial file descriptor flags for ppp_fd */ @@ -145,7 +154,6 @@ sys_check_options() { } - /* * ppp_available - check whether the system has any ppp interfaces * (in fact we check whether we can do an ioctl on ppp0). @@ -523,7 +531,7 @@ output(unit, p, len) int len; { if (debug) - log_packet(p, len, "sent "); + log_packet(p, len, "sent ", LOG_DEBUG); if (write(ttyfd, p, len) < 0) { if (errno != EIO) @@ -793,6 +801,32 @@ get_idle_time(u, ip) } +#ifdef PPP_FILTER +/* + * set_filters - transfer the pass and active filters to the kernel. + */ +int +set_filters(pass, active) + struct bpf_program *pass, *active; +{ + int ret = 1; + + if (pass->bf_len > 0) { + if (ioctl(ppp_fd, PPPIOCSPASS, pass) < 0) { + syslog(LOG_ERR, "Couldn't set pass-filter in kernel: %m"); + ret = 0; + } + } + if (active->bf_len > 0) { + if (ioctl(ppp_fd, PPPIOCSACTIVE, active) < 0) { + syslog(LOG_ERR, "Couldn't set active-filter in kernel: %m"); + ret = 0; + } + } + return ret; +} +#endif + /* * sifvjcomp - config tcp header compression */ -- 2.39.2