summaryrefslogtreecommitdiff
path: root/source4/torture/nbt
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-11 22:23:14 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:49:32 +0100
commit6f2252dace1629d7b5c5637b103caa28d2c89b07 (patch)
treefc09abaf04401ef510d55866066738840d052ebf /source4/torture/nbt
parentf9948d18d73fb8d8711c3b5a46b1d83c881a0084 (diff)
downloadsamba-6f2252dace1629d7b5c5637b103caa28d2c89b07.tar.gz
samba-6f2252dace1629d7b5c5637b103caa28d2c89b07.tar.bz2
samba-6f2252dace1629d7b5c5637b103caa28d2c89b07.zip
r26401: Don't cache interfaces context in libnetif.
(This used to be commit 9f975417cc66bfd4589da38bfd23731dbe0e6153)
Diffstat (limited to 'source4/torture/nbt')
-rw-r--r--source4/torture/nbt/dgram.c15
-rw-r--r--source4/torture/nbt/register.c10
-rw-r--r--source4/torture/nbt/wins.c7
-rw-r--r--source4/torture/nbt/winsbench.c4
-rw-r--r--source4/torture/nbt/winsreplication.c15
5 files changed, 38 insertions, 13 deletions
diff --git a/source4/torture/nbt/dgram.c b/source4/torture/nbt/dgram.c
index 37d445cac4..d8903eedac 100644
--- a/source4/torture/nbt/dgram.c
+++ b/source4/torture/nbt/dgram.c
@@ -77,6 +77,8 @@ static bool nbt_test_netlogon(struct torture_context *tctx)
const char *address;
struct nbt_name name;
+
+ struct interface *ifaces;
name.name = lp_workgroup(tctx->lp_ctx);
name.type = NBT_NAME_LOGON;
@@ -87,7 +89,8 @@ static bool nbt_test_netlogon(struct torture_context *tctx)
resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, event_context_find(tctx)),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
- myaddress = talloc_strdup(dgmsock, iface_best_ip(tctx->lp_ctx, address));
+ load_interfaces(lp_interfaces(tctx->lp_ctx), &ifaces);
+ myaddress = talloc_strdup(dgmsock, iface_best_ip(ifaces, address));
socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name,
@@ -156,6 +159,8 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
const char *address;
struct nbt_name name;
+
+ struct interface *ifaces;
name.name = lp_workgroup(tctx->lp_ctx);
name.type = NBT_NAME_LOGON;
@@ -166,7 +171,8 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, event_context_find(tctx)),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
- myaddress = talloc_strdup(dgmsock, iface_best_ip(tctx->lp_ctx, address));
+ load_interfaces(lp_interfaces(tctx->lp_ctx), &ifaces);
+ myaddress = talloc_strdup(dgmsock, iface_best_ip(ifaces, address));
socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name,
myaddress, lp_dgram_port(tctx->lp_ctx));
@@ -265,6 +271,8 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
struct socket_address *socket_address;
const char *address;
struct nbt_name name;
+
+ struct interface *ifaces;
name.name = lp_workgroup(tctx->lp_ctx);
name.type = NBT_NAME_LOGON;
@@ -275,7 +283,8 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, event_context_find(tctx)),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
- myaddress = talloc_strdup(dgmsock, iface_best_ip(tctx->lp_ctx, address));
+ load_interfaces(lp_interfaces(tctx->lp_ctx), &ifaces);
+ myaddress = talloc_strdup(dgmsock, iface_best_ip(ifaces, address));
socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name,
myaddress, lp_dgram_port(tctx->lp_ctx));
diff --git a/source4/torture/nbt/register.c b/source4/torture/nbt/register.c
index 2c37d9de50..090027be2e 100644
--- a/source4/torture/nbt/register.c
+++ b/source4/torture/nbt/register.c
@@ -49,11 +49,14 @@ static bool nbt_register_own(struct torture_context *tctx)
struct nbt_name name;
const char *address;
const char *myaddress;
+ struct interface *ifaces;
if (!torture_nbt_get_name(tctx, &name, &address))
return false;
- myaddress = iface_best_ip(tctx->lp_ctx, address);
+ load_interfaces(lp_interfaces(tctx->lp_ctx), &ifaces);
+
+ myaddress = iface_best_ip(ifaces, address);
socket_address = socket_address_from_strings(tctx, nbtsock->sock->backend_name,
myaddress, 0);
@@ -115,11 +118,14 @@ static bool nbt_refresh_own(struct torture_context *tctx)
struct socket_address *socket_address;
struct nbt_name name;
const char *address;
+ struct interface *ifaces;
if (!torture_nbt_get_name(tctx, &name, &address))
return false;
- myaddress = iface_best_ip(tctx->lp_ctx, address);
+ load_interfaces(lp_interfaces(tctx->lp_ctx), &ifaces);
+
+ myaddress = iface_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 2ba7f221c9..0d895ddd0d 100644
--- a/source4/torture/nbt/wins.c
+++ b/source4/torture/nbt/wins.c
@@ -54,8 +54,13 @@ static bool nbt_test_wins_name(struct torture_context *tctx, const char *address
struct nbt_name_release release;
NTSTATUS status;
struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL);
- const char *myaddress = talloc_strdup(tctx, iface_best_ip(tctx->lp_ctx, address));
+ const char *myaddress;
struct socket_address *socket_address;
+ struct interface *ifaces;
+
+ load_interfaces(lp_interfaces(tctx->lp_ctx), &ifaces);
+
+ myaddress = talloc_strdup(tctx, iface_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 d49b50b9d3..95241a1a12 100644
--- a/source4/torture/nbt/winsbench.c
+++ b/source4/torture/nbt/winsbench.c
@@ -234,6 +234,7 @@ static bool bench_wins(struct torture_context *tctx)
struct socket_address *my_ip;
struct nbt_name name;
const char *address;
+ struct interface *ifaces;
if (!torture_nbt_get_name(tctx, &name, &address))
return false;
@@ -244,7 +245,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 = lp_nbt_port(tctx->lp_ctx);
- state->my_ip = talloc_strdup(tctx, iface_best_ip(tctx->lp_ctx, address));
+ load_interfaces(lp_interfaces(tctx->lp_ctx), &ifaces);
+ state->my_ip = talloc_strdup(tctx, iface_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 fc88d7fce1..b90daa98c4 100644
--- a/source4/torture/nbt/winsreplication.c
+++ b/source4/torture/nbt/winsreplication.c
@@ -547,6 +547,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
struct socket_address *nbt_srv_addr;
NTSTATUS status;
uint32_t i;
+ struct interface *ifaces;
ctx = talloc_zero(tctx, struct test_wrepl_conflict_conn);
if (!ctx) return NULL;
@@ -612,12 +613,14 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
ctx->nbtsock = nbt_name_socket_init(ctx, NULL);
if (!ctx->nbtsock) return NULL;
- ctx->myaddr = socket_address_from_strings(tctx, ctx->nbtsock->sock->backend_name, iface_best_ip(tctx->lp_ctx, address), 0);
+ load_interfaces(lp_interfaces(tctx->lp_ctx), &ifaces);
+
+ ctx->myaddr = socket_address_from_strings(tctx, ctx->nbtsock->sock->backend_name, iface_best_ip(ifaces, address), 0);
if (!ctx->myaddr) return NULL;
- for (i = 0; i < iface_count(tctx->lp_ctx); i++) {
- if (strcmp(ctx->myaddr->addr, iface_n_ip(tctx->lp_ctx, i)) == 0) continue;
- ctx->myaddr2 = socket_address_from_strings(tctx, ctx->nbtsock->sock->backend_name, iface_n_ip(tctx->lp_ctx, i), 0);
+ 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);
if (!ctx->myaddr2) return NULL;
break;
}
@@ -674,12 +677,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(tctx->lp_ctx);
+ ctx->addresses_all_num = iface_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(tctx->lp_ctx, i));
+ ctx->addresses_all[i].ip = talloc_strdup(ctx->addresses_all, iface_n_ip(ifaces, i));
if (!ctx->addresses_all[i].ip) return NULL;
}