Hi Takao, Numan,

On 11/17/26 5:00 PM, Numan Siddique wrote:
> On Mon, Nov 16, 2026 at 6:48 PM Takao Yatagai <[email protected]> wrote:
>>
>> From: Takao Yatagai <[email protected]>
>>
>> A load balancer on a distributed logical router without a distributed
>> gateway port (DGP) is applied in lr_in_dnat on every chassis, but the
>> router gets no un-DNAT for the replies, so they leave it with the
>> backend's address as their source.
>>
>> Patch 1 factors the priority 120 lr_out_undnat flow of DGP routers out
>> into a helper.  Patch 2 adds the same flow, without the DGP and chassis
>> terms, on distributed routers without a DGP.  The replies are un-DNATed
>> on the chassis where they re-enter the router, and the CMS must make
>> sure, through its logical topology, that this is the chassis that load
>> balanced the request.
>>
>> v1: https://patchwork.ozlabs.org/project/ovn/list/?series=532911
>>
>> v2:
>> - Dropped the symmetric_return option: the un-DNAT flow is now added on
>>   every distributed router without a DGP.  (Numan, Dumitru)
>> - Documented the flow in ovn-logical-flows(7).  (Numan)
>> - Added a "Load Balancing on Logical Routers" section to the
>>   Load_Balancer table in ovn-nb(5).  (Dumitru)
>> - Rebased onto current main.  Patch 1 is unchanged apart from Numan's
>>   Acked-by.
>>
> 
> Thanks Takao.
> 
> I added you to the AUTHORS  file and applied the series to main branch.
> Before applying I did the below changes in the ovn-northd.at in the patch 2
> 
> @Dumitru Ceara any concerns if this series can be backported to 26.09
> and 26.03  ?
> 

So, let me see if I understand this right, this is a "bug fix for an
unsupported feature"? :)

I'm not against it, it shouldn't affect existing users because there
should be no users that configure load balancers on distributed routers
on those releases.

Let's see what the other maintainers think about it too though.

Regards,
Dumitru

