Hi Jana,

Jana Rapava wrote:
"


As far as I know, DHCP needs some special treatment, but I'm not sure I 
understand you. Do you mean something like
setsockopt(SOL_SOCKET, SO_BINDTODEVICE, device) in Linux?


"
Yes, something like SO_BINDTODEVICE.




Let me explain in more detail. If you create a socket in HelenOS [or any 
other operating system, for that matter] using socket() and send a UDP 
datagram (or create TCP connection), the only thing you need to specify is 
the destination address. The network stack will determine the next hop / 
direction based on its current route table (i.e. configured subnets and 
static routes) - this influences what interface the datagram will be sent 
from.




The network stack next determines the *source address* as the local address 
of the interface the datagram is to be sent to. Finally the datagram is 
transmitted.





You can bind() the socket to a specific local address (might work in 
HelenOS, but not tested extensively, IMHO), which effectively determines 
which interface to send from. This only works, however, for interfaces that 
already have an address configured.




In case of interfaces that do not have an address, you need to specify the 
interface directly, that's what SO_BINDTODEVICE does, and I believe is used 
in some DHCP implementation(s).




In case of HelenOS you probably want to be able to specify the 'iplink' to 
use.




Regards

-Jiri
_______________________________________________
HelenOS-devel mailing list
[email protected]
http://lists.modry.cz/cgi-bin/listinfo/helenos-devel

Reply via email to