Page MenuHomeFreeBSD

test/libalias: Tests for outgoing NAT
ClosedPublic

Authored by donner on May 18 2021, 2:54 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Mar 18, 8:05 AM
Unknown Object (File)
Mon, Mar 18, 8:05 AM
Unknown Object (File)
Mon, Mar 18, 8:05 AM
Unknown Object (File)
Mon, Mar 18, 8:05 AM
Unknown Object (File)
Mon, Mar 18, 8:05 AM
Unknown Object (File)
Mon, Mar 18, 8:05 AM
Unknown Object (File)
Mon, Mar 18, 8:05 AM
Unknown Object (File)
Mon, Mar 18, 8:05 AM

Details

Summary

Testing LibAliasOut functionality. This concentrates the typical use case of initiating data transfers from the inside.

Provide a exhaustive test for the data structure in order to check for performance improvements

Test Plan
$ `make test`
2_natout:1_simplemasq  ->  passed  [0.003s]
2_natout:2_unregistered  ->  passed  [0.003s]
2_natout:3_cgn  ->  passed  [0.003s]
2_natout:4_udp  ->  passed  [0.003s]
2_natout:5_sameport  ->  passed  [0.003s]
2_natout:7_stress  ->  passed  [11.192s]

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

  • Add UDP and reverse translation
  • Simplify structure
  • More simplification.
  • Add UDP and reverse translation
  • Fix packet header size calculation
kp added a subscriber: kp.
kp added inline comments.
tests/sys/netinet/libalias/2_natout.c
209

I'm not the only one who really enjoys that comment, right?

This revision is now accepted and ready to land.May 19 2021, 1:53 PM

I'm far from finished with this.
But thank you @kp for the intermediate, positive response.

  • Factor out common utilities
  • Zeroize packet buffer
This revision now requires review to proceed.May 19 2021, 10:45 PM
  • Fix stupid errors (reversed length check, existing nat state)
  • Fix case 4_udp and various issues
  • Test case for PKG_ALIAS_SAME_PORTS
donner edited the test plan for this revision. (Show Details)
donner edited the summary of this revision. (Show Details)
  • Add test for PKT_ALIAS_RESET_ON_ADDR_CHANGE
  • Add stress test for exhausting of search data structure
donner edited the test plan for this revision. (Show Details)

@kp may you have a look again?
Does this cover your common use cases, @lev ?

Does this cover your common use cases, @lev ?

Big part of my use cases is port forwarding into DMZ, both TCP and UDP, with multiple (2000+) streams to same forward.

(it is M4 source, so SKYNET_NAT, SKYNET_IP and DMZ_HOST are macros which expand to simple IPv4 addresses).

nat SKYNET_NAT config ip SKYNET_IP same_ports redirect_port tcp DMZ_HOST:1688116881 redirect_port udp DMZ_HOST:1688116881 redirect_port tcp TORRENT_BOX4:18080 18080

These redirects process A LOT of traffic in MULTIPLE streams.

This revision is now accepted and ready to land.May 21 2021, 9:42 AM
In D30335#682354, @lev wrote:

Does this cover your common use cases, @lev ?

Big part of my use cases is port forwarding into DMZ, both TCP and UDP, with multiple (2000+) streams to same forward.

Okay, than you have to wait for the next part of the test suite "LibAliasIn".

Thank you @kp, having this in main allows to test other branches more easily.

This revision was automatically updated to reflect the committed changes.