Make improvements

- Clean up sigaction() code
- Add a port scanner example
- Introduce a ParseCidr() API
- Clean up our futex abstraction code
- Fix a harmless integer overflow in ParseIp()
- Use kernel semaphores on NetBSD to make threads much faster
This commit is contained in:
Justine Tunney 2022-11-07 02:22:09 -08:00
parent 539bddce8c
commit c995838e5c
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
107 changed files with 1085 additions and 492 deletions

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/testlib/testlib.h"
#include "net/http/http.h"
#include "net/http/ip.h"
TEST(ParseIp, test) {
EXPECT_EQ(-1, ParseIp("", -1));
@ -30,6 +30,8 @@ TEST(ParseIp, test) {
EXPECT_EQ(0x00000000, ParseIp("...", -1)); /* meh */
EXPECT_EQ(0x80000304, ParseIp("128.0.3.4", -1));
EXPECT_EQ(0x80000304, ParseIp("128..3.4", -1));
EXPECT_EQ(-1, ParseIp("4294967296", -1));
EXPECT_EQ(-1, ParseIp("255.255.255.256", -1));
EXPECT_EQ(-1, ParseIp("256.255.255.255", -1));
EXPECT_EQ(-1, ParseIp("hello", -1));
EXPECT_EQ(-1, ParseIp("hello\177", -1));