libdns refactoring: get rid of multiple versions of dns_keytable_add, dns_iptable_addprefix and dns_iptable_addprefix
This commit is contained in:
@@ -138,13 +138,13 @@ ATF_TC_BODY(dns_acl_isinsecure, tc) {
|
||||
|
||||
inaddr.s_addr = htonl(0x0a000000); /* 10.0.0.0 */
|
||||
isc_netaddr_fromin(&addr, &inaddr);
|
||||
result = dns_iptable_addprefix2(pos4pos6->iptable, &addr, 8,
|
||||
ISC_TRUE, ecs[pass].first);
|
||||
result = dns_iptable_addprefix(pos4pos6->iptable, &addr, 8,
|
||||
ISC_TRUE, ecs[pass].first);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
addr.family = AF_INET6; /* 0a00:: */
|
||||
result = dns_iptable_addprefix2(pos4pos6->iptable, &addr, 8,
|
||||
ISC_TRUE, ecs[pass].second);
|
||||
result = dns_iptable_addprefix(pos4pos6->iptable, &addr, 8,
|
||||
ISC_TRUE, ecs[pass].second);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
result = dns_acl_merge(notpos4pos6, pos4pos6, ISC_FALSE);
|
||||
@@ -152,13 +152,13 @@ ATF_TC_BODY(dns_acl_isinsecure, tc) {
|
||||
|
||||
inaddr.s_addr = htonl(0x0a000000); /* !10.0.0.0/8 */
|
||||
isc_netaddr_fromin(&addr, &inaddr);
|
||||
result = dns_iptable_addprefix2(neg4pos6->iptable, &addr, 8,
|
||||
ISC_FALSE, ecs[pass].first);
|
||||
result = dns_iptable_addprefix(neg4pos6->iptable, &addr, 8,
|
||||
ISC_FALSE, ecs[pass].first);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
addr.family = AF_INET6; /* 0a00::/8 */
|
||||
result = dns_iptable_addprefix2(neg4pos6->iptable, &addr, 8,
|
||||
ISC_TRUE, ecs[pass].second);
|
||||
result = dns_iptable_addprefix(neg4pos6->iptable, &addr, 8,
|
||||
ISC_TRUE, ecs[pass].second);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
result = dns_acl_merge(notneg4pos6, neg4pos6, ISC_FALSE);
|
||||
@@ -166,13 +166,13 @@ ATF_TC_BODY(dns_acl_isinsecure, tc) {
|
||||
|
||||
inaddr.s_addr = htonl(0x0a000000); /* 10.0.0.0/8 */
|
||||
isc_netaddr_fromin(&addr, &inaddr);
|
||||
result = dns_iptable_addprefix2(pos4neg6->iptable, &addr, 8,
|
||||
ISC_TRUE, ecs[pass].first);
|
||||
result = dns_iptable_addprefix(pos4neg6->iptable, &addr, 8,
|
||||
ISC_TRUE, ecs[pass].first);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
addr.family = AF_INET6; /* !0a00::/8 */
|
||||
result = dns_iptable_addprefix2(pos4neg6->iptable, &addr, 8,
|
||||
ISC_FALSE, ecs[pass].second);
|
||||
result = dns_iptable_addprefix(pos4neg6->iptable, &addr, 8,
|
||||
ISC_FALSE, ecs[pass].second);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
result = dns_acl_merge(notpos4neg6, pos4neg6, ISC_FALSE);
|
||||
@@ -180,13 +180,13 @@ ATF_TC_BODY(dns_acl_isinsecure, tc) {
|
||||
|
||||
inaddr.s_addr = htonl(0x0a000000); /* !10.0.0.0/8 */
|
||||
isc_netaddr_fromin(&addr, &inaddr);
|
||||
result = dns_iptable_addprefix2(neg4neg6->iptable, &addr, 8,
|
||||
ISC_FALSE, ecs[pass].first);
|
||||
result = dns_iptable_addprefix(neg4neg6->iptable, &addr, 8,
|
||||
ISC_FALSE, ecs[pass].first);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
addr.family = AF_INET6; /* !0a00::/8 */
|
||||
result = dns_iptable_addprefix2(neg4neg6->iptable, &addr, 8,
|
||||
ISC_FALSE, ecs[pass].second);
|
||||
result = dns_iptable_addprefix(neg4neg6->iptable, &addr, 8,
|
||||
ISC_FALSE, ecs[pass].second);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
result = dns_acl_merge(notneg4neg6, neg4neg6, ISC_FALSE);
|
||||
@@ -224,16 +224,16 @@ ATF_TC_BODY(dns_acl_isinsecure, tc) {
|
||||
|
||||
inaddr.s_addr = htonl(0x7f000001); /* 127.0.0.1 */
|
||||
isc_netaddr_fromin(&addr, &inaddr);
|
||||
result = dns_iptable_addprefix2(loop4->iptable, &addr, 32,
|
||||
ISC_TRUE, ecs[pass].first);
|
||||
result = dns_iptable_addprefix(loop4->iptable, &addr, 32,
|
||||
ISC_TRUE, ecs[pass].first);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
result = dns_acl_merge(notloop4, loop4, ISC_FALSE);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
isc_netaddr_fromin6(&addr, &in6addr_loopback); /* ::1 */
|
||||
result = dns_iptable_addprefix2(loop6->iptable, &addr, 128,
|
||||
ISC_TRUE, ecs[pass].first);
|
||||
result = dns_iptable_addprefix(loop6->iptable, &addr, 128,
|
||||
ISC_TRUE, ecs[pass].first);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
result = dns_acl_merge(notloop6, loop6, ISC_FALSE);
|
||||
@@ -270,13 +270,13 @@ ATF_TC_BODY(dns_acl_isinsecure, tc) {
|
||||
|
||||
inaddr.s_addr = htonl(0x7f000001); /* 127.0.0.1 */
|
||||
isc_netaddr_fromin(&addr, &inaddr);
|
||||
result = dns_iptable_addprefix2(loop4pos6->iptable, &addr, 32,
|
||||
ISC_TRUE, ecs[pass].first);
|
||||
result = dns_iptable_addprefix(loop4pos6->iptable, &addr, 32,
|
||||
ISC_TRUE, ecs[pass].first);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
addr.family = AF_INET6; /* f700:0001::/32 */
|
||||
result = dns_iptable_addprefix2(loop4pos6->iptable, &addr, 32,
|
||||
ISC_TRUE, ecs[pass].second);
|
||||
result = dns_iptable_addprefix(loop4pos6->iptable, &addr, 32,
|
||||
ISC_TRUE, ecs[pass].second);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
result = dns_acl_merge(notloop4pos6, loop4pos6, ISC_FALSE);
|
||||
@@ -284,13 +284,13 @@ ATF_TC_BODY(dns_acl_isinsecure, tc) {
|
||||
|
||||
inaddr.s_addr = htonl(0x7f000001); /* 127.0.0.1 */
|
||||
isc_netaddr_fromin(&addr, &inaddr);
|
||||
result = dns_iptable_addprefix2(loop4neg6->iptable, &addr, 32,
|
||||
ISC_TRUE, ecs[pass].first);
|
||||
result = dns_iptable_addprefix(loop4neg6->iptable, &addr, 32,
|
||||
ISC_TRUE, ecs[pass].first);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
addr.family = AF_INET6; /* !f700:0001::/32 */
|
||||
result = dns_iptable_addprefix2(loop4neg6->iptable, &addr, 32,
|
||||
ISC_FALSE, ecs[pass].second);
|
||||
result = dns_iptable_addprefix(loop4neg6->iptable, &addr, 32,
|
||||
ISC_FALSE, ecs[pass].second);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
result = dns_acl_merge(notloop4neg6, loop4neg6, ISC_FALSE);
|
||||
|
||||
@@ -129,12 +129,12 @@ create_tables() {
|
||||
|
||||
/* Add a normal key */
|
||||
create_key(257, 3, 5, "example.com", keystr1, &key);
|
||||
ATF_REQUIRE_EQ(dns_keytable_add2(keytable, ISC_FALSE, ISC_FALSE, &key),
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_FALSE, ISC_FALSE, &key),
|
||||
ISC_R_SUCCESS);
|
||||
|
||||
/* Add an initializing managed key */
|
||||
create_key(257, 3, 5, "managed.com", keystr1, &key);
|
||||
ATF_REQUIRE_EQ(dns_keytable_add2(keytable, ISC_TRUE, ISC_TRUE, &key),
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_TRUE, ISC_TRUE, &key),
|
||||
ISC_R_SUCCESS);
|
||||
|
||||
/* Add a null key */
|
||||
@@ -193,7 +193,7 @@ ATF_TC_BODY(add, tc) {
|
||||
* nextkeynode() should still return NOTFOUND.
|
||||
*/
|
||||
create_key(257, 3, 5, "example.com", keystr1, &key);
|
||||
ATF_REQUIRE_EQ(dns_keytable_add2(keytable, ISC_FALSE, ISC_FALSE, &key),
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_FALSE, ISC_FALSE, &key),
|
||||
ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keytable_nextkeynode(keytable, keynode,
|
||||
&next_keynode), ISC_R_NOTFOUND);
|
||||
@@ -201,7 +201,7 @@ ATF_TC_BODY(add, tc) {
|
||||
/* Add another key (different keydata) */
|
||||
dns_keytable_detachkeynode(keytable, &keynode);
|
||||
create_key(257, 3, 5, "example.com", keystr2, &key);
|
||||
ATF_REQUIRE_EQ(dns_keytable_add2(keytable, ISC_FALSE, ISC_FALSE, &key),
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_FALSE, ISC_FALSE, &key),
|
||||
ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("example.com"),
|
||||
&keynode), ISC_R_SUCCESS);
|
||||
@@ -231,7 +231,7 @@ ATF_TC_BODY(add, tc) {
|
||||
* ISC_R_NOTFOUND and that the added key is an initializing key.
|
||||
*/
|
||||
create_key(257, 3, 5, "managed.com", keystr2, &key);
|
||||
ATF_REQUIRE_EQ(dns_keytable_add2(keytable, ISC_TRUE, ISC_TRUE, &key),
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_TRUE, ISC_TRUE, &key),
|
||||
ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("managed.com"),
|
||||
&keynode), ISC_R_SUCCESS);
|
||||
@@ -248,7 +248,7 @@ ATF_TC_BODY(add, tc) {
|
||||
* nodes for managed.com, both containing non-initializing keys.
|
||||
*/
|
||||
create_key(257, 3, 5, "managed.com", keystr2, &key);
|
||||
ATF_REQUIRE_EQ(dns_keytable_add2(keytable, ISC_TRUE, ISC_FALSE, &key),
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_TRUE, ISC_FALSE, &key),
|
||||
ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("managed.com"),
|
||||
&keynode), ISC_R_SUCCESS);
|
||||
@@ -269,7 +269,7 @@ ATF_TC_BODY(add, tc) {
|
||||
* that the added key is an initializing key.
|
||||
*/
|
||||
create_key(257, 3, 5, "two.com", keystr1, &key);
|
||||
ATF_REQUIRE_EQ(dns_keytable_add2(keytable, ISC_TRUE, ISC_TRUE, &key),
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_TRUE, ISC_TRUE, &key),
|
||||
ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("two.com"),
|
||||
&keynode), ISC_R_SUCCESS);
|
||||
@@ -284,7 +284,7 @@ ATF_TC_BODY(add, tc) {
|
||||
* ISC_R_NOTFOUND and that the added key is not an initializing key.
|
||||
*/
|
||||
create_key(257, 3, 5, "two.com", keystr2, &key);
|
||||
ATF_REQUIRE_EQ(dns_keytable_add2(keytable, ISC_TRUE, ISC_FALSE, &key),
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_TRUE, ISC_FALSE, &key),
|
||||
ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("two.com"),
|
||||
&keynode), ISC_R_SUCCESS);
|
||||
@@ -301,7 +301,7 @@ ATF_TC_BODY(add, tc) {
|
||||
* nodes for two.com, both containing non-initializing keys.
|
||||
*/
|
||||
create_key(257, 3, 5, "two.com", keystr1, &key);
|
||||
ATF_REQUIRE_EQ(dns_keytable_add2(keytable, ISC_TRUE, ISC_FALSE, &key),
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_TRUE, ISC_FALSE, &key),
|
||||
ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("two.com"),
|
||||
&keynode), ISC_R_SUCCESS);
|
||||
@@ -323,7 +323,7 @@ ATF_TC_BODY(add, tc) {
|
||||
ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("null.example"),
|
||||
&null_keynode), ISC_R_SUCCESS);
|
||||
create_key(257, 3, 5, "null.example", keystr2, &key);
|
||||
ATF_REQUIRE_EQ(dns_keytable_add2(keytable, ISC_FALSE, ISC_FALSE, &key),
|
||||
ATF_REQUIRE_EQ(dns_keytable_add(keytable, ISC_FALSE, ISC_FALSE, &key),
|
||||
ISC_R_SUCCESS);
|
||||
ATF_REQUIRE_EQ(dns_keytable_find(keytable, str2name("null.example"),
|
||||
&keynode), ISC_R_SUCCESS);
|
||||
@@ -629,7 +629,7 @@ ATF_TC_BODY(nta, tc) {
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
create_key(257, 3, 5, "example", keystr1, &key);
|
||||
result = dns_keytable_add2(keytable, ISC_FALSE, ISC_FALSE, &key);
|
||||
result = dns_keytable_add(keytable, ISC_FALSE, ISC_FALSE, &key);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
isc_stdtime_get(&now);
|
||||
|
||||
Reference in New Issue
Block a user