From: Mike F. <vap...@gm...> - 2008-06-23 20:50:39
|
On Mon, Jun 23, 2008 at 4:27 PM, Henry Nestler wrote: > With rev 479/480 you pointed to a bigger set of changes. > > By the while I found the place where it goes wrong. Please see the > source snip or: > http://colinux.svn.sourceforge.net/viewvc/colinux/branches/devel/src/colinux/user/slirp/udp.c?revision=677&view=markup > > file udp.c, line 323, function udp_output() > > In the line 323 the source address saddr.sin_addr (192.168.x.x) is > overwritten with 10.0.2.2 > One line before was checked the listen address (so->so_faddr). > I'm afraid, there should check the source address instead? But why there > is a check for broadcast? Is that a hack for a hack? It sems me, that it > would better work without the lines from 322 to 326 there? > > Background: > special_addr = 10.0.2.2 (const) > > All UDP sockets are listen on address 0.0.0.0, that address is set as > faked address 10.0.2.2 in line 383: > "so->so_faddr = alias_addr;" > > ----------------------------------- > devel/src/colinux/user/slirp/udp.c > 315 int udp_output(struct socket *so, struct mbuf *m, > 316 struct sockaddr_in *addr) > 317 > 318 { > 319 struct sockaddr_in saddr, daddr; > 320 > 321 saddr = *addr; > 322 if ((so->so_faddr.s_addr & htonl(0xffffff00)) == > special_addr.s_addr) { > 323 saddr.sin_addr.s_addr = so->so_faddr.s_addr; > 324 if ((so->so_faddr.s_addr & htonl(0x000000ff)) == htonl(0xff)) > 325 saddr.sin_addr.s_addr = alias_addr.s_addr; > 326 } > 327 daddr.sin_addr = so->so_laddr; > 328 daddr.sin_port = so->so_lport; > 329 > 330 return udp_output2(so, m, &saddr, &daddr, so->so_iptos); > 331 } i'd like to assist in analysis, but i'm not familiar with any of the colinux source base, so i cant really even make an educated guess; i'd be shooting blind. i'll gladly test any proposed changes though. a comment block here in the source explaining what it's supposed to be doing would have been useful :/. -mike |