summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore2
-rw-r--r--source4/cldap_server/cldap_server.c6
-rw-r--r--source4/cldap_server/netlogon.c2
-rw-r--r--source4/heimdal_build/glue.c7
-rw-r--r--source4/kdc/kdc.c6
-rw-r--r--source4/ldap_server/ldap_server.c4
-rw-r--r--source4/lib/socket/interface.c26
-rw-r--r--source4/lib/socket/testsuite.c11
-rw-r--r--source4/libcli/resolve/bcast.c7
-rw-r--r--source4/libcli/resolve/nbtlist.c2
-rw-r--r--source4/libcli/wrepl/winsrepl.c3
-rw-r--r--source4/nbt_server/interfaces.c10
-rw-r--r--source4/nbt_server/nbt_server.c2
-rw-r--r--source4/nbt_server/wins/wins_ldb.c5
-rw-r--r--source4/nbt_server/wins/winsdb.c2
-rw-r--r--source4/rpc_server/service_rpc.c4
-rw-r--r--source4/scripting/ejs/smbcalls_sys.c4
-rw-r--r--source4/smb_server/smb_server.c4
-rw-r--r--source4/torture/nbt/dgram.c6
-rw-r--r--source4/torture/nbt/register.c4
-rw-r--r--source4/torture/nbt/wins.c2
-rw-r--r--source4/torture/nbt/winsbench.c2
-rw-r--r--source4/torture/nbt/winsreplication.c12
-rw-r--r--source4/torture/rpc/spoolss_notify.c2
-rw-r--r--source4/utils/nmblookup.c4
-rw-r--r--source4/web_server/web_server.c4
-rw-r--r--source4/wrepl_server/wrepl_in_connection.c4
27 files changed, 76 insertions, 71 deletions
diff --git a/.bzrignore b/.bzrignore
index 76232aa6c54..fed92f06e82 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -208,7 +208,7 @@ source/lib/ldb/tdbtest.ldb
libtdb.so.*
libtalloc.so.*
source/lib/registry/tests/proto.h
-tmpccache
+source/libcli/ldap/ldap_ndr.h
source/tdbtest.ldb
source/tdbtest.ldb.2
source/templates.ldb
diff --git a/source4/cldap_server/cldap_server.c b/source4/cldap_server/cldap_server.c
index f2c35684693..d71e933b5f0 100644
--- a/source4/cldap_server/cldap_server.c
+++ b/source4/cldap_server/cldap_server.c
@@ -123,7 +123,7 @@ static NTSTATUS cldapd_add_socket(struct cldapd_server *cldapd, struct loadparm_
*/
static NTSTATUS cldapd_startup_interfaces(struct cldapd_server *cldapd, struct loadparm_context *lp_ctx)
{
- int num_interfaces = iface_count();
+ int num_interfaces = iface_count(lp_ctx);
TALLOC_CTX *tmp_ctx = talloc_new(cldapd);
NTSTATUS status;
@@ -136,7 +136,7 @@ static NTSTATUS cldapd_startup_interfaces(struct cldapd_server *cldapd, struct l
int i;
for (i=0; i<num_interfaces; i++) {
- const char *address = talloc_strdup(tmp_ctx, iface_n_ip(i));
+ const char *address = talloc_strdup(tmp_ctx, iface_n_ip(lp_ctx, i));
status = cldapd_add_socket(cldapd, lp_ctx, address);
NT_STATUS_NOT_OK_RETURN(status);
}
@@ -155,7 +155,7 @@ static void cldapd_task_init(struct task_server *task)
struct cldapd_server *cldapd;
NTSTATUS status;
- if (iface_count() == 0) {
+ if (iface_count(task->lp_ctx) == 0) {
task_server_terminate(task, "cldapd: no network interfaces configured");
return;
}
diff --git a/source4/cldap_server/netlogon.c b/source4/cldap_server/netlogon.c
index b123027a7c2..d1f001e333d 100644
--- a/source4/cldap_server/netlogon.c
+++ b/source4/cldap_server/netlogon.c
@@ -187,7 +187,7 @@ static NTSTATUS cldapd_netlogon_fill(struct cldapd_server *cldapd,
lp_workgroup(lp_ctx));
server_site = "Default-First-Site-Name";
client_site = "Default-First-Site-Name";
- pdc_ip = iface_best_ip(src_address);
+ pdc_ip = iface_best_ip(lp_ctx, src_address);
ZERO_STRUCTP(netlogon);
diff --git a/source4/heimdal_build/glue.c b/source4/heimdal_build/glue.c
index a3ecd00b56d..df08cae57c5 100644
--- a/source4/heimdal_build/glue.c
+++ b/source4/heimdal_build/glue.c
@@ -23,20 +23,21 @@
#include "system/network.h"
#include "system/kerberos.h"
#include "lib/socket/netif.h"
+#include "param/param.h"
-/*
+/**
get the list of IP addresses for configured interfaces
*/
krb5_error_code KRB5_LIB_FUNCTION krb5_get_all_client_addrs(krb5_context context, krb5_addresses *res)
{
int i;
- res->len = iface_count();
+ res->len = iface_count(global_loadparm);
res->val = malloc_array_p(HostAddress, res->len);
if (res->val == NULL) {
return ENOMEM;
}
for (i=0;i<res->len;i++) {
- const char *ip = iface_n_ip(i);
+ const char *ip = iface_n_ip(global_loadparm, i);
res->val[i].addr_type = AF_INET;
res->val[i].address.length = 4;
res->val[i].address.data = malloc(4);
diff --git a/source4/kdc/kdc.c b/source4/kdc/kdc.c
index 7708a76c446..18fc86b8e01 100644
--- a/source4/kdc/kdc.c
+++ b/source4/kdc/kdc.c
@@ -522,14 +522,14 @@ static NTSTATUS kdc_add_socket(struct kdc_server *kdc, const char *address,
*/
static NTSTATUS kdc_startup_interfaces(struct kdc_server *kdc, struct loadparm_context *lp_ctx)
{
- int num_interfaces = iface_count();
+ int num_interfaces = iface_count(lp_ctx);
TALLOC_CTX *tmp_ctx = talloc_new(kdc);
NTSTATUS status;
int i;
for (i=0; i<num_interfaces; i++) {
- const char *address = talloc_strdup(tmp_ctx, iface_n_ip(i));
+ const char *address = talloc_strdup(tmp_ctx, iface_n_ip(lp_ctx, i));
status = kdc_add_socket(kdc, address, lp_krb5_port(lp_ctx),
lp_kpasswd_port(lp_ctx));
NT_STATUS_NOT_OK_RETURN(status);
@@ -571,7 +571,7 @@ static void kdc_task_init(struct task_server *task)
break;
}
- if (iface_count() == 0) {
+ if (iface_count(task->lp_ctx) == 0) {
task_server_terminate(task, "kdc: no network interfaces configured");
return;
}
diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c
index 81988b60f66..99889f1f7fc 100644
--- a/source4/ldap_server/ldap_server.c
+++ b/source4/ldap_server/ldap_server.c
@@ -546,7 +546,7 @@ static void ldapsrv_task_init(struct task_server *task)
if (ldap_service->tls_params == NULL) goto failed;
if (lp_interfaces(task->lp_ctx) && lp_bind_interfaces_only(task->lp_ctx)) {
- int num_interfaces = iface_count();
+ int num_interfaces = iface_count(task->lp_ctx);
int i;
/* We have been given an interfaces line, and been
@@ -554,7 +554,7 @@ static void ldapsrv_task_init(struct task_server *task)
socket per interface and bind to only these.
*/
for(i = 0; i < num_interfaces; i++) {
- const char *address = iface_n_ip(i);
+ const char *address = iface_n_ip(task->lp_ctx, i);
status = add_socket(task->event_ctx, task->lp_ctx, model_ops, address, ldap_service);
if (!NT_STATUS_IS_OK(status)) goto failed;
}
diff --git a/source4/lib/socket/interface.c b/source4/lib/socket/interface.c
index a3f6ccc570a..79c5673022b 100644
--- a/source4/lib/socket/interface.c
+++ b/source4/lib/socket/interface.c
@@ -235,12 +235,12 @@ void unload_interfaces(void)
/**
how many interfaces do we have
**/
-int iface_count(void)
+int iface_count(struct loadparm_context *lp_ctx)
{
int ret = 0;
struct interface *i;
- load_interfaces(lp_interfaces(global_loadparm));
+ load_interfaces(lp_interfaces(lp_ctx));
for (i=local_interfaces;i;i=i->next)
ret++;
@@ -250,11 +250,11 @@ int iface_count(void)
/**
return IP of the Nth interface
**/
-const char *iface_n_ip(int n)
+const char *iface_n_ip(struct loadparm_context *lp_ctx, int n)
{
struct interface *i;
- load_interfaces(lp_interfaces(global_loadparm));
+ load_interfaces(lp_interfaces(lp_ctx));
for (i=local_interfaces;i && n;i=i->next)
n--;
@@ -268,11 +268,11 @@ const char *iface_n_ip(int n)
/**
return bcast of the Nth interface
**/
-const char *iface_n_bcast(int n)
+const char *iface_n_bcast(struct loadparm_context *lp_ctx, int n)
{
struct interface *i;
- load_interfaces(lp_interfaces(global_loadparm));
+ load_interfaces(lp_interfaces(lp_ctx));
for (i=local_interfaces;i && n;i=i->next)
n--;
@@ -286,11 +286,11 @@ const char *iface_n_bcast(int n)
/**
return netmask of the Nth interface
**/
-const char *iface_n_netmask(int n)
+const char *iface_n_netmask(struct loadparm_context *lp_ctx, int n)
{
struct interface *i;
- load_interfaces(lp_interfaces(global_loadparm));
+ load_interfaces(lp_interfaces(lp_ctx));
for (i=local_interfaces;i && n;i=i->next)
n--;
@@ -305,29 +305,29 @@ const char *iface_n_netmask(int n)
return the local IP address that best matches a destination IP, or
our first interface if none match
*/
-const char *iface_best_ip(const char *dest)
+const char *iface_best_ip(struct loadparm_context *lp_ctx, const char *dest)
{
struct interface *iface;
struct in_addr ip;
- load_interfaces(lp_interfaces(global_loadparm));
+ load_interfaces(lp_interfaces(lp_ctx));
ip.s_addr = interpret_addr(dest);
iface = iface_find(ip, true);
if (iface) {
return iface->ip_s;
}
- return iface_n_ip(0);
+ return iface_n_ip(lp_ctx, 0);
}
/**
return true if an IP is one one of our local networks
*/
-bool iface_is_local(const char *dest)
+bool iface_is_local(struct loadparm_context *lp_ctx, const char *dest)
{
struct in_addr ip;
- load_interfaces(lp_interfaces(global_loadparm));
+ load_interfaces(lp_interfaces(lp_ctx));
ip.s_addr = interpret_addr(dest);
if (iface_find(ip, true)) {
diff --git a/source4/lib/socket/testsuite.c b/source4/lib/socket/testsuite.c
index 928469dd82c..84132c62b8a 100644
--- a/source4/lib/socket/testsuite.c
+++ b/source4/lib/socket/testsuite.c
@@ -48,7 +48,7 @@ static bool test_udp(struct torture_context *tctx)
talloc_steal(mem_ctx, sock2);
localhost = socket_address_from_strings(sock1, sock1->backend_name,
- iface_best_ip("127.0.0.1"), 0);
+ iface_best_ip(tctx->lp_ctx, "127.0.0.1"), 0);
torture_assert(tctx, localhost, "Localhost not found");
@@ -56,10 +56,11 @@ static bool test_udp(struct torture_context *tctx)
torture_assert_ntstatus_ok(tctx, status, "listen on socket 1");
srv_addr = socket_get_my_addr(sock1, mem_ctx);
- torture_assert(tctx, srv_addr != NULL && strcmp(srv_addr->addr, iface_best_ip("127.0.0.1")) == 0,
+ torture_assert(tctx, srv_addr != NULL &&
+ strcmp(srv_addr->addr, iface_best_ip(tctx->lp_ctx, "127.0.0.1")) == 0,
talloc_asprintf(tctx,
"Expected server address of %s but got %s",
- iface_best_ip("127.0.0.1"), srv_addr ? srv_addr->addr : NULL));
+ iface_best_ip(tctx->lp_ctx, "127.0.0.1"), srv_addr ? srv_addr->addr : NULL));
torture_comment(tctx, "server port is %d\n", srv_addr->port);
@@ -129,7 +130,7 @@ static bool test_tcp(struct torture_context *tctx)
talloc_steal(mem_ctx, sock2);
localhost = socket_address_from_strings(sock1, sock1->backend_name,
- iface_best_ip("127.0.0.1"), 0);
+ iface_best_ip(tctx->lp_ctx, "127.0.0.1"), 0);
torture_assert(tctx, localhost, "Localhost not found");
status = socket_listen(sock1, localhost, 0, 0);
@@ -139,7 +140,7 @@ static bool test_tcp(struct torture_context *tctx)
torture_assert(tctx, srv_addr && srv_addr->addr,
"Unexpected socket_get_my_addr NULL\n");
- torture_assert_str_equal(tctx, srv_addr->addr, iface_best_ip("127.0.0.1"),
+ torture_assert_str_equal(tctx, srv_addr->addr, iface_best_ip(tctx->lp_ctx, "127.0.0.1"),
"Unexpected server address");
torture_comment(tctx, "server port is %d\n", srv_addr->port);
diff --git a/source4/libcli/resolve/bcast.c b/source4/libcli/resolve/bcast.c
index 3193d70789a..ad574e4c9e0 100644
--- a/source4/libcli/resolve/bcast.c
+++ b/source4/libcli/resolve/bcast.c
@@ -23,15 +23,16 @@
#include "libcli/resolve/resolve.h"
#include "system/network.h"
#include "lib/socket/netif.h"
+#include "param/param.h"
-/*
+/**
broadcast name resolution method - async send
*/
struct composite_context *resolve_name_bcast_send(TALLOC_CTX *mem_ctx,
struct event_context *event_ctx,
struct nbt_name *name)
{
- int num_interfaces = iface_count();
+ int num_interfaces = iface_count(global_loadparm);
const char **address_list;
struct composite_context *c;
int i, count=0;
@@ -40,7 +41,7 @@ struct composite_context *resolve_name_bcast_send(TALLOC_CTX *mem_ctx,
if (address_list == NULL) return NULL;
for (i=0;i<num_interfaces;i++) {
- const char *bcast = iface_n_bcast(i);
+ const char *bcast = iface_n_bcast(global_loadparm, i);
if (bcast == NULL) continue;
address_list[count] = talloc_strdup(address_list, bcast);
if (address_list[count] == NULL) {
diff --git a/source4/libcli/resolve/nbtlist.c b/source4/libcli/resolve/nbtlist.c
index 13010eec3ef..daa602f97c0 100644
--- a/source4/libcli/resolve/nbtlist.c
+++ b/source4/libcli/resolve/nbtlist.c
@@ -77,7 +77,7 @@ static void nbtlist_handler(struct nbt_name_request *req)
/* favor a local address if possible */
state->reply_addr = NULL;
for (i=0;i<q->out.num_addrs;i++) {
- if (iface_is_local(q->out.reply_addrs[i])) {
+ if (iface_is_local(global_loadparm, q->out.reply_addrs[i])) {
state->reply_addr = talloc_steal(state,
q->out.reply_addrs[i]);
break;
diff --git a/source4/libcli/wrepl/winsrepl.c b/source4/libcli/wrepl/winsrepl.c
index 1f7ca796b64..8f808198ebc 100644
--- a/source4/libcli/wrepl/winsrepl.c
+++ b/source4/libcli/wrepl/winsrepl.c
@@ -29,6 +29,7 @@
#include "libcli/composite/composite.h"
#include "system/network.h"
#include "lib/socket/netif.h"
+#include "param/param.h"
static struct wrepl_request *wrepl_request_finished(struct wrepl_request *req, NTSTATUS status);
@@ -330,7 +331,7 @@ struct composite_context *wrepl_connect_send(struct wrepl_socket *wrepl_socket,
state->wrepl_socket = wrepl_socket;
if (!our_ip) {
- our_ip = iface_best_ip(peer_ip);
+ our_ip = iface_best_ip(global_loadparm, peer_ip);
}
us = socket_address_from_strings(state, wrepl_socket->sock->backend_name,
diff --git a/source4/nbt_server/interfaces.c b/source4/nbt_server/interfaces.c
index c40cd6322c1..21ebada3c81 100644
--- a/source4/nbt_server/interfaces.c
+++ b/source4/nbt_server/interfaces.c
@@ -218,7 +218,7 @@ static NTSTATUS nbtd_add_wins_socket(struct nbtd_server *nbtsrv)
*/
NTSTATUS nbtd_startup_interfaces(struct nbtd_server *nbtsrv, struct loadparm_context *lp_ctx)
{
- int num_interfaces = iface_count();
+ int num_interfaces = iface_count(lp_ctx);
int i;
TALLOC_CTX *tmp_ctx = talloc_new(nbtsrv);
NTSTATUS status;
@@ -232,7 +232,7 @@ NTSTATUS nbtd_startup_interfaces(struct nbtd_server *nbtsrv, struct loadparm_con
for non-WINS queries not made on a specific
interface */
if (num_interfaces > 0) {
- primary_address = iface_n_ip(0);
+ primary_address = iface_n_ip(lp_ctx, 0);
} else {
primary_address = inet_ntoa(interpret_addr2(
lp_netbios_name(lp_ctx)));
@@ -250,15 +250,15 @@ NTSTATUS nbtd_startup_interfaces(struct nbtd_server *nbtsrv, struct loadparm_con
}
for (i=0; i<num_interfaces; i++) {
- const char *bcast = iface_n_bcast(i);
+ const char *bcast = iface_n_bcast(lp_ctx, i);
const char *address, *netmask;
/* we can't assume every interface is broadcast capable */
if (bcast == NULL) continue;
- address = talloc_strdup(tmp_ctx, iface_n_ip(i));
+ address = talloc_strdup(tmp_ctx, iface_n_ip(lp_ctx, i));
bcast = talloc_strdup(tmp_ctx, bcast);
- netmask = talloc_strdup(tmp_ctx, iface_n_netmask(i));
+ netmask = talloc_strdup(tmp_ctx, iface_n_netmask(lp_ctx, i));
status = nbtd_add_socket(nbtsrv, lp_ctx,
address, address, bcast, netmask);
diff --git a/source4/nbt_server/nbt_server.c b/source4/nbt_server/nbt_server.c
index 29715e925f4..22f46dec69b 100644
--- a/source4/nbt_server/nbt_server.c
+++ b/source4/nbt_server/nbt_server.c
@@ -38,7 +38,7 @@ static void nbtd_task_init(struct task_server *task)
struct nbtd_server *nbtsrv;
NTSTATUS status;
- if (iface_count() == 0) {
+ if (iface_count(task->lp_ctx) == 0) {
task_server_terminate(task, "nbtd: no network interfaces configured");
return;
}
diff --git a/source4/nbt_server/wins/wins_ldb.c b/source4/nbt_server/wins/wins_ldb.c
index 3d22b5fe1b4..7caab34aaaa 100644
--- a/source4/nbt_server/wins/wins_ldb.c
+++ b/source4/nbt_server/wins/wins_ldb.c
@@ -84,12 +84,13 @@ static int wins_ldb_init(struct ldb_module *ctx)
{
struct winsdb_handle *h;
const char *owner;
+ struct loadparm_context *lp_ctx = ldb_get_opaque(ctx->ldb, "loadparm");
ctx->private_data = NULL;
- owner = lp_parm_string(global_loadparm, NULL, "winsdb", "local_owner");
+ owner = lp_parm_string(lp_ctx, NULL, "winsdb", "local_owner");
if (!owner) {
- owner = iface_n_ip(0);
+ owner = iface_n_ip(lp_ctx, 0);
if (!owner) {
owner = "0.0.0.0";
}
diff --git a/source4/nbt_server/wins/winsdb.c b/source4/nbt_server/wins/winsdb.c
index 438fb12b587..428b1547317 100644
--- a/source4/nbt_server/wins/winsdb.c
+++ b/source4/nbt_server/wins/winsdb.c
@@ -1035,7 +1035,7 @@ struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx, struct loadparm_contex
owner = lp_parm_string(lp_ctx, NULL, "winsdb", "local_owner");
if (!owner) {
- owner = iface_n_ip(0);
+ owner = iface_n_ip(lp_ctx, 0);
}
h->local_owner = talloc_strdup(h, owner);
diff --git a/source4/rpc_server/service_rpc.c b/source4/rpc_server/service_rpc.c
index 9cce5292381..265cf0b8120 100644
--- a/source4/rpc_server/service_rpc.c
+++ b/source4/rpc_server/service_rpc.c
@@ -377,10 +377,10 @@ static NTSTATUS dcesrv_add_ep_tcp(struct dcesrv_context *dce_ctx,
/* Add TCP/IP sockets */
if (lp_interfaces(lp_ctx) && lp_bind_interfaces_only(lp_ctx)) {
- int num_interfaces = iface_count();
+ int num_interfaces = iface_count(lp_ctx);
int i;
for(i = 0; i < num_interfaces; i++) {
- const char *address = iface_n_ip(i);
+ const char *address = iface_n_ip(lp_ctx, i);
status = add_socket_rpc_tcp_iface(dce_ctx, e, event_ctx, model_ops, address);
NT_STATUS_NOT_OK_RETURN(status);
}
diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c
index 10de8e162e8..86e0873e09d 100644
--- a/source4/scripting/ejs/smbcalls_sys.c
+++ b/source4/scripting/ejs/smbcalls_sys.c
@@ -32,10 +32,10 @@
*/
static int ejs_sys_interfaces(MprVarHandle eid, int argc, struct MprVar **argv)
{
- int i, count = iface_count();
+ int i, count = iface_count(global_loadparm);
struct MprVar ret = mprArray("interfaces");
for (i=0;i<count;i++) {
- mprAddArray(&ret, i, mprString(iface_n_ip(i)));
+ mprAddArray(&ret, i, mprString(iface_n_ip(global_loadparm, i)));
}
mpr_Return(eid, ret);
return 0;
diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c
index 9c693b772af..e7006a2ceed 100644
--- a/source4/smb_server/smb_server.c
+++ b/source4/smb_server/smb_server.c
@@ -220,7 +220,7 @@ static void smbsrv_task_init(struct task_server *task)
task_server_set_title(task, "task[smbsrv]");
if (lp_interfaces(task->lp_ctx) && lp_bind_interfaces_only(task->lp_ctx)) {
- int num_interfaces = iface_count();
+ int num_interfaces = iface_count(task->lp_ctx);
int i;
/* We have been given an interfaces line, and been
@@ -228,7 +228,7 @@ static void smbsrv_task_init(struct task_server *task)
socket per interface and bind to only these.
*/
for(i = 0; i < num_interfaces; i++) {
- const char *address = iface_n_ip(i);
+ const char *address = iface_n_ip(task->lp_ctx, i);
status = smbsrv_add_socket(task->event_ctx, task->lp_ctx, task->model_ops, address);
if (!NT_STATUS_IS_OK(status)) goto failed;
}
diff --git a/source4/torture/nbt/dgram.c b/source4/torture/nbt/dgram.c
index e56d8c7500d..bc3aa5dd57c 100644
--- a/source4/torture/nbt/dgram.c
+++ b/source4/torture/nbt/dgram.c
@@ -87,7 +87,7 @@ static bool nbt_test_netlogon(struct torture_context *tctx)
resolve_name(&name, tctx, &address, event_context_find(tctx), lp_name_resolve_order(tctx->lp_ctx)),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
- myaddress = talloc_strdup(dgmsock, iface_best_ip(address));
+ myaddress = talloc_strdup(dgmsock, iface_best_ip(tctx->lp_ctx, address));
socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name,
@@ -166,7 +166,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
resolve_name(&name, tctx, &address, event_context_find(tctx), lp_name_resolve_order(tctx->lp_ctx)),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
- myaddress = talloc_strdup(dgmsock, iface_best_ip(address));
+ myaddress = talloc_strdup(dgmsock, iface_best_ip(tctx->lp_ctx, address));
socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name,
myaddress, lp_dgram_port(tctx->lp_ctx));
@@ -275,7 +275,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
resolve_name(&name, tctx, &address, event_context_find(tctx), lp_name_resolve_order(tctx->lp_ctx)),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
- myaddress = talloc_strdup(dgmsock, iface_best_ip(address));
+ myaddress = talloc_strdup(dgmsock, iface_best_ip(tctx->lp_ctx, 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 9ff22c4bb9f..cc3a55a7872 100644
--- a/source4/torture/nbt/register.c
+++ b/source4/torture/nbt/register.c
@@ -52,7 +52,7 @@ static bool nbt_register_own(struct torture_context *tctx)
if (!torture_nbt_get_name(tctx, &name, &address))
return false;
- myaddress = iface_best_ip(address);
+ myaddress = iface_best_ip(tctx->lp_ctx, address);
socket_address = socket_address_from_strings(tctx, nbtsock->sock->backend_name,
myaddress, 0);
@@ -117,7 +117,7 @@ static bool nbt_refresh_own(struct torture_context *tctx)
if (!torture_nbt_get_name(tctx, &name, &address))
return false;
- myaddress = iface_best_ip(address);
+ myaddress = iface_best_ip(tctx->lp_ctx, 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 fe87d7f9710..2ba7f221c9b 100644
--- a/source4/torture/nbt/wins.c
+++ b/source4/torture/nbt/wins.c
@@ -54,7 +54,7 @@ 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(address));
+ const char *myaddress = talloc_strdup(tctx, iface_best_ip(tctx->lp_ctx, address));
struct socket_address *socket_address;
socket_address = socket_address_from_strings(tctx,
diff --git a/source4/torture/nbt/winsbench.c b/source4/torture/nbt/winsbench.c
index 34d27ab4103..1c79b5eb758 100644
--- a/source4/torture/nbt/winsbench.c
+++ b/source4/torture/nbt/winsbench.c
@@ -241,7 +241,7 @@ static bool bench_wins(struct torture_context *tctx)
state->num_names = torture_entries;
state->registered = talloc_zero_array(state, bool, state->num_names);
state->wins_server = address;
- state->my_ip = talloc_strdup(tctx, iface_best_ip(address));
+ state->my_ip = talloc_strdup(tctx, iface_best_ip(tctx->lp_ctx, 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 2164ebf8b23..b427843b80e 100644
--- a/source4/torture/nbt/winsreplication.c
+++ b/source4/torture/nbt/winsreplication.c
@@ -612,12 +612,12 @@ 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(address), 0);
+ ctx->myaddr = socket_address_from_strings(tctx, ctx->nbtsock->sock->backend_name, iface_best_ip(tctx->lp_ctx, address), 0);
if (!ctx->myaddr) return NULL;
- for (i = 0; i < iface_count(); i++) {
- if (strcmp(ctx->myaddr->addr, iface_n_ip(i)) == 0) continue;
- ctx->myaddr2 = socket_address_from_strings(tctx, ctx->nbtsock->sock->backend_name, iface_n_ip(i), 0);
+ 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);
if (!ctx->myaddr2) return NULL;
break;
}
@@ -674,12 +674,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();
+ ctx->addresses_all_num = iface_count(tctx->lp_ctx);
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(i));
+ ctx->addresses_all[i].ip = talloc_strdup(ctx->addresses_all, iface_n_ip(tctx->lp_ctx, i));
if (!ctx->addresses_all[i].ip) return NULL;
}
diff --git a/source4/torture/rpc/spoolss_notify.c b/source4/torture/rpc/spoolss_notify.c
index b211e3aa57e..5e7a4469e44 100644
--- a/source4/torture/rpc/spoolss_notify.c
+++ b/source4/torture/rpc/spoolss_notify.c
@@ -226,7 +226,7 @@ static bool test_RFFPCNEx(struct torture_context *tctx,
lp_set_cmdline(tctx->lp_ctx, "dcerpc endpoint servers", "spoolss");
- address = iface_n_ip(0);
+ address = iface_n_ip(tctx->lp_ctx, 0);
torture_comment(tctx, "Listening for callbacks on %s\n", address);
status = smbsrv_add_socket(p->conn->event_ctx, tctx->lp_ctx, &single_ops, address);
torture_assert_ntstatus_ok(tctx, status, "starting smb server");
diff --git a/source4/utils/nmblookup.c b/source4/utils/nmblookup.c
index c0fb31a21ff..9f121390f6d 100644
--- a/source4/utils/nmblookup.c
+++ b/source4/utils/nmblookup.c
@@ -241,9 +241,9 @@ static bool process_one(const char *name, int nbt_port)
status = do_node_query(nbtsock, options.unicast_address,
nbt_port, node_name, node_type, false);
} else {
- int i, num_interfaces = iface_count();
+ int i, num_interfaces = iface_count(global_loadparm);
for (i=0;i<num_interfaces;i++) {
- const char *bcast = iface_n_bcast(i);
+ const char *bcast = iface_n_bcast(global_loadparm, i);
if (bcast == NULL) continue;
status = do_node_query(nbtsock, bcast, nbt_port,
node_name, node_type, true);
diff --git a/source4/web_server/web_server.c b/source4/web_server/web_server.c
index e68b967dfdc..a8fd9234aef 100644
--- a/source4/web_server/web_server.c
+++ b/source4/web_server/web_server.c
@@ -251,10 +251,10 @@ static void websrv_task_init(struct task_server *task)
if (!model_ops) goto failed;
if (lp_interfaces(task->lp_ctx) && lp_bind_interfaces_only(task->lp_ctx)) {
- int num_interfaces = iface_count();
+ int num_interfaces = iface_count(task->lp_ctx);
int i;
for(i = 0; i < num_interfaces; i++) {
- const char *address = iface_n_ip(i);
+ const char *address = iface_n_ip(task->lp_ctx, i);
status = stream_setup_socket(task->event_ctx, model_ops,
&web_stream_ops,
"ipv4", address,
diff --git a/source4/wrepl_server/wrepl_in_connection.c b/source4/wrepl_server/wrepl_in_connection.c
index f5d1d82f9d0..089bdd5f3ee 100644
--- a/source4/wrepl_server/wrepl_in_connection.c
+++ b/source4/wrepl_server/wrepl_in_connection.c
@@ -276,7 +276,7 @@ NTSTATUS wreplsrv_setup_sockets(struct wreplsrv_service *service, struct loadpar
}
if (lp_interfaces(lp_ctx) && lp_bind_interfaces_only(lp_ctx)) {
- int num_interfaces = iface_count();
+ int num_interfaces = iface_count(lp_ctx);
int i;
/* We have been given an interfaces line, and been
@@ -284,7 +284,7 @@ NTSTATUS wreplsrv_setup_sockets(struct wreplsrv_service *service, struct loadpar
socket per interface and bind to only these.
*/
for(i = 0; i < num_interfaces; i++) {
- address = iface_n_ip(i);
+ address = iface_n_ip(lp_ctx, i);
status = stream_setup_socket(task->event_ctx, model_ops, &wreplsrv_stream_ops,
"ipv4", address, &port,
lp_socket_options(task->lp_ctx),