> 
> ------------------
> diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
> index 165e48cbd3..f1e88b4bdf 100644
> --- a/tests/ovn-northd.at
> +++ b/tests/ovn-northd.at
> @@ -26133,61 +26133,59 @@ check ovn-nbctl --wait=sb sync
>  # backend's replies on every chassis: no DGP or chassis terms.
>  ovn-sbctl dump-flows lr0 > lr0flows
>  AT_CAPTURE_FILE([lr0flows])
> -AT_CHECK([grep 'lr_in_ip_routing' lr0flows | grep 'select' |
> ovn_strip_ecmp_ids | ovn_strip_lflows], [0], [dnl
> -  table=??(lr_in_ip_routing   ), priority=1840 , match=(reg7 == 0 &&
> ip4.dst == 192.168.10.0/24), action=(ip.ttl--; flags.loopback = 1;
> reg8[[0..15]] = <gid>; reg8[[16..31]] = select(<mid>, <mid>);)
> +AT_CHECK([grep "lr_in_dnat" lr0flows | ovn_strip_lflows | sort], [0], [dnl
> +  table=??(lr_in_dnat         ), priority=0    , match=(1), action=(next;)
> +  table=??(lr_in_dnat         ), priority=120  , match=(ct.new &&
> !ct.rel && ip4 && ip4.dst == 172.168.0.200 && reg1[[16..23]] == 6 &&
> reg1[[0..15]] == 80), action=(ct_lb_mark(backends=10.0.0.4:8080);)
> +  table=??(lr_in_dnat         ), priority=50   , match=(ct.est &&
> !ct.rel && !ct.new && !ct.rpl && ct_mark.natted), action=(next;)
> +  table=??(lr_in_dnat         ), priority=50   , match=(ct.rel &&
> !ct.est && !ct.new && !ct.rpl), action=(ct_commit_nat;)
> +  table=??(lr_in_dnat         ), priority=70   , match=(ct.est &&
> !ct.rel && !ct.new && !ct.rpl && ct_mark.natted && ct_mark.force_snat
> == 1), action=(flags.force_snat_for_lb = 1; next;)
> +  table=??(lr_in_dnat         ), priority=70   , match=(ct.est &&
> !ct.rel && !ct.new && !ct.rpl && ct_mark.natted && ct_mark.skip_snat
> == 1), action=(flags.skip_snat_for_lb = 1; next;)
> +  table=??(lr_in_dnat         ), priority=70   , match=(ct.rel &&
> !ct.est && !ct.new && !ct.rpl && ct_mark.force_snat == 1),
> action=(flags.force_snat_for_lb = 1; ct_commit_nat;)
> +  table=??(lr_in_dnat         ), priority=70   , match=(ct.rel &&
> !ct.est && !ct.new && !ct.rpl && ct_mark.skip_snat == 1),
> action=(flags.skip_snat_for_lb = 1; ct_commit_nat;)
>  ])
> 
> -AT_CHECK([grep "lr_in_dnat" lr0flows | grep "ip4.dst == 172.168.0.200" | \
> -          grep -c "ct_lb_mark(backends=10.0.0.4:8080)"], [0], [1
> -])
> -AT_CHECK([grep "lr_in_dnat" lr0flows | grep "ip4.dst == 172.168.0.200" | \
> -          grep -c "is_chassis_resident"], [1], [0
> -])
> -AT_CHECK([grep "lr_out_undnat" lr0flows | grep "priority=120" | \
> -          grep "ip4.src == 10.0.0.4 && tcp.src == 8080" | \
> -          grep -c "action=(ct_dnat;)"], [0], [1
> -])
> -AT_CHECK([grep "lr_out_undnat" lr0flows | grep "10.0.0.4" | \
> -          grep -c "is_chassis_resident\|inport\|outport"], [1], [0
> +AT_CHECK([grep "lr_out_undnat" lr0flows | ovn_strip_lflows | sort], [0], [dnl
> +  table=??(lr_out_undnat      ), priority=0    , match=(1), action=(next;)
> +  table=??(lr_out_undnat      ), priority=120  , match=(ip4 &&
> ((ip4.src == 10.0.0.4 && tcp.src == 8080))), action=(ct_dnat;)
>  ])
> 
>  # With use_common_zone the un-DNAT uses the common zone, like the LB's
>  # own flows on routers with a distributed gateway port.
>  check ovn-nbctl --wait=sb set NB_Global . options:use_common_zone=true
>  ovn-sbctl dump-flows lr0 > lr0flows
> -AT_CHECK([grep "lr_out_undnat" lr0flows | grep "priority=120" | \
> -          grep "ip4.src == 10.0.0.4 && tcp.src == 8080" | \
> -          grep -c "action=(ct_dnat_in_czone;)"], [0], [1
> +AT_CHECK([grep "lr_out_undnat" lr0flows | ovn_strip_lflows | sort], [0], [dnl
> +  table=??(lr_out_undnat      ), priority=0    , match=(1), action=(next;)
> +  table=??(lr_out_undnat      ), priority=120  , match=(ip4 &&
> ((ip4.src == 10.0.0.4 && tcp.src == 8080))),
> action=(ct_dnat_in_czone;)
>  ])
> +
>  check ovn-nbctl --wait=sb remove NB_Global . options use_common_zone
> 
>  # skip_snat keeps its flag, as on routers with a distributed gateway port.
>  check ovn-nbctl --wait=sb set load_balancer lb0 options:skip_snat=true
>  ovn-sbctl dump-flows lr0 > lr0flows
> -AT_CHECK([grep "lr_out_undnat" lr0flows | grep "priority=120" | \
> -          grep "ip4.src == 10.0.0.4 && tcp.src == 8080" | \
> -          grep -c "action=(flags.skip_snat_for_lb = 1; ct_dnat;)"], [0], [1
> +AT_CHECK([grep "lr_out_undnat" lr0flows | ovn_strip_lflows | sort], [0], [dnl
> +  table=??(lr_out_undnat      ), priority=0    , match=(1), action=(next;)
> +  table=??(lr_out_undnat      ), priority=120  , match=(ip4 &&
> ((ip4.src == 10.0.0.4 && tcp.src == 8080))),
> action=(flags.skip_snat_for_lb = 1; ct_dnat;)
>  ])
> +
>  check ovn-nbctl --wait=sb remove load_balancer lb0 options skip_snat
> 
>  # With a DGP, the flow is bound to the DGP and its chassis instead.
>  check ovn-nbctl lrp-add lr0 lr0-public 00:00:00:00:ff:02 172.168.0.1/24
>  check ovn-nbctl --wait=sb lrp-set-gateway-chassis lr0-public gw1
>  ovn-sbctl dump-flows lr0 > lr0flows
> -AT_CHECK([grep "lr_out_undnat" lr0flows | grep "priority=120" | \
> -          grep "ip4.src == 10.0.0.4 && tcp.src == 8080" | \
> -          grep "outport == \"lr0-public\"" | \
> -          grep -c "is_chassis_resident(\"cr-lr0-public\")"], [0], [1
> -])
> -AT_CHECK([grep "lr_out_undnat" lr0flows | grep "priority=120" | \
> -          grep -c "10.0.0.4"], [0], [1
> +AT_CHECK([grep "lr_out_undnat" lr0flows | ovn_strip_lflows | sort], [0], [dnl
> +  table=??(lr_out_undnat      ), priority=0    , match=(1), action=(next;)
> +  table=??(lr_out_undnat      ), priority=120  , match=(ip4 &&
> ((ip4.src == 10.0.0.4 && tcp.src == 8080)) && (inport == "lr0-public"
> || outport == "lr0-public") && is_chassis_resident("cr-lr0-public")),
> action=(ct_dnat;)
>  ])
> +
>  check ovn-nbctl --wait=sb lrp-del lr0-public
> 
>  # Removing the load balancer removes the un-DNAT flow.
>  check ovn-nbctl --wait=sb lr-lb-del lr0 lb0
>  ovn-sbctl dump-flows lr0 > lr0flows
> -AT_CHECK([grep "lr_out_undnat" lr0flows | grep -c "10.0.0.4"], [1], [0
> +AT_CHECK([grep "lr_out_undnat" lr0flows | ovn_strip_lflows | sort], [0], [dnl
> +  table=??(lr_out_undnat      ), priority=0    , match=(1), action=(next;)
>  ])
> 
>  OVN_CLEANUP_NORTHD
> 
> ----------------------
> 
> Thanks
> Numan
> 
> 
>> Takao Yatagai (2):
>>   northd: Factor out the LB un-DNAT flow of DGP routers.
>>   northd: Un-DNAT LB replies on distributed routers without a DGP.
>>
>>  Documentation/ref/ovn-logical-flows.7.rst | 13 ++++
>>  NEWS                                      |  4 ++
>>  northd/northd.c                           | 85 ++++++++++++++++-------
>>  ovn-nb.xml                                | 48 +++++++++++++
>>  tests/ovn-northd.at                       | 80 +++++++++++++++++++++
>>  5 files changed, 203 insertions(+), 27 deletions(-)
>>
>> --
>> 2.55.0
>>
> 

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to