From 186d0be47e4e7f49a3df05eb1ff3aa729f0a89a8 Mon Sep 17 00:00:00 2001 From: Brian Somers Date: Sat, 28 Jun 1997 01:34:03 +0000 Subject: [PATCH] Deal with HISADDR/MYADDR in filter rules. Mostly submitted by: kfurge@worldnet.att.net Allow MYADDR in add/delete commands to facilitate dynamic additions of a loopback route to MYADDR. --- usr.sbin/ppp/command.c | 24 +++++++++++++----------- usr.sbin/ppp/filter.c | 12 ++++++++---- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index 51b2191b33db..5afead54e438 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: command.c,v 1.62 1997/06/25 02:04:35 brian Exp $ + * $Id: command.c,v 1.63 1997/06/25 19:29:59 brian Exp $ * */ #include @@ -258,17 +258,13 @@ char **argv; TtyOldMode(); if(argc > 0) { /* substitute pseudo args */ - for (i=1; i 0 && argc < 4) { - dest = GetIpAddr(argv[0]); + if (strcasecmp(argv[0], "MYADDR") == 0) + dest = IpcpInfo.want_ipaddr; + else + dest = GetIpAddr(argv[0]); netmask.s_addr = INADDR_ANY; if (argc > 1) { if (strcasecmp(argv[1], "HISADDR") == 0) diff --git a/usr.sbin/ppp/filter.c b/usr.sbin/ppp/filter.c index 305573e52c4f..60e0506891f3 100644 --- a/usr.sbin/ppp/filter.c +++ b/usr.sbin/ppp/filter.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: filter.c,v 1.9 1997/05/10 01:22:08 brian Exp $ + * $Id: filter.c,v 1.10 1997/06/09 03:27:19 brian Exp $ * * TODO: Shoud send ICMP error message when we discard packets. */ @@ -37,6 +37,7 @@ #include "filter.h" #include "loadalias.h" #include "vars.h" +#include "ipcp.h" static struct filterent filterdata; @@ -60,7 +61,6 @@ struct in_addr *paddr; struct in_addr *pmask; int *pwidth; { - u_long addr; int bits; char *cp, *wp; @@ -72,8 +72,12 @@ int *pwidth; pmask->s_addr = 0xffffffff; /* Assume 255.255.255.255 as default */ cp = index(*argv, '/'); if (cp) *cp++ = '\0'; - addr = inet_addr(*argv); - paddr->s_addr = addr; + if (strcasecmp(*argv, "HISADDR") == 0) + *paddr = IpcpInfo.his_ipaddr; + else if (strcasecmp(*argv, "MYADDR") == 0) + *paddr = IpcpInfo.want_ipaddr; + else + paddr->s_addr = inet_addr(*argv); if (cp && *cp) { bits = strtol(cp, &wp, 0); if (cp == wp || bits < 0 || bits > 32) {