* Actually implemented the SO_BINDTODEVICE socket option I added some time ago.

* This makes it possible to select a specific device, even if no interface
  has been configured for it yet. To make it work, each interface now has a
  private direct route which will be returned if a socket is bound to a device.
* This will be used for example in DHCP to make it work when more than one
  adapter is attached.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27983 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-10-11 22:10:31 +00:00
parent 11f2701ecf
commit 27e0dea9f0
7 changed files with 81 additions and 20 deletions
@@ -258,6 +258,16 @@ create_interface(net_domain *domain, const char *name, const char *baseName,
interface->metric = 0;
interface->device_interface = grab_device_interface(deviceInterface);
// setup direct route for bound devices
interface->direct_route.destination = NULL;
interface->direct_route.mask = NULL;
interface->direct_route.gateway = NULL;
interface->direct_route.flags = 0;
interface->direct_route.mtu = 0;
interface->direct_route.interface = interface;
interface->direct_route.ref_count = 1;
// make sure this doesn't get deleted accidently
status_t status = get_domain_datalink_protocols(interface);
if (status < B_OK) {
delete interface;