+ if (egress)
+ tcmsg.tcm_parent = TC_H_MAKE(TC_H_CLSACT, TC_H_MIN_EGRESS);
+ else
+ tcmsg.tcm_parent = TC_H_MAKE(TC_H_CLSACT, TC_H_MIN_INGRESS);
+
+ tcmsg.tcm_info = TC_H_MAKE(prio << 16, htons(ETH_P_ALL));
+
+ msg = nlmsg_alloc_simple(RTM_NEWTFILTER, NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL);
+ nlmsg_append(msg, &tcmsg, sizeof(tcmsg), NLMSG_ALIGNTO);
+ nla_put_string(msg, TCA_KIND, "bpf");
+
+ opts = nla_nest_start(msg, TCA_OPTIONS);
+ nla_put_u32(msg, TCA_BPF_FD, prog_fd);
+ nla_put_string(msg, TCA_BPF_NAME, name);
+ nla_put_u32(msg, TCA_BPF_FLAGS, TCA_BPF_FLAG_ACT_DIRECT);
+ nla_put_u32(msg, TCA_BPF_FLAGS_GEN, TCA_CLS_FLAGS_SKIP_HW);
+ nla_nest_end(msg, opts);
+
+ nl_send_auto_complete(rtnl_sock, msg);
+ nlmsg_free(msg);
+
+ return nl_wait_for_ack(rtnl_sock);