Commit Graph

48 Commits

Author SHA1 Message Date
dmiller bb69aeafb5 Propagate Nsock test failure 2026-09-25 16:04:14 +00:00
dmiller a16b2848ef fix c99-ism in nsock test 2026-02-25 20:41:19 +00:00
dmiller d42dd7eed9 Additional tests and checks for gh_heap validity 2024-10-08 21:14:41 +00:00
dmiller 9fc9e6e081 Fix a typo in nsock tests 2024-04-02 21:32:24 +00:00
dmiller a3fb546708 Fix proxy parsing to fail on empty string. Fixes #177 2022-09-20 23:37:29 +00:00
dmiller 0afb05b155 Add tests for nsock proxy parsing 2022-09-20 23:37:28 +00:00
dmiller 1bc5302911 Restore log handler after log tests 2022-09-20 23:37:27 +00:00
dmiller c236ade401 Increase stress level of tests for nsock 2022-09-20 23:37:26 +00:00
dmiller e9f3b12e07 Move a useful function to nbase 2022-09-20 23:37:25 +00:00
dmiller 1c9e1ddbcb Improve assertions in gh_heap
* Assert index matches any time a node is accessed by index, subsuming
  the assertion from #2139.
* Ensure all removed nodes are invalidated, so double-removes will
  trigger assertion failure. Added a test for this.
2022-07-29 15:21:13 +00:00
dmiller d30b3c36a8 Silence ASan warning due to definition of container_of in tests. Same as r32536 2016-08-03 18:29:56 +00:00
dmiller 28bd96b82e Reorder checks and libs to fix building when OpenSSL requires -ldl 2016-07-31 13:57:01 +00:00
dmiller 7f6595112d Better use of configured flags when building Nsock tests 2016-07-30 03:53:59 +00:00
dmiller f4619edece Update http urls for nmap.org to https 2015-11-05 20:41:05 +00:00
henri b55ff2d68f Don't associate nsock logging info to a nspool.
Make current loglevel and current log callback global
to the library. Attaching them to the nsock pool doesn't
bring any benefit and prevents from logging activity in
code sections that don't have access to a pool (such as
proxy chain specification parsing).

Updated external calls and nsock tests accordingly.
2015-06-27 08:21:53 +00:00
dmiller 7e30cb9c4a Only run SSL nsock tests if configured with OpenSSL 2015-02-11 04:55:36 +00:00
dmiller 04ac366666 Fix nsock tests using wrong type (clang complains) 2014-12-31 04:30:58 +00:00
dmiller 59de1a50de Fix Nsock's make check: wrong value tested 2014-11-17 13:32:41 +00:00
dmiller f6d70cd3e6 Revert r33815 (unrelated changes) 2014-11-17 13:31:56 +00:00
dmiller 2b9fade75b Fix Nsock's make check: wrong value tested 2014-11-17 13:25:35 +00:00
henri 97103efdfb Try to trigger connection failure in a more portable way.
The former one was hackish and didn't behave consistently
between operating systems.

Passing in a zero addrlen should reliably make connect(2) fail.
2014-08-10 18:31:00 +00:00
henri a913288efa Added missing variable declaration, as reported by Gisle Vanem 2014-08-10 13:22:09 +00:00
dmiller 9bf8974b38 Let nsock use /bin/sh instead of Bash for testing 2014-08-02 04:38:04 +00:00
henri 240da6ede2 Attempt to connect to 0.0.0.1 to reliably trigger an error.
0.0.0.1 seems to always fail with EINVAL, where 192.0.2.1 actually sends
a probe (and timeout.)
2014-06-11 20:14:20 +00:00
henri a00aa0a460 New nsock regression test: TestConnectFailure.
Trigger a ENETUNREACH error on connect() and check if properly reported.

As of now the test fails, the error isn't delivered.
2014-06-05 19:44:00 +00:00
dmiller 2e047114f6 Improve support for non-included libpcap in nsock 2014-01-26 16:38:22 +00:00
dmiller 2506269bcc Let nsock's configure take the same --with-libpcap as Nmap does 2013-12-11 23:17:50 +00:00
dmiller 89db1ca27c Don't fail nsock/tests/run_tests if ncat can't be found 2013-12-03 23:03:10 +00:00
dmiller ed250a8ff0 Fix linking errors in nsock/tests 2013-12-02 21:23:24 +00:00
henri 457e9dcf62 Added extra cancelation tests.
Schedule and immediately cancel TCP, UDP and SSL connects.
These tests are now grouped in a "cancel" module.
2013-10-23 19:04:10 +00:00
henri 4fd3cc2f10 Allow NSE_TYPE_CONNECT_SSL to be canceled.
This fixes a really bad bug that seems to have been there for a while. Canceling
a nsock connect SSL operation fails with fatal(). I have never seen it in real
life though.

Added a corresponding unit test.
2013-09-15 10:52:07 +00:00
henri 456430c676 Windows compatibility fix.
Initialize winsock before starting nsock test suite.
Initial patch from Gisle Vanem.
2013-08-13 12:36:28 +00:00
henri b0abceec37 Make nsock test suite listeners listen on IPv4
Do everything explicitely to avoid unexpected behaviors. IPv6 will be added
separately at some point.
2013-08-11 08:31:39 +00:00
henri ea8995ebf7 Use a parameter to invoke `ncat' in run_tests.sh
Run: `NCAT=/opt/something/ncat ./run_tests.sh' to invoke a specific binary.
2013-08-11 00:11:21 +00:00
henri 853aaff586 Manage expiration times via a heap queue.
This prevents nsock from iterating over the whole list of events at
each runloop, thus improving performance.

It made it necessary to have pointers from the msevents to the event
lists they belong to. The patch therefore also changes gh_list from
autonomous containers to embedded structures.

Added unit tests accordingly and cosmetic changes to make things look
more consistent.
2013-08-10 23:59:30 +00:00
henri 170a85f677 Don't use ANSI color sequences on windows.
Pointed out by Gisle Vanem. Fixed it in a way that makes it easy to disable on
other systems as well.
2013-08-10 20:19:38 +00:00
henri 23ad881d6b Removed superfluous includes.
Report and patch by Gisle Vanem.
2013-08-06 20:10:57 +00:00
henri 40b11064e4 Use socket_strerror() for error reporting.
Report and patch by Gisle Vanem.
2013-08-06 20:10:49 +00:00
henri 9bfe6e46cc Display the test name before running it.
This makes it easier to identify a test that hangs.
2013-06-15 12:33:31 +00:00
henri 8b7f91cd0f Moved gh_lists tests from nsock/src/ to nsock/tests/ 2013-05-22 14:35:24 +00:00
david b6ca01d295 Use /bin/bash in run_tests.sh.
I got this error:
./run_tests.sh: 42: ./run_tests.sh: Syntax error: "(" unexpected
2013-05-18 19:18:07 +00:00
henri 8475cef210 Return actual error code. 2013-05-11 16:00:11 +00:00
henri 34c407189b s/Little/Minimal/ 2013-05-11 16:00:01 +00:00
henri e54df43edf Readme file. 2013-05-11 10:22:44 +00:00
henri 3776852557 Added simple TCP connect test and setup ncat listeners.
The listeners are ncat-based echo servers:
  - UDP
  - TCP
  - TCP + SSL
2013-05-10 08:26:48 +00:00
henri 1da1fce331 Fixed indentation. 2013-05-08 18:08:48 +00:00
henri 4862bbcbb9 Added a nsock test module for loglevels. 2013-05-08 18:08:38 +00:00
henri b51a943a48 Added a minimal regression test suite for nsock. 2013-05-08 11:52:28 +00:00