Skip to content

Commit

Permalink
RSS: Reuse SNAT IPs until port range is exhausted (#6037)
Browse files Browse the repository at this point in the history
Prior to this PR, RSS would step both the IP and the port range when
assigning SNAT IPs to boundary NTP zones. E.g., on a4x2:

```json
            "snat_cfg": {
              "ip": "198.51.100.25",
              "first_port": 0,
              "last_port": 16383
            }
            "snat_cfg": {
              "ip": "198.51.100.26",
              "first_port": 16384,
              "last_port": 32767
            }
```

After the change, we reuse the IP and only step the ports:

```json
            "snat_cfg": {
              "ip": "198.51.100.25",
              "first_port": 0,
              "last_port": 16383
            }
            "snat_cfg": {
              "ip": "198.51.100.25",
              "first_port": 16384,
              "last_port": 32767
            }
```

I confirmed both boundary NTP zones still have external connectivity, as
expected.

I believe the code here already intended to do this, but accidentally
never assigned `self.next_snat_ip`, so always allocated a new IP.
  • Loading branch information
jgallagher authored Jul 10, 2024
1 parent 1135047 commit aa06313
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sled-agent/src/rack_setup/plan/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,8 @@ impl ServicePortBuilder {
self.next_snat_port += NUM_SOURCE_NAT_PORTS;
if self.next_snat_port.0 == 0 {
self.next_snat_ip = None;
} else {
self.next_snat_ip = Some(snat_ip);
}

let snat_cfg =
Expand Down

0 comments on commit aa06313

Please sign in to comment.