nat: fix EI hairpinning thread safety 74/31174/4
authorKlement Sekera <ksekera@cisco.com>
Tue, 2 Feb 2021 12:25:40 +0000 (13:25 +0100)
committerOle Tr�an <otroan@employees.org>
Wed, 10 Feb 2021 13:12:33 +0000 (13:12 +0000)
commit98d82ca04ba438cd2ba3c03de6e1e82e4786cd83
treed63d0b002555b63730fab3cea261d824c21986b1
parent4f423bf6b4f3dedf6a3e8d5bbb38c31558d13534
nat: fix EI hairpinning thread safety

Avoid doing inter-thread reads without locks by doing a handoff before
destination address rewrite. Destination address is read from a session
which is possibly owned by a different thread. By splitting the work in
two parts with a handoff in the middle, we can do both in a thread safe
way.

Type: improvement
Signed-off-by: Klement Sekera <ksekera@cisco.com>
Change-Id: I1c50d188393a610f5564fa230c75771a8065f273
src/plugins/nat/nat.c
src/plugins/nat/nat.h
src/plugins/nat/nat44-ei/nat44_ei_in2out.c
src/plugins/nat/nat44_hairpinning.c
src/plugins/nat/nat44_hairpinning.h [new file with mode: 0644]
src/plugins/nat/test/test_nat44_ei.py
src/vnet/buffer.h
test/run_tests.py