qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Mark Jonckheere <mark.jonckheere@easynet.be>
To: qemu-devel@nongnu.org, paul@nowt.org, fabrice@bellard.org
Subject: [Qemu-devel] [PATCH]: UDP-broadcast address-translation error in slirp code.
Date: Tue, 02 May 2006 12:26:27 -0000	[thread overview]
Message-ID: <44574FCF.3080403@easynet.be> (raw)

[-- Attachment #1: Type: text/plain, Size: 1291 bytes --]

Fabrice, Paul,

There has been a lot of changes in the slirp code this last week,
so I'll try once again to submit my UDP broadcast patch. Note, the
patch has been modified from previous submissions: this time I do
only a check for a broadcast address, when the address has been
replaced with our special address.

Description of the problem:

    guest         host
    -----         ----
10.0.2.15 --> 10.0.2.255  # guest sends broadcast packet
10.0.2.15 <-- 10.0.2.255  # host sends reply with invalid source
                           # address, packet is ignored by guest

This should be:

    guest         host
    -----         ----
10.0.2.15 --> 10.0.2.255  # guest sends broadcast packet
10.0.2.15 <-- 10.0.2.2    # host replies with his own address.


Packets with destination address 10.0.2.255 (IP-broadcast) from the
guest to the host are replied by the slirp code with this broadcast
address as source address where it should be the host IP-address
(CTL_ALIAS), since CTL_CMD and CLT_EXEC are not used and CTL_DNS is
excluded because it doesn't make sense to do a broadcast DNS lookup.

Correcting this bug makes it possible for e.g. a Windows 98 guest to
browse the network neigbourhoud and see the share that is published
by the host with the -smb switch.

Greetings,
Mark.

[-- Attachment #2: patches.diff --]
[-- Type: text/x-patch, Size: 695 bytes --]

diff -wurb qemu/slirp/udp.c qemu-patched/slirp/udp.c
--- qemu/slirp/udp.c	2005-07-03 19:08:43.000000000 +0200
+++ qemu-patched/slirp/udp.c	2006-05-02 12:19:22.000000000 +0200
@@ -312,8 +312,11 @@
     struct sockaddr_in saddr, daddr;
 
     saddr = *addr;
-    if ((so->so_faddr.s_addr & htonl(0xffffff00)) == special_addr.s_addr)
+    if ((so->so_faddr.s_addr & htonl(0xffffff00)) == special_addr.s_addr) {
         saddr.sin_addr.s_addr = so->so_faddr.s_addr;
+        if ((so->so_faddr.s_addr & htonl(0x000000ff)) == htonl(0xff))
+            saddr.sin_addr.s_addr = special_addr.s_addr | htonl(CTL_ALIAS);
+    }
     daddr.sin_addr = so->so_laddr;
     daddr.sin_port = so->so_lport;
     

                 reply	other threads:[~2006-05-02 12:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=44574FCF.3080403@easynet.be \
    --to=mark.jonckheere@easynet.be \
    --cc=fabrice@bellard.org \
    --cc=paul@nowt.org \
    --cc=qemu-devel@nongnu.org \
    /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).