X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fsys-bsd.c;h=0aee267b6b652fcbefddbbfbaf71b2fd38b8dc30;hp=f0e49bc27b50609bad577fbce82f981e42ee8bc0;hb=9cb20e5f15c7da0955c27b8a0ddf515629c5848b;hpb=2c2fd4c10e05532a84aa3a5b07190b8c7b138367 diff --git a/pppd/sys-bsd.c b/pppd/sys-bsd.c index f0e49bc..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.26 1996/07/01 05:32:37 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.26 1996/07/01 05:32:37 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.26 1996/07/01 05:32:37 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 */ @@ -119,7 +128,7 @@ sys_cleanup() if (ifaddrs[0] != 0) cifaddr(0, ifaddrs[0], ifaddrs[1]); if (default_route_gateway) - cifdefaultroute(0, default_route_gateway); + cifdefaultroute(0, 0, default_route_gateway); if (proxy_arp_addr) cifproxyarp(0, proxy_arp_addr); } @@ -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 */ @@ -929,7 +963,8 @@ sifaddr(u, o, h, m) return 0; } syslog(LOG_WARNING, - "Couldn't set interface address: Address already exists"); + "Couldn't set interface address: Address %s already exists", + ip_ntoa(o)); } ifaddrs[0] = o; ifaddrs[1] = h; @@ -966,9 +1001,9 @@ cifaddr(u, o, h) * sifdefaultroute - assign a default route through the address given. */ int -sifdefaultroute(u, g) +sifdefaultroute(u, l, g) int u; - u_int32_t g; + u_int32_t l, g; { return dodefaultroute(g, 's'); } @@ -977,9 +1012,9 @@ sifdefaultroute(u, g) * cifdefaultroute - delete a default route through the address given. */ int -cifdefaultroute(u, g) +cifdefaultroute(u, l, g) int u; - u_int32_t g; + u_int32_t l, g; { return dodefaultroute(g, 'c'); }