summaryrefslogtreecommitdiff
path: root/source4/utils/nmblookup.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/utils/nmblookup.c')
-rw-r--r--source4/utils/nmblookup.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source4/utils/nmblookup.c b/source4/utils/nmblookup.c
index 1471dfb5b7..6c849fc0db 100644
--- a/source4/utils/nmblookup.c
+++ b/source4/utils/nmblookup.c
@@ -180,7 +180,8 @@ static NTSTATUS do_node_query(struct nbt_name_socket *nbtsock,
}
-static bool process_one(struct loadparm_context *lp_ctx, const char *name, int nbt_port)
+static bool process_one(struct loadparm_context *lp_ctx,
+ struct interface *ifaces, const char *name, int nbt_port)
{
TALLOC_CTX *tmp_ctx = talloc_new(NULL);
enum nbt_name_type node_type = NBT_NAME_CLIENT;
@@ -242,9 +243,11 @@ static bool process_one(struct loadparm_context *lp_ctx, const char *name, int n
status = do_node_query(nbtsock, options.unicast_address,
nbt_port, node_name, node_type, false);
} else {
- int i, num_interfaces = iface_count(lp_ctx);
+ int i, num_interfaces;
+
+ num_interfaces = iface_count(ifaces);
for (i=0;i<num_interfaces;i++) {
- const char *bcast = iface_n_bcast(lp_ctx, i);
+ const char *bcast = iface_n_bcast(ifaces, i);
if (bcast == NULL) continue;
status = do_node_query(nbtsock, bcast, nbt_port,
node_name, node_type, true);
@@ -267,6 +270,7 @@ static bool process_one(struct loadparm_context *lp_ctx, const char *name, int n
int main(int argc, const char *argv[])
{
bool ret = true;
+ struct interface *ifaces;
poptContext pc;
int opt;
enum {
@@ -350,11 +354,13 @@ int main(int argc, const char *argv[])
poptPrintUsage(pc, stderr, 0);
exit(1);
}
+
+ load_interfaces(lp_interfaces(cmdline_lp_ctx), &ifaces);
while (poptPeekArg(pc)) {
const char *name = poptGetArg(pc);
- ret &= process_one(cmdline_lp_ctx, name, lp_nbt_port(cmdline_lp_ctx));
+ ret &= process_one(cmdline_lp_ctx, ifaces, name, lp_nbt_port(cmdline_lp_ctx));
}
poptFreeContext(pc);