Otherwise there is a race window when interface is already visible, but
not all of the protocols have completed their attach.
Details
- Reviewers
- None
- Group Reviewers
network
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped - Build Status
Buildable 69072 Build 65955: arc lint + arc unit
Event Timeline
| sys/net/if.c | ||
|---|---|---|
| 938 | The original ifnet_arrival_event reads, "the interface is attached and global visible". But after this change, "the interface is attached but is not guaranteed to be global visible". There are consumers, sys/net/rtsock.c:EVENTHANDLER_DEFINE(ifnet_arrival_event, rts_handle_ifnet_arrival, NULL, 0); ... sys/netlink/route/iface.c: EVENTHANDLER_DEREGISTER(ifnet_arrival_event, ifattach_event); rely on the former behavior, so that netlink clients or tsock clients can see global visible ifnet. I'm not sure what's the best approach, but maybe a new EVENTHANDLER is wanted to attach IPv4 and IPv6 stacks to an interface ? | |
| sys/net/if.c | ||
|---|---|---|
| 938 |
That's a good observation, thanks.
...
These two do not actually work with the global glue, they don't need the interface to be fully linked in. However, they do announce the interface arrival to the userland. Hypothetically there could be a race with the application seeing the announcement and immediately doing an ioctl/netlink call, that reaches kernel faster than other eventhandlers do their work.
I'd rather create a second event handler that would be called after a complete attach of the interface. The rtsock and the netlink would be its only consumers for now. What do you think? | |