Re: [PATCH] Implement IP_UNICAST_IF socket option.
From: Erich E. Hoover <hidden>
Date: 2012-01-27 15:30:31
On Fri, Jan 27, 2012 at 2:01 AM, Hagen Paul Pfeifer [off-list ref] wrote:
On Thu, 26 Jan 2012 16:57:48 -0700, "Erich E. Hoover" wrote:quoted
The IP_UNICAST_IF feature is needed by the Wine project. This patch implements the feature by setting the outgoing interface in the same fashion as that of IP_PKTINFO.Why duplicate functionality - rewrite your application and use IP_PKTINFO or bind() your socket. This patch duplicate already existing functionality (and bloat inet_sock unnecessarily).
The IP_UNICAST_IF feature works on broadcast packets, so bind() won't do the trick. Also, native Windows applications have the ability to use both IP_PKTINFO and IP_UNICAST_IF on the same socket, so using IP_PKTINFO to implement IP_UNICAST_IF might break some applications. Even so, I did attempt to do this and Alexandre was unsatisfied with the approach since it required a significant amount of extra code and the extra communication between the "server" and "user" components of Wine significantly slowed down socket performance. Alexendre indicated that I need to get this functionality added to the kernel to implement the feature properly, so here I am. I'm hoping that I can also use this feature, combined with Linux Socket Filtering, to allow Windows applications to use bind() and have the socket still work with broadcast packets. IP_UNICAST_IF is a relatively new feature, older Windows applications used bind() instead (Windows bind() still captures broadcast packets). I've been working on different ways to get Wine to handle this capability for a long time and I'd really like to be able to finally check this bug off of my list. Anyway, thank you for taking the time to look at my patch. I really appreciate and I hope that I've satisfactorily answered your question. Erich Hoover ehoover@mines.edu