[PATCH 10/17] allow to set both supported forwarding modes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In the previous version of lldptool, only one setting of either bridge or
reflective relay mode was allowed whereas both modes together should be
settable.
This patch corrects it.

Signed-off-by: Jens Osterkamp <jens@xxxxxxxxxxxxxxxxxx>
---
 lldp_evb_cmds.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/lldp_evb_cmds.c b/lldp_evb_cmds.c
index d0a9051..aa2dc7c 100644
--- a/lldp_evb_cmds.c
+++ b/lldp_evb_cmds.c
@@ -194,6 +194,7 @@ static int get_arg_fmode(struct cmd *cmd, char *arg, char *argvalue,
 static int set_arg_fmode(struct cmd *cmd, char *arg, char *argvalue,
 			       char *obuf)
 {
+	u8 smode;
 	char arg_path[EVB_BUF_SIZE];
 	struct evb_data *ed;
 
@@ -214,12 +215,21 @@ static int set_arg_fmode(struct cmd *cmd, char *arg, char *argvalue,
 	if (!ed)
 		return cmd_invalid;
 
-	if (!strcasecmp(argvalue, VAL_EVB_FMODE_BRIDGE))
-		ed->tie->smode = LLDP_EVB_CAPABILITY_FORWARD_STANDARD;
-	else if (!strcasecmp(argvalue, VAL_EVB_FMODE_REFLECTIVE_RELAY))
-		ed->tie->smode = LLDP_EVB_CAPABILITY_FORWARD_REFLECTIVE_RELAY;
-	else
+	smode = 0;
+
+	if (strcasestr(argvalue, VAL_EVB_FMODE_BRIDGE)) {
+		smode |= LLDP_EVB_CAPABILITY_FORWARD_STANDARD;
+	}
+
+	if (strcasestr(argvalue, VAL_EVB_FMODE_REFLECTIVE_RELAY)) {
+		smode |= LLDP_EVB_CAPABILITY_FORWARD_REFLECTIVE_RELAY;
+	}
+
+	if (smode == 0) {
 		return cmd_invalid;
+	} else {
+		ed->tie->smode = smode;
+	}
 
 	evb_changed(cmd->ifname);
 
-- 
1.7.1

_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/virtualization


[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux