Skip to content

Commit 635d448

Browse files
Paul Blakeykuba-moo
authored andcommitted
net: openvswitch: Fix matching zone id for invalid conns arriving from tc
Zone id is not restored if we passed ct and ct rejected the connection, as there is no ct info on the skb. Save the zone from tc skb cb to tc skb extension and pass it on to ovs, use that info to restore the zone id for invalid connections. Fixes: d29334c ("net/sched: act_api: fix miss set post_ct for ovs after do conntrack in act_ct") Signed-off-by: Paul Blakey <paulb@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 3849595 commit 635d448

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

include/linux/skbuff.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ struct nf_bridge_info {
286286
struct tc_skb_ext {
287287
__u32 chain;
288288
__u16 mru;
289+
__u16 zone;
289290
bool post_ct;
290291
};
291292
#endif

net/openvswitch/flow.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <net/mpls.h>
3535
#include <net/ndisc.h>
3636
#include <net/nsh.h>
37+
#include <net/netfilter/nf_conntrack_zones.h>
3738

3839
#include "conntrack.h"
3940
#include "datapath.h"
@@ -860,6 +861,7 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info,
860861
#endif
861862
bool post_ct = false;
862863
int res, err;
864+
u16 zone = 0;
863865

864866
/* Extract metadata from packet. */
865867
if (tun_info) {
@@ -898,6 +900,7 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info,
898900
key->recirc_id = tc_ext ? tc_ext->chain : 0;
899901
OVS_CB(skb)->mru = tc_ext ? tc_ext->mru : 0;
900902
post_ct = tc_ext ? tc_ext->post_ct : false;
903+
zone = post_ct ? tc_ext->zone : 0;
901904
} else {
902905
key->recirc_id = 0;
903906
}
@@ -906,8 +909,11 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info,
906909
#endif
907910

908911
err = key_extract(skb, key);
909-
if (!err)
912+
if (!err) {
910913
ovs_ct_fill_key(skb, key, post_ct); /* Must be after key_extract(). */
914+
if (post_ct && !skb_get_nfct(skb))
915+
key->ct_zone = zone;
916+
}
911917
return err;
912918
}
913919

net/sched/cls_api.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,6 +1625,7 @@ int tcf_classify(struct sk_buff *skb,
16251625
ext->chain = last_executed_chain;
16261626
ext->mru = cb->mru;
16271627
ext->post_ct = cb->post_ct;
1628+
ext->zone = cb->zone;
16281629
}
16291630

16301631
return ret;

0 commit comments

Comments
 (0)