Skip to contentSkip to conversation

PATCH: access samba-server on host OS with -user-net

Qemu-devel Mark Jonckheere 1 participant 1 message Aug 31, 2004

lore
Share & tools
lore
#0 lore raw

After switching from TUN/TAP-based to slirp-based networking, I discovered that a windows 98 client couldn't access the samba server on the linux host anymore.

After some debugging it became clear that UDP messages sent with a broadcast destination address 10.0.2.255 are answered with that same broadcast address as a source address. These answers are ignored by windows.

The following patch corrects this:

---8<------------------------------------

slirp/udp.c +2 -0
@@ -314,6 +314,8 @@
     saddr = *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;
 

---8<------------------------------------

Groeten,
Mark.

Signature · 1 line
:wq