Rate-limit nat port table being full warning #366
Merged
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.
The log message is very helpful in operations.
But as it now logs every packet that gets no NAT because of the port table being full, this is a potential attack vector for DoS from attached VMs. (And also an annoyance for reading the logs).
So I introduced a simple log rate-limit that should still provide enough logging and keep limits independent for each VM as I put the timestamp inside the
snat_data
itself.While moving the log message (to include all the needed log info), I also noticed an unnecessary table lookup, so that is the change in the first commit.