diff options
author | teor <teor@torproject.org> | 2019-08-09 13:53:34 +1000 |
---|---|---|
committer | teor <teor@torproject.org> | 2019-08-09 13:53:34 +1000 |
commit | 45f30ba5faf1c27fd8404c2fb95b1a79b9f59984 (patch) | |
tree | 4aea8ada612c49b9e2eec261510af3967a8183ae /src/test/test_addr.c | |
parent | 05018d55cabdf9c0f80d6bf78ca30c795b60500e (diff) | |
parent | 63b404911441a7691949c475a374569d668a1b32 (diff) | |
download | tor-45f30ba5faf1c27fd8404c2fb95b1a79b9f59984.tar.gz tor-45f30ba5faf1c27fd8404c2fb95b1a79b9f59984.zip |
Merge remote-tracking branch 'tor-github/pr/762' into maint-0.2.9
Diffstat (limited to 'src/test/test_addr.c')
-rw-r--r-- | src/test/test_addr.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/test_addr.c b/src/test/test_addr.c index be440a0925..5c4b6449cd 100644 --- a/src/test/test_addr.c +++ b/src/test/test_addr.c @@ -1063,6 +1063,23 @@ test_addr_make_null(void *data) tor_free(zeros); } +#define TEST_ADDR_INTERNAL(a, for_listening, rv) STMT_BEGIN \ + tor_addr_t t; \ + tt_int_op(tor_inet_pton(AF_INET, a, &t.addr.in_addr), OP_EQ, 1); \ + t.family = AF_INET; \ + tt_int_op(tor_addr_is_internal(&t, for_listening), OP_EQ, rv); \ + STMT_END; + +static void +test_addr_rfc6598(void *arg) +{ + (void)arg; + TEST_ADDR_INTERNAL("100.64.0.1", 0, 1); + TEST_ADDR_INTERNAL("100.64.0.1", 1, 0); + done: + ; +} + #define ADDR_LEGACY(name) \ { #name, test_addr_ ## name , 0, NULL, NULL } @@ -1076,6 +1093,7 @@ struct testcase_t addr_tests[] = { { "sockaddr_to_str", test_addr_sockaddr_to_str, 0, NULL, NULL }, { "is_loopback", test_addr_is_loopback, 0, NULL, NULL }, { "make_null", test_addr_make_null, 0, NULL, NULL }, + { "rfc6598", test_addr_rfc6598, 0, NULL, NULL }, END_OF_TESTCASES }; |