diff options
author | brian <brian@FreeBSD.org> | 1998-01-05 01:35:20 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1998-01-05 01:35:20 +0000 |
commit | 6fd0acab5e3bddd3cc676ec0f73342ded6520d19 (patch) | |
tree | 26d31505fdef06bcf0c0f65401d1e14cd81a2955 /usr.sbin/ppp/ipcp.c | |
parent | 486344203a84fce7bb2007181b0bb740889b6282 (diff) | |
download | FreeBSD-src-6fd0acab5e3bddd3cc676ec0f73342ded6520d19.zip FreeBSD-src-6fd0acab5e3bddd3cc676ec0f73342ded6520d19.tar.gz |
o Allow the use of HISADDR as the first arg to "add".
o Allow a forth argument in ppp.secret, specifying a new
label. This gives control over which section of
ppp.link{up,down} is used based on the authenticated user.
o Support random address ranges in ppp.secret (not just in ppp.conf).
o Add a AUTHENTICATING INCOMING CONNECTIONS section to the man page.
o Add a bit more about DEFLATE in the man page.
o Fix the incorrect "you must specify a password in interactive
mode" bit of the manual.
o Space things in the man page consistently.
o Be more precice about where you can use MYADDR, HISADDR and INTERFACE
in the "add" command documentation.
Diffstat (limited to 'usr.sbin/ppp/ipcp.c')
-rw-r--r-- | usr.sbin/ppp/ipcp.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/usr.sbin/ppp/ipcp.c b/usr.sbin/ppp/ipcp.c index f85fbc9..b2a40dc 100644 --- a/usr.sbin/ppp/ipcp.c +++ b/usr.sbin/ppp/ipcp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ipcp.c,v 1.45 1997/12/24 09:29:02 brian Exp $ + * $Id: ipcp.c,v 1.46 1997/12/27 13:45:50 brian Exp $ * * TODO: * o More RFC1772 backwoard compatibility @@ -55,6 +55,7 @@ #include "ip.h" #include "throughput.h" #include "route.h" +#include "filter.h" #ifndef NOMSEXT struct in_addr ns_entries[2]; @@ -631,3 +632,39 @@ IpcpInput(struct mbuf * bp) { FsmInput(&IpcpFsm, bp); } + +int +UseHisaddr(const char *hisaddr, int setaddr) +{ + memset(&DefHisAddress, '\0', sizeof DefHisAddress); + iplist_reset(&DefHisChoice); + if (strpbrk(hisaddr, ",-")) { + iplist_setsrc(&DefHisChoice, hisaddr); + if (iplist_isvalid(&DefHisChoice)) { + iplist_setrandpos(&DefHisChoice); + IpcpInfo.his_ipaddr = ChooseHisAddr(IpcpInfo.want_ipaddr); + if (IpcpInfo.his_ipaddr.s_addr == INADDR_ANY) { + LogPrintf(LogWARN, "%s: None available !\n", DefHisChoice.src); + return(0); + } + DefHisAddress.ipaddr.s_addr = IpcpInfo.his_ipaddr.s_addr; + DefHisAddress.mask.s_addr = 0xffffffff; + DefHisAddress.width = 32; + } else { + LogPrintf(LogWARN, "%s: Invalid range !\n", hisaddr); + return 0; + } + } else if (ParseAddr(1, &hisaddr, &DefHisAddress.ipaddr, + &DefHisAddress.mask, &DefHisAddress.width) != 0) { + IpcpInfo.his_ipaddr.s_addr = DefHisAddress.ipaddr.s_addr; + + if (setaddr && OsSetIpaddress + (DefMyAddress.ipaddr, DefHisAddress.ipaddr) < 0) { + DefMyAddress.ipaddr.s_addr = DefHisAddress.ipaddr.s_addr = 0L; + return 0; + } + } else + return 0; + + return 1; +} |