libsmbclient: Vista servers disconnect on netbios keepalive message on port 445

Christopher R. Hertel crh at ubiqx.mn.org
Wed Dec 27 19:13:38 GMT 2006


derrell at samba.org wrote:
:
>> The tests are fairly easy, though, and don't take much time.
> 
> Please enlighten me.  What would these tests be?

Well...

- Samba doesn't care, so a Samba server is easy.

- If you send an SMB SessionSetup without sending an NBT Session Request,
  and you get an error back, then you've probably got a Windows box and
  the destination port is running NBT.  That's fairly quick.  When I tested
  against W2K it didn't close the TCP connection.  It'd be good to test
  against Vista and W2K3, though.

- The slow test (the one to avoid) is to send the NBT Session Request once
  the TCP connection is established.  The down side is that W2K won't
  respond... it just times out.  That takes forever.  According to the
  reports, newer Windows flavors will close the TCP connection (which would
  be faster, but still not very friendly).

> So I guess I have a couple of options: I could entirely remove the use of NBT
> keepalive requests, or I can use them only if the port is 445.

s/445/139
... but yeah.

> Or, I can add
> those nefarious tests to determine which protocol set is being used.

The tests are only done when you do the initial setup and are good for as
long as that TCP connection is open, so you'd only need to keep one flag.

>> Thing is, libsmbclient is supposed to support the SMB URI, so that :port
>> syntax should be available to the end user.  Mapping ports through a
>> firewall is fairly common practice.
> 
> Currently, libsmbclient supports a subset of the spec, specifically:
> 
>   smb://[[[domain;]user[:password]@]server[/share[/path[/file]]]][?options]
> 
> It does not support "cifs:" and although it knows the concept of options,
> currently no local options are supported.  It knows nothing of a port
> specifier, so that's currently not being used and we can therefore ignore your
> "minor issue".  I've never had a request to add a port specifier, and I'm not
> exactly inclined to create work for myself. :-)

Fair 'nough.

Again, I only raised it because I had complaints (and because I like fiddly
details).

>> By the way, there is a keepalive parameter in smb.conf.  I don't know
>> whether libsmbclient reads that value or not, and the docs don't say what
>> value means "turn this off", but I would assume that zero would do the job.
> 
> That wouldn't make sense, though, since this would be a per-connection issue,
> not a system-wide setting, right?

Yeah, I'm not sure how that parameter does/doesn't impact the client code.
Sometimes, however, those parameters do have an impact so I figured I'd
mention it.

Chris -)-----

-- 
"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   crh at ubiqx.mn.org
OnLineBook -- http://ubiqx.org/cifs/    -)-----   crh at ubiqx.org


More information about the samba-technical mailing list