Blame SOURCES/open-lldp-v1.0.1-30-support-DSCP-selectors.patch

74731f
From c8e438d610bc8af109c19479ee0f568b271d4030 Mon Sep 17 00:00:00 2001
74731f
From: Petr Machata <petrm@mellanox.com>
74731f
Date: Mon, 9 Jul 2018 21:43:41 +0300
74731f
Subject: [PATCH] lldpad: Support DSCP selectors in APP TLV's
74731f
74731f
The P802.1Qcd/D2.1 standard draft introduces a new APP TLV: DSCP, with
74731f
selector value of 5. Don't reject APP TLV's with selector 5, and
74731f
sanitize the PID value to not be out of bounds for DSCP.
74731f
74731f
Signed-off-by: Petr Machata <petrm@mellanox.com>
74731f
---
74731f
 lldp_8021qaz_cmds.c | 7 ++++++-
74731f
 1 file changed, 6 insertions(+), 1 deletion(-)
74731f
74731f
diff --git a/lldp_8021qaz_cmds.c b/lldp_8021qaz_cmds.c
74731f
index 8cb225e..e017e2a 100644
74731f
--- a/lldp_8021qaz_cmds.c
74731f
+++ b/lldp_8021qaz_cmds.c
74731f
@@ -1290,7 +1290,7 @@ static int _set_arg_app(struct cmd *cmd, char *args, char *arg_value,
74731f
 			obuf_len - strlen(obuf) - 2);
74731f
 		goto err;
74731f
 	}
74731f
-	if (sel < 1 || sel > 4) {
74731f
+	if (sel < 1 || sel > 5) {
74731f
 		strncat(obuf, ": selector out of range",
74731f
 			obuf_len - strlen(obuf) - 2);
74731f
 		goto err;
74731f
@@ -1305,6 +1305,11 @@ static int _set_arg_app(struct cmd *cmd, char *args, char *arg_value,
74731f
 			obuf_len - strlen(obuf) - 2);
74731f
 		goto err;
74731f
 	}
74731f
+	if (sel == 5 && pid > 63) {
74731f
+		strncat(obuf, ": DSCP > 63",
74731f
+			obuf_len - strlen(obuf) - 2);
74731f
+		goto err;
74731f
+	}
74731f
 
74731f
 	free(parse);
74731f
 
74731f
-- 
74731f
2.21.0
74731f