summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1997-10-26 07:50:28 +0000
committerAndrew Tridgell <tridge@samba.org>1997-10-26 07:50:28 +0000
commit57e0fac61414c032df35c8a4c0ba4d3a9f55c5b8 (patch)
treed4672670140a0b8af9aa6cb0082d08dcd248e2af /source
parent944ecbcbd47afcc20e2e408a06d57c7b8d0d86a8 (diff)
downloadsamba-57e0fac61414c032df35c8a4c0ba4d3a9f55c5b8.tar.gz
samba-57e0fac61414c032df35c8a4c0ba4d3a9f55c5b8.tar.xz
samba-57e0fac61414c032df35c8a4c0ba4d3a9f55c5b8.zip
added -U option to nmblookup. This is similar to -B except that it
forces the client to send a unicast instead of a broadcast netbios packet. This is useful for diagnostics.
Diffstat (limited to 'source')
-rw-r--r--source/utils/nmblookup.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/source/utils/nmblookup.c b/source/utils/nmblookup.c
index d26d1996957..a44dad511e2 100644
--- a/source/utils/nmblookup.c
+++ b/source/utils/nmblookup.c
@@ -100,6 +100,7 @@ int main(int argc,char *argv[])
int i;
static pstring servicesf = CONFIGFILE;
struct in_addr bcast_addr;
+ BOOL use_bcast = True;
BOOL got_bcast = False;
BOOL lookup_by_ip = False;
@@ -112,13 +113,20 @@ int main(int argc,char *argv[])
charset_initialise();
- while ((opt = getopt(argc, argv, "d:B:i:s:SMrhA")) != EOF)
+ while ((opt = getopt(argc, argv, "d:B:U:i:s:SMrhA")) != EOF)
switch (opt)
{
case 'B':
iface_set_default(NULL,optarg,NULL);
bcast_addr = *interpret_addr2(optarg);
got_bcast = True;
+ use_bcast = True;
+ break;
+ case 'U':
+ iface_set_default(NULL,optarg,NULL);
+ bcast_addr = *interpret_addr2(optarg);
+ got_bcast = True;
+ use_bcast = False;
break;
case 'i':
fstrcpy(scope,optarg);
@@ -172,7 +180,6 @@ int main(int argc,char *argv[])
for (i=optind;i<argc;i++)
{
- BOOL bcast = True;
int retries = 2;
char *p;
struct in_addr ip;
@@ -203,12 +210,11 @@ int main(int argc,char *argv[])
if (p) {
*p = 0;
sscanf(p+1,"%x",&lookup_type);
- bcast = False;
retries = 1;
}
- if (name_query(ServerFD,lookup,lookup_type,bcast,True,
- bcast_addr,&ip,NULL))
+ if (name_query(ServerFD,lookup,lookup_type,use_bcast,True,
+ bcast_addr,&ip,NULL))
{
printf("%s %s\n",inet_ntoa(ip),lookup);