Skip to content

Commit

Permalink
netfilter: flowtable: Fix incorrect tc_setup_type type
Browse files Browse the repository at this point in the history
The indirect block setup should use TC_SETUP_FT as the type instead of
TC_SETUP_BLOCK. Adjust existing users of the indirect flow block
infrastructure.

Fixes: b5140a3 ("netfilter: flowtable: add indr block setup support")
Signed-off-by: wenxu <[email protected]>
Signed-off-by: Pablo Neira Ayuso <[email protected]>
  • Loading branch information
wenxu authored and ummakynes committed Mar 27, 2020
1 parent 53c2b28 commit 133a2fe
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion include/net/flow_offload.h
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ void flow_indr_block_cb_unregister(struct net_device *dev,

void flow_indr_block_call(struct net_device *dev,
struct flow_block_offload *bo,
enum flow_block_command command);
enum flow_block_command command,
enum tc_setup_type type);

#endif /* _NET_FLOW_OFFLOAD_H */
6 changes: 3 additions & 3 deletions net/core/flow_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,8 @@ EXPORT_SYMBOL_GPL(flow_indr_block_cb_unregister);

void flow_indr_block_call(struct net_device *dev,
struct flow_block_offload *bo,
enum flow_block_command command)
enum flow_block_command command,
enum tc_setup_type type)
{
struct flow_indr_block_cb *indr_block_cb;
struct flow_indr_block_dev *indr_dev;
Expand All @@ -521,8 +522,7 @@ void flow_indr_block_call(struct net_device *dev,
return;

list_for_each_entry(indr_block_cb, &indr_dev->cb_list, list)
indr_block_cb->cb(dev, indr_block_cb->cb_priv, TC_SETUP_BLOCK,
bo);
indr_block_cb->cb(dev, indr_block_cb->cb_priv, type, bo);
}
EXPORT_SYMBOL_GPL(flow_indr_block_call);

Expand Down
2 changes: 1 addition & 1 deletion net/netfilter/nf_flow_table_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ static int nf_flow_table_indr_offload_cmd(struct flow_block_offload *bo,
{
nf_flow_table_block_offload_init(bo, dev_net(dev), cmd, flowtable,
extack);
flow_indr_block_call(dev, bo, cmd);
flow_indr_block_call(dev, bo, cmd, TC_SETUP_FT);

if (list_empty(&bo->cb_list))
return -EOPNOTSUPP;
Expand Down
2 changes: 1 addition & 1 deletion net/netfilter/nf_tables_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ static int nft_indr_block_offload_cmd(struct nft_base_chain *chain,

nft_flow_block_offload_init(&bo, dev_net(dev), cmd, chain, &extack);

flow_indr_block_call(dev, &bo, cmd);
flow_indr_block_call(dev, &bo, cmd, TC_SETUP_BLOCK);

if (list_empty(&bo.cb_list))
return -EOPNOTSUPP;
Expand Down
2 changes: 1 addition & 1 deletion net/sched/cls_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ static void tc_indr_block_call(struct tcf_block *block,
};
INIT_LIST_HEAD(&bo.cb_list);

flow_indr_block_call(dev, &bo, command);
flow_indr_block_call(dev, &bo, command, TC_SETUP_BLOCK);
tcf_block_setup(block, &bo);
}

Expand Down

0 comments on commit 133a2fe

Please sign in to comment.