Skip to content

Commit

Permalink
net_sched: Provide default walker function for actions
Browse files Browse the repository at this point in the history
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jamal Hadi Salim authored and David S. Miller committed Dec 6, 2013
1 parent 43c00dc commit 382ca8a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions net/sched/act_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,11 @@ int tcf_register_action(struct tc_action_ops *act)
if (!act->act || !act->dump || !act->cleanup || !act->init)
return -EINVAL;

/* Supply defaults */
if (!act->lookup)
act->lookup = tcf_hash_search;
if (!act->walk)
act->walk = tcf_generic_walker;

write_lock(&act_mod_lock);
for (ap = &act_base; (a = *ap) != NULL; ap = &a->next) {
Expand Down Expand Up @@ -1089,12 +1092,6 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
memset(&a, 0, sizeof(struct tc_action));
a.ops = a_o;

if (a_o->walk == NULL) {
WARN(1, "tc_dump_action: %s !capable of dumping table\n",
a_o->kind);
goto out_module_put;
}

nlh = nlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq,
cb->nlh->nlmsg_type, sizeof(*t), 0);
if (!nlh)
Expand Down

0 comments on commit 382ca8a

Please sign in to comment.