SO_BINDTODEVICE is not supported on this system

Matthias Andree mandree at
Tue Jul 23 19:10:10 UTC 2013

Am 23.07.2013 11:09, schrieb Lambrecht Jürgen:
> On 07/22/2013 05:02 AM, Denys Vlasenko wrote:
>> On Thursday 18 July 2013 20:59, Matthias Andree wrote:
>>> Am 18.07.2013 16:58, schrieb Lambrecht Jürgen:
>>>> On 07/18/2013 12:49 PM, Lambrecht Jürgen wrote:
>>>>> Hi,
>>>>> I am porting the busybox dhcp server to an RTOS (eCos). eCos uses the
>>>>> FreeBSD TCP/IP stack.
>>>>> I get this message: bb_error_msg("SO_BINDTODEVICE is not supported on
>>>>> this system");.
>>>>> Why not ignoring this option on systems that do not support it, as long
>>>>> as there is only 1 network interface?
>> I assume you are concerned with this code in networking/udhcp/socket.c:
>> int FAST_FUNC udhcp_listen_socket(/*uint32_t ip,*/ int port, const char *inf)
>> {
>> ...
>>          if (setsockopt_bindtodevice(fd, inf))
>>                  xfunc_die(); /* warning is already printed */
>> I propose replacing xfunc_die() here with a message
>> which explains that there could be problems
>> if we run on a multihomed machine.
> Indeed, that is what I try to do in my patch, but I try to only print a 
> message on a multihomed machine, not if there is only 1 interface.
>> On another note, how BSD software does this?
>> Surely they have dhcp clients, and they work correctly on multihomed machines?
> This is about the dhcp server.
> And I am quite sure the busybox dhcp server does not run on FreeBSD, 
> because there is no SO_BINDTODEVICE there. So the dhcp server will die 
> when run on FreeBSD.
> I sent an email to mandree at (found on 
> about it, but no reply yet.

In case you haven't noticed, you have already responded to my reply; I
had chosen to respond to the list, because your message was but a
forward from the list and because there is no need to take this talk
behind the scenes.

I have also stated that the FreeBSD busybox port does not install the
network applications.

FWIW, FreeBSD's dhclient uses the Berkeley Packet Filter and raw
sockets.  The source is at
<> for those who'd
like to peek.

> No, it is about the dhcp server.
> But anyhow, it is a valid point: the dhcp server (read in notes on the 
> busybox sources) should also run when the interface has no address!

This may not necessarily work everywhere, for the typical four-packet
exchange (discover->offer->request->ack), you may often see that the
later parts of the exchange, DHCP(ACK|NAK) in particular, talk unicast
rather than broadcast.

More information about the busybox mailing list