diff mbox series

[net-next,v2,1/1] netfilter: flowtable: Add FLOW_OFFLOAD_XMIT_UNSPEC xmit type

Message ID 20210413080605.2108422-1-roid@nvidia.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v2,1/1] netfilter: flowtable: Add FLOW_OFFLOAD_XMIT_UNSPEC xmit type | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 6 maintainers not CCed: kadlec@netfilter.org coreteam@netfilter.org fw@strlen.de davem@davemloft.net netfilter-devel@vger.kernel.org kuba@kernel.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit fail Errors and warnings before: 106 this patch: 107
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/build_allmodconfig_warn fail Errors and warnings before: 108 this patch: 109
netdev/header_inline success Link

Commit Message

Roi Dayan April 13, 2021, 8:06 a.m. UTC
It could be xmit type was not set and would default to FLOW_OFFLOAD_XMIT_NEIGH
and in this type the gc expect to have a route info.
Fix that by adding FLOW_OFFLOAD_XMIT_UNSPEC which defaults to 0.

Fixes: 8b9229d15877 ("netfilter: flowtable: dst_check() from garbage collector path")
Signed-off-by: Roi Dayan <roid@nvidia.com>
---

Notes:
    v2
    - add FLOW_OFFLOAD_XMIT_UNSPEC instead of still using neigh as default and checking dst for null

 include/net/netfilter/nf_flow_table.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Pablo Neira Ayuso April 13, 2021, 10:45 a.m. UTC | #1
On Tue, Apr 13, 2021 at 11:06:05AM +0300, Roi Dayan wrote:
> It could be xmit type was not set and would default to FLOW_OFFLOAD_XMIT_NEIGH
> and in this type the gc expect to have a route info.
> Fix that by adding FLOW_OFFLOAD_XMIT_UNSPEC which defaults to 0.

Applied, thanks.

diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
index 76573bae6664..39c02d1aeedf 100644
--- a/net/netfilter/nf_flow_table_core.c
+++ b/net/netfilter/nf_flow_table_core.c
@@ -130,6 +130,9 @@ static int flow_offload_fill_route(struct flow_offload *flow,
                flow_tuple->dst_cache = dst;
                flow_tuple->dst_cookie = flow_offload_dst_cookie(flow_tuple);
                break;
+       default:
+               WARN_ON_ONCE(1);
+               break;
        }
        flow_tuple->xmit_type = route->tuple[dir].xmit_type;

I have included this chunk to make gcc happy.

net/netfilter/nf_flow_table_core.c: In function ‘flow_offload_fill_route’:
net/netfilter/nf_flow_table_core.c:116:2: warning: enumeration value ‘FLOW_OFFLOAD_XMIT_UNSPEC’ not handled in switch [-Wswitch]
  116 |  switch (route->tuple[dir].xmit_type) {
      |  ^~~~~~
diff mbox series

Patch

diff --git a/include/net/netfilter/nf_flow_table.h b/include/net/netfilter/nf_flow_table.h
index 583b327d8fc0..9b42c6523b4d 100644
--- a/include/net/netfilter/nf_flow_table.h
+++ b/include/net/netfilter/nf_flow_table.h
@@ -90,7 +90,8 @@  enum flow_offload_tuple_dir {
 #define FLOW_OFFLOAD_DIR_MAX	IP_CT_DIR_MAX
 
 enum flow_offload_xmit_type {
-	FLOW_OFFLOAD_XMIT_NEIGH		= 0,
+	FLOW_OFFLOAD_XMIT_UNSPEC	= 0,
+	FLOW_OFFLOAD_XMIT_NEIGH,
 	FLOW_OFFLOAD_XMIT_XFRM,
 	FLOW_OFFLOAD_XMIT_DIRECT,
 };