diff --git a/ipppcomp/README.LZS b/ipppcomp/README.LZS index ecb4a5c7..b1df9539 100644 --- a/ipppcomp/README.LZS +++ b/ipppcomp/README.LZS @@ -1,5 +1,5 @@ -# $Id: README.LZS,v 1.3 1998/07/10 17:40:51 hipp Exp $ +# $Id: README.LZS,v 1.4 1999/06/21 13:28:31 hipp Exp $ *** ALPHA *** ALPHA *** ALPHA *** ALPHA *** ALPHA *** ALPHA *** ALPHA *** @@ -34,6 +34,25 @@ insight into isdn_ppp will adopt and complete them. The API to the com- pressor could also get a general facelift, but one thing after the other. + INSTALL + + +The easiest way to build the module is to copy isdn_lzscomp.c to +linux/drivers/isdn/ and to edit the Makefile in this directory, adding +a line for LZS like: + + ifdef CONFIG_ISDN_PPP + O_OBJS += isdn_ppp.o + M_OBJS += isdn_bsdcomp.o ++ M_OBJS += isdn_lzscomp.o + endif + +The module will be built on the next "make modules". If you want to use +any CCP method with I4L, you must first load the relevant module(s). Then +you start the connection. You may need to give options to ipppd in order +to make sure negotiations succeed, see below. + + Supported Modes @@ -43,6 +62,16 @@ peer is an Ascend Max, the correct options are "Stac-9" for mode 3 and "MS-Stac" for mode 4. Ask your ISP for what their NAS speaks. Either mode is Ok, but if you insist on non-M$, I'm virtually yours. +Note: If your peer sends you CCP with the LZS identity (0x11) but a + length of 6 bytes, it is not compatible with RFC1974 but uses + a proprietary predecessor of it. Typical case is an Ascend Max + that has never been set to something else but the default "Stac" + in "Answer" and doesn't override this per-profile, either. Ask + your ISP about changing this, nobody (but other Ascend boxes) + will ever be able to use this compression. Especially not Win95, + if the ISP wants interoperability with Win95 he needs to set + MS-Stac, and then this module works as well. + If the NAS you are talking to will not negotiate gracefully you may want to wire the exact mode ipppd is requesting. For instance, an Ascend Max with a profile set to Stac-9, when asked for any number of histories but @@ -168,14 +197,39 @@ net for more than a hour without any problem. Your milage may vary. The source code isdn_lzscomp.c is heavily commented (so I can still read it in a month). It contains a thorough description of the compression algo- rithm used and how I came to it. This in turn involves Credits to the -net.persons who helped me with getting that compressor faster. I'll -append a Credit list to this file ASAP. +net.persons who helped me with getting that compressor faster. When we +are at it: + + + Credits + +Phil Katz and L. Peter Deutsch + for the zlib and deflate format and specifications + +Jean-loup Gailly and Mark Adler + for deflate, gzip and zlib as well as the comp.compression FAQ + +David Carr + for a lot of general tips, hints and tricks speeding up a + compressor, pointers to freeze and the sigma buffer and especially + explaining to me the concept of the barrier hash until I finally + got it + +Leonid Broukis + for the freeze implementation with the sigma buffer which + inspired my 8-buffer and for pointing out how memcmp(3) can + be used in match searching + +Ojala Pasi 'Albert' + for general tips and his website which was the first reading + I had about speeding up a compressor beyond brute force Contact You can reach me by EMail: beck@ibh.de -Discussion will take place at de.alt.isdn4linux, the USENET mirror of the -official I4L Mailing List. +Discussion will take place at de.alt.comm.isdn4linux, the USENET mirror +of the official I4L Mailing List. +Check http://www.ibh-dd.de/~beck/stuff/lzs4i4l/ for new versions. diff --git a/ipppcomp/isdn_lzscomp.c b/ipppcomp/isdn_lzscomp.c index 7b379538..01d70d8e 100644 --- a/ipppcomp/isdn_lzscomp.c +++ b/ipppcomp/isdn_lzscomp.c @@ -1,15 +1,24 @@ /* -*- mode: c; c-basic-offset: 1 -*- * - * $Id: isdn_lzscomp.c,v 1.3 1998/07/10 17:40:52 hipp Exp $ + * $Id: isdn_lzscomp.c,v 1.4 1999/06/21 13:28:33 hipp Exp $ * - * PPP link compression code for Stac LZS support - * Initially just a RFC1974 decompressor is provided - * If interest is sufficient a compressor may follow + * PPP link compression code for Stac LZS (RFC1974) support + * + * (Copyleft) 1998 by Andre Beck under terms of the GPL + * + * Originally just a RFC1974 decompressor, this module now contains + * a useable compressor as well, but that one is disabled by default. + * + * This code is still in ALPHA state but appears to be quite stable. * - * GPL - you know * * Compile with: * gcc -O2 -I/usr/src/linux/include -D__KERNEL__ -DMODULE -c isdn_lzscomp.c + * + * Or even easier, copy isdn_lzscomp.c to linux/drivers/isdn/, add a line + * for it to the Makefile there (just below isdn_bsdcomp.o) and it is + * compiled automatically with full kernel optimizations. + * */ #ifndef MODULE @@ -17,7 +26,7 @@ #endif static const char -rcsid[] = "$Id: isdn_lzscomp.c,v 1.3 1998/07/10 17:40:52 hipp Exp $"; +rcsid[] = "$Id: isdn_lzscomp.c,v 1.4 1999/06/21 13:28:33 hipp Exp $"; /* Wow. No wonder this needs so long to compile. This include list * is a shameless rip from other compressor code. Hopefully no (C) @@ -66,16 +75,15 @@ rcsid[] = "$Id: isdn_lzscomp.c,v 1.3 1998/07/10 17:40:52 hipp Exp $"; #include #include -#include "isdn_ppp.h" +#include #include /* #define TEST_BROKEN_SEQNO 10 #define TEST_BROKEN_CCNT 10 -*/ - #define TEST_COMP_BROKEN_CCNT 10 #define TEST_COMP_BROKEN_SEQNO 10 +*/ /* * Values for debug: @@ -916,7 +924,7 @@ static int lzsCompress(void *state, struct sk_buff *skbin, register int llen, nlen, retry; register u32 hidx, lidx, next; register u8 hash; - int prepd, ohlen, totlen, ext, ilen, cols; + int prepd, ohlen, totlen, ext, ilen, cols, uncomp; u8 *ibuf; /* Prefill statistics for the case of sending uncompressed - this will then @@ -1123,17 +1131,30 @@ static int lzsCompress(void *state, struct sk_buff *skbin, just shows the particular inability of reading a standard paper by these guys. If you want to send uncompressed, just do it - it is that simple. + + UPDATE: We must use the inband sending method if we have to commu- + nicate a compressor state reset to the decompressor. EXT mode has + no ResetAck but does that using a bit in a uncompressed frame, so + we need to do this as well whenever a ResetAck is outstanding. */ totlen = ohlen + skbout->len; + /* Assume that data is compressed for EXT first */ + uncomp = 0; + +#ifdef COMP_XMIT_ADVANCED_HEURISTICS + /* HACK Attack Warning - this looks weird. Would really be nice to have the real MTU here. But I don't have a way to find it out. Seems that another API change would be necessary to allow for this. On the other hand, the MTU is never set or used by the isdn_ppp stuff, the ioctl(2) for that job doesn't do anything. Thus, to have something to try with - at all, assume MTU is 1500 fixed. HACK anyway. */ - + at all, assume MTU is 1500 fixed. HACK anyway. + + Stability over Performance IMHO - use trivial decision until code + has settled a bit, then implement MTU based stuff. */ + if((totlen + 4) > 1500) { if(debug > 1) printk(KERN_DEBUG "lzsComp: compressed size exceeds MTU\n"); @@ -1154,6 +1175,32 @@ static int lzsCompress(void *state, struct sk_buff *skbin, s->lastinc = 0; } +#else + + /* Trivial does-or-does-not-expand decision - suboptimal but stable */ + + if(totlen > skbin->len) { + if(debug > 1) + printk(KERN_DEBUG "lzsComp: frame expands\n"); + resetCompHist(s, h); + if(s->cmode == LZS_CMODE_EXT) { + /* In EXT mode, we must send an EXT frame with uncompressed data + and the flush-bit set now */ + uncomp = 1; + /* Copy input data to output data unmodified (Hmm, looks crashy) */ + p = skbout->data; + *p++ = proto >> 8; + *p++ = proto & 0xff; + memcpy(p, skbin->data, skbin->len); + skbout->len = skbin->len + 2; + } else { + /* All other modes just send uncompressed */ + return 0; + } + } + +#endif + /* Step 8 - fill the remaining parts of the frame by prepending them to the skbout. Return the frame length so it can be sent. */ @@ -1212,9 +1259,11 @@ static int lzsCompress(void *state, struct sk_buff *skbin, s->ccnt++; s->ccnt &= 0x0fff; - /* Mark the frame as compressed by setting bit C */ - ext |= 0x2000; - if(s->ackrs) { + /* Mark the frame as compressed by setting bit C - except it is not + compressed but a uncompressed inband flush */ + if(!uncomp) + ext |= 0x2000; + if(s->ackrs || uncomp) { /* Mark the frame as an inband reset ack by setting bit A */ ext |= 0x8000; s->ackrs = 0; @@ -1274,14 +1323,17 @@ static int lzsCompress(void *state, struct sk_buff *skbin, /* Adapt statistics - correct the former assumption of an incompressible packet by tweaking the counters */ - s->stats.inc_bytes -= skbin->len + 2; - s->stats.inc_packets--; - s->stats.bytes_out -= skbin->len + 2; s->stats.bytes_out += skbout->len; - s->stats.comp_bytes += skbout->len; - s->stats.comp_packets++; + if(!uncomp) { + /* Correct only if not sending a uncompressed EXT frame inband */ + s->stats.inc_bytes -= skbin->len + 2; + s->stats.inc_packets--; + + s->stats.comp_bytes += skbout->len; + s->stats.comp_packets++; + } return skbout->len; } diff --git a/ipppd/Makefile.in b/ipppd/Makefile.in index b51e7f55..cc0c52da 100644 --- a/ipppd/Makefile.in +++ b/ipppd/Makefile.in @@ -1,6 +1,6 @@ # # ipppd makefile for Linux -# $Id: Makefile.in,v 1.13 1998/11/18 13:48:52 fritz Exp $ +# $Id: Makefile.in,v 1.14 1999/06/21 13:28:39 hipp Exp $ # HAVE_LIBDES := @HAVE_LIBDES@ @@ -30,12 +30,12 @@ RADIUS_WTMP_LOGGING := 1 endif PPPDSRCS = main.c magic.c fsm.c lcp.c ipcp.c upap.c chap.c md5.c ccp.c \ - ipxcp.c auth.c options.c sys-linux.c cbcp.c + ipxcp.c auth.c options.c sys-linux.c cbcp.c environ.c HEADERS = callout.h pathnames.h patchlevel.h chap.h md5.h \ - ipxcp.h cbcp.h + ipxcp.h cbcp.h environ.h MANPAGES = ipppd.8 PPPDOBJS = main.o magic.o fsm.o lcp.o ipcp.o upap.o chap.o md5.o ccp.o \ - auth.o options.o sys-linux.o cbcp.o ipxcp.o + auth.o options.o sys-linux.o cbcp.o ipxcp.o environ.o all: ipppd diff --git a/ipppd/NOTES.IPPPD b/ipppd/NOTES.IPPPD index 391d8aae..d6f0ada5 100644 --- a/ipppd/NOTES.IPPPD +++ b/ipppd/NOTES.IPPPD @@ -66,6 +66,9 @@ CHANGELOG: - minor bug with corrupted MPdiscr fixed 22.03.98: - more CCP changes +21.Jun.99: + - I got two different DNS patches. Applied one of them. + - added changes from A. Beck to ccp.c ----------------------------------------------------------------- diff --git a/ipppd/ccp.c b/ipppd/ccp.c index 66e50970..bbc33059 100644 --- a/ipppd/ccp.c +++ b/ipppd/ccp.c @@ -25,26 +25,24 @@ * OR MODIFICATIONS. */ -char ccp_rcsid[] = "$Id: ccp.c,v 1.10 1998/12/01 12:59:38 hipp Exp $"; +char ccp_rcsid[] = "$Id: ccp.c,v 1.11 1999/06/21 13:28:42 hipp Exp $"; #include #include #include #include +#if 0 +#include +#endif +#include #include "fsm.h" #include "ipppd.h" #include "ccp.h" -#include - #include "compressions.h" -#ifdef HAVE_LZSCOMP_H #include -#else -#include "../ipppcomp/isdn_lzscomp.h" -#endif /* * Protocol entry points from main code. @@ -448,7 +446,6 @@ static void ccp_resetci(fsm *f) opt_buf[4] = LZS_CMODE_SEQNO; if(ccp_test(unit, opt_buf, CILEN_LZS_COMPRESS, 0) <= 0) { go->lzs = 0; - syslog(LOG_NOTICE,"Kernel check for LZS failed\n"); } } } @@ -1201,12 +1198,32 @@ static int ccp_printpkt(u_char *p,int plen,void (*printer)(void*,char*,...),void } break; case CI_LZS_COMPRESS: - if(optlen >= CILEN_LZS_COMPRESS) { - printer(arg, "LZS hists %d check %d", + /* Make sure we differ real (RFC1974) from old pre-RFC + implementations like Ascends. ISPs who never set up + LZS on an Ascend Max will end up announcing the + mode "Stac" which claims to be 0x11 - the same + value used for RFC1974 conforming LZS - but has + another format, primarily a length of 6 of the + config element. While I know a bit about that mode + I refrain from implementing it. Users who see that + stuff announced should contact their ISPs and ask + for RFC compliant compression. Usually, it is just + an oversight at the ISP, no bad taste */ + if(optlen == CILEN_LZS_COMPRESS) { + printer(arg, "LZS (RFC) hists %d check %d", (p[2] << 16) | p[3], p[4]); p += CILEN_LZS_COMPRESS; + } else if(optlen == 6) { + printer(arg, "LZS (Ascend pre-RFC)"); + p += optlen; + } else { + printer(arg, "LZS (non-RFC)"); + p += optlen; } break; + /* Looks like the following default was missing. I added + it, hopefully it is correct. ---abp */ + default: while (p < optend) printer(arg, " %.2x", *p++); printer(arg, ">"); diff --git a/ipppd/ipcp.c b/ipppd/ipcp.c index 7486736a..3b3430a3 100644 --- a/ipppd/ipcp.c +++ b/ipppd/ipcp.c @@ -17,7 +17,7 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -char ipcp_rcsid[] = "$Id: ipcp.c,v 1.5 1998/05/05 08:51:20 hipp Exp $"; +char ipcp_rcsid[] = "$Id: ipcp.c,v 1.6 1999/06/21 13:28:45 hipp Exp $"; /* * TODO: @@ -34,6 +34,7 @@ char ipcp_rcsid[] = "$Id: ipcp.c,v 1.5 1998/05/05 08:51:20 hipp Exp $"; #include "ipppd.h" #include "ipcp.h" #include "pathnames.h" +#include "environ.h" /* global vars */ ipcp_options ipcp_wantoptions[NUM_PPP]; /* Options that we want to request */ @@ -349,7 +350,11 @@ static int ipcp_cilen(fsm *f) } return (LENCIADDR(go->neg_addr, go->old_addrs) + - LENCIVJ(go->neg_vj, go->old_vj)); + LENCIVJ(go->neg_vj, go->old_vj) + + LENCIADDR(go->neg_dns1, 0) + + LENCIADDR(go->neg_dns2, 0) + + LENCIADDR(go->neg_wins1, 0) + + LENCIADDR(go->neg_wins2, 0)); } @@ -401,6 +406,14 @@ static void ipcp_addci(fsm *f,u_char *ucp,int *lenp) ADDCIVJ(CI_COMPRESSTYPE, go->neg_vj, go->vj_protocol, go->old_vj, go->maxslotindex, go->cflag); + ADDCIADDR(CI_MS_DNS1, go->neg_dns1, 0, go->dnsaddr[0], 0); + + ADDCIADDR(CI_MS_DNS2, go->neg_dns2, 0, go->dnsaddr[1], 0); + + ADDCIADDR(CI_MS_WINS1, go->neg_wins1, 0, go->winsaddr[0], 0); + + ADDCIADDR(CI_MS_WINS2, go->neg_wins2, 0, go->winsaddr[1], 0); + *lenp -= len; } @@ -477,6 +490,14 @@ static int ipcp_ackci(fsm *f,u_char *p,int len) ACKCIVJ(CI_COMPRESSTYPE, go->neg_vj, go->vj_protocol, go->old_vj, go->maxslotindex, go->cflag); + ACKCIADDR(CI_MS_DNS1, go->neg_dns1, 0, go->dnsaddr[0], 0); + + ACKCIADDR(CI_MS_DNS2, go->neg_dns2, 0, go->dnsaddr[1], 0); + + ACKCIADDR(CI_MS_WINS1, go->neg_wins1, 0, go->winsaddr[0], 0); + + ACKCIADDR(CI_MS_WINS2, go->neg_wins2, 0, go->winsaddr[1], 0); + /* * If there are any remaining CIs, then this packet is bad. */ @@ -593,6 +614,15 @@ static int ipcp_nakci(fsm *f,u_char *p,int len) } ); + NAKCIADDR(CI_MS_DNS1, neg_dns1, 0, try.dnsaddr[0]=ciaddr1; ); + + NAKCIADDR(CI_MS_DNS2, neg_dns2, 0, try.dnsaddr[1]=ciaddr1; ); + + NAKCIADDR(CI_MS_WINS1, neg_wins1, 0, try.winsaddr[0]=ciaddr1; ); + + NAKCIADDR(CI_MS_WINS2, neg_wins2, 0, try.winsaddr[1]=ciaddr1; ); + + /* * There may be remaining CIs, if the peer is requesting negotiation * on an option that we didn't include in our request packet. @@ -731,6 +761,14 @@ static int ipcp_rejci(fsm *f,u_char *p,int len) REJCIVJ(CI_COMPRESSTYPE, neg_vj, go->vj_protocol, go->old_vj, go->maxslotindex, go->cflag); + REJCIADDR(CI_MS_DNS1, neg_dns1, 0, go->dnsaddr[0], 0); + + REJCIADDR(CI_MS_DNS2, neg_dns2, 0, go->dnsaddr[1], 0); + + REJCIADDR(CI_MS_WINS1, neg_wins1, 0, go->winsaddr[0], 0); + + REJCIADDR(CI_MS_WINS2, neg_wins2, 0, go->winsaddr[1], 0); + /* * If there are any remaining CIs, then this packet is bad. */ @@ -1088,6 +1126,22 @@ static void ipcp_up(fsm *f) return; } + script_unsetenv_prefix("MS_DNS"); + + if ( go->dnsaddr[0] ) + script_setenv("MS_DNS1", ip_ntoa(go->dnsaddr[0])); + + if ( go->dnsaddr[1] ) + script_setenv("MS_DNS2", ip_ntoa(go->dnsaddr[1])); + + script_unsetenv_prefix("MS_WINS"); + + if ( go->winsaddr[0] ) + script_setenv("MS_WINS1", ip_ntoa(go->winsaddr[0])); + + if ( go->winsaddr[1] ) + script_setenv("MS_WINS2", ip_ntoa(go->winsaddr[1])); + /* * Check that the peer is allowed to use the IP address it wants. */ @@ -1296,6 +1350,34 @@ int ipcp_printpkt(u_char *p,int plen,void (*printer) __P((void *, char *, ...)), printer(arg, "addr %s", ip_ntoa(htonl(cilong))); } break; + case CI_MS_DNS1: + if (olen == CILEN_ADDR) { + p+=2; + GETLONG(cilong,p); + printer(arg, "ms-dns1 %s", ip_ntoa(htonl(cilong))); + } + break; + case CI_MS_DNS2: + if (olen == CILEN_ADDR) { + p+=2; + GETLONG(cilong,p); + printer(arg, "ms-dns2 %s", ip_ntoa(htonl(cilong))); + } + break; + case CI_MS_WINS1: + if (olen == CILEN_ADDR) { + p+=2; + GETLONG(cilong,p); + printer(arg, "ms-wins1 %s", ip_ntoa(htonl(cilong))); + } + break; + case CI_MS_WINS2: + if (olen == CILEN_ADDR) { + p+=2; + GETLONG(cilong,p); + printer(arg, "ms-wins2 %s", ip_ntoa(htonl(cilong))); + } + break; } while (p < optend) { GETCHAR(code, p); diff --git a/ipppd/ipcp.h b/ipppd/ipcp.h index 17764b37..4424800c 100644 --- a/ipppd/ipcp.h +++ b/ipppd/ipcp.h @@ -16,7 +16,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ipcp.h,v 1.1 1997/03/07 16:01:19 hipp Exp $ + * $Id: ipcp.h,v 1.2 1999/06/21 13:28:46 hipp Exp $ */ /* @@ -52,6 +52,10 @@ typedef struct ipcp_options { int old_vj : 1; /* use old (short) form of VJ option? */ int accept_local : 1; /* accept peer's value for ouraddr */ int accept_remote : 1; /* accept peer's value for hisaddr */ + int neg_dns1 : 1; /* Negotiate MS DNS entries */ + int neg_dns2 : 1; /* Negotiate MS DNS entries */ + int neg_wins1 : 1; /* Negotiate MS WINS entries */ + int neg_wins2 : 1; /* Negotiate MS WINS entries */ u_short vj_protocol; /* protocol value to use in VJ option */ u_char maxslotindex, cflag; /* values for RFC1332 VJ compression neg. */ u_int32_t ouraddr, hisaddr; /* Addresses in NETWORK BYTE ORDER */ diff --git a/ipppd/ipppd.man.in b/ipppd/ipppd.man.in index c3e055aa..adf54be6 100644 --- a/ipppd/ipppd.man.in +++ b/ipppd/ipppd.man.in @@ -1,6 +1,6 @@ .\" manual page [] for ipppd 2.0 -.\" $Id: ipppd.man.in,v 1.4 1998/12/03 14:30:05 paul Exp $ -.\" CHECKIN $Date: 1998/12/03 14:30:05 $ +.\" $Id: ipppd.man.in,v 1.5 1999/06/21 13:28:47 hipp Exp $ +.\" CHECKIN $Date: 1999/06/21 13:28:47 $ .\" SH section heading .\" SS subsection heading .\" LP paragraph @@ -314,6 +314,21 @@ Server. It is used by Microsoft Windows clients. The primary DNS address is specified by the first instance of the ms-dns option. The secondary is specified by the second instance. .TP +.B ms-get-dns +Implements the client side of RFC1877. If pppd is acting as a client +to a server that implements RFC1877 such as one intended to be used +with Microsoft Windows clients, this option allows pppd to obtain one +or two DNS (Domain Name Server) addresses from the server. It does +not do anything with these addresses except put them in the +environment (MS_DNS1 MS_DNS2) that is passed to scripts. The /etc/ppp/ip-up +script should use this information to perform whatever adjustment is +necessary. Note: RFC1877 is a horrible protocol layering violation, +the correct approach would be to use DHCP after the IPCP phase. +.TP +.B ms-get-wins +As ms-get-dns but for WINS (Windows Internet Name Services) server +addresses. Environment variables are MS_WINS1 and MS_WINS2. +.TP .B domain \fI Append the domain name to the local host name for authentication purposes. For example, if gethostname() returns the name porsche, but the diff --git a/ipppd/main.c b/ipppd/main.c index 5582f68c..f707654b 100644 --- a/ipppd/main.c +++ b/ipppd/main.c @@ -25,7 +25,7 @@ * PATCHLEVEL 9 */ -char main_rcsid[] = "$Id: main.c,v 1.15 1998/12/29 15:21:53 paul Exp $"; +char main_rcsid[] = "$Id: main.c,v 1.16 1999/06/21 13:28:49 hipp Exp $"; #include #include @@ -55,6 +55,7 @@ char main_rcsid[] = "$Id: main.c,v 1.15 1998/12/29 15:21:53 paul Exp $"; #include "lcp.h" #include "ipcp.h" #include "ipxcp.h" +#include "environ.h" #include "upap.h" #include "chap.h" @@ -900,10 +901,7 @@ int run_program(char *prog,char **args,int must_exist,int unit) { int pid; char *nullenv[1]; -#ifdef RADIUS char **envtouse; - extern char **environment; /* from radius.c */ -#endif pid = fork(); if (pid < 0) { @@ -938,15 +936,11 @@ int run_program(char *prog,char **args,int must_exist,int unit) } nullenv[0] = NULL; -#ifdef RADIUS - if (environment) - envtouse = environment; + if (script_env) + envtouse = script_env; else envtouse = nullenv; execve(prog, args, envtouse); -#else - execve(prog, args, nullenv); -#endif if (must_exist || errno != ENOENT) syslog(LOG_WARNING, "Can't execute %s: %m", prog); exit(99); /* CHILD exit */ @@ -1362,4 +1356,3 @@ void reload_config(void) auth_reload_upap_pw(); } - diff --git a/ipppd/options.c b/ipppd/options.c index dc4d4740..75ff9531 100644 --- a/ipppd/options.c +++ b/ipppd/options.c @@ -17,7 +17,7 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -char options_rcsid[] = "$Id: options.c,v 1.13 1998/10/29 17:28:47 hipp Exp $"; +char options_rcsid[] = "$Id: options.c,v 1.14 1999/06/21 13:28:50 hipp Exp $"; #include #include @@ -242,7 +242,9 @@ static int setsessionlimit __P((int,char **)); #endif static int setholdoff __P((int,char **)); static int setdnsaddr __P((int,char **)); +static int setgetdnsaddr __P((int,char **)); static int setwinsaddr __P((int,char **)); +static int setgetwinsaddr __P((int,char **)); static int resetipxproto __P((int)); static int setuseifip __P((int)); static int setusefirstip __P((int)); @@ -403,6 +405,8 @@ static struct cmd { {"holdoff", 1, setholdoff}, /* set holdoff time (seconds) */ {"ms-dns", 1, setdnsaddr}, /* DNS address for the peer's use */ {"ms-wins", 1, setwinsaddr}, /* WINS address for the peer's use */ + {"ms-get-dns", 0, setgetdnsaddr}, /* DNS address for the my use */ + {"ms-get-wins", 0, setgetwinsaddr}, /* Nameserver for SMB over TCP/IP for me */ {"noipx", 0, resetipxproto}, /* Disable IPXCP (and IPX) */ {"-ipx", 0, resetipxproto}, /* Disable IPXCP (and IPX) */ @@ -2296,6 +2300,26 @@ static int setwinsaddr(int ipcp_slot,char **argv) return (1); } +/* + * setgetdnsaddr - ask peer's idea of DNS server's address + */ +static int setgetdnsaddr(int slot,char **argv) +{ + ipcp_wantoptions[slot].neg_dns1 = 1; + ipcp_wantoptions[slot].neg_dns2 = 1; + return 1; +} + +/* + * setgetwinsaddr - ask peer's idea of WINS server's address + */ +static int setgetwinsaddr(int slot,char **argv) +{ + ipcp_wantoptions[slot].neg_wins1 = 1; + ipcp_wantoptions[slot].neg_wins2 = 1; + return 1; +} + static int setipxrouter (int slot,char **argv) { char *val,arg[1024],*endp; diff --git a/ipppd/radius.c b/ipppd/radius.c index 98869920..79f3d700 100644 --- a/ipppd/radius.c +++ b/ipppd/radius.c @@ -1,5 +1,5 @@ /* - * $Id: radius.c,v 1.3 1998/05/05 08:51:28 hipp Exp $ + * $Id: radius.c,v 1.4 1999/06/21 13:28:52 hipp Exp $ * * Copyright (C) 1996, Matjaz Godec * Copyright (C) 1996, Lars Fenneberg @@ -50,12 +50,6 @@ struct ifstats long tx_packets; }; -ENV *env = NULL; -char **environment; -#ifndef ENV_SIZE -#define ENV_SIZE 128 -#endif - /*************************************************************************** * * Name: radius_init @@ -305,8 +299,7 @@ radius_wtmp_logging(user,unit) * ***************************************************************************/ int -radius_buildenv(env, vp) - ENV *env ; +radius_buildenv(vp) VALUE_PAIR *vp ; { @@ -317,7 +310,7 @@ radius_buildenv(env, vp) int acount[256]; int attr; - rc_add_env(env, "RADIUS_USER_NAME", radius_user); + script_setenv("RADIUS_USER_NAME", radius_user); while (vp) { @@ -347,11 +340,8 @@ radius_buildenv(env, vp) strcat(name,buf); } } - - if (rc_add_env(env, name, value) < 0) - { - return 1; - } + + script_setenv(name, value); vp = vp->next; } @@ -423,20 +413,9 @@ radius_pap_auth (unit, user, passwd, msg, msglen ) else { /* Build the environment for ip-up and ip-down */ - if ( env != NULL ) - { - rc_free_env ( env ) ; - } ; + script_unsetenv_prefix("RADIUS_"); - env = rc_new_env(ENV_SIZE); - - if (env != NULL) - { - if (radius_buildenv(env, received)) - env = NULL; - if (env != NULL) - environment = env->env; - } + radius_buildenv(received); } } else