Skip to contentSkip to conversation

netfilter: flowtable: Add FLOW_OFFLOAD_XMIT_UNSPEC xmit type

PATCH Applied Roi Dayan 2 participants 2 messages Apr 13, 2021

Subsystems (3)
lore
Share & tools
lore

Roi Dayan

author
#0 lore raw

PATCH v2 1/1 netfilter: flowtable: Add FLOW_OFFLOAD_XMIT_UNSPEC xmit type

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")

---

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(-)
include/net/netfilter/nf_flow_table.h +2 -1
index 583b327d8fc0..9b42c6523b4d 100644
@@ -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,
 };
Signature · 1 line
2.26.2
maintainer Applied
#1 lore raw
Quoted 3 lines · Roi Dayan

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.

net/netfilter/nf_flow_table_core.c +3 -0
index 76573bae6664..39c02d1aeedf 100644
@@ -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) {
      |  ^~~~~~