nat: avoid hairpinning infinite loop problem 40/30340/2
authorElias Rudberg <elias.rudberg@bahnhof.net>
Tue, 8 Dec 2020 13:21:19 +0000 (14:21 +0100)
committerAndrew Yourtchenko <ayourtch@gmail.com>
Thu, 10 Dec 2020 09:30:46 +0000 (09:30 +0000)
commit3b82d3e39331c5c6cade1014444091ba31052551
tree756b83f3914ce9ab56116f2f97dfbc2018f8116d
parenta23dd5dbb5cde4cb12b3d7b0bed8156e2ff7e6b5
nat: avoid hairpinning infinite loop problem

Fix in nat44 hairpinning code to check if anything was actually
changed in the snat_hairpinning() routine, and return 0 if nothing
changed. This helps avoid an infinite loop repeating the three
nodes nat44-hairpinning-->ip4-lookup-->ip4-local in case there
was no change. Also add a corresponding test case.

This is essentially a cherry-pick of change 30284 but the
automatic cherry-picking did not work because of some filename
changes.

Type: fix

Signed-off-by: Elias Rudberg <elias.rudberg@bahnhof.net>
Change-Id: I21a59ae7423f40abeff9fc0411330da58b3011f0
src/plugins/nat/nat44_hairpinning.c
src/plugins/nat/test/test_nat.py