int tca_id, struct nlmsghdr *n)
{
const char *bpf_obj = NULL, *bpf_uds_name = NULL;
- struct tc_act_bpf parm = { .action = TC_ACT_PIPE };
+ struct tc_act_bpf parm = {};
struct bpf_cfg_in cfg = {};
bool seen_run = false;
struct rtattr *tail;
NEXT_ARG();
opt_bpf:
seen_run = true;
+ cfg.type = bpf_type;
cfg.argc = argc;
cfg.argv = argv;
- if (bpf_parse_common(bpf_type, &cfg, &bpf_cb_ops, n))
+ if (bpf_parse_and_load_common(&cfg, &bpf_cb_ops, n))
return -1;
argc = cfg.argc;
NEXT_ARG_FWD();
}
- if (argc && !action_a2n(*argv, &parm.action, false))
- NEXT_ARG_FWD();
+ parse_action_control_dflt(&argc, &argv, &parm.action,
+ false, TC_ACT_PIPE);
if (argc) {
if (matches(*argv, "index") == 0) {
{
struct rtattr *tb[TCA_ACT_BPF_MAX + 1];
struct tc_act_bpf *parm;
+ int dump_ok = 0;
if (arg == NULL)
return -1;
fprintf(f, " ");
}
- fprintf(f, "default-action %s\n", action_n2a(parm->action));
+ if (tb[TCA_ACT_BPF_ID])
+ dump_ok = bpf_dump_prog_info(f, rta_getattr_u32(tb[TCA_ACT_BPF_ID]));
+ if (!dump_ok && tb[TCA_ACT_BPF_TAG]) {
+ SPRINT_BUF(b);
+
+ fprintf(f, "tag %s ",
+ hexstring_n2a(RTA_DATA(tb[TCA_ACT_BPF_TAG]),
+ RTA_PAYLOAD(tb[TCA_ACT_BPF_TAG]),
+ b, sizeof(b)));
+ }
+
+ print_action_control(f, "default-action ", parm->action, "\n");
fprintf(f, "\tindex %u ref %d bind %d", parm->index, parm->refcnt,
parm->bindcnt);