Fixed https://gerrit.fd.io/r/#/c/11560/
DBGvpp# set int ip address GigabitEthernet0/8/0 172.16.2.1/24 DBGvpp# show nat44 static mappings NAT44 static mappings: DBGvpp# nat44 add static mapping tcp local 10.0.0.3 1234 external GigabitEthernet0/8/0 2345 nat44 add static mapping: External addres must be allocated. DBGvpp# show nat44 static mappings NAT44 static mappings: DBGvpp# DBGvpp# nat44 add static mapping tcp local 10.0.0.3 1234 external GigabitEthernet0/8/0 2345 DBGvpp# show nat44 static mappings NAT44 static mappings: tcp local 10.0.0.3:1234 external GigabitEthernet0/8/0:2345 vrf -1 DBGvpp# set int ip address GigabitEthernet0/8/0 172.16.2.1/24 DBGvpp# show nat44 static mappings NAT44 static mappings: tcp local 10.0.0.3:1234 external GigabitEthernet0/8/0:2345 vrf -1 DBGvpp# nat44 add static mapping tcp local 10.0.0.3 1234 external GigabitEthernet0/8/0 2345 del DBGvpp# show nat44 static mappings NAT44 static mappings: DBGvpp# Matus From: vpp-dev@lists.fd.io <vpp-dev@lists.fd.io> On Behalf Of Matus Fabian -X (matfabia - PANTHEON TECHNOLOGIES at Cisco) Sent: Friday, April 6, 2018 7:25 AM To: vpp-dev@lists.fd.io Cc: vpp-dev <vpp-dev@lists.fd.io> Subject: Re: [vpp-dev] Multiple Static Mappings Static mapping using interface address is stored in resolution vector (without external IP address) and when resolved it is stored as standard static mapping with external address (hash table record, static mapping pool entry). Static mappings with port from resolution vector are resolved in callback for NAT pool address from interface or immediately when interface has assigned address in snat_add_static_mapping. I guess in your case interface already has assigned address and when snat_add_static_mapping try to reserve port for external address it is not in NAT pool and operation failed, in this case record from static mapping resolution vector should be deleted. Delete operation in snat_add_static_mapping doesn’t find resolved static mapping (try do this because interface has address). I will fix this issue. In case when interface obtain address after static mapping was added it won’t be resolved. Matus From: vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io> <vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io>> On Behalf Of Jon Loeliger Sent: Thursday, April 5, 2018 6:13 PM To: vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io> Cc: vpp-dev <vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io>> Subject: Re: [vpp-dev] Multiple Static Mappings On Wed, Apr 4, 2018 at 11:24 PM, Matus Fabian -X (matfabia - PANTHEON TECHNOLOGIES@Cisco) <matfa...@cisco.com<mailto:matfa...@cisco.com>> wrote: When using static mapping with port number external address/interface must be added to NAT pool otherwise static mapping won’t be resolved when interface obtain IP address. Run first “nat44 add interface address TenGigabitEthernet6/0/0” in your case. Matus, Sure, I can do that. But my point is: Why did it both "work" and "not work"? It _does_ add the mapping, and then it _does_ return an error. My user interface is very confused by this! If part of the mapping request is not fulfilled (not an interface IP address available), it should fail and NOT add the mapping. Alternatively, if it is able to fulfill the mapping but just delayed, it should return a success code. Thanks, jdl Matus From: Jon Loeliger <j...@netgate.com<mailto:j...@netgate.com>> Sent: Wednesday, April 4, 2018 5:41 PM To: Matus Fabian -X (matfabia - PANTHEON TECHNOLOGIES at Cisco) <matfa...@cisco.com<mailto:matfa...@cisco.com>> Cc: vpp-dev <vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io>> Subject: Re: [vpp-dev] Multiple Static Mappings On Wed, Apr 4, 2018 at 5:34 AM, Matus Fabian -X (matfabia - PANTHEON TECHNOLOGIES@Cisco) <matfa...@cisco.com<mailto:matfa...@cisco.com>> wrote: Fixed https://gerrit.fd.io/r/#/c/11505/ Matus Matus, Thanks for the quick turn-around on the bug fix! While the original problem (one local address with multiple externals) seems to have been fixed, there is still some lingering problem here. It may simply be an issue with the return codes: vpp# nat44 add static mapping udp local 10.10.10.100 90 external TenGigabitEthernet6/0/0 9999 nat44 add static mapping: External addres must be allocated. vpp# show nat44 static mapping NAT44 static mappings: udp local 10.10.10.100:90<http://10.10.10.100:90> external TenGigabitEthernet6/0/0:9999 vrf -1 vpp# nat44 add static mapping udp local 10.10.10.100 90 external TenGigabitEthernet6/0/0 9999 del nat44 add static mapping: Mapping not exist. vpp# show nat44 static mapping NAT44 static mappings: vpp# It appears to properly add and delete the mappings, but the return code indicates that the operations have failed. Thanks, jdl._,