qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Michael Tokarev <mjt@tls.msk.ru>,
	Qemu Development List <Qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] slirp smb with modern win guests when samba is also running on host
Date: Wed, 12 Mar 2014 08:23:36 +0100	[thread overview]
Message-ID: <53200B78.2020509@siemens.com> (raw)
In-Reply-To: <52979A67.80305@msgid.tls.msk.ru>

On 2013-11-28 20:32, Michael Tokarev wrote:
> 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.

I don't see either that this is expressible with the current exec
feature of slirp.

> 
> The one-liner (not exactly 1 since it touches previous line too) is like
> this:
> 
> Signed-off-By: Michael Tokarev <mjt@tls.msk.ru>
> 
> diff --git a/net/slirp.c b/net/slirp.c
> index 124e953..a22e976 100644
> --- a/net/slirp.c
> +++ b/net/slirp.c
> @@ -549,7 +549,8 @@ static int slirp_smb(SlirpState* s, const char *exported_dir
>      snprintf(smb_cmdline, sizeof(smb_cmdline), "%s -s %s",
>               CONFIG_SMBD_COMMAND, smb_conf);
> 
> -    if (slirp_add_exec(s->slirp, 0, smb_cmdline, &vserver_addr, 139) < 0) {
> +    if (slirp_add_exec(s->slirp, 0, smb_cmdline, &vserver_addr, 139) < 0 ||
> +        slirp_add_exec(s->slirp, 0, smb_cmdline, &vserver_addr, 445) < 0) {
>          slirp_smb_cleanup(s);
>          error_report("conflicting/invalid smbserver address");
>          return -1;
> 

Thanks, merged to my slirp queue. Will send this out ASAP, sorry for the
excessive delay.

JAn

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux

      parent reply	other threads:[~2014-03-12  7:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-28 19:32 [Qemu-devel] slirp smb with modern win guests when samba is also running on host Michael Tokarev
2014-02-05  9:18 ` Michael Tokarev
2014-03-12  7:23 ` Jan Kiszka [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53200B78.2020509@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=Qemu-devel@nongnu.org \
    --cc=mjt@tls.msk.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).