aboutsummaryrefslogtreecommitdiffstats
path: root/src/vat2
diff options
context:
space:
mode:
authorAlexander Chernavin <achernavin@netgate.com>2021-07-06 06:08:26 -0400
committerMatthew Smith <mgsmith@netgate.com>2021-08-17 21:32:14 +0000
commit4de12b9c62757f7297c6ac5c7eedff17082f4ee8 (patch)
tree9435894aa5f601220efde2d9a414586cd9a79cad /src/vat2
parentb93782b36643714a8dcb53e2e396da642b1b0053 (diff)
nat: fix counters increment for output feature
Type: fix The NAT plugin stores packet counters and a counter represents a vector indexed by interface index. When an interface is assigned a NAT role, the counters are validated to be long enough for the given interface index. When a packet traverses NAT in2out and output feature is disabled, the appropriate counters are updated by the RX interface index. In this case, translation happens on the inside interface and its index was ensured to be valid in all of the counters during NAT role assignment. When a packet traverses NAT in2out and output feature is enabled, the appropriate counters are updated by the RX interface index too. In this case, translation happens on the outside interface and the packet could be received on any interface, even with no NAT role assigned. If that's the case and its index is greater than the greatest index validated in the counters, a new counter value will be written to memory that does not belong to the counter. As a result, a crash will occur at some point. With this change, use TX interface index to update the counters when output feature is enabled. TX interface is an actual interface where translation happens and its index is always valid in the counters. Signed-off-by: Alexander Chernavin <achernavin@netgate.com> Change-Id: I53a52af949fe96419e1b5fef4134ab4062198f51
Diffstat (limited to 'src/vat2')
0 files changed, 0 insertions, 0 deletions