Skip to content

Commit

Permalink
test: HAVE_INET6 is always defined (#1046)
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredh authored Jan 11, 2024
1 parent 729e464 commit 974f273
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 30 deletions.
6 changes: 0 additions & 6 deletions test/fmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,10 +622,8 @@ int test_fmt_snprintf(void)
const uint8_t v[] = {0xfa, 0xce, 0xb0, 0x0c};
struct sa sa4;
const char addr4[] = "1.2.3.4";
#ifdef HAVE_INET6
struct sa sa6;
const char addr6[] = "2001:5c0:8fff:ffff::d";
#endif
char buf[128], sbuf[8];
int n, err;

Expand All @@ -646,26 +644,22 @@ int test_fmt_snprintf(void)
DEBUG_WARNING("sa_set_str4: %m\n", err);
goto out;
}
#ifdef HAVE_INET6
err = sa_set_str(&sa6, addr6, 0);
if (err) {
DEBUG_WARNING("sa_set_str6: %m\n", err);
goto out;
}
#endif

(void)re_snprintf(buf, sizeof(buf), "%j", &sa4);
if (0 != strcmp(buf, addr4)) {
err = EINVAL;
goto out;
}
#ifdef HAVE_INET6
(void)re_snprintf(buf, sizeof(buf), "%j", &sa6);
if (0 != strcmp(buf, addr6)) {
err = EINVAL;
goto out;
}
#endif

/* Overflow */
n = re_snprintf(buf, 3, "12");
Expand Down
2 changes: 0 additions & 2 deletions test/ice.c
Original file line number Diff line number Diff line change
Expand Up @@ -855,12 +855,10 @@ static const char *testv[] = {
"6 1 TCP 1692401663 192.0.2.3 45687 typ srflx raddr"
" 10.0.1.1 rport 8999 tcptype so",

#ifdef HAVE_INET6
"H76f0ae12 1 UDP 2130706431 fda8:de2d:e95f:4811::1 6054 typ host",

"3113280040 1 UDP 2122255103 2001:aaaa:5ef5:79fb:1847:2c0d:a230:23ab 53329"
" typ host",
#endif

};

Expand Down
8 changes: 0 additions & 8 deletions test/sa.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ int test_sa_cmp(void)
"1.2.3.4", 12344,
false
},
#ifdef HAVE_INET6
{
"0:0:0:0:0:0:0:0", 123,
"::", 123,
Expand Down Expand Up @@ -90,7 +89,6 @@ int test_sa_cmp(void)
"fe80:0000:0000:0000:1215:58ff:fe2d:90ab", 3333,
false
},
#endif
};
size_t i;
int err = 0;
Expand Down Expand Up @@ -133,12 +131,10 @@ int test_sa_decode(void)
{0, AF_INET, "1.2.3.4:0", "1.2.3.4", 0},
{EINVAL, AF_INET, "1.2.3.4", "", 0},
{EINVAL, AF_INET, "1.2.3.4.:1234", "", 0},
#ifdef HAVE_INET6
{0, AF_INET6, "[::1]:1", "::1", 1},
{0, AF_INET6, "[fe80::215:58ff:fe2d:90ab]:3333",
"fe80::215:58ff:fe2d:90ab", 3333},
{EINVAL, AF_INET6, "[::1]", "", 0},
#endif
};
uint32_t i;
int err = 0;
Expand Down Expand Up @@ -204,12 +200,10 @@ int test_sa_class(void)
{true, false, false, "127.0.0.1"},
{true, false, false, "127.3.0.3"},
{false, true, false, "169.254.1.2"},
#ifdef HAVE_INET6
{false, false, true, "::"},
{true, false, false, "::1"},
{false, true, false, "fe80::215:58ff:fe2d:90ab"},
{false, false, false, "2610:a0:c779:b::d1ad:35b4"}
#endif
};
uint32_t i;
int err = 0;
Expand Down Expand Up @@ -279,11 +273,9 @@ int test_sa_ntop(void)
{AF_INET, "0.0.0.0"},
{AF_INET, "1.2.3.4"},
{AF_INET, "255.254.253.128"},
#ifdef HAVE_INET6
{AF_INET6, "::1"},
{AF_INET6, "fe80::215:58ff:fe2d:90ab"},
{AF_INET6, "2610:a0:c779:b::d1ad:35b4"}
#endif
};
uint32_t i;
int err = 0;
Expand Down
6 changes: 0 additions & 6 deletions test/sip.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,9 @@ int test_sip_addr(void)
"\"Agmund Bolt\" <sip:[email protected]:5060;lr;user=phone>"
";tag=foo123;bar=9d7j3",

