Skip to content

Commit

Permalink
netfilter: flowtable: add a 'default' case to flowtable datapath
Browse files Browse the repository at this point in the history
Add a 'default' case in case return a uninitialized value of ret, this
should not ever happen since the follow transmit path types:

- FLOW_OFFLOAD_XMIT_UNSPEC
- FLOW_OFFLOAD_XMIT_TC

are never observed from this path. Add this check for safety reasons.

Signed-off-by: Li Qiong <liqiong@nfschina.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Li Qiong authored and Pablo Neira Ayuso committed Dec 8, 2022
1 parent 7d7cfb4 commit 895fa59
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions net/netfilter/nf_flow_table_ip.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,10 @@ nf_flow_offload_ip_hook(void *priv, struct sk_buff *skb,
if (ret == NF_DROP)
flow_offload_teardown(flow);
break;
default:
WARN_ON_ONCE(1);
ret = NF_DROP;
break;
}

return ret;
Expand Down Expand Up @@ -682,6 +686,10 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb,
if (ret == NF_DROP)
flow_offload_teardown(flow);
break;
default:
WARN_ON_ONCE(1);
ret = NF_DROP;
break;
}

return ret;
Expand Down

0 comments on commit 895fa59

Please sign in to comment.