mirror_qemu/net
Michael Tokarev 5c1e1890bf slirp smb with modern win guests when samba is also running on host
After numerous reports that -smb (or -netdev user,smb=foo) not working
with modern windows (win7 and vista are reported as non-working), I
started digging myself.  And found that indeed it doesn't work, and
why.

The thing is that modern win tries to connect to port 445 (microsoft-ds)
first, and if that fails, it falls back to old port 139 (netbios-ssn).

slirp code in qemu only redirects port 139, it does not touch port 445.

So the prob is that if samba is also running on the host, guest will try
to communicate using port 445, and that will succed, but ofcourse guest
will not talk with our samba but with samba running on the host.

If samba is not running on the host, guest will fall back to port 139,
and will reach the redirecting rule and qemu will spawn smbd correctly.

The solution is to redirect both ports (139 and 445), and the fix is
a one-liner, adding second call to slirp_add_exec() at the end of
net/slirp.c:slirp_smb() function (provided below).

But it looks like that is not a proper fix really, since in theory
we should redirect both ports to the SAME, single samba instance,
but I'm not sure this is possible with slirp.  Well, even if two
smbd processes will be run on the same config dir, it should not
be a problem.

The one-liner (not exactly 1 since it touches previous line too) is like
this:

Signed-off-By: Michael Tokarev <mjt@tls.msk.ru>

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2014-03-12 08:13:24 +01:00
..
Makefile.objs net: Adding netmap network backend 2013-12-09 13:33:19 +01:00
checksum.c net: iovec checksum calculator 2013-03-25 11:13:10 +01:00
clients.h net: Adding netmap network backend 2013-12-09 13:33:19 +01:00
dump.c aio / timers: Switch entire codebase to the new timer API 2013-08-22 19:14:24 +02:00
eth.c misc: Use g_assert_not_reached for code which is expected to be unreachable 2013-07-27 11:22:54 +04:00
hub.c net: Rename send_queue to incoming_queue 2013-09-06 17:01:26 +02:00
hub.h net: fix qemu_flush_queued_packets() in presence of a hub 2013-02-27 16:10:23 +01:00
net.c net: remove implicit peer from offload API 2014-02-25 14:31:05 +01:00
netmap.c net: Disable netmap backend when not supported 2014-02-25 11:50:17 +01:00
queue.c net: fix unbounded NetQueue 2013-02-27 16:10:39 +01:00
slirp.c slirp smb with modern win guests when samba is also running on host 2014-03-12 08:13:24 +01:00
socket.c net: call socket_set_fast_reuse instead of setting SO_REUSEADDR 2013-10-02 19:20:31 +02:00
tap-aix.c tap: multiqueue support 2013-02-01 11:03:02 -06:00
tap-bsd.c tap: Use numbered tap/tun devices on all *BSD OS's 2013-09-06 17:01:26 +02:00
tap-haiku.c tap: multiqueue support 2013-02-01 11:03:02 -06:00
tap-linux.c tap-linux: Get features once and use it many times 2014-01-27 15:44:06 +01:00
tap-linux.h tap: set IFF_ONE_QUEUE per default 2013-02-27 16:10:47 +01:00
tap-solaris.c tap: multiqueue support 2013-02-01 11:03:02 -06:00
tap-win32.c net: make tap offloading callbacks static 2014-02-25 11:50:17 +01:00
tap.c net: make tap offloading callbacks static 2014-02-25 11:50:17 +01:00
tap_int.h tap: multiqueue support 2013-02-01 11:03:02 -06:00
util.c net: reorganize headers 2012-12-19 08:31:29 +01:00
util.h net: move parse_macaddr() to net/util.[ch] 2009-12-03 09:41:34 -06:00
vde.c net: increase buffer size to accommodate Jumbo frame pkts 2013-03-25 11:14:07 +01:00