diff options
author | George Kadianakis <desnacked@riseup.net> | 2019-03-12 18:11:35 +0200 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2019-03-12 18:11:35 +0200 |
commit | 0ce32affc2d617e487fbedaac1582358fa6fb85c (patch) | |
tree | afcdf037639981f4c46f4d7cee6e54511a64b942 /src/test | |
parent | 9c9214f2c9f4e9511a2e09238e1cc90d81ae02de (diff) | |
parent | 08ddf1f62bf62aa3dc044e0570fb368477223688 (diff) | |
download | tor-0ce32affc2d617e487fbedaac1582358fa6fb85c.tar.gz tor-0ce32affc2d617e487fbedaac1582358fa6fb85c.zip |
Merge branch 'tor-github/pr/763' into maint-0.4.0
Diffstat (limited to 'src/test')
-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 1aa7a3dcd6..fb8df5f0fb 100644 --- a/src/test/test_addr.c +++ b/src/test/test_addr.c @@ -1243,6 +1243,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 } @@ -1257,5 +1274,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 }; |