http://bugs.winehq.org/show_bug.cgi?id=7929
------- Additional Comments From d13f00l@gmail.com 2007-20-05 01:30 ------- I really can't think of a sane way to do this...SO_BINDTODEVICE is root only...so we can't use that. I posted a few comments on linux-net, hoping someone would have something interesting to say.
http://www.uwsg.iu.edu/hypermail/linux/net/0705.1/0029.html http://www.uwsg.iu.edu/hypermail/linux/net/0705.1/0028.html
We can use IP_PKTINFO with sendmsg() and recvmsg()....and keep a table of what each socket should listen and send on. If you bind a socket to INADDR_ANY under linux, you'll be able to receive from any interface, but sending defaults on the default route.
sendmsg() can be persuaded to send out on other interfaces _I THINK_ by setting that socket option, and giving it a struct in_pktinfo filled out w/ the device ip/interface index.
So Wine's recv and send implementations would have to be changed slightly...we'd have to maintain a list of what each socket should map to, since we override what windows programs suggest and bind to 0.0.0.0...probably with a linked list...adding new elements on bind()...but this can create all sorts of memory leaks if applications don't close() sockets...
It's pretty silly...so_bindtodevice does all this flawlessly in kernel space. Another person suggested on the boards that the kernel be modified to have a socket option to be able to recv broadcasts even if sockets are bound to an ip other than INADDR_ANY.....that's looking to be a good option at this point. I wonder if people can be persuaded this is a good idea...