1 diff -Naur ppp-2.4.4.orig/include/linux/ppp-comp.h ppp-2.4.4/include/linux/ppp-comp.h
2 --- ppp-2.4.4.orig/include/linux/ppp-comp.h 2009-05-09 03:44:09.000000000 -0400
3 +++ ppp-2.4.4/include/linux/ppp-comp.h 2009-05-09 03:45:52.000000000 -0400
8 - * ==FILEVERSION 20020319==
9 + * ==FILEVERSION 20020715==
11 * NOTE TO MAINTAINERS:
12 * If you modify this file at all, please set the above date.
15 /* Compress a packet */
16 int (*compress) (void *state, unsigned char *rptr,
17 - unsigned char *obuf, int isize, int osize);
18 + unsigned char *obuf, int isize, int osize);
20 /* Return compression statistics */
21 void (*comp_stat) (void *state, struct compstat *stats);
24 /* Decompress a packet. */
25 int (*decompress) (void *state, unsigned char *ibuf, int isize,
26 - unsigned char *obuf, int osize);
27 + unsigned char *obuf, int osize);
29 /* Update state for an incompressible packet received */
30 void (*incomp) (void *state, unsigned char *ibuf, int icnt);
32 opts |= MPPE_OPT_UNKNOWN; \
33 } while (/* CONSTCOND */ 0)
35 +/* MPPE/MPPC definitions by J.D.*/
36 +#define MPPE_STATELESS MPPE_H_BIT /* configuration bit H */
37 +#define MPPE_40BIT MPPE_L_BIT /* configuration bit L */
38 +#define MPPE_56BIT MPPE_M_BIT /* configuration bit M */
39 +#define MPPE_128BIT MPPE_S_BIT /* configuration bit S */
40 +#define MPPE_MPPC MPPE_C_BIT /* configuration bit C */
43 + * Definitions for Stac LZS.
46 +#define CI_LZS 17 /* config option for Stac LZS */
47 +#define CILEN_LZS 5 /* length of config option */
49 +#define LZS_OVHD 4 /* max. LZS overhead */
50 +#define LZS_HIST_LEN 2048 /* LZS history size */
51 +#define LZS_MAX_CCOUNT 0x0FFF /* max. coherency counter value */
53 +#define LZS_MODE_NONE 0
54 +#define LZS_MODE_LCB 1
55 +#define LZS_MODE_CRC 2
56 +#define LZS_MODE_SEQ 3
57 +#define LZS_MODE_EXT 4
59 +#define LZS_EXT_BIT_FLUSHED 0x80 /* bit A */
60 +#define LZS_EXT_BIT_COMP 0x20 /* bit C */
63 * Definitions for other, as yet unsupported, compression methods.
65 diff -Naur ppp-2.4.4.orig/include/net/ppp-comp.h ppp-2.4.4/include/net/ppp-comp.h
66 --- ppp-2.4.4.orig/include/net/ppp-comp.h 2009-05-09 03:44:09.000000000 -0400
67 +++ ppp-2.4.4/include/net/ppp-comp.h 2009-05-09 03:45:52.000000000 -0400
69 opts |= MPPE_OPT_UNKNOWN; \
70 } while (/* CONSTCOND */ 0)
72 +/* MPPE/MPPC definitions by J.D.*/
73 +#define MPPE_STATELESS MPPE_H_BIT /* configuration bit H */
74 +#define MPPE_40BIT MPPE_L_BIT /* configuration bit L */
75 +#define MPPE_56BIT MPPE_M_BIT /* configuration bit M */
76 +#define MPPE_128BIT MPPE_S_BIT /* configuration bit S */
77 +#define MPPE_MPPC MPPE_C_BIT /* configuration bit C */
80 + * Definitions for Stac LZS.
83 +#define CI_LZS 17 /* config option for Stac LZS */
84 +#define CILEN_LZS 5 /* length of config option */
86 +#define LZS_OVHD 4 /* max. LZS overhead */
87 +#define LZS_HIST_LEN 2048 /* LZS history size */
88 +#define LZS_MAX_CCOUNT 0x0FFF /* max. coherency counter value */
90 +#define LZS_MODE_NONE 0
91 +#define LZS_MODE_LCB 1
92 +#define LZS_MODE_CRC 2
93 +#define LZS_MODE_SEQ 3
94 +#define LZS_MODE_EXT 4
96 +#define LZS_EXT_BIT_FLUSHED 0x80 /* bit A */
97 +#define LZS_EXT_BIT_COMP 0x20 /* bit C */
100 * Definitions for other, as yet unsupported, compression methods.
102 diff -Naur ppp-2.4.4.orig/pppd/ccp.c ppp-2.4.4/pppd/ccp.c
103 --- ppp-2.4.4.orig/pppd/ccp.c 2009-05-09 03:44:09.000000000 -0400
104 +++ ppp-2.4.4/pppd/ccp.c 2009-05-09 03:45:52.000000000 -0400
106 static char bsd_value[8];
107 static char deflate_value[8];
110 - * Option variables.
113 -bool refuse_mppe_stateful = 1; /* Allow stateful mode? */
115 +static int setmppe(char **);
116 +static int setnomppe(void);
119 static option_t ccp_option_list[] = {
120 { "noccp", o_bool, &ccp_protent.enabled_flag,
121 @@ -108,54 +106,36 @@
122 "don't allow Predictor-1", OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLR,
123 &ccp_allowoptions[0].predictor_1 },
125 + { "lzs", o_bool, &ccp_wantoptions[0].lzs,
126 + "request Stac LZS", 1, &ccp_allowoptions[0].lzs, OPT_PRIO },
127 + { "+lzs", o_bool, &ccp_wantoptions[0].lzs,
128 + "request Stac LZS", 1, &ccp_allowoptions[0].lzs, OPT_ALIAS | OPT_PRIO },
129 + { "nolzs", o_bool, &ccp_wantoptions[0].lzs,
130 + "don't allow Stac LZS", OPT_PRIOSUB | OPT_A2CLR,
131 + &ccp_allowoptions[0].lzs },
132 + { "-lzs", o_bool, &ccp_wantoptions[0].lzs,
133 + "don't allow Stac LZS", OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLR,
134 + &ccp_allowoptions[0].lzs },
137 - /* MPPE options are symmetrical ... we only set wantoptions here */
138 - { "require-mppe", o_bool, &ccp_wantoptions[0].mppe,
139 - "require MPPE encryption",
140 - OPT_PRIO | MPPE_OPT_40 | MPPE_OPT_128 },
141 - { "+mppe", o_bool, &ccp_wantoptions[0].mppe,
142 - "require MPPE encryption",
143 - OPT_ALIAS | OPT_PRIO | MPPE_OPT_40 | MPPE_OPT_128 },
144 - { "nomppe", o_bool, &ccp_wantoptions[0].mppe,
145 - "don't allow MPPE encryption", OPT_PRIO },
146 - { "-mppe", o_bool, &ccp_wantoptions[0].mppe,
147 - "don't allow MPPE encryption", OPT_ALIAS | OPT_PRIO },
149 - /* We use ccp_allowoptions[0].mppe as a junk var ... it is reset later */
150 - { "require-mppe-40", o_bool, &ccp_allowoptions[0].mppe,
151 - "require MPPE 40-bit encryption", OPT_PRIO | OPT_A2OR | MPPE_OPT_40,
152 - &ccp_wantoptions[0].mppe },
153 - { "+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 - { "nomppe-40", o_bool, &ccp_allowoptions[0].mppe,
157 - "don't allow MPPE 40-bit encryption",
158 - OPT_PRIOSUB | OPT_A2CLRB | MPPE_OPT_40, &ccp_wantoptions[0].mppe },
159 - { "-mppe-40", o_bool, &ccp_allowoptions[0].mppe,
160 - "don't allow MPPE 40-bit encryption",
161 - OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLRB | MPPE_OPT_40,
162 - &ccp_wantoptions[0].mppe },
164 - { "require-mppe-128", o_bool, &ccp_allowoptions[0].mppe,
165 - "require MPPE 128-bit encryption", OPT_PRIO | OPT_A2OR | MPPE_OPT_128,
166 - &ccp_wantoptions[0].mppe },
167 - { "+mppe-128", o_bool, &ccp_allowoptions[0].mppe,
168 - "require MPPE 128-bit encryption",
169 - OPT_ALIAS | OPT_PRIO | OPT_A2OR | MPPE_OPT_128,
170 - &ccp_wantoptions[0].mppe },
171 - { "nomppe-128", o_bool, &ccp_allowoptions[0].mppe,
172 - "don't allow MPPE 128-bit encryption",
173 - OPT_PRIOSUB | OPT_A2CLRB | MPPE_OPT_128, &ccp_wantoptions[0].mppe },
174 - { "-mppe-128", o_bool, &ccp_allowoptions[0].mppe,
175 - "don't allow MPPE 128-bit encryption",
176 - OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLRB | MPPE_OPT_128,
177 - &ccp_wantoptions[0].mppe },
179 - /* strange one; we always request stateless, but will we allow stateful? */
180 - { "mppe-stateful", o_bool, &refuse_mppe_stateful,
181 - "allow MPPE stateful mode", OPT_PRIO },
182 - { "nomppe-stateful", o_bool, &refuse_mppe_stateful,
183 - "disallow MPPE stateful mode", OPT_PRIO | 1 },
184 + { "mppc", o_bool, &ccp_wantoptions[0].mppc,
185 + "request MPPC compression", 1, &ccp_allowoptions[0].mppc },
186 + { "+mppc", o_bool, &ccp_wantoptions[0].mppc,
187 + "request MPPC compression", 1, &ccp_allowoptions[0].mppc, OPT_ALIAS },
188 + { "nomppc", o_bool, &ccp_wantoptions[0].mppc,
189 + "don't allow MPPC compression", OPT_PRIOSUB | OPT_A2CLR,
190 + &ccp_allowoptions[0].mppc },
191 + { "-mppc", o_bool, &ccp_wantoptions[0].mppc,
192 + "don't allow MPPC compression", OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLR,
193 + &ccp_allowoptions[0].mppc },
194 + { "mppe", o_special, (void *)setmppe,
195 + "request MPPE encryption" },
196 + { "+mppe", o_special, (void *)setmppe,
197 + "request MPPE encryption" },
198 + { "nomppe", o_special_noarg, (void *)setnomppe,
199 + "don't allow MPPE encryption" },
200 + { "-mppe", o_special_noarg, (void *)setnomppe,
201 + "don't allow MPPE encryption" },
207 #define ANY_COMPRESS(opt) ((opt).deflate || (opt).bsd_compress \
208 || (opt).predictor_1 || (opt).predictor_2 \
210 + || (opt).lzs || (opt).mppc || (opt).mppe)
213 * Local state (mainly for handling reset-reqs and reset-acks).
214 @@ -344,6 +324,100 @@
220 + * Functions called from config options
224 + required - require MPPE; disconnect if peer doesn't support it
225 + stateless - use stateless mode
226 + no40 - disable 40 bit keys
227 + no56 - disable 56 bit keys
228 + no128 - disable 128 bit keys
230 +int setmppe(char **argv)
233 + char *str, cmdbuf[16];
235 + ccp_allowoptions[0].mppe = 1;
236 + ccp_allowoptions[0].mppe_40 = 1;
237 + ccp_allowoptions[0].mppe_56 = 1;
238 + ccp_allowoptions[0].mppe_128 = 1;
239 + ccp_allowoptions[0].mppe_stateless = 0;
240 + ccp_wantoptions[0].mppe = 0;
246 + memset(cmdbuf, '\0', 16);
247 + while ((i < 16) && (*str != ',') && (*str != '\0'))
248 + cmdbuf[i++] = *str++;
250 + if (!strncasecmp(cmdbuf, "no40", strlen("no40"))) {
251 + ccp_allowoptions[0].mppe_40 = 0;
253 + } else if (!strncasecmp(cmdbuf, "no56", strlen("no56"))) {
254 + ccp_allowoptions[0].mppe_56 = 0;
256 + } else if (!strncasecmp(cmdbuf, "no128", strlen("no128"))) {
257 + ccp_allowoptions[0].mppe_128 = 0;
259 + } else if (!strncasecmp(cmdbuf, "stateless", strlen("stateless"))) {
260 + ccp_allowoptions[0].mppe_stateless = 1;
262 + } else if (!strncasecmp(cmdbuf, "required", strlen("required"))) {
263 + ccp_wantoptions[0].mppe = 1;
266 + option_error("invalid parameter '%s' for mppe option", cmdbuf);
275 + if (*str == '\0') {
276 + if (!(ccp_allowoptions[0].mppe_40 || ccp_allowoptions[0].mppe_56 ||
277 + ccp_allowoptions[0].mppe_128)) {
278 + if (ccp_wantoptions[0].mppe == 1) {
279 + option_error("You require MPPE but you have switched off "
280 + "all encryption key lengths.");
283 + ccp_wantoptions[0].mppe = ccp_allowoptions[0].mppe = 0;
284 + ccp_wantoptions[0].mppe_stateless =
285 + ccp_allowoptions[0].mppe_stateless = 0;
287 + ccp_allowoptions[0].mppe = 1;
288 + ccp_wantoptions[0].mppe_stateless =
289 + ccp_allowoptions[0].mppe_stateless;
290 + if (ccp_wantoptions[0].mppe == 1) {
291 + ccp_wantoptions[0].mppe_40 = ccp_allowoptions[0].mppe_40;
292 + ccp_wantoptions[0].mppe_56 = ccp_allowoptions[0].mppe_56;
293 + ccp_wantoptions[0].mppe_128 = ccp_allowoptions[0].mppe_128;
303 + ccp_wantoptions[0].mppe = ccp_allowoptions[0].mppe = 0;
304 + ccp_wantoptions[0].mppe_40 = ccp_allowoptions[0].mppe_40 = 0;
305 + ccp_wantoptions[0].mppe_56 = ccp_allowoptions[0].mppe_56 = 0;
306 + ccp_wantoptions[0].mppe_128 = ccp_allowoptions[0].mppe_128 = 0;
307 + ccp_wantoptions[0].mppe_stateless = ccp_allowoptions[0].mppe_stateless = 0;
313 * ccp_init - initialize CCP.
316 ccp_allowoptions[0].bsd_bits = BSD_MAX_BITS;
318 ccp_allowoptions[0].predictor_1 = 1;
320 + ccp_wantoptions[0].lzs = 0; /* Stac LZS - will be enabled in the future */
321 + ccp_wantoptions[0].lzs_mode = LZS_MODE_SEQ;
322 + ccp_wantoptions[0].lzs_hists = 1;
323 + ccp_allowoptions[0].lzs = 0; /* Stac LZS - will be enabled in the future */
324 + ccp_allowoptions[0].lzs_mode = LZS_MODE_SEQ;
325 + ccp_allowoptions[0].lzs_hists = 1;
328 + /* by default allow and request MPPC... */
329 + ccp_wantoptions[0].mppc = ccp_allowoptions[0].mppc = 1;
331 + /* ... and allow but don't request MPPE */
332 + ccp_allowoptions[0].mppe = 1;
333 + ccp_allowoptions[0].mppe_40 = 1;
334 + ccp_allowoptions[0].mppe_56 = 1;
335 + ccp_allowoptions[0].mppe_128 = 1;
336 + ccp_allowoptions[0].mppe_stateless = 1;
337 + ccp_wantoptions[0].mppe = 0;
338 + ccp_wantoptions[0].mppe_40 = 0;
339 + ccp_wantoptions[0].mppe_56 = 0;
340 + ccp_wantoptions[0].mppe_128 = 0;
341 + ccp_wantoptions[0].mppe_stateless = 0;
346 @@ -455,11 +553,11 @@
347 if (oldstate == OPENED && p[0] == TERMREQ && f->state != OPENED) {
348 notice("Compression disabled by peer.");
350 - if (ccp_gotoptions[unit].mppe) {
351 + if (ccp_wantoptions[unit].mppe) {
352 error("MPPE disabled, closing LCP");
353 lcp_close(unit, "MPPE disabled by peer");
362 /* send a reset-ack, which the transmitter will see and
363 reset its compression state. */
365 + /* In case of MPPE/MPPC or LZS we shouldn't send CCP_RESETACK,
366 + but we do it in order to reset compressor; CCP_RESETACK is
367 + then silently discarded. See functions ppp_send_frame and
368 + ppp_ccp_peek in ppp_generic.c (Linux only !!!). All the
369 + confusion is caused by the fact that CCP code is splited
370 + into two parts - one part is handled by pppd, the other one
371 + is handled by kernel. */
373 fsm_sdata(f, CCP_RESETACK, id, NULL, 0);
376 @@ -515,12 +622,11 @@
377 fsm_lowerdown(&ccp_fsm[unit]);
380 - if (ccp_gotoptions[unit].mppe) {
381 + if (ccp_wantoptions[unit].mppe) {
382 error("MPPE required but peer negotiation failed");
383 lcp_close(unit, "MPPE required but peer negotiation failed");
392 all_rejected[f->unit] = 0;
396 + if (go->mppe || go->mppc) {
397 ccp_options *ao = &ccp_allowoptions[f->unit];
398 int auth_mschap_bits = auth_done[f->unit];
400 @@ -551,80 +657,109 @@
401 * NB: If MPPE is required, all other compression opts are invalid.
402 * So, we return right away if we can't do it.
404 + if (ccp_wantoptions[f->unit].mppe) {
405 + /* Leave only the mschap auth bits set */
406 + auth_mschap_bits &= (CHAP_MS_WITHPEER | CHAP_MS_PEER |
407 + CHAP_MS2_WITHPEER | CHAP_MS2_PEER);
408 + /* Count the mschap auths */
409 + auth_mschap_bits >>= CHAP_MS_SHIFT;
412 + numbits += auth_mschap_bits & 1;
413 + auth_mschap_bits >>= 1;
414 + } while (auth_mschap_bits);
416 + error("MPPE required, but auth done in both directions.");
417 + lcp_close(f->unit, "MPPE required but not available");
421 + error("MPPE required, but MS-CHAP[v2] auth not performed.");
422 + lcp_close(f->unit, "MPPE required but not available");
426 - /* Leave only the mschap auth bits set */
427 - auth_mschap_bits &= (CHAP_MS_WITHPEER | CHAP_MS_PEER |
428 - CHAP_MS2_WITHPEER | CHAP_MS2_PEER);
429 - /* Count the mschap auths */
430 - auth_mschap_bits >>= CHAP_MS_SHIFT;
433 - numbits += auth_mschap_bits & 1;
434 - auth_mschap_bits >>= 1;
435 - } while (auth_mschap_bits);
437 - error("MPPE required, but auth done in both directions.");
438 - lcp_close(f->unit, "MPPE required but not available");
442 - error("MPPE required, but MS-CHAP[v2] auth not performed.");
443 - lcp_close(f->unit, "MPPE required but not available");
447 - /* A plugin (eg radius) may not have obtained key material. */
448 - if (!mppe_keys_set) {
449 - error("MPPE required, but keys are not available. "
450 - "Possible plugin problem?");
451 - lcp_close(f->unit, "MPPE required but not available");
455 - /* LM auth not supported for MPPE */
456 - if (auth_done[f->unit] & (CHAP_MS_WITHPEER | CHAP_MS_PEER)) {
457 - /* This might be noise */
458 - if (go->mppe & MPPE_OPT_40) {
459 - notice("Disabling 40-bit MPPE; MS-CHAP LM not supported");
460 - go->mppe &= ~MPPE_OPT_40;
461 - ccp_wantoptions[f->unit].mppe &= ~MPPE_OPT_40;
462 + /* A plugin (eg radius) may not have obtained key material. */
463 + if (!mppe_keys_set) {
464 + error("MPPE required, but keys are not available. "
465 + "Possible plugin problem?");
466 + lcp_close(f->unit, "MPPE required but not available");
471 - /* Last check: can we actually negotiate something? */
472 - if (!(go->mppe & (MPPE_OPT_40 | MPPE_OPT_128))) {
473 - /* Could be misconfig, could be 40-bit disabled above. */
474 - error("MPPE required, but both 40-bit and 128-bit disabled.");
475 - lcp_close(f->unit, "MPPE required but not available");
478 + * Check whether the kernel knows about the various
479 + * compression methods we might request. Key material
480 + * unimportant here.
483 + opt_buf[0] = CI_MPPE;
484 + opt_buf[1] = CILEN_MPPE;
488 + opt_buf[5] = MPPE_MPPC;
489 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE, 0) <= 0)
493 + opt_buf[0] = CI_MPPE;
494 + opt_buf[1] = CILEN_MPPE;
495 + opt_buf[2] = MPPE_STATELESS;
498 + opt_buf[5] = MPPE_40BIT;
499 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0) <= 0)
503 + opt_buf[0] = CI_MPPE;
504 + opt_buf[1] = CILEN_MPPE;
505 + opt_buf[2] = MPPE_STATELESS;
508 + opt_buf[5] = MPPE_56BIT;
509 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0) <= 0)
512 + if (go->mppe_128) {
513 + opt_buf[0] = CI_MPPE;
514 + opt_buf[1] = CILEN_MPPE;
515 + opt_buf[2] = MPPE_STATELESS;
518 + opt_buf[5] = MPPE_128BIT;
519 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0) <= 0)
522 + if (!go->mppe_40 && !go->mppe_56 && !go->mppe_128) {
523 + if (ccp_wantoptions[f->unit].mppe) {
524 + error("MPPE required, but kernel has no support.");
525 + lcp_close(f->unit, "MPPE required but not available");
527 + go->mppe = go->mppe_stateless = 0;
529 + /* MPPE is not compatible with other compression types */
530 + if (ccp_wantoptions[f->unit].mppe) {
531 + ao->bsd_compress = go->bsd_compress = 0;
532 + ao->predictor_1 = go->predictor_1 = 0;
533 + ao->predictor_2 = go->predictor_2 = 0;
534 + ao->deflate = go->deflate = 0;
535 + ao->lzs = go->lzs = 0;
540 - ao->mppe = go->mppe;
541 - /* MPPE is not compatible with other compression types */
542 - ao->bsd_compress = go->bsd_compress = 0;
543 - ao->predictor_1 = go->predictor_1 = 0;
544 - ao->predictor_2 = go->predictor_2 = 0;
545 - ao->deflate = go->deflate = 0;
550 - * Check whether the kernel knows about the various
551 - * compression methods we might request.
555 - opt_buf[0] = CI_MPPE;
556 - opt_buf[1] = CILEN_MPPE;
557 - MPPE_OPTS_TO_CI(go->mppe, &opt_buf[2]);
558 - /* Key material unimportant here. */
559 - if (ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0) <= 0) {
560 - error("MPPE required, but kernel has no support.");
561 - lcp_close(f->unit, "MPPE required but not available");
564 + opt_buf[0] = CI_LZS;
565 + opt_buf[1] = CILEN_LZS;
566 + opt_buf[2] = go->lzs_hists >> 8;
567 + opt_buf[3] = go->lzs_hists & 0xff;
568 + opt_buf[4] = LZS_MODE_SEQ;
569 + if (ccp_test(f->unit, opt_buf, CILEN_LZS, 0) <= 0)
573 if (go->bsd_compress) {
574 opt_buf[0] = CI_BSD_COMPRESS;
575 opt_buf[1] = CILEN_BSD_COMPRESS;
577 + (go->deflate? CILEN_DEFLATE: 0)
578 + (go->predictor_1? CILEN_PREDICTOR_1: 0)
579 + (go->predictor_2? CILEN_PREDICTOR_2: 0)
580 - + (go->mppe? CILEN_MPPE: 0);
581 + + (go->lzs? CILEN_LZS: 0)
582 + + ((go->mppe || go->mppc)? CILEN_MPPE: 0);
589 ccp_options *go = &ccp_gotoptions[f->unit];
590 + ccp_options *ao = &ccp_allowoptions[f->unit];
591 + ccp_options *wo = &ccp_wantoptions[f->unit];
595 @@ -701,22 +839,43 @@
596 * in case it gets Acked.
600 + if (go->mppe || go->mppc || (!wo->mppe && ao->mppe)) {
601 u_char opt_buf[CILEN_MPPE + MPPE_MAX_KEY_LEN];
603 - p[0] = opt_buf[0] = CI_MPPE;
604 - p[1] = opt_buf[1] = CILEN_MPPE;
605 - MPPE_OPTS_TO_CI(go->mppe, &p[2]);
606 - MPPE_OPTS_TO_CI(go->mppe, &opt_buf[2]);
609 + p[2] = (go->mppe_stateless ? MPPE_STATELESS : 0);
612 + p[5] = (go->mppe_40 ? MPPE_40BIT : 0) | (go->mppe_56 ? MPPE_56BIT : 0) |
613 + (go->mppe_128 ? MPPE_128BIT : 0) | (go->mppc ? MPPE_MPPC : 0);
615 + BCOPY(p, opt_buf, CILEN_MPPE);
616 BCOPY(mppe_recv_key, &opt_buf[CILEN_MPPE], MPPE_MAX_KEY_LEN);
617 res = ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0);
623 /* This shouldn't happen, we've already tested it! */
624 - lcp_close(f->unit, "MPPE required but not available in kernel");
625 + go->mppe = go->mppe_40 = go->mppe_56 = go->mppe_128 =
626 + go->mppe_stateless = go->mppc = 0;
627 + if (ccp_wantoptions[f->unit].mppe)
628 + lcp_close(f->unit, "MPPE required but not available in kernel");
635 + p[2] = go->lzs_hists >> 8;
636 + p[3] = go->lzs_hists & 0xff;
637 + p[4] = LZS_MODE_SEQ;
638 + res = ccp_test(f->unit, p, CILEN_LZS, 0);
646 p[0] = go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT;
647 p[1] = CILEN_DEFLATE;
651 * ccp_ackci - process a received configure-ack, and return
652 - * 1 iff the packet was OK.
653 + * 1 if the packet was OK.
657 @@ -811,24 +970,44 @@
660 ccp_options *go = &ccp_gotoptions[f->unit];
661 + ccp_options *ao = &ccp_allowoptions[f->unit];
662 + ccp_options *wo = &ccp_wantoptions[f->unit];
667 - u_char opt_buf[CILEN_MPPE];
669 - opt_buf[0] = CI_MPPE;
670 - opt_buf[1] = CILEN_MPPE;
671 - MPPE_OPTS_TO_CI(go->mppe, &opt_buf[2]);
672 - if (len < CILEN_MPPE || memcmp(opt_buf, p, CILEN_MPPE))
673 + if (go->mppe || go->mppc || (!wo->mppe && ao->mppe)) {
674 + if (len < CILEN_MPPE
675 + || p[1] != CILEN_MPPE || p[0] != CI_MPPE
676 + || p[2] != (go->mppe_stateless ? MPPE_STATELESS : 0)
679 + || (p[5] != ((go->mppe_40 ? MPPE_40BIT : 0) |
680 + (go->mppc ? MPPE_MPPC : 0))
681 + && p[5] != ((go->mppe_56 ? MPPE_56BIT : 0) |
682 + (go->mppc ? MPPE_MPPC : 0))
683 + && p[5] != ((go->mppe_128 ? MPPE_128BIT : 0) |
684 + (go->mppc ? MPPE_MPPC : 0))))
686 + if (go->mppe_40 || go->mppe_56 || go->mppe_128)
690 + /* Cope with first/fast ack */
691 + if (p == p0 && len == 0)
696 + if (len < CILEN_LZS || p[0] != CI_LZS || p[1] != CILEN_LZS
697 + || p[2] != go->lzs_hists>>8 || p[3] != (go->lzs_hists&0xff)
698 + || p[4] != LZS_MODE_SEQ)
702 /* XXX Cope with first/fast ack */
704 + if (p == p0 && len == 0)
709 if (len < CILEN_DEFLATE
710 || p[0] != (go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT)
714 * ccp_nakci - process received configure-nak.
715 - * Returns 1 iff the nak was OK.
716 + * Returns 1 if the nak was OK.
719 ccp_nakci(f, p, len, treat_as_reject)
723 ccp_options *go = &ccp_gotoptions[f->unit];
724 + ccp_options *ao = &ccp_allowoptions[f->unit];
725 + ccp_options *wo = &ccp_wantoptions[f->unit];
726 ccp_options no; /* options we've seen already */
727 ccp_options try; /* options to ask for next time */
729 @@ -908,28 +1089,100 @@
733 - if (go->mppe && len >= CILEN_MPPE
734 - && p[0] == CI_MPPE && p[1] == CILEN_MPPE) {
737 - * Peer wants us to use a different strength or other setting.
738 - * Fail if we aren't willing to use his suggestion.
740 - MPPE_CI_TO_OPTS(&p[2], try.mppe);
741 - if ((try.mppe & MPPE_OPT_STATEFUL) && refuse_mppe_stateful) {
742 - error("Refusing MPPE stateful mode offered by peer");
744 - } else if (((go->mppe | MPPE_OPT_STATEFUL) & try.mppe) != try.mppe) {
745 - /* Peer must have set options we didn't request (suggest) */
748 + if ((go->mppe || go->mppc || (!wo->mppe && ao->mppe)) &&
749 + len >= CILEN_MPPE && p[0] == CI_MPPE && p[1] == CILEN_MPPE) {
752 - error("MPPE required but peer negotiation failed");
753 - lcp_close(f->unit, "MPPE required but peer negotiation failed");
756 + if (!(p[5] & MPPE_MPPC))
768 + if (go->mppe_stateless)
769 + no.mppe_stateless = 1;
772 + if ((p[5] & MPPE_40BIT))
775 + try.mppe_40 = (p[5] == 0) ? 1 : 0;
778 + if ((p[5] & MPPE_56BIT))
781 + try.mppe_56 = (p[5] == 0) ? 1 : 0;
783 + if (ao->mppe_128) {
784 + if ((p[5] & MPPE_128BIT))
787 + try.mppe_128 = (p[5] == 0) ? 1 : 0;
790 + if (ao->mppe_stateless) {
791 + if ((p[2] & MPPE_STATELESS) || wo->mppe_stateless)
792 + try.mppe_stateless = 1;
794 + try.mppe_stateless = 0;
797 + if (!try.mppe_56 && !try.mppe_40 && !try.mppe_128) {
798 + try.mppe = try.mppe_stateless = 0;
800 + /* we require encryption, but peer doesn't support it
801 + so we close connection */
802 + wo->mppc = wo->mppe = wo->mppe_stateless = wo->mppe_40 =
803 + wo->mppe_56 = wo->mppe_128 = 0;
804 + lcp_close(f->unit, "MPPE required but cannot negotiate MPPE "
808 + if (wo->mppe && (wo->mppe_40 != try.mppe_40) &&
809 + (wo->mppe_56 != try.mppe_56) && (wo->mppe_128 != try.mppe_128)) {
810 + /* cannot negotiate key length */
811 + wo->mppc = wo->mppe = wo->mppe_stateless = wo->mppe_40 =
812 + wo->mppe_56 = wo->mppe_128 = 0;
813 + lcp_close(f->unit, "Cannot negotiate MPPE key length");
815 + if (try.mppe_40 && try.mppe_56 && try.mppe_128)
816 + try.mppe_40 = try.mppe_56 = 0;
818 + if (try.mppe_56 && try.mppe_128)
821 + if (try.mppe_40 && try.mppe_128)
824 + if (try.mppe_40 && try.mppe_56)
832 + if (go->lzs && len >= CILEN_LZS && p[0] == CI_LZS && p[1] == CILEN_LZS) {
834 + if (((p[2]<<8)|p[3]) > 1 || (p[4] != LZS_MODE_SEQ &&
835 + p[4] != LZS_MODE_EXT))
838 + try.lzs_mode = p[4];
839 + try.lzs_hists = (p[2] << 8) | p[3];
845 if (go->deflate && len >= CILEN_DEFLATE
846 && p[0] == (go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT)
847 && p[1] == CILEN_DEFLATE) {
848 @@ -1002,14 +1255,50 @@
852 - if (go->mppe && len >= CILEN_MPPE
853 + if ((go->mppe || go->mppc) && len >= CILEN_MPPE
854 && p[0] == CI_MPPE && p[1] == CILEN_MPPE) {
855 - error("MPPE required but peer refused");
856 - lcp_close(f->unit, "MPPE required but peer refused");
857 + ccp_options *wo = &ccp_wantoptions[f->unit];
858 + if (p[2] != (go->mppe_stateless ? MPPE_STATELESS : 0) ||
861 + p[5] != ((go->mppe_40 ? MPPE_40BIT : 0) |
862 + (go->mppe_56 ? MPPE_56BIT : 0) |
863 + (go->mppe_128 ? MPPE_128BIT : 0) |
864 + (go->mppc ? MPPE_MPPC : 0)))
876 + if (go->mppe_stateless)
877 + try.mppe_stateless = 0;
878 + if (!try.mppe_56 && !try.mppe_40 && !try.mppe_128)
879 + try.mppe = try.mppe_stateless = 0;
880 + if (wo->mppe) { /* we want MPPE but cannot negotiate key length */
881 + wo->mppc = wo->mppe = wo->mppe_stateless = wo->mppe_40 =
882 + wo->mppe_56 = wo->mppe_128 = 0;
883 + lcp_close(f->unit, "MPPE required but cannot negotiate MPPE "
892 + if (go->lzs && len >= CILEN_LZS && p[0] == CI_LZS && p[1] == CILEN_LZS) {
893 + if (p[2] != go->lzs_hists>>8 || p[3] != (go->lzs_hists&0xff)
894 + || p[4] != go->lzs_mode)
900 if (go->deflate_correct && len >= CILEN_DEFLATE
901 && p[0] == CI_DEFLATE && p[1] == CILEN_DEFLATE) {
902 if (p[2] != DEFLATE_MAKE_OPT(go->deflate_size)
903 @@ -1073,14 +1362,15 @@
906 int ret, newret, res;
908 + u_char *p0, *retp, p2, p5;
909 int len, clen, type, nb;
910 ccp_options *ho = &ccp_hisoptions[f->unit];
911 ccp_options *ao = &ccp_allowoptions[f->unit];
912 + ccp_options *wo = &ccp_wantoptions[f->unit];
914 - bool rej_for_ci_mppe = 1; /* Are we rejecting based on a bad/missing */
915 - /* CI_MPPE, or due to other options? */
917 + u_char opt_buf[CILEN_MPPE + MPPE_MAX_KEY_LEN];
923 @@ -1103,106 +1393,302 @@
927 - if (!ao->mppe || clen != CILEN_MPPE) {
928 + if ((!ao->mppc && !ao->mppe) || clen != CILEN_MPPE) {
932 - MPPE_CI_TO_OPTS(&p[2], ho->mppe);
934 - /* Nak if anything unsupported or unknown are set. */
935 - if (ho->mppe & MPPE_OPT_UNSUPPORTED) {
938 + /* not sure what they want, tell 'em what we got */
939 + if (((p[2] & ~MPPE_STATELESS) != 0 || p[3] != 0 || p[4] != 0 ||
940 + (p[5] & ~(MPPE_40BIT | MPPE_56BIT | MPPE_128BIT |
941 + MPPE_MPPC)) != 0 || p[5] == 0) ||
942 + (p[2] == 0 && p[3] == 0 && p[4] == 0 && p[5] == 0)) {
944 - ho->mppe &= ~MPPE_OPT_UNSUPPORTED;
946 - if (ho->mppe & MPPE_OPT_UNKNOWN) {
948 - ho->mppe &= ~MPPE_OPT_UNKNOWN;
951 - /* Check state opt */
952 - if (ho->mppe & MPPE_OPT_STATEFUL) {
954 - * We can Nak and request stateless, but it's a
955 - * lot easier to just assume the peer will request
956 - * it if he can do it; stateful mode is bad over
957 - * the Internet -- which is where we expect MPPE.
959 - if (refuse_mppe_stateful) {
960 - error("Refusing MPPE stateful mode offered by peer");
963 + p[2] = (wo->mppe_stateless ? MPPE_STATELESS : 0);
966 + p[5] = (wo->mppe_40 ? MPPE_40BIT : 0) |
967 + (wo->mppe_56 ? MPPE_56BIT : 0) |
968 + (wo->mppe_128 ? MPPE_128BIT : 0) |
969 + (wo->mppc ? MPPE_MPPC : 0);
973 + if ((p[5] & MPPE_MPPC)) {
976 + BCOPY(p, opt_buf, CILEN_MPPE);
977 + opt_buf[2] = opt_buf[3] = opt_buf[4] = 0;
978 + opt_buf[5] = MPPE_MPPC;
979 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE, 1) <= 0) {
981 + p[5] &= ~MPPE_MPPC;
986 + if (wo->mppe || ao->mppe) {
987 + p[5] &= ~MPPE_MPPC;
993 - /* Find out which of {S,L} are set. */
994 - if ((ho->mppe & MPPE_OPT_128)
995 - && (ho->mppe & MPPE_OPT_40)) {
996 - /* Both are set, negotiate the strongest. */
998 - if (ao->mppe & MPPE_OPT_128)
999 - ho->mppe &= ~MPPE_OPT_40;
1000 - else if (ao->mppe & MPPE_OPT_40)
1001 - ho->mppe &= ~MPPE_OPT_128;
1006 - } else if (ho->mppe & MPPE_OPT_128) {
1007 - if (!(ao->mppe & MPPE_OPT_128)) {
1011 - } else if (ho->mppe & MPPE_OPT_40) {
1012 - if (!(ao->mppe & MPPE_OPT_40)) {
1019 + if ((p[2] & MPPE_STATELESS)) {
1020 + if (ao->mppe_stateless) {
1021 + if (wo->mppe_stateless)
1022 + ho->mppe_stateless = 1;
1026 + p[2] &= ~MPPE_STATELESS;
1031 + p[2] &= ~MPPE_STATELESS;
1034 + if (wo->mppe_stateless && !dont_nak) {
1035 + wo->mppe_stateless = 0;
1037 + p[2] |= MPPE_STATELESS;
1041 + if ((p[5] & ~MPPE_MPPC) == (MPPE_40BIT|MPPE_56BIT|MPPE_128BIT)) {
1043 + if (ao->mppe_128) {
1045 + p[5] &= ~(MPPE_40BIT|MPPE_56BIT);
1046 + BCOPY(p, opt_buf, CILEN_MPPE);
1047 + BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
1048 + MPPE_MAX_KEY_LEN);
1049 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
1050 + MPPE_MAX_KEY_LEN, 1) <= 0) {
1052 + p[5] |= (MPPE_40BIT|MPPE_56BIT);
1053 + p[5] &= ~MPPE_128BIT;
1054 + goto check_mppe_56_40;
1058 + p[5] &= ~MPPE_128BIT;
1059 + goto check_mppe_56_40;
1061 + if ((p[5] & ~MPPE_MPPC) == (MPPE_56BIT|MPPE_128BIT)) {
1063 + if (ao->mppe_128) {
1065 + p[5] &= ~MPPE_56BIT;
1066 + BCOPY(p, opt_buf, CILEN_MPPE);
1067 + BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
1068 + MPPE_MAX_KEY_LEN);
1069 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
1070 + MPPE_MAX_KEY_LEN, 1) <= 0) {
1072 + p[5] |= MPPE_56BIT;
1073 + p[5] &= ~MPPE_128BIT;
1074 + goto check_mppe_56;
1078 + p[5] &= ~MPPE_128BIT;
1079 + goto check_mppe_56;
1081 + if ((p[5] & ~MPPE_MPPC) == (MPPE_40BIT|MPPE_128BIT)) {
1083 + if (ao->mppe_128) {
1085 + p[5] &= ~MPPE_40BIT;
1086 + BCOPY(p, opt_buf, CILEN_MPPE);
1087 + BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
1088 + MPPE_MAX_KEY_LEN);
1089 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
1090 + MPPE_MAX_KEY_LEN, 1) <= 0) {
1092 + p[5] |= MPPE_40BIT;
1093 + p[5] &= ~MPPE_128BIT;
1094 + goto check_mppe_40;
1098 + p[5] &= ~MPPE_128BIT;
1099 + goto check_mppe_40;
1101 + if ((p[5] & ~MPPE_MPPC) == MPPE_128BIT) {
1102 + if (ao->mppe_128) {
1104 + BCOPY(p, opt_buf, CILEN_MPPE);
1105 + BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
1106 + MPPE_MAX_KEY_LEN);
1107 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
1108 + MPPE_MAX_KEY_LEN, 1) <= 0) {
1110 + p[5] &= ~MPPE_128BIT;
1115 + p[5] &= ~MPPE_128BIT;
1120 + if ((p[5] & ~MPPE_MPPC) == (MPPE_40BIT|MPPE_56BIT)) {
1122 + if (ao->mppe_56) {
1124 + p[5] &= ~MPPE_40BIT;
1125 + BCOPY(p, opt_buf, CILEN_MPPE);
1126 + BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
1127 + MPPE_MAX_KEY_LEN);
1128 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
1129 + MPPE_MAX_KEY_LEN, 1) <= 0) {
1131 + p[5] |= MPPE_40BIT;
1132 + p[5] &= ~MPPE_56BIT;
1134 + goto check_mppe_40;
1138 + p[5] &= ~MPPE_56BIT;
1139 + goto check_mppe_40;
1142 + if ((p[5] & ~MPPE_MPPC) == MPPE_56BIT) {
1143 + if (ao->mppe_56) {
1145 + BCOPY(p, opt_buf, CILEN_MPPE);
1146 + BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
1147 + MPPE_MAX_KEY_LEN);
1148 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
1149 + MPPE_MAX_KEY_LEN, 1) <= 0) {
1151 + p[5] &= ~MPPE_56BIT;
1156 + p[5] &= ~MPPE_56BIT;
1161 + if ((p[5] & ~MPPE_MPPC) == MPPE_40BIT) {
1162 + if (ao->mppe_40) {
1164 + BCOPY(p, opt_buf, CILEN_MPPE);
1165 + BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
1166 + MPPE_MAX_KEY_LEN);
1167 + if (ccp_test(f->unit, opt_buf, CILEN_MPPE +
1168 + MPPE_MAX_KEY_LEN, 1) <= 0) {
1170 + p[5] &= ~MPPE_40BIT;
1175 + p[5] &= ~MPPE_40BIT;
1179 + if (!ho->mppe_40 && !ho->mppe_56 && !ho->mppe_128) {
1180 + if (wo->mppe_40 || wo->mppe_56 || wo->mppe_128) {
1182 + p[2] |= (wo->mppe_stateless ? MPPE_STATELESS : 0);
1183 + p[5] |= (wo->mppe_40 ? MPPE_40BIT : 0) |
1184 + (wo->mppe_56 ? MPPE_56BIT : 0) |
1185 + (wo->mppe_128 ? MPPE_128BIT : 0) |
1186 + (wo->mppc ? MPPE_MPPC : 0);
1188 + ho->mppe = ho->mppe_stateless = 0;
1191 - /* Neither are set. */
1192 - /* We cannot accept this. */
1194 - /* Give the peer our idea of what can be used,
1195 - so it can choose and confirm */
1196 - ho->mppe = ao->mppe;
1199 - /* rebuild the opts */
1200 - MPPE_OPTS_TO_CI(ho->mppe, &p[2]);
1201 - if (newret == CONFACK) {
1202 - u_char opt_buf[CILEN_MPPE + MPPE_MAX_KEY_LEN];
1205 - BCOPY(p, opt_buf, CILEN_MPPE);
1206 - BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE],
1207 - MPPE_MAX_KEY_LEN);
1208 - if (ccp_test(f->unit, opt_buf,
1209 - CILEN_MPPE + MPPE_MAX_KEY_LEN, 1) <= 0) {
1210 - /* This shouldn't happen, we've already tested it! */
1211 - error("MPPE required, but kernel has no support.");
1212 - lcp_close(f->unit, "MPPE required but not available");
1217 - * We need to decrease the interface MTU by MPPE_PAD
1218 - * because MPPE frames **grow**. The kernel [must]
1219 - * allocate MPPE_PAD extra bytes in xmit buffers.
1221 - mtu = netif_get_mtu(f->unit);
1223 - netif_set_mtu(f->unit, mtu - MPPE_PAD);
1229 - * We have accepted MPPE or are willing to negotiate
1230 - * MPPE parameters. A CONFREJ is due to subsequent
1231 - * (non-MPPE) processing.
1233 - rej_for_ci_mppe = 0;
1236 + /* MPPE is not compatible with other compression types */
1238 + ao->bsd_compress = 0;
1239 + ao->predictor_1 = 0;
1240 + ao->predictor_2 = 0;
1245 + if ((!ho->mppc || !ao->mppc) && !ho->mppe) {
1253 + * I have commented the code below because according to RFC1547
1254 + * MTU is only information for higher level protocols about
1255 + * "the maximum allowable length for a packet (q.v.) transmitted
1256 + * over a point-to-point link without incurring network layer
1257 + * fragmentation." Of course a PPP implementation should be able
1258 + * to handle overhead added by MPPE - in our case apropriate code
1259 + * is located in drivers/net/ppp_generic.c in the kernel sources.
1261 + * According to RFC1661:
1262 + * - when negotiated MRU is less than 1500 octets, a PPP
1263 + * implementation must still be able to receive at least 1500
1265 + * - when PFC is negotiated, a PPP implementation is still
1266 + * required to receive frames with uncompressed protocol field.
1268 + * So why not to handle MPPE overhead without changing MTU value?
1269 + * I am sure that RFC3078, unfortunately silently, assumes that.
1273 + * We need to decrease the interface MTU by MPPE_PAD
1274 + * because MPPE frames **grow**. The kernel [must]
1275 + * allocate MPPE_PAD extra bytes in xmit buffers.
1278 + mtu = netif_get_mtu(f->unit);
1280 + netif_set_mtu(f->unit, mtu - MPPE_PAD);
1283 + if (ccp_wantoptions[f->unit].mppe) {
1284 + error("Cannot adjust MTU needed by MPPE.");
1285 + lcp_close(f->unit, "Cannot adjust MTU needed by MPPE.");
1293 + if (!ao->lzs || clen != CILEN_LZS) {
1299 + ho->lzs_hists = (p[2] << 8) | p[3];
1300 + ho->lzs_mode = p[4];
1301 + if ((ho->lzs_hists != ao->lzs_hists) ||
1302 + (ho->lzs_mode != ao->lzs_mode)) {
1305 + p[2] = ao->lzs_hists >> 8;
1306 + p[3] = ao->lzs_hists & 0xff;
1307 + p[4] = ao->lzs_mode;
1312 + if (p == p0 && ccp_test(f->unit, p, CILEN_LZS, 1) <= 0) {
1317 case CI_DEFLATE_DRAFT:
1318 if (!ao->deflate || clen != CILEN_DEFLATE
1319 @@ -1344,12 +1830,6 @@
1324 - if (ret == CONFREJ && ao->mppe && rej_for_ci_mppe) {
1325 - error("MPPE required but peer negotiation failed");
1326 - lcp_close(f->unit, "MPPE required but peer negotiation failed");
1332 @@ -1371,24 +1851,35 @@
1334 char *q = result + sizeof(result); /* 1 past result */
1336 - slprintf(p, q - p, "MPPE ");
1338 - if (opt->mppe & MPPE_OPT_128) {
1339 - slprintf(p, q - p, "128-bit ");
1342 - if (opt->mppe & MPPE_OPT_40) {
1343 - slprintf(p, q - p, "40-bit ");
1346 - if (opt->mppe & MPPE_OPT_STATEFUL)
1347 - slprintf(p, q - p, "stateful");
1349 - slprintf(p, q - p, "stateless");
1353 + slprintf(p, q - p, "MPPC/MPPE ");
1356 + slprintf(p, q - p, "MPPE ");
1359 + if (opt->mppe_128) {
1360 + slprintf(p, q - p, "128-bit ");
1362 + } else if (opt->mppe_56) {
1363 + slprintf(p, q - p, "56-bit ");
1365 + } else if (opt->mppe_40) {
1366 + slprintf(p, q - p, "40-bit ");
1369 + if (opt->mppe_stateless)
1370 + slprintf(p, q - p, "stateless");
1372 + slprintf(p, q - p, "stateful");
1373 + } else if (opt->mppc)
1374 + slprintf(p, q - p, "MPPC");
1380 + return "Stac LZS";
1382 case CI_DEFLATE_DRAFT:
1383 if (opt2 != NULL && opt2->deflate_size != opt->deflate_size)
1384 @@ -1444,12 +1935,12 @@
1385 } else if (ANY_COMPRESS(*ho))
1386 notice("%s transmit compression enabled", method_name(ho, NULL));
1389 + if (go->mppe || go->mppc) {
1390 BZERO(mppe_recv_key, MPPE_MAX_KEY_LEN);
1391 BZERO(mppe_send_key, MPPE_MAX_KEY_LEN);
1392 continue_networks(f->unit); /* Bring up IP et al */
1399 @@ -1472,7 +1963,7 @@
1400 lcp_close(f->unit, "MPPE disabled");
1408 @@ -1532,24 +2023,28 @@
1411 if (optlen >= CILEN_MPPE) {
1414 - MPPE_CI_TO_OPTS(&p[2], mppe_opts);
1415 - printer(arg, "mppe %s %s %s %s %s %s%s",
1416 - (p[2] & MPPE_H_BIT)? "+H": "-H",
1417 - (p[5] & MPPE_M_BIT)? "+M": "-M",
1418 - (p[5] & MPPE_S_BIT)? "+S": "-S",
1419 - (p[5] & MPPE_L_BIT)? "+L": "-L",
1420 + printer(arg, "mppe %s %s %s %s %s %s",
1421 + (p[2] & MPPE_STATELESS)? "+H": "-H",
1422 + (p[5] & MPPE_56BIT)? "+M": "-M",
1423 + (p[5] & MPPE_128BIT)? "+S": "-S",
1424 + (p[5] & MPPE_40BIT)? "+L": "-L",
1425 (p[5] & MPPE_D_BIT)? "+D": "-D",
1426 - (p[5] & MPPE_C_BIT)? "+C": "-C",
1427 - (mppe_opts & MPPE_OPT_UNKNOWN)? " +U": "");
1428 - if (mppe_opts & MPPE_OPT_UNKNOWN)
1429 + (p[5] & MPPE_MPPC)? "+C": "-C");
1430 + if ((p[5] & ~(MPPE_56BIT | MPPE_128BIT | MPPE_40BIT |
1431 + MPPE_D_BIT | MPPE_MPPC)) ||
1432 + (p[2] & ~MPPE_STATELESS))
1433 printer(arg, " (%.2x %.2x %.2x %.2x)",
1434 p[2], p[3], p[4], p[5]);
1441 + if (optlen >= CILEN_LZS) {
1442 + printer(arg, "lzs %.2x %.2x %.2x", p[2], p[3], p[4]);
1447 case CI_DEFLATE_DRAFT:
1448 if (optlen >= CILEN_DEFLATE) {
1449 @@ -1635,6 +2130,7 @@
1450 error("Lost compression sync: disabling compression");
1451 ccp_close(unit, "Lost compression sync");
1453 + /* My module dosn't need this. J.D., 2003-07-06 */
1455 * If we were doing MPPE, we must also take the link down.
1457 @@ -1642,9 +2138,18 @@
1458 error("Too many MPPE errors, closing LCP");
1459 lcp_close(unit, "Too many MPPE errors");
1465 + * When LZS or MPPE/MPPC is negotiated we just send CCP_RESETREQ
1466 + * and don't wait for CCP_RESETACK
1468 + if ((ccp_gotoptions[f->unit].method == CI_LZS) ||
1469 + (ccp_gotoptions[f->unit].method == CI_MPPE)) {
1470 + fsm_sdata(f, CCP_RESETREQ, f->reqid = ++f->id, NULL, 0);
1474 * Send a reset-request to reset the peer's compressor.
1475 * We don't do that if we are still waiting for an
1476 * acknowledgement to a previous reset-request.
1477 @@ -1675,4 +2180,3 @@
1479 ccp_localstate[f->unit] &= ~RACK_PENDING;
1482 diff -Naur ppp-2.4.4.orig/pppd/ccp.h ppp-2.4.4/pppd/ccp.h
1483 --- ppp-2.4.4.orig/pppd/ccp.h 2009-05-09 03:44:09.000000000 -0400
1484 +++ ppp-2.4.4/pppd/ccp.h 2009-05-09 03:45:52.000000000 -0400
1486 bool predictor_2; /* do Predictor-2? */
1487 bool deflate_correct; /* use correct code for deflate? */
1488 bool deflate_draft; /* use draft RFC code for deflate? */
1489 + bool lzs; /* do Stac LZS? */
1490 + bool mppc; /* do MPPC? */
1491 bool mppe; /* do MPPE? */
1492 + bool mppe_40; /* allow 40 bit encryption? */
1493 + bool mppe_56; /* allow 56 bit encryption? */
1494 + bool mppe_128; /* allow 128 bit encryption? */
1495 + bool mppe_stateless; /* allow stateless encryption */
1496 u_short bsd_bits; /* # bits/code for BSD Compress */
1497 u_short deflate_size; /* lg(window size) for Deflate */
1498 + u_short lzs_mode; /* LZS check mode */
1499 + u_short lzs_hists; /* number of LZS histories */
1500 short method; /* code for chosen compression method */
1503 diff -Naur ppp-2.4.4.orig/pppd/chap_ms.c ppp-2.4.4/pppd/chap_ms.c
1504 --- ppp-2.4.4.orig/pppd/chap_ms.c 2009-05-09 03:45:07.000000000 -0400
1505 +++ ppp-2.4.4/pppd/chap_ms.c 2009-05-09 03:45:52.000000000 -0400
1506 @@ -897,13 +897,17 @@
1508 * Disable undesirable encryption types. Note that we don't ENABLE
1509 * any encryption types, to avoid overriding manual configuration.
1511 + * It seems that 56 bit keys are unsupported in MS-RADIUS (see RFC 2548)
1514 case MPPE_ENC_TYPES_RC4_40:
1515 - ccp_wantoptions[0].mppe &= ~MPPE_OPT_128; /* disable 128-bit */
1516 + ccp_wantoptions[0].mppe_128 = 0; /* disable 128-bit */
1517 + ccp_wantoptions[0].mppe_56 = 0; /* disable 56-bit */
1519 case MPPE_ENC_TYPES_RC4_128:
1520 - ccp_wantoptions[0].mppe &= ~MPPE_OPT_40; /* disable 40-bit */
1521 + ccp_wantoptions[0].mppe_56 = 0; /* disable 56-bit */
1522 + ccp_wantoptions[0].mppe_40 = 0; /* disable 40-bit */