Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bugfix for issue #4589.
The root cause
ensure_ipv4_nat_entry
previously would match against any existing table entries with the matching parameters. We need it to only match against entries that are active, or in implementation terms, entries whoseversion_removed
column isNULL
.The events triggering the bug is as follows:
external_ip
may have the same parameters used by the soft-deleted nat records. Since we previously were not filtering forversion_removed = NULL
inensure_ipv4_nat_entry
, the soft-deleted records would still be treated as "live" in our db query, causing Nexus to skip inserting new nat records when the instance restarts.This PR should resolve this unwanted behavior. However, a second issue was noticed during verification of the bug fix. I noticed that when running
swadm nat list
, the entries did not re-appear in the output even thoughdendrite
was indeed picking up the new additions and configuring the softnpu asic accordingly. I believe this was also something @askfongjojo reported in chat. This means that we could have live entries on the switch and external traffic flowing to an instance, even though the nat entry is not appearing inswadm nat list
. This PR also includes an upgraded dendrite that resolves that bug.TODO
swadm nat list
being incorrect (https://github.com/oxidecomputer/dendrite/pull/688)dendrite
once bugfix is merged