summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0066-Valid-VLANID-should-be-1-4095-as-in-802.1VLAN-spec.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0066-Valid-VLANID-should-be-1-4095-as-in-802.1VLAN-spec.patch')
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0066-Valid-VLANID-should-be-1-4095-as-in-802.1VLAN-spec.patch44
1 files changed, 44 insertions, 0 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0066-Valid-VLANID-should-be-1-4095-as-in-802.1VLAN-spec.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0066-Valid-VLANID-should-be-1-4095-as-in-802.1VLAN-spec.patch
new file mode 100644
index 000000000..f8f71338a
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0066-Valid-VLANID-should-be-1-4095-as-in-802.1VLAN-spec.patch
@@ -0,0 +1,44 @@
+From 07caf4cc516601c93d12bbe89b4afb0284201dff Mon Sep 17 00:00:00 2001
+From: Suryakanth Sekar <suryakanth.sekar@linux.intel.com>
+Date: Fri, 2 Aug 2019 14:18:31 +0530
+Subject: [PATCH] Valid VLANID should be 1-4095 as in 802.1VLAN spec
+
+Added the VLAN ID checking condition in Set LAN configuration
+
+Unit test:
+Verified VLAN ID 1-4095 is allowed and CC returns for 0 & > 4095
+
+Change-Id: I1737986ed7adb727758dedb84b851ba2c208cea3
+Signed-off-by: Suryakanth Sekar <suryakanth.sekar@linux.intel.com>
+---
+ transporthandler.cpp | 4 ++++
+ transporthandler.hpp | 1 +
+ 2 files changed, 5 insertions(+)
+
+diff --git a/transporthandler.cpp b/transporthandler.cpp
+index 44ddcef..ede6472 100644
+--- a/transporthandler.cpp
++++ b/transporthandler.cpp
+@@ -536,6 +536,10 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
+ // We assume that ipmitool always send enable
+ // bit as 1.
+ vlan = le16toh(vlan);
++ if (vlan == 0 || vlan > maxValidVLANIDValue)
++ {
++ return IPMI_CC_INVALID_FIELD_REQUEST;
++ }
+ channelConf->vlanID = vlan;
+ }
+ break;
+diff --git a/transporthandler.hpp b/transporthandler.hpp
+index 1237658..d8805e1 100644
+--- a/transporthandler.hpp
++++ b/transporthandler.hpp
+@@ -219,3 +219,4 @@ enum class Privilege : uint8_t
+
+ constexpr uint8_t progressMask = 0x03;
+ constexpr uint8_t enableMask = 0x01;
++constexpr uint16_t maxValidVLANIDValue = 4095;
+--
+2.7.4
+