directing smbc_opendir(url) to an explicit interface

David Wuertele dave-gnus at bfnet.com
Thu Nov 13 02:23:00 GMT 2003


My computer has two interfaces, eth0 and eth1.
Each interface is on a different private subnet: 192.168.0.0/24 and
192.168.0.1/24 respectively.  There is no router forwarding packets.

Each subnet contains a separate WORKGROUP with separate netbios scope.
I do not mean ScopeID, I mean scope in terms of reachability.
These two WORKGROUPs are *meant* to be separated from each other.
My host is the only one that can see both.

I am writing a client program that uses libsmbclient to enumerate the
shares on each of these workgroups.  Here is the code that I'm using:

    snprintf (url, MAX_BUFF_SIZE, "smb://WORKGROUP");
    smbc_init (auth_fn, 0);
    dh = smbc_opendir (url);
    while (dirptr = smbc_readdir (dh)) {
      if (debug > 2) fprintf (stderr, "found server %s\n", dirptr->name);
    }

Unfortunately, this only prints the servers on the WORKGROUP found on
the *first* subnet, eth0.

The URL syntax doesn't seem to provide for differentiating these two
WORKGROUPS:

  smb://[[[domain;]user[:password@]]server[/share[/path[/file]]]]

Is it possible to tell "smbc_opendir(url)" which interface to use?

Dave




More information about the samba-technical mailing list