1 Index: ppp-2.4.3/include/linux/ppp-comp.h
2 ===================================================================
3 --- ppp-2.4.3.orig/include/linux/ppp-comp.h 2007-06-04 13:22:08.143617264 +0200
4 +++ ppp-2.4.3/include/linux/ppp-comp.h 2007-06-04 13:22:12.031026288 +0200
9 - * ==FILEVERSION 20020319==
10 + * ==FILEVERSION 20020715==
12 * NOTE TO MAINTAINERS:
13 * If you modify this file at all, please set the above date.
16 /* Compress a packet */
17 int (*compress) (void *state, unsigned char *rptr,
18 - unsigned char *obuf, int isize, int osize);
19 + unsigned char *obuf, int isize, int osize);
21 /* Return compression statistics */
22 void (*comp_stat) (void *state, struct compstat *stats);
25 /* Decompress a packet. */
26 int (*decompress) (void *state, unsigned char *ibuf, int isize,
27 - unsigned char *obuf, int osize);
28 + unsigned char *obuf, int osize);
30 /* Update state for an incompressible packet received */
31 void (*incomp) (void *state, unsigned char *ibuf, int icnt);
33 opts |= MPPE_OPT_UNKNOWN; \
34 } while (/* CONSTCOND */ 0)
36 +/* MPPE/MPPC definitions by J.D.*/
37 +#define MPPE_STATELESS MPPE_H_BIT /* configuration bit H */
38 +#define MPPE_40BIT MPPE_L_BIT /* configuration bit L */
39 +#define MPPE_56BIT MPPE_M_BIT /* configuration bit M */
40 +#define MPPE_128BIT MPPE_S_BIT /* configuration bit S */
41 +#define MPPE_MPPC MPPE_C_BIT /* configuration bit C */
44 + * Definitions for Stac LZS.
47 +#define CI_LZS 17 /* config option for Stac LZS */
48 +#define CILEN_LZS 5 /* length of config option */
50 +#define LZS_OVHD 4 /* max. LZS overhead */
51 +#define LZS_HIST_LEN 2048 /* LZS history size */
52 +#define LZS_MAX_CCOUNT 0x0FFF /* max. coherency counter value */
54 +#define LZS_MODE_NONE 0
55 +#define LZS_MODE_LCB 1
56 +#define LZS_MODE_CRC 2
57 +#define LZS_MODE_SEQ 3
58 +#define LZS_MODE_EXT 4
60 +#define LZS_EXT_BIT_FLUSHED 0x80 /* bit A */
61 +#define LZS_EXT_BIT_COMP 0x20 /* bit C */
64 * Definitions for other, as yet unsupported, compression methods.
66 Index: ppp-2.4.3/include/net/ppp-comp.h
67 ===================================================================
68 --- ppp-2.4.3.orig/include/net/ppp-comp.h 2007-06-04 13:22:08.150616200 +0200
69 +++ ppp-2.4.3/include/net/ppp-comp.h 2007-06-04 13:22:12.031026288 +0200
71 opts |= MPPE_OPT_UNKNOWN; \
72 } while (/* CONSTCOND */ 0)
74 +/* MPPE/MPPC definitions by J.D.*/
75 +#define MPPE_STATELESS MPPE_H_BIT /* configuration bit H */
76 +#define MPPE_40BIT MPPE_L_BIT /* configuration bit L */
77 +#define MPPE_56BIT MPPE_M_BIT /* configuration bit M */
78 +#define MPPE_128BIT MPPE_S_BIT /* configuration bit S */
79 +#define MPPE_MPPC MPPE_C_BIT /* configuration bit C */
82 + * Definitions for Stac LZS.
85 +#define CI_LZS 17 /* config option for Stac LZS */
86 +#define CILEN_LZS 5 /* length of config option */
88 +#define LZS_OVHD 4 /* max. LZS overhead */
89 +#define LZS_HIST_LEN 2048 /* LZS history size */
90 +#define LZS_MAX_CCOUNT 0x0FFF /* max. coherency counter value */
92 +#define LZS_MODE_NONE 0
93 +#define LZS_MODE_LCB 1
94 +#define LZS_MODE_CRC 2
95 +#define LZS_MODE_SEQ 3
96 +#define LZS_MODE_EXT 4
98 +#define LZS_EXT_BIT_FLUSHED 0x80 /* bit A */
99 +#define LZS_EXT_BIT_COMP 0x20 /* bit C */
102 * Definitions for other, as yet unsupported, compression methods.
104 Index: ppp-2.4.3/pppd/ccp.c
105 ===================================================================
106 --- ppp-2.4.3.orig/pppd/ccp.c 2007-06-04 13:22:08.157615136 +0200
107 +++ ppp-2.4.3/pppd/ccp.c 2007-06-04 13:22:12.033025984 +0200
109 static char bsd_value[8];
110 static char deflate_value[8];
113 - * Option variables.
116 -bool refuse_mppe_stateful = 1; /* Allow stateful mode? */
118 +static int setmppe(char **);
119 +static int setnomppe(void);
122 static option_t ccp_option_list[] = {
123 { "noccp", o_bool, &ccp_protent.enabled_flag,
124 @@ -108,54 +106,36 @@
125 "don't allow Predictor-1", OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLR,
126 &ccp_allowoptions[0].predictor_1 },
128 + { "lzs", o_bool, &ccp_wantoptions[0].lzs,
129 + "request Stac LZS", 1, &ccp_allowoptions[0].lzs, OPT_PRIO },
130 + { "+lzs", o_bool, &ccp_wantoptions[0].lzs,
131 + "request Stac LZS", 1, &ccp_allowoptions[0].lzs, OPT_ALIAS | OPT_PRIO },
132 + { "nolzs", o_bool, &ccp_wantoptions[0].lzs,
133 + "don't allow Stac LZS", OPT_PRIOSUB | OPT_A2CLR,
134 + &ccp_allowoptions[0].lzs },
135 + { "-lzs", o_bool, &ccp_wantoptions[0].lzs,
136 + "don't allow Stac LZS", OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLR,
137 + &ccp_allowoptions[0].lzs },
140 - /* MPPE options are symmetrical ... we only set wantoptions here */
141 - { "require-mppe", o_bool, &ccp_wantoptions[0].mppe,
142 - "require MPPE encryption",
143 - OPT_PRIO | MPPE_OPT_40 | MPPE_OPT_128 },
144 - { "+mppe", o_bool, &ccp_wantoptions[0].mppe,
145 - "require MPPE encryption",
146 - OPT_ALIAS | OPT_PRIO | MPPE_OPT_40 | MPPE_OPT_128 },
147 - { "nomppe", o_bool, &ccp_wantoptions[0].mppe,
148 - "don't allow MPPE encryption", OPT_PRIO },
149 - { "-mppe", o_bool, &ccp_wantoptions[0].mppe,
150 - "don't allow MPPE encryption", OPT_ALIAS | OPT_PRIO },
152 - /* We use ccp_allowoptions[0].mppe as a junk var ... it is reset later */
153 - { "require-mppe-40", o_bool, &ccp_allowoptions[0].mppe,
154 - "require MPPE 40-bit encryption", OPT_PRIO | OPT_A2OR | MPPE_OPT_40,
155 - &ccp_wantoptions[0].mppe },
156 - { "+mppe-40", o_bool, &ccp_allowoptions[0].mppe,
157 - "require MPPE 40-bit encryption", OPT_PRIO | OPT_A2OR | MPPE_OPT_40,
158 - &ccp_wantoptions[0].mppe },
159 - { "nomppe-40", o_bool, &ccp_allowoptions[0].mppe,
160 - "don't allow MPPE 40-bit encryption",
161 - OPT_PRIOSUB | OPT_A2CLRB | MPPE_OPT_40, &ccp_wantoptions[0].mppe },
162 - { "-mppe-40", o_bool, &ccp_allowoptions[0].mppe,
163 - "don't allow MPPE 40-bit encryption",
164 - OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLRB | MPPE_OPT_40,
165 - &ccp_wantoptions[0].mppe },
167 - { "require-mppe-128", o_bool, &ccp_allowoptions[0].mppe,
168 - "require MPPE 128-bit encryption", OPT_PRIO | OPT_A2OR | MPPE_OPT_128,
169 - &ccp_wantoptions[0].mppe },
170 - { "+mppe-128", o_bool, &ccp_allowoptions[0].mppe,
171 - "require MPPE 128-bit encryption",
172 - OPT_ALIAS | OPT_PRIO | OPT_A2OR | MPPE_OPT_128,
173 - &ccp_wantoptions[0].mppe },
174 - { "nomppe-128", o_bool, &ccp_allowoptions[0].mppe,
175 - "don't allow MPPE 128-bit encryption",
176 - OPT_PRIOSUB | OPT_A2CLRB | MPPE_OPT_128, &ccp_wantoptions[0].mppe },
177 - { "-mppe-128", o_bool, &ccp_allowoptions[0].mppe,
178 - "don't allow MPPE 128-bit encryption",
179 - OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLRB | MPPE_OPT_128,
180 - &ccp_wantoptions[0].mppe },
182 - /* strange one; we always request stateless, but will we allow stateful? */
183 - { "mppe-stateful", o_bool, &refuse_mppe_stateful,
184 - "allow MPPE stateful mode", OPT_PRIO },
185 - { "nomppe-stateful", o_bool, &refuse_mppe_stateful,
186 - "disallow MPPE stateful mode", OPT_PRIO | 1 },
187 + { "mppc", o_bool, &ccp_wantoptions[0].mppc,
188 + "request MPPC compression", 1, &ccp_allowoptions[0].mppc },
189 + { "+mppc", o_bool, &ccp_wantoptions[0].mppc,
190 + "request MPPC compression", 1, &ccp_allowoptions[0].mppc, OPT_ALIAS },
191 + { "nomppc", o_bool, &ccp_wantoptions[0].mppc,
192 + "don't allow MPPC compression", OPT_PRIOSUB | OPT_A2CLR,
193 + &ccp_allowoptions[0].mppc },
194 + { "-mppc", o_bool, &ccp_wantoptions[0].mppc,
195 + "don't allow MPPC compression", OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLR,
196 + &ccp_allowoptions[0].mppc },
197 + { "mppe", o_special, (void *)setmppe,
198 + "request MPPE encryption" },
199 + { "+mppe", o_special, (void *)setmppe,
200 + "request MPPE encryption" },
201 + { "nomppe", o_special_noarg, (void *)setnomppe,
202 + "don't allow MPPE encryption" },
203 + { "-mppe", o_special_noarg, (void *)setnomppe,
204 + "don't allow MPPE encryption" },
210 #define ANY_COMPRESS(opt) ((opt).deflate || (opt).bsd_compress \
211 || (opt).predictor_1 || (opt).predictor_2 \
213 + || (opt).lzs || (opt).mppc || (opt).mppe)
216 * Local state (mainly for handling reset-reqs and reset-acks).
217 @@ -344,6 +324,100 @@
223 + * Functions called from config options
227 + required - require MPPE; disconnect if peer doesn't support it
228 + stateless - use stateless mode
229 + no40 - disable 40 bit keys
230 + no56 - disable 56 bit keys
231 + no128 - disable 128 bit keys
233 +int setmppe(char **argv)
236 + char *str, cmdbuf[16];
238 + ccp_allowoptions[0].mppe = 1;
239 + ccp_allowoptions[0].mppe_40 = 1;
240 + ccp_allowoptions[0].mppe_56 = 1;
241 + ccp_allowoptions[0].mppe_128 = 1;
242 + ccp_allowoptions[0].mppe_stateless = 0;
243 + ccp_wantoptions[0].mppe = 0;
249 + memset(cmdbuf, '\0', 16);
250 + while ((i < 16) && (*str != ',') && (*str != '\0'))
251 + cmdbuf[i++] = *str++;
253 + if (!strncasecmp(cmdbuf, "no40", strlen("no40"))) {
254 + ccp_allowoptions[0].mppe_40 = 0;
256 + } else if (!strncasecmp(cmdbuf, "no56", strlen("no56"))) {
257 + ccp_allowoptions[0].mppe_56 = 0;
259 + } else if (!strncasecmp(cmdbuf, "no128", strlen("no128"))) {
260 + ccp_allowoptions[0].mppe_128 = 0;
262 + } else if (!strncasecmp(cmdbuf, "stateless", strlen("stateless"))) {
263 + ccp_allowoptions[0].mppe_stateless = 1;
265 + } else if (!strncasecmp(cmdbuf, "required", strlen("required"))) {
266 + ccp_wantoptions[0].mppe = 1;
269 + option_error("invalid parameter '%s' for mppe option", cmdbuf);
278 + if (*str == '\0') {
279 + if (!(ccp_allowoptions[0].mppe_40 || ccp_allowoptions[0].mppe_56 ||
280 + ccp_allowoptions[0].mppe_128)) {
281 + if (ccp_wantoptions[0].mppe == 1) {
282 + option_error("You require MPPE but you have switched off "
283 + "all encryption key lengths.");
286 + ccp_wantoptions[0].mppe = ccp_allowoptions[0].mppe = 0;
287 + ccp_wantoptions[0].mppe_stateless =
288 + ccp_allowoptions[0].mppe_stateless = 0;
290 + ccp_allowoptions[0].mppe = 1;
291 + ccp_wantoptions[0].mppe_stateless =
292 + ccp_allowoptions[0].mppe_stateless;
293 + if (ccp_wantoptions[0].mppe == 1) {
294 + ccp_wantoptions[0].mppe_40 = ccp_allowoptions[0].mppe_40;
295 + ccp_wantoptions[0].mppe_56 = ccp_allowoptions[0].mppe_56;
296 + ccp_wantoptions[0].mppe_128 = ccp_allowoptions[0].mppe_128;
306 + ccp_wantoptions[0].mppe = ccp_allowoptions[0].mppe = 0;
307 + ccp_wantoptions[0].mppe_40 = ccp_allowoptions[0].mppe_40 = 0;
308 + ccp_wantoptions[0].mppe_56 = ccp_allowoptions[0].mppe_56 = 0;
309 + ccp_wantoptions[0].mppe_128 = ccp_allowoptions[0].mppe_128 = 0;
310 + ccp_wantoptions[0].mppe_stateless = ccp_allowoptions[0].mppe_stateless = 0;
316 * ccp_init - initialize CCP.
319 ccp_allowoptions[0].bsd_bits = BSD_MAX_BITS;
321 ccp_allowoptions[0].predictor_1 = 1;
323 + ccp_wantoptions[0].lzs = 0; /* Stac LZS - will be enabled in the future */
324 + ccp_wantoptions[0].lzs_mode = LZS_MODE_SEQ;
325 + ccp_wantoptions[0].lzs_hists = 1;
326 + ccp_allowoptions[0].lzs = 0; /* Stac LZS - will be enabled in the future */
327 + ccp_allowoptions[0].lzs_mode = LZS_MODE_SEQ;
328 + ccp_allowoptions[0].lzs_hists = 1;
331 + /* by default allow and request MPPC... */
332 + ccp_wantoptions[0].mppc = ccp_allowoptions[0].mppc = 1;
334 + /* ... and allow but don't request MPPE */
335 + ccp_allowoptions[0].mppe = 1;
336 + ccp_allowoptions[0].mppe_40 = 1;
337 + ccp_allowoptions[0].mppe_56 = 1;
338 + ccp_allowoptions[0].mppe_128 = 1;
339 + ccp_allowoptions[0].mppe_stateless = 1;
340 + ccp_wantoptions[0].mppe = 0;
341 + ccp_wantoptions[0].mppe_40 = 0;
342 + ccp_wantoptions[0].mppe_56 = 0;
343 + ccp_wantoptions[0].mppe_128 = 0;
344 + ccp_wantoptions[0].mppe_stateless = 0;
349 @@ -455,11 +553,11 @@
350 if (oldstate == OPENED && p[0] == TERMREQ && f->state != OPENED) {
351 notice("Compression disabled by peer.");
353 - if (ccp_gotoptions[unit].mppe) {
354 + if (ccp_wantoptions[unit].mppe) {
355 error("MPPE disabled, closing LCP");
356 lcp_close(unit, "MPPE disabled by peer");
365 /* send a reset-ack, which the transmitter will see and
366 reset its compression state. */
368 + /* In case of MPPE/MPPC or LZS we shouldn't send CCP_RESETACK,
369 + but we do it in order to reset compressor; CCP_RESETACK is
370 + then silently discarded. See functions ppp_send_frame and
371 + ppp_ccp_peek in ppp_generic.c (Linux only !!!). All the
372 + confusion is caused by the fact that CCP code is splited
373 + into two parts - one part is handled by pppd, the other one
374 + is handled by kernel. */
376 fsm_sdata(f, CCP_RESETACK, id, NULL, 0);
379 @@ -515,12 +622,11 @@
380 fsm_lowerdown(&ccp_fsm[unit]);
383 - if (ccp_gotoptions[unit].mppe) {
384 + if (ccp_wantoptions[unit].mppe) {
385 error("MPPE required but peer negotiation failed");
386 lcp_close(unit, "MPPE required but peer negotiation failed");
395 all_rejected[f->unit] = 0;
399 + if (go->mppe || go->mppc) {
400 ccp_options *ao = &ccp_allowoptions[f->unit];
401 int auth_mschap_bits = auth_done[f->unit];
403 @@ -551,80 +657,109 @@
404 * NB: If MPPE is required, all other compression opts are invalid.
405 * So, we return right away if we can't do it.
407 + if (ccp_wantoptions[f->unit].mppe) {
408 + /* Leave only the mschap auth bits set */
409 + auth_mschap_bits &= (CHAP_MS_WITHPEER | CHAP_MS_PEER |
410 + CHAP_MS2_WITHPEER | CHAP_MS2_PEER);
411 + /* Count the mschap auths */
412 + auth_mschap_bits >>= CHAP_MS_SHIFT;
415 + numbits += auth_mschap_bits & 1;
416 + auth_mschap_bits >>= 1;
417 + } while (auth_mschap_bits);
419 + error("MPPE required, but auth done in both directions.");
420 + lcp_close(f->unit, "MPPE required but not available");
424 + error("MPPE required, but MS-CHAP[v2] auth not performed.");
425 + lcp_close(f->unit, "MPPE required but not available");
429 - /* Leave only the mschap auth bits set */
430 - auth_mschap_bits &= (CHAP_MS_WITHPEER | CHAP_MS_PEER |
431 - CHAP_MS2_WITHPEER | CHAP_MS2_PEER);
432 - /* Count the mschap auths */
433 - auth_mschap_bits >>= CHAP_MS_SHIFT;
436 - numbits += auth_mschap_bits & 1;
437 - auth_mschap_bits >>= 1;
438 - } while (auth_mschap_bits);
440 - error("MPPE required, but auth done in both directions.");
441 - lcp_close(f->unit, "MPPE required but not available");
445 - error("MPPE required, but MS-CHAP[v2] auth not performed.");
446 - lcp_close(f->unit, "MPPE required but not available");
450 - /* A plugin (eg radius) may not have obtained key material. */
451 - if (!mppe_keys_set) {
452 - error("MPPE required, but keys are not available. "
453 - "Possible plugin problem?");
454 - lcp_close(f->unit, "MPPE required but not available");
458 - /* LM auth not supported for MPPE */
459 - if (auth_done[f->unit] & (CHAP_MS_WITHPEER | CHAP_MS_PEER)) {
460 - /* This might be noise */
461 - if (go->mppe & MPPE_OPT_40) {
462 - notice("Disabling 40-bit MPPE; MS-CHAP LM not supported");
463 - go->mppe &= ~MPPE_OPT_40;
464 - ccp_wantoptions[f->unit].mppe &= ~MPPE_OPT_40;
465 + /* A plugin (eg radius) may not have obtained key material. */
466 + if (!mppe_keys_set) {
467 + error("MPPE required, but keys are not available. "
468 + "Possible plugin problem?");
469 + lcp_close(f->unit, "MPPE required but not available");
474 - /* Last check: can we actually negotiate something? */
475 - if (!(go->mppe & (MPPE_OPT_40 | MPPE_OPT_128))) {
476 - /* Could be misconfig, could be 40-bit disabled above. */
477 - error("MPPE required, but both 40-bit and 128-bit disabled.");
478 - lcp_close(f->unit, "MPPE required but not available");
481 + * Check whether the kernel knows about the various
482 + * compression methods we might request. Key material
483 + * unimportant here.
486 + opt_buf[0] = CI_MPPE;
487 + opt_buf[1] = CILEN_MPPE;
491 + opt_buf[5] = MPPE_MPPC;
492 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE, 0) <= 0)
496 + opt_buf[0] = CI_MPPE;
497 + opt_buf[1] = CILEN_MPPE;
498 + opt_buf[2] = MPPE_STATELESS;
501 + opt_buf[5] = MPPE_40BIT;
502 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0) <= 0)
506 + opt_buf[0] = CI_MPPE;
507 + opt_buf[1] = CILEN_MPPE;
508 + opt_buf[2] = MPPE_STATELESS;
511 + opt_buf[5] = MPPE_56BIT;
512 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0) <= 0)
515 + if (go->mppe_128) {
516 + opt_buf[0] = CI_MPPE;
517 + opt_buf[1] = CILEN_MPPE;
518 + opt_buf[2] = MPPE_STATELESS;
521 + opt_buf[5] = MPPE_128BIT;
522 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0) <= 0)
525 + if (!go->mppe_40 && !go->mppe_56 && !go->mppe_128) {
526 + if (ccp_wantoptions[f->unit].mppe) {
527 + error("MPPE required, but kernel has no support.");
528 + lcp_close(f->unit, "MPPE required but not available");
530 + go->mppe = go->mppe_stateless = 0;
532 + /* MPPE is not compatible with other compression types */
533 + if (ccp_wantoptions[f->unit].mppe) {
534 + ao->bsd_compress = go->bsd_compress = 0;
535 + ao->predictor_1 = go->predictor_1 = 0;
536 + ao->predictor_2 = go->predictor_2 = 0;
537 + ao->deflate = go->deflate = 0;
538 + ao->lzs = go->lzs = 0;
543 - ao->mppe = go->mppe;
544 - /* MPPE is not compatible with other compression types */
545 - ao->bsd_compress = go->bsd_compress = 0;
546 - ao->predictor_1 = go->predictor_1 = 0;
547 - ao->predictor_2 = go->predictor_2 = 0;
548 - ao->deflate = go->deflate = 0;
553 - * Check whether the kernel knows about the various
554 - * compression methods we might request.
558 - opt_buf[0] = CI_MPPE;
559 - opt_buf[1] = CILEN_MPPE;
560 - MPPE_OPTS_TO_CI(go->mppe, &opt_buf[2]);
561 - /* Key material unimportant here. */
562 - if (ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0) <= 0) {
563 - error("MPPE required, but kernel has no support.");
564 - lcp_close(f->unit, "MPPE required but not available");
567 + opt_buf[0] = CI_LZS;
568 + opt_buf[1] = CILEN_LZS;
569 + opt_buf[2] = go->lzs_hists >> 8;
570 + opt_buf[3] = go->lzs_hists & 0xff;
571 + opt_buf[4] = LZS_MODE_SEQ;
572 + if (ccp_test(f->unit, opt_buf, CILEN_LZS, 0) <= 0)
576 if (go->bsd_compress) {
577 opt_buf[0] = CI_BSD_COMPRESS;
578 opt_buf[1] = CILEN_BSD_COMPRESS;
580 + (go->deflate? CILEN_DEFLATE: 0)
581 + (go->predictor_1? CILEN_PREDICTOR_1: 0)
582 + (go->predictor_2? CILEN_PREDICTOR_2: 0)
583 - + (go->mppe? CILEN_MPPE: 0);
584 + + (go->lzs? CILEN_LZS: 0)
585 + + ((go->mppe || go->mppc)? CILEN_MPPE: 0);
592 ccp_options *go = &ccp_gotoptions[f->unit];
593 + ccp_options *ao = &ccp_allowoptions[f->unit];
594 + ccp_options *wo = &ccp_wantoptions[f->unit];
598 @@ -701,22 +839,43 @@
599 * in case it gets Acked.
603 + if (go->mppe || go->mppc || (!wo->mppe && ao->mppe)) {
604 u_char opt_buf[CILEN_MPPE + MPPE_MAX_KEY_LEN];
606 - p[0] = opt_buf[0] = CI_MPPE;
607 - p[1] = opt_buf[1] = CILEN_MPPE;
608 - MPPE_OPTS_TO_CI(go->mppe, &p[2]);
609 - MPPE_OPTS_TO_CI(go->mppe, &opt_buf[2]);
612 + p[2] = (go->mppe_stateless ? MPPE_STATELESS : 0);
615 + p[5] = (go->mppe_40 ? MPPE_40BIT : 0) | (go->mppe_56 ? MPPE_56BIT : 0) |
616 + (go->mppe_128 ? MPPE_128BIT : 0) | (go->mppc ? MPPE_MPPC : 0);
618 + BCOPY(p, opt_buf, CILEN_MPPE);
619 BCOPY(mppe_recv_key, &opt_buf[CILEN_MPPE], MPPE_MAX_KEY_LEN);
620 res = ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0);
626 /* This shouldn't happen, we've already tested it! */
627 - lcp_close(f->unit, "MPPE required but not available in kernel");
628 + go->mppe = go->mppe_40 = go->mppe_56 = go->mppe_128 =
629 + go->mppe_stateless = go->mppc = 0;
630 + if (ccp_wantoptions[f->unit].mppe)
631 + lcp_close(f->unit, "MPPE required but not available in kernel");
638 + p[2] = go->lzs_hists >> 8;
639 + p[3] = go->lzs_hists & 0xff;
640 + p[4] = LZS_MODE_SEQ;
641 + res = ccp_test(f->unit, p, CILEN_LZS, 0);
649 p[0] = go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT;
650 p[1] = CILEN_DEFLATE;
654 * ccp_ackci - process a received configure-ack, and return
655 - * 1 iff the packet was OK.
656 + * 1 if the packet was OK.
660 @@ -811,24 +970,44 @@
663 ccp_options *go = &ccp_gotoptions[f->unit];
664 + ccp_options *ao = &ccp_allowoptions[f->unit];
665 + ccp_options *wo = &ccp_wantoptions[f->unit];
670 - u_char opt_buf[CILEN_MPPE];
672 - opt_buf[0] = CI_MPPE;
673 - opt_buf[1] = CILEN_MPPE;
674 - MPPE_OPTS_TO_CI(go->mppe, &opt_buf[2]);
675 - if (len < CILEN_MPPE || memcmp(opt_buf, p, CILEN_MPPE))
676 + if (go->mppe || go->mppc || (!wo->mppe && ao->mppe)) {
677 + if (len < CILEN_MPPE
678 + || p[1] != CILEN_MPPE || p[0] != CI_MPPE
679 + || p[2] != (go->mppe_stateless ? MPPE_STATELESS : 0)
682 + || (p[5] != ((go->mppe_40 ? MPPE_40BIT : 0) |
683 + (go->mppc ? MPPE_MPPC : 0))
684 + && p[5] != ((go->mppe_56 ? MPPE_56BIT : 0) |
685 + (go->mppc ? MPPE_MPPC : 0))
686 + && p[5] != ((go->mppe_128 ? MPPE_128BIT : 0) |
687 + (go->mppc ? MPPE_MPPC : 0))))
689 + if (go->mppe_40 || go->mppe_56 || go->mppe_128)
693 + /* Cope with first/fast ack */
694 + if (p == p0 && len == 0)
699 + if (len < CILEN_LZS || p[0] != CI_LZS || p[1] != CILEN_LZS
700 + || p[2] != go->lzs_hists>>8 || p[3] != (go->lzs_hists&0xff)
701 + || p[4] != LZS_MODE_SEQ)
705 /* XXX Cope with first/fast ack */
707 + if (p == p0 && len == 0)
712 if (len < CILEN_DEFLATE
713 || p[0] != (go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT)
717 * ccp_nakci - process received configure-nak.
718 - * Returns 1 iff the nak was OK.
719 + * Returns 1 if the nak was OK.
722 ccp_nakci(f, p, len, treat_as_reject)
726 ccp_options *go = &ccp_gotoptions[f->unit];
727 + ccp_options *ao = &ccp_allowoptions[f->unit];
728 + ccp_options *wo = &ccp_wantoptions[f->unit];
729 ccp_options no; /* options we've seen already */
730 ccp_options try; /* options to ask for next time */
732 @@ -907,28 +1088,100 @@
736 - if (go->mppe && len >= CILEN_MPPE
737 - && p[0] == CI_MPPE && p[1] == CILEN_MPPE) {
740 - * Peer wants us to use a different strength or other setting.
741 - * Fail if we aren't willing to use his suggestion.
743 - MPPE_CI_TO_OPTS(&p[2], try.mppe);
744 - if ((try.mppe & MPPE_OPT_STATEFUL) && refuse_mppe_stateful) {
745 - error("Refusing MPPE stateful mode offered by peer");
747 - } else if (((go->mppe | MPPE_OPT_STATEFUL) & try.mppe) != try.mppe) {
748 - /* Peer must have set options we didn't request (suggest) */
751 + if ((go->mppe || go->mppc || (!wo->mppe && ao->mppe)) &&
752 + len >= CILEN_MPPE && p[0] == CI_MPPE && p[1] == CILEN_MPPE) {
755 - error("MPPE required but peer negotiation failed");
756 - lcp_close(f->unit, "MPPE required but peer negotiation failed");
759 + if (!(p[5] & MPPE_MPPC))
771 + if (go->mppe_stateless)
772 + no.mppe_stateless = 1;
775 + if ((p[5] & MPPE_40BIT))
778 + try.mppe_40 = (p[5] == 0) ? 1 : 0;
781 + if ((p[5] & MPPE_56BIT))
784 + try.mppe_56 = (p[5] == 0) ? 1 : 0;
786 + if (ao->mppe_128) {
787 + if ((p[5] & MPPE_128BIT))
790 + try.mppe_128 = (p[5] == 0) ? 1 : 0;
793 + if (ao->mppe_stateless) {
794 + if ((p[2] & MPPE_STATELESS) || wo->mppe_stateless)
795 + try.mppe_stateless = 1;
797 + try.mppe_stateless = 0;
800 + if (!try.mppe_56 && !try.mppe_40 && !try.mppe_128) {
801 + try.mppe = try.mppe_stateless = 0;
803 + /* we require encryption, but peer doesn't support it
804 + so we close connection */
805 + wo->mppc = wo->mppe = wo->mppe_stateless = wo->mppe_40 =
806 + wo->mppe_56 = wo->mppe_128 = 0;
807 + lcp_close(f->unit, "MPPE required but cannot negotiate MPPE "
811 + if (wo->mppe && (wo->mppe_40 != try.mppe_40) &&
812 + (wo->mppe_56 != try.mppe_56) && (wo->mppe_128 != try.mppe_128)) {
813 + /* cannot negotiate key length */
814 + wo->mppc = wo->mppe = wo->mppe_stateless = wo->mppe_40 =
815 + wo->mppe_56 = wo->mppe_128 = 0;
816 + lcp_close(f->unit, "Cannot negotiate MPPE key length");
818 + if (try.mppe_40 && try.mppe_56 && try.mppe_128)
819 + try.mppe_40 = try.mppe_56 = 0;
821 + if (try.mppe_56 && try.mppe_128)
824 + if (try.mppe_40 && try.mppe_128)
827 + if (try.mppe_40 && try.mppe_56)
835 + if (go->lzs && len >= CILEN_LZS && p[0] == CI_LZS && p[1] == CILEN_LZS) {
837 + if (((p[2]<<8)|p[3]) > 1 || (p[4] != LZS_MODE_SEQ &&
838 + p[4] != LZS_MODE_EXT))
841 + try.lzs_mode = p[4];
842 + try.lzs_hists = (p[2] << 8) | p[3];
848 if (go->deflate && len >= CILEN_DEFLATE
849 && p[0] == (go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT)
850 && p[1] == CILEN_DEFLATE) {
851 @@ -1001,14 +1254,50 @@
855 - if (go->mppe && len >= CILEN_MPPE
856 + if ((go->mppe || go->mppc) && len >= CILEN_MPPE
857 && p[0] == CI_MPPE && p[1] == CILEN_MPPE) {
858 - error("MPPE required but peer refused");
859 - lcp_close(f->unit, "MPPE required but peer refused");
860 + ccp_options *wo = &ccp_wantoptions[f->unit];
861 + if (p[2] != (go->mppe_stateless ? MPPE_STATELESS : 0) ||
864 + p[5] != ((go->mppe_40 ? MPPE_40BIT : 0) |
865 + (go->mppe_56 ? MPPE_56BIT : 0) |
866 + (go->mppe_128 ? MPPE_128BIT : 0) |
867 + (go->mppc ? MPPE_MPPC : 0)))
879 + if (go->mppe_stateless)
880 + try.mppe_stateless = 0;
881 + if (!try.mppe_56 && !try.mppe_40 && !try.mppe_128)
882 + try.mppe = try.mppe_stateless = 0;
883 + if (wo->mppe) { /* we want MPPE but cannot negotiate key length */
884 + wo->mppc = wo->mppe = wo->mppe_stateless = wo->mppe_40 =
885 + wo->mppe_56 = wo->mppe_128 = 0;
886 + lcp_close(f->unit, "MPPE required but cannot negotiate MPPE "
895 + if (go->lzs && len >= CILEN_LZS && p[0] == CI_LZS && p[1] == CILEN_LZS) {
896 + if (p[2] != go->lzs_hists>>8 || p[3] != (go->lzs_hists&0xff)
897 + || p[4] != go->lzs_mode)
903 if (go->deflate_correct && len >= CILEN_DEFLATE
904 && p[0] == CI_DEFLATE && p[1] == CILEN_DEFLATE) {
905 if (p[2] != DEFLATE_MAKE_OPT(go->deflate_size)
906 @@ -1072,14 +1361,15 @@
909 int ret, newret, res;
911 + u_char *p0, *retp, p2, p5;
912 int len, clen, type, nb;
913 ccp_options *ho = &ccp_hisoptions[f->unit];
914 ccp_options *ao = &ccp_allowoptions[f->unit];
915 + ccp_options *wo = &ccp_wantoptions[f->unit];
917 - bool rej_for_ci_mppe = 1; /* Are we rejecting based on a bad/missing */
918 - /* CI_MPPE, or due to other options? */
920 + u_char opt_buf[CILEN_MPPE + MPPE_MAX_KEY_LEN];
926 @@ -1102,103 +1392,305 @@
930 - if (!ao->mppe || clen != CILEN_MPPE) {
931 + if ((!ao->mppc && !ao->mppe) || clen != CILEN_MPPE) {
935 - MPPE_CI_TO_OPTS(&p[2], ho->mppe);
937 - /* Nak if anything unsupported or unknown are set. */
938 - if (ho->mppe & MPPE_OPT_UNSUPPORTED) {
940 - ho->mppe &= ~MPPE_OPT_UNSUPPORTED;
942 - if (ho->mppe & MPPE_OPT_UNKNOWN) {
945 + /* not sure what they want, tell 'em what we got */
946 + if (((p[2] & ~MPPE_STATELESS) != 0 || p[3] != 0 || p[4] != 0 ||
947 + (p[5] & ~(MPPE_40BIT | MPPE_56BIT | MPPE_128BIT |
948 + MPPE_MPPC)) != 0 || p[5] == 0) ||
949 + (p[2] == 0 && p[3] == 0 && p[4] == 0 && p[5] == 0)) {
951 - ho->mppe &= ~MPPE_OPT_UNKNOWN;
952 + p[2] = (wo->mppe_stateless ? MPPE_STATELESS : 0);
955 + p[5] = (wo->mppe_40 ? MPPE_40BIT : 0) |
956 + (wo->mppe_56 ? MPPE_56BIT : 0) |
957 + (wo->mppe_128 ? MPPE_128BIT : 0) |
958 + (wo->mppc ? MPPE_MPPC : 0);
962 - /* Check state opt */
963 - if (ho->mppe & MPPE_OPT_STATEFUL) {
965 - * We can Nak and request stateless, but it's a
966 - * lot easier to just assume the peer will request
967 - * it if he can do it; stateful mode is bad over
968 - * the Internet -- which is where we expect MPPE.
970 - if (refuse_mppe_stateful) {
971 - error("Refusing MPPE stateful mode offered by peer");
972 + if ((p[5] & MPPE_MPPC)) {
975 + BCOPY(p, opt_buf, CILEN_MPPE);
976 + opt_buf[2] = opt_buf[3] = opt_buf[4] = 0;
977 + opt_buf[5] = MPPE_MPPC;
978 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE, 1) <= 0) {
980 + p[5] &= ~MPPE_MPPC;
986 + if (wo->mppe || ao->mppe) {
987 + p[5] &= ~MPPE_MPPC;
996 + if ((p[2] & MPPE_STATELESS)) {
997 + if (ao->mppe_stateless) {
998 + if (wo->mppe_stateless)
999 + ho->mppe_stateless = 1;
1003 + p[2] &= ~MPPE_STATELESS;
1008 + p[2] &= ~MPPE_STATELESS;
1011 + if (wo->mppe_stateless && !dont_nak) {
1012 + wo->mppe_stateless = 0;
1014 + p[2] |= MPPE_STATELESS;
1018 - /* Find out which of {S,L} are set. */
1019 - if ((ho->mppe & MPPE_OPT_128)
1020 - && (ho->mppe & MPPE_OPT_40)) {
1021 - /* Both are set, negotiate the strongest. */
1022 + if ((p[5] & ~MPPE_MPPC) == (MPPE_40BIT|MPPE_56BIT|MPPE_128BIT)) {
1024 - if (ao->mppe & MPPE_OPT_128)
1025 - ho->mppe &= ~MPPE_OPT_40;
1026 - else if (ao->mppe & MPPE_OPT_40)
1027 - ho->mppe &= ~MPPE_OPT_128;
1031 + if (ao->mppe_128) {
1033 + p[5] &= ~(MPPE_40BIT|MPPE_56BIT);
1034 + BCOPY(p, opt_buf, CILEN_MPPE);
1035 + BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
1036 + MPPE_MAX_KEY_LEN);
1037 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
1038 + MPPE_MAX_KEY_LEN, 1) <= 0) {
1040 + p[5] |= (MPPE_40BIT|MPPE_56BIT);
1041 + p[5] &= ~MPPE_128BIT;
1042 + goto check_mppe_56_40;
1046 - } else if (ho->mppe & MPPE_OPT_128) {
1047 - if (!(ao->mppe & MPPE_OPT_128)) {
1050 + p[5] &= ~MPPE_128BIT;
1051 + goto check_mppe_56_40;
1053 + if ((p[5] & ~MPPE_MPPC) == (MPPE_56BIT|MPPE_128BIT)) {
1055 + if (ao->mppe_128) {
1057 + p[5] &= ~MPPE_56BIT;
1058 + BCOPY(p, opt_buf, CILEN_MPPE);
1059 + BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
1060 + MPPE_MAX_KEY_LEN);
1061 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
1062 + MPPE_MAX_KEY_LEN, 1) <= 0) {
1064 + p[5] |= MPPE_56BIT;
1065 + p[5] &= ~MPPE_128BIT;
1066 + goto check_mppe_56;
1070 - } else if (ho->mppe & MPPE_OPT_40) {
1071 - if (!(ao->mppe & MPPE_OPT_40)) {
1074 + p[5] &= ~MPPE_128BIT;
1075 + goto check_mppe_56;
1077 + if ((p[5] & ~MPPE_MPPC) == (MPPE_40BIT|MPPE_128BIT)) {
1079 + if (ao->mppe_128) {
1081 + p[5] &= ~MPPE_40BIT;
1082 + BCOPY(p, opt_buf, CILEN_MPPE);
1083 + BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
1084 + MPPE_MAX_KEY_LEN);
1085 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
1086 + MPPE_MAX_KEY_LEN, 1) <= 0) {
1088 + p[5] |= MPPE_40BIT;
1089 + p[5] &= ~MPPE_128BIT;
1090 + goto check_mppe_40;
1094 + p[5] &= ~MPPE_128BIT;
1095 + goto check_mppe_40;
1097 + if ((p[5] & ~MPPE_MPPC) == MPPE_128BIT) {
1098 + if (ao->mppe_128) {
1100 + BCOPY(p, opt_buf, CILEN_MPPE);
1101 + BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
1102 + MPPE_MAX_KEY_LEN);
1103 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
1104 + MPPE_MAX_KEY_LEN, 1) <= 0) {
1106 + p[5] &= ~MPPE_128BIT;
1111 + p[5] &= ~MPPE_128BIT;
1116 + if ((p[5] & ~MPPE_MPPC) == (MPPE_40BIT|MPPE_56BIT)) {
1118 + if (ao->mppe_56) {
1120 + p[5] &= ~MPPE_40BIT;
1121 + BCOPY(p, opt_buf, CILEN_MPPE);
1122 + BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
1123 + MPPE_MAX_KEY_LEN);
1124 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
1125 + MPPE_MAX_KEY_LEN, 1) <= 0) {
1127 + p[5] |= MPPE_40BIT;
1128 + p[5] &= ~MPPE_56BIT;
1130 + goto check_mppe_40;
1134 + p[5] &= ~MPPE_56BIT;
1135 + goto check_mppe_40;
1138 + if ((p[5] & ~MPPE_MPPC) == MPPE_56BIT) {
1139 + if (ao->mppe_56) {
1141 + BCOPY(p, opt_buf, CILEN_MPPE);
1142 + BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
1143 + MPPE_MAX_KEY_LEN);
1144 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
1145 + MPPE_MAX_KEY_LEN, 1) <= 0) {
1147 + p[5] &= ~MPPE_56BIT;
1152 + p[5] &= ~MPPE_56BIT;
1157 + if ((p[5] & ~MPPE_MPPC) == MPPE_40BIT) {
1158 + if (ao->mppe_40) {
1160 + BCOPY(p, opt_buf, CILEN_MPPE);
1161 + BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
1162 + MPPE_MAX_KEY_LEN);
1163 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
1164 + MPPE_MAX_KEY_LEN, 1) <= 0) {
1166 + p[5] &= ~MPPE_40BIT;
1171 + p[5] &= ~MPPE_40BIT;
1175 + if (!ho->mppe_40 && !ho->mppe_56 && !ho->mppe_128) {
1176 + if (wo->mppe_40 || wo->mppe_56 || wo->mppe_128) {
1178 + p[2] |= (wo->mppe_stateless ? MPPE_STATELESS : 0);
1179 + p[5] |= (wo->mppe_40 ? MPPE_40BIT : 0) |
1180 + (wo->mppe_56 ? MPPE_56BIT : 0) |
1181 + (wo->mppe_128 ? MPPE_128BIT : 0) |
1182 + (wo->mppc ? MPPE_MPPC : 0);
1184 + ho->mppe = ho->mppe_stateless = 0;
1187 - /* Neither are set. */
1188 + /* MPPE is not compatible with other compression types */
1190 + ao->bsd_compress = 0;
1191 + ao->predictor_1 = 0;
1192 + ao->predictor_2 = 0;
1197 + if ((!ho->mppc || !ao->mppc) && !ho->mppe) {
1204 - /* rebuild the opts */
1205 - MPPE_OPTS_TO_CI(ho->mppe, &p[2]);
1206 - if (newret == CONFACK) {
1207 - u_char opt_buf[CILEN_MPPE + MPPE_MAX_KEY_LEN];
1210 - BCOPY(p, opt_buf, CILEN_MPPE);
1211 - BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
1212 - MPPE_MAX_KEY_LEN);
1213 - if (ccp_test(f->unit, opt_buf,
1214 - CILEN_MPPE + MPPE_MAX_KEY_LEN, 1) <= 0) {
1215 - /* This shouldn't happen, we've already tested it! */
1216 - error("MPPE required, but kernel has no support.");
1217 - lcp_close(f->unit, "MPPE required but not available");
1222 - * We need to decrease the interface MTU by MPPE_PAD
1223 - * because MPPE frames **grow**. The kernel [must]
1224 - * allocate MPPE_PAD extra bytes in xmit buffers.
1226 - mtu = netif_get_mtu(f->unit);
1228 - netif_set_mtu(f->unit, mtu - MPPE_PAD);
1233 + * I have commented the code below because according to RFC1547
1234 + * MTU is only information for higher level protocols about
1235 + * "the maximum allowable length for a packet (q.v.) transmitted
1236 + * over a point-to-point link without incurring network layer
1237 + * fragmentation." Of course a PPP implementation should be able
1238 + * to handle overhead added by MPPE - in our case apropriate code
1239 + * is located in drivers/net/ppp_generic.c in the kernel sources.
1241 + * According to RFC1661:
1242 + * - when negotiated MRU is less than 1500 octets, a PPP
1243 + * implementation must still be able to receive at least 1500
1245 + * - when PFC is negotiated, a PPP implementation is still
1246 + * required to receive frames with uncompressed protocol field.
1248 + * So why not to handle MPPE overhead without changing MTU value?
1249 + * I am sure that RFC3078, unfortunately silently, assumes that.
1253 - * We have accepted MPPE or are willing to negotiate
1254 - * MPPE parameters. A CONFREJ is due to subsequent
1255 - * (non-MPPE) processing.
1256 + * We need to decrease the interface MTU by MPPE_PAD
1257 + * because MPPE frames **grow**. The kernel [must]
1258 + * allocate MPPE_PAD extra bytes in xmit buffers.
1260 - rej_for_ci_mppe = 0;
1262 + mtu = netif_get_mtu(f->unit);
1264 + netif_set_mtu(f->unit, mtu - MPPE_PAD);
1267 + if (ccp_wantoptions[f->unit].mppe) {
1268 + error("Cannot adjust MTU needed by MPPE.");
1269 + lcp_close(f->unit, "Cannot adjust MTU needed by MPPE.");
1277 + if (!ao->lzs || clen != CILEN_LZS) {
1283 + ho->lzs_hists = (p[2] << 8) | p[3];
1284 + ho->lzs_mode = p[4];
1285 + if ((ho->lzs_hists != ao->lzs_hists) ||
1286 + (ho->lzs_mode != ao->lzs_mode)) {
1289 + p[2] = ao->lzs_hists >> 8;
1290 + p[3] = ao->lzs_hists & 0xff;
1291 + p[4] = ao->lzs_mode;
1296 + if (p == p0 && ccp_test(f->unit, p, CILEN_LZS, 1) <= 0) {
1302 case CI_DEFLATE_DRAFT:
1303 if (!ao->deflate || clen != CILEN_DEFLATE
1304 @@ -1340,12 +1832,6 @@
1309 - if (ret == CONFREJ && ao->mppe && rej_for_ci_mppe) {
1310 - error("MPPE required but peer negotiation failed");
1311 - lcp_close(f->unit, "MPPE required but peer negotiation failed");
1317 @@ -1367,24 +1853,35 @@
1319 char *q = result + sizeof(result); /* 1 past result */
1321 - slprintf(p, q - p, "MPPE ");
1323 - if (opt->mppe & MPPE_OPT_128) {
1324 - slprintf(p, q - p, "128-bit ");
1327 - if (opt->mppe & MPPE_OPT_40) {
1328 - slprintf(p, q - p, "40-bit ");
1331 - if (opt->mppe & MPPE_OPT_STATEFUL)
1332 - slprintf(p, q - p, "stateful");
1334 - slprintf(p, q - p, "stateless");
1338 + slprintf(p, q - p, "MPPC/MPPE ");
1341 + slprintf(p, q - p, "MPPE ");
1344 + if (opt->mppe_128) {
1345 + slprintf(p, q - p, "128-bit ");
1347 + } else if (opt->mppe_56) {
1348 + slprintf(p, q - p, "56-bit ");
1350 + } else if (opt->mppe_40) {
1351 + slprintf(p, q - p, "40-bit ");
1354 + if (opt->mppe_stateless)
1355 + slprintf(p, q - p, "stateless");
1357 + slprintf(p, q - p, "stateful");
1358 + } else if (opt->mppc)
1359 + slprintf(p, q - p, "MPPC");
1365 + return "Stac LZS";
1367 case CI_DEFLATE_DRAFT:
1368 if (opt2 != NULL && opt2->deflate_size != opt->deflate_size)
1369 @@ -1440,12 +1937,12 @@
1370 } else if (ANY_COMPRESS(*ho))
1371 notice("%s transmit compression enabled", method_name(ho, NULL));
1374 + if (go->mppe || go->mppc) {
1375 BZERO(mppe_recv_key, MPPE_MAX_KEY_LEN);
1376 BZERO(mppe_send_key, MPPE_MAX_KEY_LEN);
1377 continue_networks(f->unit); /* Bring up IP et al */
1384 @@ -1468,7 +1965,7 @@
1385 lcp_close(f->unit, "MPPE disabled");
1393 @@ -1528,24 +2025,28 @@
1396 if (optlen >= CILEN_MPPE) {
1399 - MPPE_CI_TO_OPTS(&p[2], mppe_opts);
1400 - printer(arg, "mppe %s %s %s %s %s %s%s",
1401 - (p[2] & MPPE_H_BIT)? "+H": "-H",
1402 - (p[5] & MPPE_M_BIT)? "+M": "-M",
1403 - (p[5] & MPPE_S_BIT)? "+S": "-S",
1404 - (p[5] & MPPE_L_BIT)? "+L": "-L",
1405 + printer(arg, "mppe %s %s %s %s %s %s",
1406 + (p[2] & MPPE_STATELESS)? "+H": "-H",
1407 + (p[5] & MPPE_56BIT)? "+M": "-M",
1408 + (p[5] & MPPE_128BIT)? "+S": "-S",
1409 + (p[5] & MPPE_40BIT)? "+L": "-L",
1410 (p[5] & MPPE_D_BIT)? "+D": "-D",
1411 - (p[5] & MPPE_C_BIT)? "+C": "-C",
1412 - (mppe_opts & MPPE_OPT_UNKNOWN)? " +U": "");
1413 - if (mppe_opts & MPPE_OPT_UNKNOWN)
1414 + (p[5] & MPPE_MPPC)? "+C": "-C");
1415 + if ((p[5] & ~(MPPE_56BIT | MPPE_128BIT | MPPE_40BIT |
1416 + MPPE_D_BIT | MPPE_MPPC)) ||
1417 + (p[2] & ~MPPE_STATELESS))
1418 printer(arg, " (%.2x %.2x %.2x %.2x)",
1419 p[2], p[3], p[4], p[5]);
1426 + if (optlen >= CILEN_LZS) {
1427 + printer(arg, "lzs %.2x %.2x %.2x", p[2], p[3], p[4]);
1432 case CI_DEFLATE_DRAFT:
1433 if (optlen >= CILEN_DEFLATE) {
1434 @@ -1631,6 +2132,7 @@
1435 error("Lost compression sync: disabling compression");
1436 ccp_close(unit, "Lost compression sync");
1438 + /* My module dosn't need this. J.D., 2003-07-06 */
1440 * If we were doing MPPE, we must also take the link down.
1442 @@ -1638,9 +2140,18 @@
1443 error("Too many MPPE errors, closing LCP");
1444 lcp_close(unit, "Too many MPPE errors");
1450 + * When LZS or MPPE/MPPC is negotiated we just send CCP_RESETREQ
1451 + * and don't wait for CCP_RESETACK
1453 + if ((ccp_gotoptions[f->unit].method == CI_LZS) ||
1454 + (ccp_gotoptions[f->unit].method == CI_MPPE)) {
1455 + fsm_sdata(f, CCP_RESETREQ, f->reqid = ++f->id, NULL, 0);
1459 * Send a reset-request to reset the peer's compressor.
1460 * We don't do that if we are still waiting for an
1461 * acknowledgement to a previous reset-request.
1462 @@ -1671,4 +2182,3 @@
1464 ccp_localstate[f->unit] &= ~RACK_PENDING;
1467 Index: ppp-2.4.3/pppd/ccp.h
1468 ===================================================================
1469 --- ppp-2.4.3.orig/pppd/ccp.h 2007-06-04 13:22:08.162614376 +0200
1470 +++ ppp-2.4.3/pppd/ccp.h 2007-06-04 13:22:12.033025984 +0200
1472 bool predictor_2; /* do Predictor-2? */
1473 bool deflate_correct; /* use correct code for deflate? */
1474 bool deflate_draft; /* use draft RFC code for deflate? */
1475 + bool lzs; /* do Stac LZS? */
1476 + bool mppc; /* do MPPC? */
1477 bool mppe; /* do MPPE? */
1478 + bool mppe_40; /* allow 40 bit encryption? */
1479 + bool mppe_56; /* allow 56 bit encryption? */
1480 + bool mppe_128; /* allow 128 bit encryption? */
1481 + bool mppe_stateless; /* allow stateless encryption */
1482 u_short bsd_bits; /* # bits/code for BSD Compress */
1483 u_short deflate_size; /* lg(window size) for Deflate */
1484 + u_short lzs_mode; /* LZS check mode */
1485 + u_short lzs_hists; /* number of LZS histories */
1486 short method; /* code for chosen compression method */
1489 Index: ppp-2.4.3/pppd/chap_ms.c
1490 ===================================================================
1491 --- ppp-2.4.3.orig/pppd/chap_ms.c 2007-06-04 13:22:08.168613464 +0200
1492 +++ ppp-2.4.3/pppd/chap_ms.c 2007-06-04 13:22:12.033025984 +0200
1493 @@ -895,13 +895,17 @@
1495 * Disable undesirable encryption types. Note that we don't ENABLE
1496 * any encryption types, to avoid overriding manual configuration.
1498 + * It seems that 56 bit keys are unsupported in MS-RADIUS (see RFC 2548)
1501 case MPPE_ENC_TYPES_RC4_40:
1502 - ccp_wantoptions[0].mppe &= ~MPPE_OPT_128; /* disable 128-bit */
1503 + ccp_wantoptions[0].mppe_128 = 0; /* disable 128-bit */
1504 + ccp_wantoptions[0].mppe_56 = 0; /* disable 56-bit */
1506 case MPPE_ENC_TYPES_RC4_128:
1507 - ccp_wantoptions[0].mppe &= ~MPPE_OPT_40; /* disable 40-bit */
1508 + ccp_wantoptions[0].mppe_56 = 0; /* disable 56-bit */
1509 + ccp_wantoptions[0].mppe_40 = 0; /* disable 40-bit */
1513 Index: ppp-2.4.3/pppd/pppd.8
1514 ===================================================================
1515 --- ppp-2.4.3.orig/pppd/pppd.8 2007-06-04 13:22:08.175612400 +0200
1516 +++ ppp-2.4.3/pppd/pppd.8 2007-06-04 13:22:12.034025832 +0200
1517 @@ -622,9 +622,29 @@
1518 Enables the use of PPP multilink; this is an alias for the `multilink'
1519 option. This option is currently only available under Linux.
1522 -Allow MPPE to use stateful mode. Stateless mode is still attempted first.
1523 -The default is to disallow stateful mode.
1525 +Enables MPPC (Microsoft Point to Point Compression). This is the default.
1527 +.B mppe \fIsubopt1[,subopt2[,subopt3[..]]]
1528 +Modify MPPE (Microsoft Point to Point Encryption) parameters. In order
1529 +for MPPE to successfully come up, you must have authenticated with either
1530 +MS-CHAP or MS-CHAPv2. By default MPPE is optional, it means that pppd will
1531 +not propose MPPE to the peer, but will negotiate MPPE if peer wants that.
1532 +You can change this using \fIrequired\fR suboption.
1533 +This option is presently only supported under Linux, and only if your
1534 +kernel has been configured to include MPPE support.
1538 +\fIrequired\fR - require MPPE; disconnect if peer doesn't support it,
1540 +\fIstateless\fR - try to negotiate stateless mode; default is stateful,
1542 +\fIno40\fR - disable 40 bit keys,
1544 +\fIno56\fR - disable 56 bit keys,
1546 +\fIno128\fR - disable 128 bit keys
1549 Enables the use of short (12-bit) sequence numbers in multilink
1550 @@ -757,17 +777,11 @@
1551 Disables the use of PPP multilink. This option is currently only
1552 available under Linux.
1555 -Disables MPPE (Microsoft Point to Point Encryption). This is the default.
1558 -Disable 40-bit encryption with MPPE.
1560 +Disables MPPC (Microsoft Point to Point Compression).
1563 -Disable 128-bit encryption with MPPE.
1565 -.B nomppe\-stateful
1566 -Disable MPPE stateful mode. This is the default.
1568 +Disables MPPE (Microsoft Point to Point Encryption).
1571 Disables the use of short (12-bit) sequence numbers in the PPP
1572 @@ -948,19 +962,6 @@
1573 Require the peer to authenticate itself using CHAP [Challenge
1574 Handshake Authentication Protocol] authentication.
1577 -Require the use of MPPE (Microsoft Point to Point Encryption). This
1578 -option disables all other compression types. This option enables
1579 -both 40-bit and 128-bit encryption. In order for MPPE to successfully
1580 -come up, you must have authenticated with either MS\-CHAP or MS\-CHAPv2.
1581 -This option is presently only supported under Linux, and only if your
1582 -kernel has been configured to include MPPE support.
1584 -.B require\-mppe\-40
1585 -Require the use of MPPE, with 40-bit encryption.
1587 -.B require\-mppe\-128
1588 -Require the use of MPPE, with 128-bit encryption.
1591 Require the peer to authenticate itself using MS\-CHAP [Microsoft Challenge