#ifdef HAVE_INET6
/* RFC 5118 - SIP Torture Test Messages for IPv6 */
"\"Caller\" <sip:caller@[2001:db8::1]>",
"\"Caller\" <sip:caller@[2001:db8::1]:5080>",
#endif

/* gruu */
"\"hei\" <sip:[email protected]:32829;keepalive=crlf>"
Expand Down Expand Up @@ -165,11 +163,9 @@ int test_sip_via(void)
{SIP_TRANSP_UDP, "1.2.3.4", 1234, "z9ghkdkasd"},
{SIP_TRANSP_TCP, "123.123.123.123", 0, "b0ajsd01abcdef918"},
{SIP_TRANSP_TCP, "myhost.com", 0, "b0ajsd01ab2838475"},
#ifdef HAVE_INET6
{SIP_TRANSP_TCP, "fe80::215:58ff:fe2d:90ab", 5060,
"b0ajs01cde38475"},
{SIP_TRANSP_TLS, "fe80::215:58ff:fe2d:90ab", 0, "47daasd5"}
#endif
};
struct sip_msg *msg = NULL;
struct mbuf *mb;
Expand Down Expand Up @@ -198,11 +194,9 @@ int test_sip_via(void)

ipaddr = !sa_set_str(&addr, testv[i].host, testv[i].port);

#ifdef HAVE_INET6
if (ipaddr && AF_INET6 == sa_af(&addr))
err = mbuf_printf(mb, "[%s]", testv[i].host);
else
#endif
err = mbuf_printf(mb, "%s", testv[i].host);
if (err)
goto out;
Expand Down
4 changes: 0 additions & 4 deletions test/stun.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ static const unsigned char respv4[] =
"\x80\x28\x00\x04"
"\xc0\x7d\x4c\x96";

#ifdef HAVE_INET6
static const unsigned char respv6[] =
"\x01\x01\x00\x48"
"\x21\x12\xa4\x42"
Expand All @@ -73,7 +72,6 @@ static const unsigned char respv6[] =
"\x82\x92\xc2\x75\xbf\xe3\xed\x41"
"\x80\x28\x00\x04"
"\xc8\xfb\x0b\x4c";
#endif


static const uint32_t ice_prio = 0x6e0001ff;
Expand Down Expand Up @@ -242,15 +240,13 @@ int test_stun_resp(void)
if (err)
return err;

#ifdef HAVE_INET6
resp.p = (char *)respv6;
resp.l = sizeof(respv6) - 1;
err = sa_set_str(&maddr, "2001:db8:1234:5678:11:2233:4455:6677",
32853);
if (err)
return err;
err = test_resp(&resp, &maddr);
#endif

return err;
}
Expand Down
4 changes: 0 additions & 4 deletions test/uri.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ int test_uri(void)
"sip:atlanta.com;method=REGISTER?to=alice%40atlanta.com",
"sip:alice;[email protected]",

#ifdef HAVE_INET6
/* IPv6 */
"sip:[::1];transport=udp",
"sip:[::1]:1234;transport=udp",
Expand All @@ -53,7 +52,6 @@ int test_uri(void)
"sip:[2001:db8::10:5070]",
"sip:[2001:db8::10]:5070",
"sip:user@[2001:db8::10]",
#endif
};
struct uri uri;
struct mbuf mb;
Expand Down Expand Up @@ -124,7 +122,6 @@ int test_uri_encode(void)
PL("")},
"sip:user:pass@host:443/wss/;transport=wss"
},
#ifdef HAVE_INET6
{{PL("sip"),
PL("user"),
PL(""),
Expand All @@ -135,7 +132,6 @@ int test_uri_encode(void)
PL("")},
"sip:user@[::1]:1234;transport=udp"
}
#endif
};
struct mbuf mb;
int err = EINVAL;
Expand Down

0 comments on commit 974f273

Please sign in to comment.