Re: Blocking DNS lookup on MC startup



On Wed, 31 May 2006, Pavel Tsekov wrote:

On Tue, 30 May 2006, Pavel Tsekov wrote:

Yes. I understood that the first time through. There was a similiar bug
report already.

The question is: why MC is doing DNS queries? Is possible to
disable them?

Maybe someone else is doing those queries. A library linked to MC most likely. I've tried to reproduce that many times and I cannot get neither
the slowdown nor those particualr dns lookups for interface names. I
disconnect the network cable and still I am not able to get the described
behaviour.

Ok, I was able to reproduce it - it seems that the slowdown happens only
if MC has smbfs support. I'll investigate.

Here is a backtrace:

(gdb) bt
#0  0x00a19402 in ?? ()
#1  0x007b7c79 in poll () from /lib/libc.so.6
#2  0x00119187 in __libc_res_nsend () from /lib/libresolv.so.2
#3  0x00117f8b in __libc_res_nquery () from /lib/libresolv.so.2
#4  0x0011821e in __libc_res_nquerydomain () from /lib/libresolv.so.2
#5  0x001185df in __libc_res_nsearch () from /lib/libresolv.so.2
#6  0x0056c91a in _nss_dns_gethostbyname3_r () from /lib/libnss_dns.so.2
#7  0x0056cb30 in _nss_dns_gethostbyname_r () from /lib/libnss_dns.so.2
#8  0x007d7282 in gethostbyname_r@@GLIBC_2.1.2 () from /lib/libc.so.6
#9  0x007d6bf0 in gethostbyname () from /lib/libc.so.6
#10 0x080eb399 in sys_gethostbyname (name=0x9f38e50 "pavel") at ../../../mc/vfs/samba/lib/system.c:273
#11 0x080ea7b7 in Get_Hostbyname (name=0xbfa19990 "pavel") at ../../../mc/vfs/samba/lib/util.c:2258
#12 0x080e9ac6 in get_myname (my_name=0x8128720 "", ip=0x0) at ../../../mc/vfs/samba/lib/util.c:1690
#13 0x080d113a in smbfs_init (me=0x814b140) at ../../mc/vfs/smbfs.c:306
#14 0x080da44e in vfs_register_class (vfs=0x814b140) at ../../mc/vfs/vfs.c:146
#15 0x080d5e6f in init_smbfs () at ../../mc/vfs/smbfs.c:2020
#16 0x080dc1c8 in vfs_init () at ../../mc/vfs/vfs.c:889
#17 0x08081ded in main (argc=2, argv=0xbfa19ee4) at ../../mc/src/main.c:2186

It is clear that this happens only of smbfs support is enabled.

Now, init_smbfs() wants to get the name of the local machine and calls
get_myname(). get_myname() retrieves both the host name and the ip address
of the local machine. This is where the dns lookups are generated. They
are generated either because you don't have an entry for your machine in
/etc/hosts or your setup requests dns lookups to be performed prior to
/etc/hosts lookup.

You may have noticed that the get_myname() call doesn't ask specifically for the ip address (its second argument is NULL) and despite of that
dns lookup is performed - well, get_myname() is a bit stupid. There is
also this interesting fact - smbfs_init() retrieves the hostname but it
actually serves no purpose, it is not used anywhere in the code.

I see several solutions to this problem:

1) The user arranges for her/his network setup to be correct

2) We fix get_myname() so that it won't perform lookups except
when asked to do so

3) We remove the call to get_myname() from smbfs_init()

4) other suggestions




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]