1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

ctdb-tests: Add extra IPv6 socket parsing tests

Add tests to confirm that square brackets are handled and that
IPv4-mapped IPv6 addresses are parsed as expected.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
This commit is contained in:
Martin Schwenke 2022-01-05 12:09:45 +11:00 committed by Volker Lendecke
parent 224e99804e
commit 255fe69c90

View File

@ -367,6 +367,25 @@ int main(int argc, char *argv[])
test_sock_addr_cmp("fe80::6af7:28ff:fefa:d136:123",
"fe80::6af7:28ff:fefa:d136:122" , true, 1);
/*
* Confirm equivalence of IPv6 sockets with and without
* square-brackets
*/
test_sock_addr_cmp("[::1]:234", "::1:234", true, 0);
test_sock_addr_cmp("[fe80::6af7:28ff:fefa:d136]:234",
"fe80::6af7:28ff:fefa:d136:234",
true,
0);
/* Check IPv4-mapped IPv6 addresses */
test_sock_addr_cmp("::ffff:172.16.0.27:977",
"172.16.0.27:977",
true,
0);
test_sock_addr_cmp("[::ffff:172.16.0.27]:977",
"172.16.0.27:977",
true,
0);
test_sock_addr_mask_from_string("127.0.0.1/8");
test_sock_addr_mask_from_string("::1/128");
test_sock_addr_mask_from_string("fe80::6af7:28ff:fefa:d136/64");