From ac218b6e00ca97ddb54362d71435c4ea2d47cfb7 Mon Sep 17 00:00:00 2001
From: Numan Siddique
+ This table also has a priority-110 flow with the match
+ inport == I
for all logical switch
+ datapaths to move traffic to the next table. Where I
+ is the peer of a logical router port. This flow is added to
+ skip the connection tracking of packets which enter from
+ logical router datapath to logical switch datapath.
+
@@ -505,7 +514,20 @@
It contains a priority-0 flow that simply moves traffic to the next - table. For established connections a priority 100 flow matches on + table. +
+ +
+ A priority-65535 flow with the match
+ inport == I
for all logical switch
+ datapaths to move traffic to the next table. Where I
+ is the peer of a logical router port. This flow is added to
+ skip the connection tracking of packets which enter from
+ logical router datapath to logical switch datapath.
+
+ For established connections a priority 65534 flow matches on
ct.est && !ct.rel && !ct.new &&
!ct.inv
and sets an action reg0[2] = 1; next;
to act
as a hint for table Stateful
to send packets through
@@ -1342,6 +1364,15 @@ output;
db="OVN_Northbound"/> table.
+ This table also has a priority-110 flow with the match
+ outport == I
for all logical switch
+ datapaths to move traffic to the next table. Where I
+ is the peer of a logical router port. This flow is added to
+ skip the connection tracking of packets which will be entering
+ logical router datapath from logical switch datapath for routing.
+
diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index 1f5433d9d..7b534ce3c 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -4850,8 +4850,9 @@ build_lswitch_output_port_sec(struct hmap *ports, struct hmap *datapaths, } static void -build_pre_acl_flows(struct ovn_datapath *od, struct ovn_port *op, - struct hmap *lflows) +skip_port_from_conntrack(struct ovn_datapath *od, struct ovn_port *op, + enum ovn_stage in_stage, enum ovn_stage out_stage, + uint16_t priority, struct hmap *lflows) { /* Can't use ct() for router ports. Consider the following configuration: * lp1(10.0.0.2) on hostA--ls1--lr0--ls2--lp2(10.0.1.2) on hostB, For a @@ -4867,10 +4868,10 @@ build_pre_acl_flows(struct ovn_datapath *od, struct ovn_port *op, ds_put_format(&match_in, "ip && inport == %s", op->json_key); ds_put_format(&match_out, "ip && outport == %s", op->json_key); - ovn_lflow_add_with_hint(lflows, od, S_SWITCH_IN_PRE_ACL, 110, + ovn_lflow_add_with_hint(lflows, od, in_stage, priority, ds_cstr(&match_in), "next;", &op->nbsp->header_); - ovn_lflow_add_with_hint(lflows, od, S_SWITCH_OUT_PRE_ACL, 110, + ovn_lflow_add_with_hint(lflows, od, out_stage, priority, ds_cstr(&match_out), "next;", &op->nbsp->header_); @@ -4903,10 +4904,14 @@ build_pre_acls(struct ovn_datapath *od, struct hmap *lflows) * defragmentation, in order to match L4 headers. */ if (has_stateful) { for (size_t i = 0; i < od->n_router_ports; i++) { - build_pre_acl_flows(od, od->router_ports[i], lflows); + skip_port_from_conntrack(od, od->router_ports[i], + S_SWITCH_IN_PRE_ACL, S_SWITCH_OUT_PRE_ACL, + 110, lflows); } for (size_t i = 0; i < od->n_localnet_ports; i++) { - build_pre_acl_flows(od, od->localnet_ports[i], lflows); + skip_port_from_conntrack(od, od->localnet_ports[i], + S_SWITCH_IN_PRE_ACL, S_SWITCH_OUT_PRE_ACL, + 110, lflows); } /* Ingress and Egress Pre-ACL Table (Priority 110). @@ -5050,6 +5055,17 @@ build_pre_lb(struct ovn_datapath *od, struct hmap *lflows, ovn_lflow_add(lflows, od, S_SWITCH_IN_PRE_LB, 0, "1", "next;"); ovn_lflow_add(lflows, od, S_SWITCH_OUT_PRE_LB, 0, "1", "next;"); + for (size_t i = 0; i < od->n_router_ports; i++) { + skip_port_from_conntrack(od, od->router_ports[i], + S_SWITCH_IN_PRE_LB, S_SWITCH_OUT_PRE_LB, + 110, lflows); + } + for (size_t i = 0; i < od->n_localnet_ports; i++) { + skip_port_from_conntrack(od, od->localnet_ports[i], + S_SWITCH_IN_PRE_LB, S_SWITCH_OUT_PRE_LB, + 110, lflows); + } + struct sset all_ips_v4 = SSET_INITIALIZER(&all_ips_v4); struct sset all_ips_v6 = SSET_INITIALIZER(&all_ips_v6); bool vip_configured = false; @@ -5725,13 +5741,18 @@ build_lb(struct ovn_datapath *od, struct hmap *lflows) ovn_lflow_add(lflows, od, S_SWITCH_OUT_LB, 0, "1", "next;"); if (od->nbs->load_balancer) { - /* Ingress and Egress LB Table (Priority 65535). + for (size_t i = 0; i < od->n_router_ports; i++) { + skip_port_from_conntrack(od, od->router_ports[i], + S_SWITCH_IN_LB, S_SWITCH_OUT_LB, + UINT16_MAX, lflows); + } + /* Ingress and Egress LB Table (Priority 65534). * * Send established traffic through conntrack for just NAT. */ - ovn_lflow_add(lflows, od, S_SWITCH_IN_LB, UINT16_MAX, + ovn_lflow_add(lflows, od, S_SWITCH_IN_LB, UINT16_MAX - 1, "ct.est && !ct.rel && !ct.new && !ct.inv", REGBIT_CONNTRACK_NAT" = 1; next;"); - ovn_lflow_add(lflows, od, S_SWITCH_OUT_LB, UINT16_MAX, + ovn_lflow_add(lflows, od, S_SWITCH_OUT_LB, UINT16_MAX - 1, "ct.est && !ct.rel && !ct.new && !ct.inv", REGBIT_CONNTRACK_NAT" = 1; next;"); } -- 2.26.2