Jack Dao <(E-Mail Removed)> writes:
> Yes, it is a BINDTODEVICE socket:
>
> if
> (setsockopt(servers[n].getSocketFD(), SOL_SOCKET,
> SO_BINDTODEVICE, (char
> *)&interface, sizeof (interface)) < 0) {
>
> So is this the right behavior for a socket that is bound to an
> interface which has no IP address nor cable plugged into it's RJ45
> jack, should this particular socket get UDP Broadcast message that
> eminate from the different NIC within the system?
It does sound wrong to me.
After some experimentation, I can't get an unconfigured interface to
return any packets at all, i.e. I can't reproduce the behavior you
describe.
Just a thought: can you verify that you're definitely passing a
nontrivial interface name? (strace -esetsockopt may help.) If you're
accidentally passing a null string then setsockopt() will succeed but
you won't get the device-specific bind.
My somewhat hacky test code:
http://www.chiark.greenend.org.uk/uc...t/udptest.git/
--
http://www.greenend.org.uk/rjk/