Skip to contentSkip to conversation

Fix the protocol settings with the range command.

PATCH In review Bing Zhao 2 participants 2 messages Oct 24, 2017

lore
Share & tools
lore

Bing Zhao

author
#0 lore raw

PATCH 1/1 Fix the protocol settings with the range command.

A "%" is missing in the command line, so the parameter comparison always returns failure. And the local variable "what" points to the argv[4], it is incorrect for this command since the argc is 4 and the max should be argv[3].

Signed-off-by [email protected]
Signed-off-by [email protected]
Signed-off-by [email protected]
---
 app/cli-functions.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
app/cli-functions.c +2 -2
index 076b86e..5e58f9c 100644
@@ -150,7 +150,7 @@ static struct cli_map range_map[] = {
 	{ 31, "range %P src ip "SMMI" %4" },
 	{ 32, "range %P dst ip %4 %4 %4 %4" },
 	{ 33, "range %P src ip %4 %4 %4 %4" },
-	{ 40, "range %P proto tcp|udp" },
+	{ 40, "range %P proto %|tcp|udp" },
 	{ 50, "range %P dst port "SMMI" %d" },
 	{ 51, "range %P src port "SMMI" %d" },
 	{ 52, "range %P dst port %d %d %d %d" },
@@ -280,7 +280,7 @@ range_cmd(int argc, char **argv)
 			break;
 		case 40:
 			foreach_port(portlist,
-				range_set_proto(info, what) );
+				range_set_proto(info, argv[3]) );
 			break;
 		case 50:
 			foreach_port(portlist,
Signature · 1 line
2.11.0.windows.1
#1 lore raw

Thank you

Quoted 38 lines · Bing Zhao

A "%" is missing in the command line, so the parameter comparison always returns failure. And the local variable "what" points to the argv[4], it is incorrect for this command since the argc is 4 and the max should be argv[3].

Signed-off-by [email protected]
Signed-off-by [email protected]
Signed-off-by [email protected]

---
app/cli-functions.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
app/cli-functions.c +2 -2
index 076b86e..5e58f9c 100644
@@ -150,7 +150,7 @@ static struct cli_map range_map[] = {
 	{ 31, "range %P src ip "SMMI" %4" },
 	{ 32, "range %P dst ip %4 %4 %4 %4" },
 	{ 33, "range %P src ip %4 %4 %4 %4" },
-	{ 40, "range %P proto tcp|udp" },
+	{ 40, "range %P proto %|tcp|udp" },
 	{ 50, "range %P dst port "SMMI" %d" },
 	{ 51, "range %P src port "SMMI" %d" },
 	{ 52, "range %P dst port %d %d %d %d" },
@@ -280,7 +280,7 @@ range_cmd(int argc, char **argv)
 			break;
 		case 40:
 			foreach_port(portlist,
-				range_set_proto(info, what) );
+				range_set_proto(info, argv[3]) );
 			break;
 		case 50:
 			foreach_port(portlist,
Signature · 1 line
2.11.0.windows.1

Regards,
Keith