diff options
author | teor <teor@torproject.org> | 2019-03-08 12:32:04 +1000 |
---|---|---|
committer | teor <teor@torproject.org> | 2019-03-08 12:33:00 +1000 |
commit | 08ddf1f62bf62aa3dc044e0570fb368477223688 (patch) | |
tree | 252a396832b95968b1dfb418e2e89f75856bd642 /src/test/test_addr.c | |
parent | d6f77b99dac1a368514cfcfc1d6c5908ef6dd74a (diff) | |
parent | 63b404911441a7691949c475a374569d668a1b32 (diff) | |
download | tor-08ddf1f62bf62aa3dc044e0570fb368477223688.tar.gz tor-08ddf1f62bf62aa3dc044e0570fb368477223688.zip |
Merge remote-tracking branch 'bug28525_029' into maint-0.3.5
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 985f43b3fa..8868edce25 100644 --- a/src/test/test_addr.c +++ b/src/test/test_addr.c @@ -1189,6 +1189,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 } @@ -1203,5 +1220,6 @@ 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 }; |