Module Name:    src
Committed By:   is
Date:           Tue Apr  7 18:28:40 UTC 2020

Modified Files:
        src/sys/net [is-mlppp]: if_spppsubr.c

Log Message:
Define a few more LCP options. Recognize, sanity-check and report (but
still reject for the moment) multilink PPP configuration options received.


To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.187.2.1 src/sys/net/if_spppsubr.c

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 src/sys/net/if_spppsubr.c:1.187.2.1
--- src/sys/net/if_spppsubr.c:1.187	Fri Mar  6 10:26:59 2020
+++ src/sys/net/if_spppsubr.c	Tue Apr  7 18:28:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.187 2020/03/06 10:26:59 knakahara Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.187.2.1 2020/04/07 18:28:40 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 2020/03/06 10:26:59 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.187.2.1 2020/04/07 18:28:40 is Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -146,6 +146,13 @@ __KERNEL_RCSID(0, "$NetBSD: if_spppsubr.
 #define LCP_OPT_RESERVED	6	/* reserved */
 #define LCP_OPT_PROTO_COMP	7	/* protocol field compression */
 #define LCP_OPT_ADDR_COMP	8	/* address/control field compression */
+#define LCP_OPT_FCS_ALTS	9	/* FCS alternatives */
+#define LCP_OPT_SELF_DESC_PAD	10	/* self-describing padding */
+#define LCP_OPT_CALL_BACK	13	/* callback */
+#define LCP_OPT_COMPOUND_FRMS	15	/* compound frames */
+#define LCP_OPT_MP_MRRU		17	/* multilink MRRU */
+#define LCP_OPT_MP_SSNHF	18	/* multilink short seq. numbers */
+#define LCP_OPT_MP_EID		19	/* multilink endpoint discriminator */
 
 #define IPCP_OPT_ADDRESSES	1	/* both IP addresses; deprecated */
 #define IPCP_OPT_COMPRESSION	2	/* IP compression protocol */
@@ -2374,6 +2381,36 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp
 			if (debug)
 				addlog(" [invalid]");
 			break;
+		case LCP_OPT_MP_EID:
+			if (len >= l && l >= 3) {
+				if (debug)
+					addlog(" [rej]");
+				break;
+			}
+			if (debug)
+				addlog(" [invalid]");
+			break;
+		case LCP_OPT_MP_SSNHF:
+			if (len >= 2 && l == 2) {
+				if (debug)
+					addlog(" [rej]");
+				break;
+			}
+			if (debug)
+				addlog(" [invalid]");
+			break;
+		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;
 		case LCP_OPT_MRU:
 			/* Maximum receive unit. */
 			if (len >= 4 && l == 4)
@@ -6016,6 +6053,12 @@ sppp_lcp_opt_name(u_char opt)
 	case LCP_OPT_MAGIC:		return "magic";
 	case LCP_OPT_PROTO_COMP:	return "proto-comp";
 	case LCP_OPT_ADDR_COMP:		return "addr-comp";
+	case LCP_OPT_SELF_DESC_PAD:	return "sdpad";
+	case LCP_OPT_CALL_BACK:		return "callback";
+	case LCP_OPT_COMPOUND_FRMS:	return "cmpd-frms";
+	case LCP_OPT_MP_MRRU:		return "mrru";
+	case LCP_OPT_MP_SSNHF:		return "mp-ssnhf";
+	case LCP_OPT_MP_EID:		return "mp-eid";
 	}
 	snprintf(buf, sizeof(buf), "0x%x", opt);
 	return buf;

Reply via email to