Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing ICMP SNAT for L2 UDNs GR #4729

Merged
merged 1 commit into from
Sep 20, 2024
Merged

Conversation

jcaamano
Copy link
Contributor

@jcaamano jcaamano commented Sep 17, 2024

On GRs we have an SNAT from the join port IP address to the external IP address for ICMP needs frag sent by OVN to the external network.

In L2 UDNs, even though there is no join network, the internal port has two IPs, one for the pod subnet and another for the join subnet. The ICMP source address will be the first one in lexicographical order which might be the pod subnet one.

The proper SNAT for the GR pod subnet address gets created in the gateway initialization. But:
1 when DisableSNATMultipleGWs=false, it is redundant because there is
already a SNAT for the whole pod subnet
2 when DisableSNATMultipleGWs=true we end up with no SNAT because
cleanupStalePodSNATs cleans it up becaause it never expected that
SNAT

This commit fixes (2)

@jcaamano jcaamano requested a review from a team as a code owner September 17, 2024 15:54
@github-actions github-actions bot added the area/unit-testing Issues related to adding/updating unit tests label Sep 17, 2024
Copy link
Contributor

@qinqon qinqon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tssurya
Copy link
Member

tssurya commented Sep 18, 2024

what is a "ICMP SNAT" ?
also I am pretty sure the issue you have linked #2 is not correct right?

@jcaamano
Copy link
Contributor Author

what is a "ICMP SNAT" ?

Explained on the message:

On GRs we have an SNAT from the join port IP address to the external IP address for ICMP needs frag sent by OVN to the external network.

I am pretty sure the issue you have linked #2 is not correct right?

right, edited

@jcaamano
Copy link
Contributor Author

Registered new flake
#4733

@tssurya tssurya requested review from tssurya and removed request for cathy-zhou September 18, 2024 12:06
@tssurya tssurya self-assigned this Sep 18, 2024
@tssurya tssurya added feature/user-defined-network-segmentation All PRs related to User defined network segmentation kind/bug All issues that are bugs and PRs opened to fix bugs labels Sep 18, 2024
Copy link
Member

@tssurya tssurya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So IIUC @jcaamano correct me if I am wrong

Generally in OVN we have the lb_force_snat_ip=router_ip which should auto-take care of SNATing to joinIP, but for ICMP needs frag it seems there is a bug in OVN https://issues.redhat.com/browse/FDP-159 due to which we had to manually start adding this SNAT: 49e1d9f
which looks like this right?

snat                                                         169.254.0.13                        100.65.0.3                                                                  
snat                                                         fd69::d                             fd99::3   

We did #4722 that fixed up the whole joinIP util being wrong

So qq what's the difference between:

if gwLRPIPset.Has(routerNat.LogicalIP) {
			continue
		}

and

if gw.containsJoinIP(logicalIP) {
			continue
		}

to me it looks like both are trying to catch the SNAT with joinIP as the prefix right? I think I might be getting confused with stuff..

@tssurya
Copy link
Member

tssurya commented Sep 19, 2024

In L2 UDNs, even though there is no join network, the internal port has two IPs, one for the pod subnet and another for the join subnet. The ICMP source address will be the first one in lexicographical order which might be the pod subnet one.

yea we discussed this also needs to be fixed: https://redhat-internal.slack.com/archives/C077NGF5HE1/p1726048908687809 opened an issue to track it at the very least

@jcaamano
Copy link
Contributor Author

jcaamano commented Sep 19, 2024

So qq what's the difference between:

if gwLRPIPset.Has(routerNat.LogicalIP) {
			continue
		}

and

if gw.containsJoinIP(logicalIP) {
			continue
		}

to me it looks like both are trying to catch the SNAT with joinIP as the prefix right? I think I might be getting confused with stuff..

gwLRPIPset contains, not only the router IP in the join subnet, but also the router IP on the pod subnet for L2 primary UDNs. I could remove the check gw.containsJoinIP(logicalIP) if you would have me do that as it is currently redundant, yeah.

@tssurya
Copy link
Member

tssurya commented Sep 19, 2024

gwLRPIPset contains, not only the router IP in the join subnet, but also the router IP on the pod subnet for L2 primary UDNs. I could remove the check gw.containsJoinIP(logicalIP) if you would have me do that as it is currently redundant, yeah.

ahhhh ack so its:

    port rtos-l2.network_ovn_layer2_switch
        mac: "0a:58:64:41:00:03"
        ipv6-lla: "fe80::858:64ff:fe41:3"
        networks: ["10.100.200.1/24", "100.65.0.3/16", "2010:100:200::1/60", "fd99::3/64"] ---> these two?

yeah go for that cleanup thanks!

@jcaamano
Copy link
Contributor Author

@tssurya @qinqon

Done.

For many other things however, the first ip of the list is being used (gwLRPIP[0]). I hope @qinqon has us covered here.

@qinqon
Copy link
Contributor

qinqon commented Sep 19, 2024

For many other things however, the first ip of the list is being used (gwLRPIP[0]). I hope @qinqon has us covered here.

That's the join subnet address, I think that's the expectation.

@jcaamano
Copy link
Contributor Author

For many other things however, the first ip of the list is being used (gwLRPIP[0]). I hope @qinqon has us covered here.

That's the join subnet address, I think that's the expectation.

It is. But previously we used gwLRPIP[0] because we only expected one address in the slice. Now we depend on a certain order. Treading dangerous paths here.

@qinqon
Copy link
Contributor

qinqon commented Sep 19, 2024

For many other things however, the first ip of the list is being used (gwLRPIP[0]). I hope @qinqon has us covered here.

That's the join subnet address, I think that's the expectation.

It is. But previously we used gwLRPIP[0] because we only expected one address in the slice. Now we depend on a certain order. Treading dangerous paths here.

Is it worth it a follow up to segregate the node gatewa address and do the gateway things at the layer2 controller.

On GRs we have an SNAT from the join port IP address to the external IP
address for ICMP needs frag sent by OVN to the external network.

In L2 UDNs, even though there is no join network, the internal port has
two IPs, one for the pod subnet and another for the join subnet. The
ICMP source address will be the first one in lexicographical order which
might be the pod subnet one.

The proper SNAT for the GR pod subnet address gets created in the gateway
initialization. But:
1 when DisableSNATMultipleGWs=false, it is redundant because there is
  already a SNAT for the whole pod subnet
2 when DisableSNATMultipleGWs=true we end up with no SNAT because
  cleanupStalePodSNATs cleans it up becaause it never expected that
  SNAT

This commit fixes #2

Signed-off-by: Jaime Caamaño Ruiz <[email protected]>
@jcaamano
Copy link
Contributor Author

For many other things however, the first ip of the list is being used (gwLRPIP[0]). I hope @qinqon has us covered here.

That's the join subnet address, I think that's the expectation.

It is. But previously we used gwLRPIP[0] because we only expected one address in the slice. Now we depend on a certain order. Treading dangerous paths here.

Is it worth it a follow up to segregate the node gatewa address and do the gateway things at the layer2 controller.

A comment somewhere could be nice. Or filtering them by containsJoinIP could work if we did not want to depend on the order.

@jcaamano jcaamano merged commit bc013a8 into ovn-org:master Sep 20, 2024
39 checks passed
@tssurya
Copy link
Member

tssurya commented Sep 20, 2024

ah woops I forgot to press merge last night... thanks Jaime!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/unit-testing Issues related to adding/updating unit tests feature/user-defined-network-segmentation All PRs related to User defined network segmentation kind/bug All issues that are bugs and PRs opened to fix bugs
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants