ipfw3nat: nat func to replace the src or dst
commit29f13cb6490754babc4058fa2e432c23471f53a9
authorBill Yuan <bycn82@dragonflybsd.org>
Mon, 9 Apr 2018 13:02:55 +0000 (9 13:02 +0000)
committerBill Yuan <bycn82@dragonflybsd.org>
Mon, 9 Apr 2018 13:02:55 +0000 (9 13:02 +0000)
tree78f9f811400e0398e3ce58e8c91f45f4991ffe8f
parenta9e52100a5db864a9de6697e684bafd6283a0901
ipfw3nat: nat func to replace the src or dst

The `src` will be replaced by `alias` when a packet is leaving the system.
Hence, the packet is from `src` to `dst` before been translated. And after
been translated, the packet is from `alias` to `dst`.

The state for outgoing packet will be stored in the nat_context of current
CPU. But due to the nature of the NAT, the returning packet may be handled
by another CPU. Hence, a state for the returning packet will be prepared and
store into the nat_context of the right CPU.
sys/net/ipfw3_nat/ip_fw3_nat.c