Commit dcf13497 authored by jamal's avatar jamal Committed by Stephen Hemminger

Fix missing class/flowid oddity

[U32] Fix missing class/flowid oddity
When an action or policer is specified but not a classid/flowid, the
syntax accepts it but the kernel never really hits it.
This has been a long standing problem, but thanks to the persistence
of Marco Berizzi <pupilla@hotmail.com> I broke down and fixed it.
Signed-off-by: default avatarJ Hadi Salim <hadi@cyberus.ca>
Signed-off-by: default avatarStephen Hemminger <shemminger@osdl.org>
parent be7f286e
...@@ -779,7 +779,7 @@ static int u32_parse_opt(struct filter_util *qu, char *handle, int argc, char ** ...@@ -779,7 +779,7 @@ static int u32_parse_opt(struct filter_util *qu, char *handle, int argc, char **
} sel; } sel;
struct tcmsg *t = NLMSG_DATA(n); struct tcmsg *t = NLMSG_DATA(n);
struct rtattr *tail; struct rtattr *tail;
int sel_ok = 0; int sel_ok = 0, terminal_ok = 0;
int sample_ok = 0; int sample_ok = 0;
__u32 htid = 0; __u32 htid = 0;
__u32 order = 0; __u32 order = 0;
...@@ -924,6 +924,7 @@ static int u32_parse_opt(struct filter_util *qu, char *handle, int argc, char ** ...@@ -924,6 +924,7 @@ static int u32_parse_opt(struct filter_util *qu, char *handle, int argc, char **
fprintf(stderr, "Illegal \"action\"\n"); fprintf(stderr, "Illegal \"action\"\n");
return -1; return -1;
} }
terminal_ok++;
continue; continue;
} else if (matches(*argv, "police") == 0) { } else if (matches(*argv, "police") == 0) {
...@@ -932,6 +933,7 @@ static int u32_parse_opt(struct filter_util *qu, char *handle, int argc, char ** ...@@ -932,6 +933,7 @@ static int u32_parse_opt(struct filter_util *qu, char *handle, int argc, char **
fprintf(stderr, "Illegal \"police\"\n"); fprintf(stderr, "Illegal \"police\"\n");
return -1; return -1;
} }
terminal_ok++;
continue; continue;
} else if (strcmp(*argv, "help") == 0) { } else if (strcmp(*argv, "help") == 0) {
explain(); explain();
...@@ -944,6 +946,10 @@ static int u32_parse_opt(struct filter_util *qu, char *handle, int argc, char ** ...@@ -944,6 +946,10 @@ static int u32_parse_opt(struct filter_util *qu, char *handle, int argc, char **
argc--; argv++; argc--; argv++;
} }
/* We dont necessarily need class/flowids */
if (terminal_ok)
sel.sel.flags |= TC_U32_TERMINAL;
if (order) { if (order) {
if (TC_U32_NODE(t->tcm_handle) && order != TC_U32_NODE(t->tcm_handle)) { if (TC_U32_NODE(t->tcm_handle) && order != TC_U32_NODE(t->tcm_handle)) {
fprintf(stderr, "\"order\" contradicts \"handle\"\n"); fprintf(stderr, "\"order\" contradicts \"handle\"\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment