From b9ae225b28f4707609e6436dad4be7ebdd7e181f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 6 Jun 1996 11:43:09 +0000 Subject: - added interface.c and removed all the references to myip, bcast_ip and Netmask, instead replacing them with calls to routines in interface.c - got rid of old MAXINT define - added code to ensure we only return one entry for each name in the ipc enum routines - added new_only option to add_netbios_entry() to prevent overwriting of important names - minor time handling fixup (This used to be commit 7ed71b73ae745da099072eee36fc2700d1d91407) --- source3/utils/nmblookup.c | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) (limited to 'source3/utils/nmblookup.c') diff --git a/source3/utils/nmblookup.c b/source3/utils/nmblookup.c index 6289ef74b1..43c328a41e 100644 --- a/source3/utils/nmblookup.c +++ b/source3/utils/nmblookup.c @@ -30,11 +30,8 @@ extern int DEBUGLEVEL; extern pstring scope; -extern struct in_addr bcast_ip; extern pstring myhostname; - -static BOOL got_bcast = False; -struct in_addr ipzero; +extern struct in_addr ipzero; int ServerFD= -1; @@ -69,24 +66,9 @@ static BOOL open_sockets(void) ****************************************************************************/ static BOOL init_structs(void ) { - struct in_addr myip; - - if (!get_myname(myhostname,&myip)) + if (!get_myname(myhostname,NULL)) return(False); - /* Read the broadcast address from the interface */ - { - struct in_addr ip0,ip2; - - ip0 = myip; - - if (!got_bcast) { - get_broadcast(&ip0,&bcast_ip,&ip2); - - DEBUG(2,("Using broadcast %s\n",inet_ntoa(bcast_ip))); - } - } - return True; } @@ -124,8 +106,6 @@ int main(int argc,char *argv[]) TimeInit(); - ipzero = *interpret_addr2("0.0.0.0"); - setup_logging(argv[0],True); charset_initialise(); @@ -134,11 +114,7 @@ int main(int argc,char *argv[]) switch (opt) { case 'B': - { - unsigned long a = interpret_addr(optarg); - putip((char *)&bcast_ip,(char *)&a); - got_bcast = True; - } + iface_set_default(NULL,optarg,NULL); break; case 'i': strcpy(scope,optarg); @@ -167,10 +143,11 @@ int main(int argc,char *argv[]) exit(1); } + load_interfaces(); init_structs(); if (!open_sockets()) return(1); - DEBUG(1,("Sending queries to %s\n",inet_ntoa(bcast_ip))); + DEBUG(1,("Sending queries to %s\n",inet_ntoa(*iface_bcast(ipzero)))); for (i=optind;i