Add help text for actions.
This commit is contained in:
parent
dc02ede68d
commit
f1e4f042a5
|
|
@ -37,7 +37,27 @@ int tab_flush = 0;
|
||||||
|
|
||||||
void act_usage(void)
|
void act_usage(void)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "action usage improper\n");
|
/*XXX: In the near future add a action->print_help to improve
|
||||||
|
* usability
|
||||||
|
* This would mean new tc will not be backward compatible
|
||||||
|
* with any action .so from the old days. But if someone really
|
||||||
|
* does that, they would know how to fix this ..
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
fprintf (stderr, "usage: tc actions <ACTSPECOP>*\n");
|
||||||
|
fprintf(stderr,
|
||||||
|
"Where: \tACTSPECOP := ACR | GD | FL\n"
|
||||||
|
"\tACR := add | change | replace <ACTSPEC>* \n"
|
||||||
|
"\tGD := get | delete | <ACTISPEC>*\n"
|
||||||
|
"\tFL := ls | list | flush | <ACTNAMESPEC>\n"
|
||||||
|
"\tACTNAMESPEC := action <ACTNAME>\n"
|
||||||
|
"\tACTISPEC := <ACTNAMESPEC> <INDEXSPEC>\n"
|
||||||
|
"\tACTSPEC := action <ACTDETAIL> [INDEXSPEC]\n"
|
||||||
|
"\tINDEXSPEC := index <32 bit indexvalue>\n"
|
||||||
|
"\tACTDETAIL := <ACTNAME> <ACTPARAMS>\n"
|
||||||
|
"\t\tExample ACTNAME is gact, mirred etc\n"
|
||||||
|
"\t\tEach action has its own parameters (ACTPARAMS)\n"
|
||||||
|
"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int print_noaopt(struct action_util *au, FILE *f, struct rtattr *opt)
|
static int print_noaopt(struct action_util *au, FILE *f, struct rtattr *opt)
|
||||||
|
|
@ -598,7 +618,7 @@ int do_action(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "Command \"%s\" is unknown, try \"tc action help\".\n", *argv);
|
fprintf(stderr, "Command \"%s\" is unknown, try \"tc actions help\".\n", *argv);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
14
tc/m_gact.c
14
tc/m_gact.c
|
|
@ -46,17 +46,17 @@ explain(void)
|
||||||
fprintf(stderr, "Usage: ... gact <ACTION> [RAND] [INDEX]\n");
|
fprintf(stderr, "Usage: ... gact <ACTION> [RAND] [INDEX]\n");
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Where: ACTION := reclassify | drop | continue | pass "
|
"Where: ACTION := reclassify | drop | continue | pass "
|
||||||
"RAND := random <RANDTYPE> <ACTION> <VAL>"
|
"RAND := random <RANDTYPE> <ACTION> <VAL>"
|
||||||
"RANDTYPE := netrand | determ"
|
"RANDTYPE := netrand | determ"
|
||||||
"VAL : = value not exceeding 10000"
|
"VAL : = value not exceeding 10000"
|
||||||
"INDEX := index value used"
|
"INDEX := index value used"
|
||||||
"\n");
|
"\n");
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "Usage: ... gact <ACTION> [INDEX]\n");
|
fprintf(stderr, "Usage: ... gact <ACTION> [INDEX]\n");
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Where: ACTION := reclassify | drop | continue | pass "
|
"Where: ACTION := reclassify | drop | continue | pass "
|
||||||
"INDEX := index value used"
|
"INDEX := index value used"
|
||||||
"\n");
|
"\n");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -171,6 +171,8 @@ parse_gact(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struc
|
||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
ok++;
|
ok++;
|
||||||
|
} else if (matches(*argv, "help") == 0) {
|
||||||
|
usage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue