[lldp-devel] [V2] evb lower case comparision for EVB protocol parameters

Thomas Richter tmricht at linux.vnet.ibm.com
Wed Mar 6 14:09:17 UTC 2013


The lldpad configuration file may store IEEE 802.1 Qbg parameters
(such as fmode and capabilities) in upper case letters.
When reading the confuration file the values a compared
against lower case strings and do not match.
The patch reads the configuration file values and uses
case in-sensitive comparisons.

Signed-off-by: Thomas Richter <tmricht at linux.vnet.ibm.com>
---
 lldp_evb_cmds.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/lldp_evb_cmds.c b/lldp_evb_cmds.c
index 6d40aae..923d56d 100644
--- a/lldp_evb_cmds.c
+++ b/lldp_evb_cmds.c
@@ -82,9 +82,9 @@ u8 evb_conf_fmode(char *ifname, enum agent_type type)
 
 	value = evb_conf_string(ifname, type, ARG_EVB_FORWARDING_MODE, smode);
 	if (value) {
-		if (strstr(value, VAL_EVB_FMODE_BRIDGE))
+		if (strcasestr(value, VAL_EVB_FMODE_BRIDGE))
 			smode = LLDP_EVB_CAPABILITY_FORWARD_STANDARD;
-		if (strstr(value, VAL_EVB_FMODE_REFLECTIVE_RELAY))
+		if (strcasestr(value, VAL_EVB_FMODE_REFLECTIVE_RELAY))
 			smode = LLDP_EVB_CAPABILITY_FORWARD_REFLECTIVE_RELAY;
 		LLDPAD_DBG("%s:%s agent %d policy %s %s(%#x)\n", __func__,
 			   ifname, type, ARG_EVB_FORWARDING_MODE, value, smode);
@@ -114,23 +114,21 @@ u16 evb_conf_vsis(char *ifname, enum agent_type type)
  */
 u8 evb_conf_capa(char *ifname, enum agent_type type)
 {
-	u8 scap = LLDP_EVB_CAPABILITY_PROTOCOL_RTE |
-			   LLDP_EVB_CAPABILITY_PROTOCOL_ECP |
-			   LLDP_EVB_CAPABILITY_PROTOCOL_VDP;
+	u8 scap = 0;
 	const char *value;
 
 	value = evb_conf_string(ifname, type, ARG_EVB_CAPABILITIES, scap);
 	if (value) {
-		if (strstr(value, VAL_EVB_CAPA_RTE))
+		if (strcasestr(value, VAL_EVB_CAPA_RTE))
 			scap = LLDP_EVB_CAPABILITY_PROTOCOL_RTE;
 
-		if (strstr(value, VAL_EVB_CAPA_ECP))
+		if (strcasestr(value, VAL_EVB_CAPA_ECP))
 			scap |= LLDP_EVB_CAPABILITY_PROTOCOL_ECP;
 
-		if (strstr(value, VAL_EVB_CAPA_VDP))
+		if (strcasestr(value, VAL_EVB_CAPA_VDP))
 			scap |= LLDP_EVB_CAPABILITY_PROTOCOL_VDP;
 
-		if (strstr(value, VAL_EVB_CAPA_NONE))
+		if (strcasestr(value, VAL_EVB_CAPA_NONE))
 			scap = 0;
 
 		LLDPAD_DBG("%s:%s agent %d policy %s %s(%#x)\n",
-- 
1.7.1



More information about the lldp-devel mailing list