Date: Fri, 20 Apr 2012 14:53:17 +0200 From: Attila Nagy <bra@fsn.hu> To: Svatopluk Kraus <onwahe@gmail.com> Cc: freebsd-net@freebsd.org Subject: Re: SO_BINDTODEVICE or equivalent? Message-ID: <4F915C3D.5070908@fsn.hu> In-Reply-To: <CAFHCsPXxwoF_xzUZGn8xH_ynPUnthdzF17M%2BsTOeRZpmHgxxyQ@mail.gmail.com> References: <4F8FA591.4010503@fsn.hu> <CAFHCsPXxwoF_xzUZGn8xH_ynPUnthdzF17M%2BsTOeRZpmHgxxyQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi, Never heard of it, thanks! On 04/19/12 11:32, Svatopluk Kraus wrote: > Hi, > > Use IP_RECVIF option. > > For IP_SENDIF look at > http://lists.freebsd.org/pipermail/freebsd-net/2007-March/013510.html > I used the patch on my embedded FreeBSD 9.0 boxes and it works fine. I > modificated it slightly to match 9.0. > > Svata > > On Thu, Apr 19, 2012 at 7:41 AM, Attila Nagy<bra@fsn.hu> wrote: >> Hi, >> I want to solve the classic problem of a DHCP server: listening for >> broadcast UDP packets and figuring out what interface a packet has >> come in. >> The Linux solution is SO_BINDTODEVICE, which according to socket(7): >> SO_BINDTODEVICE >> Bind this socket to a particular device like "eth0", as >> specified in the passed interface name. If the name is an empty >> string or the option length is zero, the socket device binding >> is removed. The passed option is a variable-length >> null-terminated interface name string with the maximum size of >> IFNAMSIZ. If a socket is bound to an interface, only packets >> received from that particular interface are processed by the >> socket. Note that this only works for some socket types, >> particularly AF_INET sockets. It is not supported for packet >> sockets (use normal [1]bind(2) there). >> >> This makes it possible to listen on selected interfaces for >> (broadcast) packets. FreeBSD currently doesn't implement this feature
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F915C3D.5070908>