Bug 3336 - libsmbclient ignore "interfaces" and "bind interfaces only" options
Summary: libsmbclient ignore "interfaces" and "bind interfaces only" options
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: 3.0.21
Hardware: All Linux
: P3 minor
Target Milestone: none
Assignee: Derrell Lipman
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-15 19:53 UTC by Mikhail Kshevetskiy (dead mail account)
Modified: 2005-12-24 21:28 UTC (History)
0 users

See Also:


Attachments
"smbclient -L orry" and smbc_opendir("smb://orry") difference (3.28 KB, text/plain)
2005-12-15 19:56 UTC, Mikhail Kshevetskiy (dead mail account)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail Kshevetskiy (dead mail account) 2005-12-15 19:53:38 UTC
libsmbclient ignore "interfaces" and "bind interfaces only" options of smb.conf and ~/.smb/smb.conf. So it send broadcast query to resolve netbios names on all interfaces.

Look to attached file (debug.diff). I attach it to clear the problem. This is a difference in debug level 10 output of "smbclient -L ORRY -d10" and similar program using libsmbclient. As you can see smbclient use 10.0.14.13/16 and 127.0.0.1/24 interfaces, so it query for ORRY only on 10.0.14.13 interface.  libsmbclient use all(except lo) my interfaces, so it query for ORRY on 195.19.252.52/24 interface (this fail) and then on 10.0.14.13/16 interface.  This is the reason for annoying me delay during the scanning shares list by NetBIOS name.

I made more accurate measurement. Here is a results of time required  to smbc_opendir() for 2 situations:

Situation 1.
============
  I have 3 network interface: 195.19.252.72/24, 10.0.14.13/16, 10.0.14.133/16.
  smbd/nmbd listen on 10.0.14.13 and 127.0.0.1.

  smb://10.0.14.13/bbs   0.04 sec
  smb://10.0.14.13       0.04 sec
  smb://laska/bbs        1.14 sec    (see note 1 below)
  smb://laska            7.22 sec    (see note 2 below)

Situation 2.
============
  I have 1 network interface: 10.0.14.13/16
  smbd/nmbd listen on 10.0.14.13 and 127.0.0.1.

  smb://10.0.14.13/bbs   0.04 sec
  smb://10.0.14.13       0.04 sec
  smb://laska/bbs        0.32 sec   (see note 1 below)
  smb://laska            2.25 sec   (see note 2 below)

==========================================================================

Note 1
------
  in Situation 1 we have 3 failed query before NetBIOS name was resolved.
  This is 3 broadcast query of laska<0x20> on 195.19.252.72/24. 

  So we got:
    time of failed query = 0.3 sec
    time of success query = 0.3 sec

Note 2
------
  in Situation 1 we have 21 failed query before NetBIOS name was resolved.
  This is:
    3 broadcast query of laska<0x1d> on 195.19.252.72/24
    3 broadcast query of laska<0x1d> on 10.0.14.13/16
    3 broadcast query of laska<0x1d> on 10.0.14.133/16 
    3 broadcast query of laska<0x1b> on 195.19.252.72/24 
    3 broadcast query of laska<0x1b> on 10.0.14.13/16  
    3 broadcast query of laska<0x1b> on 10.0.14.133/16 
    3 broadcast query of laska<0x20> on 195.19.252.72/24
  in Situation 2 we have only 6 failed query before NetBIOS name was resolved.
  This is:
    3 broadcast query of laska<0x1d> on 10.0.14.133/16
    3 broadcast query of laska<0x1b> on 10.0.14.13/16

  So we got:
    time of failed query = 0.3 sec
    time of success query = 0.3 sec

=======================================================
Conclusion
=======================================================
What can be done to improve the situation:

1) do not ignore "interfaces" and "bind interfaces only" options.
   In the Situation 1 this will allow us to avoid 15 failed broadcast queries,
   so we can decrease the time of shares listing up to 5 sec.

2) We can assume, what people more ofthen want to see shares list then 
   computers/groups list, so we can reorder the queries to find the 
   NetBIOS names of type <0x20>.

3) I think, it's possible to query NETBIOS name of type <0x00>, analyse the
   first reply (i mean something like "nmblookup -S name"). If it hostname
   we got ip already, if it group/domain name, then query for NetBIOS names
   of type <0x1d> and <0x1b>.
Comment 1 Mikhail Kshevetskiy (dead mail account) 2005-12-15 19:56:30 UTC
Created attachment 1618 [details]
"smbclient -L orry" and smbc_opendir("smb://orry") difference
Comment 2 Derrell Lipman 2005-12-24 21:17:52 UTC
Doh.  It helps to actually load the global configuration file.  It wasn't ignoring only "interfaces" and "bind interfaces only" but rather ignoring everything in the global configuration file.
Comment 3 Derrell Lipman 2005-12-24 21:28:09 UTC
Nope, previous fix was wrong.  It was opening the global config file; it was just loading the interfaces before having done so.  Interface loading is now done after all configuration files have been read.