Commit f3ae070459066e8bb878cf1f48ff53018545241d

Authored by balrog
1 parent 4fc5d071

Treat DNS a special case among special addresses in slirp (Jason Wessel).


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4267 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 4 additions and 3 deletions
slirp/udp.c
... ... @@ -318,11 +318,12 @@ int udp_output(struct socket *so, struct mbuf *m,
318 318 struct sockaddr_in saddr, daddr;
319 319  
320 320 saddr = *addr;
321   - if ((so->so_faddr.s_addr & htonl(0xffffff00)) == special_addr.s_addr &&
322   - addr->sin_addr.s_addr == htonl(0x7f000001)) {
323   - saddr.sin_addr.s_addr = so->so_faddr.s_addr;
  321 + if ((so->so_faddr.s_addr & htonl(0xffffff00)) == special_addr.s_addr) {
324 322 if ((so->so_faddr.s_addr & htonl(0x000000ff)) == htonl(0xff))
325 323 saddr.sin_addr.s_addr = alias_addr.s_addr;
  324 + else if (addr->sin_addr.s_addr == loopback_addr.s_addr ||
  325 + ((so->so_faddr.s_addr & htonl(CTL_DNS)) == htonl(CTL_DNS)))
  326 + saddr.sin_addr.s_addr = so->so_faddr.s_addr;
326 327 }
327 328 daddr.sin_addr = so->so_laddr;
328 329 daddr.sin_port = so->so_lport;
... ...