Re: [v4,iproute2-next 1/2] iproute2-next:tc:action: add a gate control action

From: Davide Caratti
Date: Wed May 06 2020 - 08:54:37 EST


On Wed, 2020-05-06 at 16:40 +0800, Po Liu wrote:
> Introduce a ingress frame gate control flow action.
[...]

hello Po Liu,

[...]

> +create_entry:
> + e = create_gate_entry(gate_state, interval,
> + ipv, maxoctets);
> + if (!e) {
> + fprintf(stderr, "gate: not enough memory\n");
> + free_entries(&gate_entries);
> + return -1;
> + }
> +
> + list_add_tail(&e->list, &gate_entries);
> + entry_num++;
> +
> + } else if (matches(*argv, "reclassify") == 0 ||
> + matches(*argv, "drop") == 0 ||
> + matches(*argv, "shot") == 0 ||
> + matches(*argv, "continue") == 0 ||
> + matches(*argv, "pass") == 0 ||
> + matches(*argv, "ok") == 0 ||
> + matches(*argv, "pipe") == 0 ||
> + matches(*argv, "goto") == 0) {
> + if (parse_action_control(&argc, &argv,
> + &parm.action, false)) {
> + free_entries(&gate_entries);
> + return -1;
> + }
> + } else if (matches(*argv, "help") == 0) {
> + usage();
> + } else {
> + break;
> + }
> +
> + argc--;
> + argv++;
> + }
> +
> + parse_action_control_dflt(&argc, &argv, &parm.action,
> + false, TC_ACT_PIPE);

it seems that the control action is parsed twice, and the first time it
does not allow "jump" and "trap". Is that intentional? IOW, are there some
"act_gate" configurations that don't allow jump or trap?

I don't see anything similar in kernel act_gate.c, where tcf_gate_act()
can return TC_ACT_SHOT or whatever is written in parm.action. That's why
I'm asking, if these two control actions are forbidden you should let the
kernel return -EINVAL with a proper extack in tcf_gate_init(). Can you
please clarify?

thank you in advance!
--
davide