qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH]: UDP-broadcast address-translation error in slirp code.
@ 2006-05-02 12:26 Mark Jonckheere
  0 siblings, 0 replies; only message in thread
From: Mark Jonckheere @ 2006-05-02 12:26 UTC (permalink / raw)
  To: qemu-devel, paul, fabrice

[-- 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;
     

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-05-02 12:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-02 12:26 [Qemu-devel] [PATCH]: UDP-broadcast address-translation error in slirp code Mark Jonckheere

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).