Sample Header Ad - 728x90

How does bind(2) choose a network device?

1 vote
1 answer
1894 views
**Background** I'm looking to write kernel-space implementations of a non-IP network protocol and associated network device driver (non-ethernet hardware). I found some resources on developing the protocol and the driver, though I'm having difficulty understanding how to associate sockets using my protocol with my driver. The aim is to have it working such that a program in userspace would only need to call bind(socket(AF_TERRIBLE_IDEA, ...), ...); and be good to go. The aim is to get more familiar developing for kernel-space simultaneously, so moving to userspace is not ideal. **Question** when a *bind* call is made, how does the kernel know which device (and therefore device driver) to associate a socket to?
Asked by Kenneth Hau (21 rep)
Sep 23, 2018, 01:32 AM
Last activity: Jul 4, 2025, 09:00 AM