summaryrefslogtreecommitdiffstats
path: root/source4/torture/nbt
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-06-24 16:26:23 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-06-24 16:26:23 +1000
commit6da26870e0ae5acd6ff49a30ec2f6886b44d095e (patch)
tree850c71039563c16a5d563c47e7ba2ab645baf198 /source4/torture/nbt
parent6925a799d04c6fa59dd2ddef1f5510f9bb7d17d1 (diff)
parent2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 (diff)
downloadsamba-4.0.0alpha16.tar.gz
samba-4.0.0alpha16.tar.xz
samba-4.0.0alpha16.zip
Merge 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 as Samba-4.0alpha16samba-4.0.0alpha16
Diffstat (limited to 'source4/torture/nbt')
-rw-r--r--source4/torture/nbt/browse.c54
-rw-r--r--source4/torture/nbt/dgram.c23
-rw-r--r--source4/torture/nbt/nbt.c4
-rw-r--r--source4/torture/nbt/register.c8
-rw-r--r--source4/torture/nbt/wins.c4
-rw-r--r--source4/torture/nbt/winsbench.c4
-rw-r--r--source4/torture/nbt/winsreplication.c151
7 files changed, 157 insertions, 91 deletions
diff --git a/source4/torture/nbt/browse.c b/source4/torture/nbt/browse.c
deleted file mode 100644
index dcf96ba3ef3..00000000000
--- a/source4/torture/nbt/browse.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- Browse service
-
- (C) Jelmer Vernooij 2005
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "includes.h"
-#include "librpc/gen_ndr/nbt.h"
-#include "libcli/resolve/resolve.h"
-#include "torture/torture.h"
-
-/*
- test nbt dgram operations
-*/
-bool torture_nbt_browse(struct torture_context *torture)
-{
- const char *address;
- struct nbt_name name;
- TALLOC_CTX *mem_ctx = talloc_new(NULL);
- NTSTATUS status;
- bool ret = true;
-
- name.name = lpcfg_workgroup();
- name.type = NBT_NAME_BROWSER;
- name.scope = NULL;
-
- /* do an initial name resolution to find its IP */
- status = resolve_name(&name, mem_ctx, &address, torture->ev);
- if (!NT_STATUS_IS_OK(status)) {
- printf("Failed to resolve %s - %s\n",
- name.name, nt_errstr(status));
- talloc_free(mem_ctx);
- return false;
- }
-
- talloc_free(mem_ctx);
-
- return ret;
-}
diff --git a/source4/torture/nbt/dgram.c b/source4/torture/nbt/dgram.c
index 36914bdcc36..aa4759edaf9 100644
--- a/source4/torture/nbt/dgram.c
+++ b/source4/torture/nbt/dgram.c
@@ -86,11 +86,13 @@ static bool nbt_test_netlogon(struct torture_context *tctx)
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok(tctx,
- resolve_name(lpcfg_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev),
+ resolve_name_ex(lpcfg_resolve_context(tctx->lp_ctx),
+ 0, 0,
+ &name, tctx, &address, tctx->ev),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
- load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
- myaddress = talloc_strdup(dgmsock, iface_best_ip(ifaces, address));
+ load_interface_list(tctx, tctx->lp_ctx, &ifaces);
+ myaddress = talloc_strdup(dgmsock, iface_list_best_ip(ifaces, address));
socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name,
@@ -180,11 +182,13 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok(tctx,
- resolve_name(lpcfg_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev),
+ resolve_name_ex(lpcfg_resolve_context(tctx->lp_ctx),
+ 0, 0,
+ &name, tctx, &address, tctx->ev),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
- load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
- myaddress = talloc_strdup(dgmsock, iface_best_ip(ifaces, address));
+ load_interface_list(tctx, tctx->lp_ctx, &ifaces);
+ myaddress = talloc_strdup(dgmsock, iface_list_best_ip(ifaces, address));
socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name,
myaddress, lpcfg_dgram_port(tctx->lp_ctx));
@@ -450,11 +454,12 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok(tctx,
- resolve_name(lpcfg_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev),
+ resolve_name_ex(lpcfg_resolve_context(tctx->lp_ctx),
+ 0, 0, &name, tctx, &address, tctx->ev),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
- load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
- myaddress = talloc_strdup(dgmsock, iface_best_ip(ifaces, address));
+ load_interface_list(tctx, tctx->lp_ctx, &ifaces);
+ myaddress = talloc_strdup(dgmsock, iface_list_best_ip(ifaces, address));
socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name,
myaddress, lpcfg_dgram_port(tctx->lp_ctx));
diff --git a/source4/torture/nbt/nbt.c b/source4/torture/nbt/nbt.c
index 7c45f867e74..1b7fe49cf84 100644
--- a/source4/torture/nbt/nbt.c
+++ b/source4/torture/nbt/nbt.c
@@ -39,7 +39,9 @@ bool torture_nbt_get_name(struct torture_context *tctx,
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok(tctx,
- resolve_name(lpcfg_resolve_context(tctx->lp_ctx), name, tctx, address, tctx->ev),
+ resolve_name_ex(lpcfg_resolve_context(tctx->lp_ctx),
+ 0, 0,
+ name, tctx, address, tctx->ev),
talloc_asprintf(tctx,
"Failed to resolve %s", name->name));
diff --git a/source4/torture/nbt/register.c b/source4/torture/nbt/register.c
index d52ae4181ec..24ca328b30f 100644
--- a/source4/torture/nbt/register.c
+++ b/source4/torture/nbt/register.c
@@ -54,9 +54,9 @@ static bool nbt_register_own(struct torture_context *tctx)
if (!torture_nbt_get_name(tctx, &name, &address))
return false;
- load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
+ load_interface_list(tctx, tctx->lp_ctx, &ifaces);
- myaddress = iface_best_ip(ifaces, address);
+ myaddress = iface_list_best_ip(ifaces, address);
socket_address = socket_address_from_strings(tctx, nbtsock->sock->backend_name,
myaddress, 0);
@@ -123,9 +123,9 @@ static bool nbt_refresh_own(struct torture_context *tctx)
if (!torture_nbt_get_name(tctx, &name, &address))
return false;
- load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
+ load_interface_list(tctx, tctx->lp_ctx, &ifaces);
- myaddress = iface_best_ip(ifaces, address);
+ myaddress = iface_list_best_ip(ifaces, address);
socket_address = socket_address_from_strings(tctx, nbtsock->sock->backend_name,
myaddress, 0);
diff --git a/source4/torture/nbt/wins.c b/source4/torture/nbt/wins.c
index 0ddaa8a05a1..571249f562d 100644
--- a/source4/torture/nbt/wins.c
+++ b/source4/torture/nbt/wins.c
@@ -65,9 +65,9 @@ static bool nbt_test_wins_name(struct torture_context *tctx, const char *address
struct interface *ifaces;
bool low_port = try_low_port;
- load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
+ load_interface_list(tctx, tctx->lp_ctx, &ifaces);
- myaddress = talloc_strdup(tctx, iface_best_ip(ifaces, address));
+ myaddress = talloc_strdup(tctx, iface_list_best_ip(ifaces, address));
socket_address = socket_address_from_strings(tctx,
nbtsock->sock->backend_name,
diff --git a/source4/torture/nbt/winsbench.c b/source4/torture/nbt/winsbench.c
index aff620878c8..cb71d8755dd 100644
--- a/source4/torture/nbt/winsbench.c
+++ b/source4/torture/nbt/winsbench.c
@@ -246,8 +246,8 @@ static bool bench_wins(struct torture_context *tctx)
state->registered = talloc_zero_array(state, bool, state->num_names);
state->wins_server = address;
state->wins_port = lpcfg_nbt_port(tctx->lp_ctx);
- load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
- state->my_ip = talloc_strdup(tctx, iface_best_ip(ifaces, address));
+ load_interface_list(tctx, tctx->lp_ctx, &ifaces);
+ state->my_ip = talloc_strdup(tctx, iface_list_best_ip(ifaces, address));
state->ttl = timelimit;
my_ip = socket_address_from_strings(nbtsock, nbtsock->sock->backend_name,
diff --git a/source4/torture/nbt/winsreplication.c b/source4/torture/nbt/winsreplication.c
index cf8db494cab..7165f10dbbb 100644
--- a/source4/torture/nbt/winsreplication.c
+++ b/source4/torture/nbt/winsreplication.c
@@ -615,14 +615,14 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
ctx->nbtsock = nbt_name_socket_init(ctx, tctx->ev);
if (!ctx->nbtsock) return NULL;
- load_interfaces(tctx, lpcfg_interfaces(tctx->lp_ctx), &ifaces);
+ load_interface_list(tctx, tctx->lp_ctx, &ifaces);
- ctx->myaddr = socket_address_from_strings(tctx, ctx->nbtsock->sock->backend_name, iface_best_ip(ifaces, address), 0);
+ ctx->myaddr = socket_address_from_strings(tctx, ctx->nbtsock->sock->backend_name, iface_list_best_ip(ifaces, address), 0);
if (!ctx->myaddr) return NULL;
- for (i = 0; i < iface_count(ifaces); i++) {
- if (strcmp(ctx->myaddr->addr, iface_n_ip(ifaces, i)) == 0) continue;
- ctx->myaddr2 = socket_address_from_strings(tctx, ctx->nbtsock->sock->backend_name, iface_n_ip(ifaces, i), 0);
+ for (i = 0; i < iface_list_count(ifaces); i++) {
+ if (strcmp(ctx->myaddr->addr, iface_list_n_ip(ifaces, i)) == 0) continue;
+ ctx->myaddr2 = socket_address_from_strings(tctx, ctx->nbtsock->sock->backend_name, iface_list_n_ip(ifaces, i), 0);
if (!ctx->myaddr2) return NULL;
break;
}
@@ -679,12 +679,12 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
ctx->addresses_best[0].owner = ctx->b.address;
ctx->addresses_best[0].ip = ctx->myaddr->addr;
- ctx->addresses_all_num = iface_count(ifaces);
+ ctx->addresses_all_num = iface_list_count(ifaces);
ctx->addresses_all = talloc_array(ctx, struct wrepl_ip, ctx->addresses_all_num);
if (!ctx->addresses_all) return NULL;
for (i=0; i < ctx->addresses_all_num; i++) {
ctx->addresses_all[i].owner = ctx->b.address;
- ctx->addresses_all[i].ip = talloc_strdup(ctx->addresses_all, iface_n_ip(ifaces, i));
+ ctx->addresses_all[i].ip = talloc_strdup(ctx->addresses_all, iface_list_n_ip(ifaces, i));
if (!ctx->addresses_all[i].ip) return NULL;
}
@@ -6701,6 +6701,7 @@ static bool test_conflict_owned_released_vs_replica(struct torture_context *tctx
}
struct test_conflict_owned_active_vs_replica_struct {
+ struct torture_context *tctx;
const char *line; /* just better debugging */
const char *section; /* just better debugging */
struct nbt_name name;
@@ -6760,6 +6761,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. unique,active with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_UA_SI_U", 0x00, NULL),
.wins = {
@@ -6786,6 +6788,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. unique,active with different ip(s), positive response
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_UA_DI_P", 0x00, NULL),
.wins = {
@@ -6813,6 +6816,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. unique,active with different ip(s), positive response other ips
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_UA_DI_O", 0x00, NULL),
.wins = {
@@ -6842,6 +6846,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. unique,active with different ip(s), negative response
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_UA_DI_N", 0x00, NULL),
.wins = {
@@ -6869,6 +6874,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. unique,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_UT_SI_U", 0x00, NULL),
.wins = {
@@ -6895,6 +6901,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. unique,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_UT_DI_U", 0x00, NULL),
.wins = {
@@ -6924,6 +6931,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. group,active with same ip(s), release expected
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_GA_SI_R", 0x00, NULL),
.wins = {
@@ -6951,6 +6959,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. group,active with different ip(s), release expected
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_GA_DI_R", 0x00, NULL),
.wins = {
@@ -6978,6 +6987,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. group,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_GT_SI_U", 0x00, NULL),
.wins = {
@@ -7004,6 +7014,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. group,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_GT_DI_U", 0x00, NULL),
.wins = {
@@ -7033,6 +7044,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. sgroup,active with same ip(s), release expected
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_SA_SI_R", 0x00, NULL),
.wins = {
@@ -7060,6 +7072,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. group,active with different ip(s), release expected
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_SA_DI_R", 0x00, NULL),
.wins = {
@@ -7087,6 +7100,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. sgroup,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_ST_SI_U", 0x00, NULL),
.wins = {
@@ -7113,6 +7127,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. sgroup,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_ST_DI_U", 0x00, NULL),
.wins = {
@@ -7142,6 +7157,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. mhomed,active with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_MA_SI_U", 0x00, NULL),
.wins = {
@@ -7168,6 +7184,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. mhomed,active with superset ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_MA_SP_U", 0x00, NULL),
.wins = {
@@ -7194,6 +7211,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. mhomed,active with different ip(s), positive response
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_MA_DI_P", 0x00, NULL),
.wins = {
@@ -7221,6 +7239,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. mhomed,active with different ip(s), positive response other ips
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_MA_DI_O", 0x00, NULL),
.wins = {
@@ -7250,6 +7269,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. mhomed,active with different ip(s), negative response
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_MA_DI_N", 0x00, NULL),
.wins = {
@@ -7277,6 +7297,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. mhomed,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_MT_SI_U", 0x00, NULL),
.wins = {
@@ -7303,6 +7324,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. mhomed,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_MT_DI_U", 0x00, NULL),
.wins = {
@@ -7332,6 +7354,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. unique,active with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_UA_SI_U", 0x00, NULL),
.wins = {
@@ -7358,6 +7381,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. unique,active with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_UA_DI_U", 0x00, NULL),
.wins = {
@@ -7384,6 +7408,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. unique,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_UT_SI_U", 0x00, NULL),
.wins = {
@@ -7410,6 +7435,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. unique,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_UT_DI_U", 0x00, NULL),
.wins = {
@@ -7439,6 +7465,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. group,active with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_GA_SI_U", 0x00, NULL),
.wins = {
@@ -7465,6 +7492,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. group,active with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_GA_DI_U", 0x00, NULL),
.wins = {
@@ -7491,6 +7519,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. group,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_GT_SI_U", 0x00, NULL),
.wins = {
@@ -7517,6 +7546,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. group,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_GT_DI_U", 0x00, NULL),
.wins = {
@@ -7546,6 +7576,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. sgroup,active with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_SA_SI_U", 0x00, NULL),
.wins = {
@@ -7572,6 +7603,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. sgroup,active with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_SA_DI_U", 0x00, NULL),
.wins = {
@@ -7598,6 +7630,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. sgroup,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_ST_SI_U", 0x00, NULL),
.wins = {
@@ -7624,6 +7657,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. sgroup,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_ST_DI_U", 0x00, NULL),
.wins = {
@@ -7653,6 +7687,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. mhomed,active with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_MA_SI_U", 0x00, NULL),
.wins = {
@@ -7679,6 +7714,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. mhomed,active with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_MA_DI_U", 0x00, NULL),
.wins = {
@@ -7705,6 +7741,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. mhomed,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_MT_SI_U", 0x00, NULL),
.wins = {
@@ -7731,6 +7768,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* group,active vs. mhomed,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_GA_MT_DI_U", 0x00, NULL),
.wins = {
@@ -7760,6 +7798,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. unique,active with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_UA_SI_U", 0x1C, NULL),
.wins = {
@@ -7786,6 +7825,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. unique,active with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_UA_DI_U", 0x1C, NULL),
.wins = {
@@ -7812,6 +7852,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. unique,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_UT_SI_U", 0x1C, NULL),
.wins = {
@@ -7838,6 +7879,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. unique,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_UT_DI_U", 0x1C, NULL),
.wins = {
@@ -7867,6 +7909,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. group,active with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_GA_SI_U", 0x1C, NULL),
.wins = {
@@ -7893,6 +7936,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. group,active with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_GA_DI_U", 0x1C, NULL),
.wins = {
@@ -7919,6 +7963,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. group,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_GT_SI_U", 0x1C, NULL),
.wins = {
@@ -7945,6 +7990,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. group,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_GT_DI_U", 0x1C, NULL),
.wins = {
@@ -7974,6 +8020,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. mhomed,active with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_MA_SI_U", 0x1C, NULL),
.wins = {
@@ -8000,6 +8047,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. mhomed,active with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_MA_DI_U", 0x1C, NULL),
.wins = {
@@ -8026,6 +8074,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. mhomed,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_MT_SI_U", 0x1C, NULL),
.wins = {
@@ -8052,6 +8101,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. mhomed,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_MT_DI_U", 0x1C, NULL),
.wins = {
@@ -8081,6 +8131,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. unique,active with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_UA_SI_U", 0x00, NULL),
.wins = {
@@ -8107,6 +8158,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. unique,active with different ip(s), positive response
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_UA_DI_P", 0x00, NULL),
.wins = {
@@ -8134,6 +8186,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. unique,active with different ip(s), positive response other ips
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_UA_DI_O", 0x00, NULL),
.wins = {
@@ -8163,6 +8216,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. unique,active with different ip(s), negative response
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_UA_DI_N", 0x00, NULL),
.wins = {
@@ -8190,6 +8244,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. unique,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_UT_SI_U", 0x00, NULL),
.wins = {
@@ -8216,6 +8271,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. unique,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_UT_DI_U", 0x00, NULL),
.wins = {
@@ -8245,6 +8301,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. group,active with same ip(s), release expected
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_GA_SI_R", 0x00, NULL),
.wins = {
@@ -8272,6 +8329,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. group,active with different ip(s), release expected
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_GA_DI_R", 0x00, NULL),
.wins = {
@@ -8299,6 +8357,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. group,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_GT_SI_U", 0x00, NULL),
.wins = {
@@ -8325,6 +8384,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. group,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_GT_DI_U", 0x00, NULL),
.wins = {
@@ -8354,6 +8414,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. sgroup,active with same ip(s), release expected
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_SA_SI_R", 0x00, NULL),
.wins = {
@@ -8381,6 +8442,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. group,active with different ip(s), release expected
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_SA_DI_R", 0x00, NULL),
.wins = {
@@ -8408,6 +8470,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. sgroup,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_ST_SI_U", 0x00, NULL),
.wins = {
@@ -8434,6 +8497,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. sgroup,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_ST_DI_U", 0x00, NULL),
.wins = {
@@ -8463,6 +8527,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,active with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MA_SI_U", 0x00, NULL),
.wins = {
@@ -8489,6 +8554,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,active with superset ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MA_SP_U", 0x00, NULL),
.wins = {
@@ -8515,6 +8581,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,active with different ip(s), positive response
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MA_DI_P", 0x00, NULL),
.wins = {
@@ -8542,6 +8609,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,active with different ip(s), positive response other ips
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MA_DI_O", 0x00, NULL),
.wins = {
@@ -8571,6 +8639,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,active with different ip(s), negative response
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MA_DI_N", 0x00, NULL),
.wins = {
@@ -8598,6 +8667,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,tombstone with same ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MT_SI_U", 0x00, NULL),
.wins = {
@@ -8624,6 +8694,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,tombstone with different ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MT_DI_U", 0x00, NULL),
.wins = {
@@ -8653,6 +8724,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,active with superset ip(s), unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.section= "Test Replica vs. owned active: some more MHOMED combinations",
.name = _NBT_NAME("_MA_MA_SP_U", 0x00, NULL),
@@ -8682,6 +8754,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,active with same ips, unchecked
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MA_SM_U", 0x00, NULL),
.comment= "C:MHOMED vs. B:MHOMED => B:MHOMED",
@@ -8710,6 +8783,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,active with subset ip(s), positive response
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MA_SB_P", 0x00, NULL),
.comment= "C:MHOMED vs. B:BEST (C:MHOMED) => B:MHOMED",
@@ -8739,6 +8813,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,active with subset ip(s), positive response, with all addresses
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MA_SB_A", 0x00, NULL),
.comment= "C:MHOMED vs. B:BEST (C:ALL) => B:MHOMED",
@@ -8772,6 +8847,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* the release demand has no effect to the database record...
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MA_SB_PRA", 0x00, NULL),
.comment= "C:MHOMED vs. B:BEST (C:BEST) => C:MHOMED",
@@ -8804,6 +8880,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,active with subset ip(s), positive response, with other addresses
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MA_SB_O", 0x00, NULL),
.comment= "C:MHOMED vs. B:BEST (B:B_3_4) =>C:MHOMED",
@@ -8835,6 +8912,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. mhomed,active with subset ip(s), negative response
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_MA_MA_SB_N", 0x00, NULL),
.comment= "C:MHOMED vs. B:BEST (NEGATIVE) => B:BEST",
@@ -8867,6 +8945,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* mhomed,active vs. unique,active with subset ip(s), positive response
*/
{
+ .tctx = tctx,
.line = __location__,
.section= "Test Replica vs. owned active: some more UNIQUE,MHOMED combinations",
.name = _NBT_NAME("_MA_UA_SB_P", 0x00, NULL),
@@ -8899,6 +8978,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* the release demand has no effect to the database record...
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_UA_DI_PRA", 0x00, NULL),
.comment= "C:BEST vs. B:BEST2 (C:BEST2,LR:BEST2) => C:BEST",
@@ -8931,6 +9011,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. unique,active with different ip(s), positive response, with all addresses
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_UA_DI_A", 0x00, NULL),
.comment= "C:BEST vs. B:BEST2 (C:ALL) => B:MHOMED",
@@ -8962,6 +9043,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* unique,active vs. mhomed,active with different ip(s), positive response, with all addresses
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_UA_MA_DI_A", 0x00, NULL),
.comment= "C:BEST vs. B:BEST2 (C:ALL) => B:MHOMED",
@@ -8996,6 +9078,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. sgroup,active with different ip(s)
*/
{
+ .tctx = tctx,
.line = __location__,
.section= "Test Replica vs. owned active: SGROUP vs. SGROUP tests",
.name = _NBT_NAME("_SA_SA_DI_U", 0x1C, NULL),
@@ -9024,6 +9107,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. sgroup,active with same ip(s)
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_SA_SI_U", 0x1C, NULL),
.skip = (ctx->addresses_all_num < 3),
@@ -9051,6 +9135,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. sgroup,active with superset ip(s)
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_SA_SP_U", 0x1C, NULL),
.skip = (ctx->addresses_all_num < 3),
@@ -9078,6 +9163,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. sgroup,active with subset ip(s)
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_SA_SB_U", 0x1C, NULL),
.skip = (ctx->addresses_all_num < 3),
@@ -9105,6 +9191,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. sgroup,tombstone with different ip(s)
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_ST_DI_U", 0x1C, NULL),
.skip = (ctx->addresses_all_num < 3),
@@ -9132,6 +9219,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. sgroup,tombstone with same ip(s)
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_ST_SI_U", 0x1C, NULL),
.skip = (ctx->addresses_all_num < 3),
@@ -9159,6 +9247,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. sgroup,tombstone with superset ip(s)
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_ST_SP_U", 0x1C, NULL),
.skip = (ctx->addresses_all_num < 3),
@@ -9186,6 +9275,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
* sgroup,active vs. sgroup,tombstone with subset ip(s)
*/
{
+ .tctx = tctx,
.line = __location__,
.name = _NBT_NAME("_SA_ST_SB_U", 0x1C, NULL),
.skip = (ctx->addresses_all_num < 3),
@@ -9489,20 +9579,26 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx,
return ret;
}
+#define __NBT_LABEL_CAT1__(a,b) a##b
+#define __NBT_LABEL_CAT2__(a,b) __NBT_LABEL_CAT1__(a,b)
+#define _NBT_LABEL __NBT_LABEL_CAT2__(_label_, __LINE__)
+
#define _NBT_ASSERT(v, correct) do { \
- if ((v) != (correct)) { \
- printf("(%s) Incorrect value %s=%d - should be %s (%d)\n", \
- __location__, #v, v, #correct, correct); \
+ bool _ret = true; \
+ torture_assert_int_equal_goto(rec->tctx, v, correct, \
+ _ret, _NBT_LABEL, "Invalid int value"); \
+_NBT_LABEL: \
+ if (!_ret) { \
return; \
} \
} while (0)
#define _NBT_ASSERT_STRING(v, correct) do { \
- if ( ((!v) && (correct)) || \
- ((v) && (!correct)) || \
- ((v) && (correct) && strcmp(v,correct) != 0)) { \
- printf("(%s) Incorrect value %s=%s - should be %s\n", \
- __location__, #v, v, correct); \
+ bool _ret = true; \
+ torture_assert_str_equal_goto(rec->tctx, v, correct, \
+ _ret, _NBT_LABEL, "Invalid string value"); \
+_NBT_LABEL: \
+ if (!_ret) { \
return; \
} \
} while (0)
@@ -9522,8 +9618,8 @@ static void test_conflict_owned_active_vs_replica_handler_query(struct nbt_name_
name = &req_packet->questions[0].name;
- _NBT_ASSERT(name->type, rec->name.type);
_NBT_ASSERT_STRING(name->name, rec->name.name);
+ _NBT_ASSERT(name->type, rec->name.type);
_NBT_ASSERT_STRING(name->scope, rec->name.scope);
_NBT_ASSERT(rec->defend.expect_release, false);
@@ -9621,8 +9717,8 @@ static void test_conflict_owned_active_vs_replica_handler_release(
name = &req_packet->questions[0].name;
- _NBT_ASSERT(name->type, rec->name.type);
_NBT_ASSERT_STRING(name->name, rec->name.name);
+ _NBT_ASSERT(name->type, rec->name.type);
_NBT_ASSERT_STRING(name->scope, rec->name.scope);
_NBT_ASSERT(rec->defend.expect_release, true);
@@ -9668,6 +9764,17 @@ static void test_conflict_owned_active_vs_replica_handler(struct nbt_name_socket
{
struct test_conflict_owned_active_vs_replica_struct *rec =
(struct test_conflict_owned_active_vs_replica_struct *)nbtsock->incoming.private_data;
+ struct nbt_name *name = &req_packet->questions[0].name;
+
+ if (req_packet->operation & NBT_FLAG_BROADCAST) {
+ torture_comment(rec->tctx,
+ "%s: incoming packet name[%s] flags[0x%08X] from[%s]\n",
+ __location__,
+ nbt_name_string(rec->tctx, name),
+ req_packet->operation,
+ src->addr);
+ return;
+ }
rec->defend.ret = false;
@@ -9679,8 +9786,14 @@ static void test_conflict_owned_active_vs_replica_handler(struct nbt_name_socket
test_conflict_owned_active_vs_replica_handler_release(nbtsock, req_packet, src);
break;
default:
- printf("%s: unexpected incoming packet\n", __location__);
- return;
+ torture_comment(rec->tctx,
+ "%s: unexpected packet name[%s] flags[0x%08X] from[%s]\n",
+ __location__,
+ nbt_name_string(rec->tctx, name),
+ req_packet->operation,
+ src->addr);
+ _NBT_ASSERT((req_packet->operation & NBT_OPCODE), NBT_OPCODE_QUERY);
+ break;
}
}