Opened 9 years ago
Closed 9 years ago
#626 closed defect (fixed)
SO_IPLINK socket option lacks important functionality of SO_BINDTODEVICE
Reported by: | Martin Decky | Owned by: | Jiri Svoboda |
---|---|---|---|
Priority: | major | Milestone: | 0.7.0 |
Component: | helenos/net/udp | Version: | mainline |
Keywords: | Cc: | ||
Blocker for: | Depends on: | ||
See also: |
Description (last modified by )
The currently implemented SO_IPLINK socket option in the UDP server lacks one important functionality of SO_BINDTODEVICE in Linux.
In Linux, the SO_BINDTODEVICE option is used to allow the DHCP client to configure multiple network devices by binding multiple sockets to the same source pair (INADDR_ANY, 68), but on different network devices.
Change History (6)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Yes, the SO_IPLINK option was apparently meant as HelenOS equivalent of SO_BINDTODEVICE from Linux. I am going to edit this ticket to reflect that.
However, this does not change the actual problem:
- The DHCP client sets the SO_IPLINK option only after it tries to bind the socket to the colliding source pair (INADDR_ANY, 68). This is not very helpful.
- The SO_IPLINK option does not lift the requirement for globally unique source pairs in the UDP server.
comment:3 by , 9 years ago
Component: | helenos/net/socket → helenos/net/udp |
---|---|
Description: | modified (diff) |
Owner: | set to |
Summary: | SO_BINDTODEVICE socket option not implemented → SO_IPLINK socket option lacks important functionality of SO_BINDTODEVICE |
comment:4 by , 9 years ago
Status: | new → accepted |
---|
comment:5 by , 9 years ago
Pushed workaround in mainline,2325 (thx Jan Buchar). We close the socket as soon as we get an address - this allows for the other DHCP instance to succeed (possibly on a retry). I am working on final solution while doing a cleanup of the transport API in https://code.launchpad.net/~jsvoboda/helenos/nettlapi.
comment:6 by , 9 years ago
Milestone: | → 0.7.0 |
---|---|
Resolution: | → fixed |
Status: | accepted → closed |
Fixed in network transport layer API rewrite - mainline,2343, mainline,2345 and mainline,2346.
After these changes we don't have the BSD sockets API anymore, so we can't talk about socket options now, but there is equivalent functionality. We create an UDP association passing an endpoint pair (inet_ep2_t) as a parameter. The application can set inet_ep2_t.local_link to the service ID of the link to listen on.
In addition to bypassing routing and sending messages on the correct link (which already happened before), now we also keep track of which link packets are received on and propagate this information as far as the demux code in UDP server (i.e. AMap). Based on inet_ep2_t.local_link AMap will select the proper association to deliver the datagram to.
That means DHCP can have associations open with multiple links at once now.
DHCP would not work at all if if could not specify which link to operate on (because the outgoing datagrams must not be routed). Instead of Linux SO_BINDTODEVICE HelenOS's DHCP uses HelenOS-specific SO_IPLINK which allows you to specify the service ID of the IP link to bind the socket to.
SO_IPLINK works to the extent that it will send datagrams to the right link (when you run enable DHCP only on one link). With multiple links, we probably hit several issues: