Module Name: src Committed By: is Date: Tue Apr 7 18:32:20 UTC 2020
Modified Files: src/sys/net [is-mlppp]: if_spppsubr.c if_spppvar.h Log Message: Multilink PPP: sanity check of option values, storage of remote MRRU. To generate a diff of this commit: cvs rdiff -u -r1.187.2.1 -r1.187.2.2 src/sys/net/if_spppsubr.c cvs rdiff -u -r1.22 -r1.22.12.1 src/sys/net/if_spppvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/net/if_spppsubr.c diff -u src/sys/net/if_spppsubr.c:1.187.2.1 src/sys/net/if_spppsubr.c:1.187.2.2 --- src/sys/net/if_spppsubr.c:1.187.2.1 Tue Apr 7 18:28:40 2020 +++ src/sys/net/if_spppsubr.c Tue Apr 7 18:32:20 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_spppsubr.c,v 1.187.2.1 2020/04/07 18:28:40 is Exp $ */ +/* $NetBSD: if_spppsubr.c,v 1.187.2.2 2020/04/07 18:32:20 is Exp $ */ /* * Synchronous PPP/Cisco link level subroutines. @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.187.2.1 2020/04/07 18:28:40 is Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.187.2.2 2020/04/07 18:32:20 is Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -2383,12 +2383,19 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp break; case LCP_OPT_MP_EID: if (len >= l && l >= 3) { - if (debug) - addlog(" [rej]"); - break; + switch (p[2]) { + case 0: if (l==3+ 0) continue;break; + case 2: if (l==3+ 4) continue;break; + case 3: if (l==3+ 6) continue;break; + case 6: if (l==3+16) continue;break; + case 1: /* FALLTHROUGH */ + case 4: if (l<=3+20) continue;break; + case 5: if (l<=3+15) continue;break; + /* XXX should it be default: continue;? */ + } } if (debug) - addlog(" [invalid]"); + addlog(" [invalid class %d len %d]", p[2], l); break; case LCP_OPT_MP_SSNHF: if (len >= 2 && l == 2) { @@ -2402,15 +2409,7 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp case LCP_OPT_MP_MRRU: /* Multilink maximum received reconstructed unit */ /* should be fall through, both are same length */ - /* for now, check, then reject anyway */ - if (len >= 4 && l == 4) { - if (debug) - addlog(" %d [rej]", (p[2] <<8) + p[3]); - break; - } - if (debug) - addlog(" [invalid]"); - break; + /* FALLTHROUGH */ case LCP_OPT_MRU: /* Maximum receive unit. */ if (len >= 4 && l == 4) @@ -2569,6 +2568,27 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp break; } continue; + case LCP_OPT_MP_EID: + /* + * Endpoint identification. + * Always agreeable, + * but ignored by now. + */ + if (debug) { + addlog(" type %d", p[2]); + sppp_print_bytes(p+3, p[1]-3); + } + continue; + case LCP_OPT_MP_MRRU: + /* + * Maximum received reconstructed unit. + * Always agreeable, + * but ignored by now. + */ + sp->lcp.their_mrru = p[2] * 256 + p[3]; + if (debug) + addlog(" %ld", sp->lcp.their_mrru); + continue; } if (rlen + l > blen) { if (debug) Index: src/sys/net/if_spppvar.h diff -u src/sys/net/if_spppvar.h:1.22 src/sys/net/if_spppvar.h:1.22.12.1 --- src/sys/net/if_spppvar.h:1.22 Thu Oct 12 09:53:55 2017 +++ src/sys/net/if_spppvar.h Tue Apr 7 18:32:20 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_spppvar.h,v 1.22 2017/10/12 09:53:55 knakahara Exp $ */ +/* $NetBSD: if_spppvar.h,v 1.22.12.1 2020/04/07 18:32:20 is Exp $ */ #ifndef _NET_IF_SPPPVAR_H_ #define _NET_IF_SPPPVAR_H_ @@ -45,6 +45,9 @@ struct slcp { int max_terminate; int max_configure; int max_failure; + /* multilink variables */ + u_long mrru; /* our max received reconstructed unit */ + u_long their_mrru; /* their max receive dreconstructed unit */ }; #define IDX_IPCP 1 /* idx into state table */