On 11/9/26, Dumitru Ceara wrote:
> I just realized that this was already broken for IPv6 SNAT rules with
> longer prefixes, e.g., the out_snat rule for /128 NATs will always be
> hit before the skip_snat rule is hit.
>
> The problem was already there before your patch but now that you're
> changing this code, would you have time to send a follow up patch about
> that too?

Hi Dumitru,

Thanks for applying it, and no worries about the delay.

Yes, I just sent the follow up:

  [PATCH ovn] northd: Keep SNAT flag consumers above IPv6 SNAT entries.

It isn't only skip_snat: the force SNAT consumers (lb_force_snat_ip with
an address, router_ip and dnat_force_snat_ip) sit at 100-110 on gateway
routers, so an IPv6 SNAT entry with a long enough prefix outranks them
as well.  I reproduced it with a /128 SNAT entry for the client on a
gateway router: with skip_snat, and with lb_force_snat_ip=router_ip, the
backend sees the SNAT entry's address.

The patch derives the priorities of all these consumers from
MAX_PREFIX_LEN, the way ROUTE_PRIO_BASE_SHIFT does for routes, so that
they stay above every NAT entry without a custom match whatever its
prefix length, and below the ones with a custom match
(NAT_PRIORITY_MATCH_OFFSET), as they already are for IPv4.  I kept them
below the custom match entries on purpose, since that is today's
behavior for IPv4; let me know if you'd rather have them above.

While at it I noticed that the nd_ns flow in lr_out_snat (priority 120)
has the same problem: an IPv6 SNAT entry that covers the router port's
link-local address (::/0 on a router with a distributed gateway port,
for example) outranks it, so the NS injected by ovn-controller goes
through ct_snat.  I couldn't see any functional impact on a recent
kernel and OVS, so I left it out of this patch; let me know if you'd
like a separate one.

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

Reply via email to