Sponsored by: Klara, Inc.
Sponsored by: Stormshield
Details
- Reviewers
zlei - Group Reviewers
network - Commits
- rG5b0bc0edac5c: socket: Export the FIB number of sockets
rG349d1366edd2: socket: Export the FIB number of sockets
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Looks good to me.
sys/sys/socketvar.h | ||
---|---|---|
618–619 | struct xsocket is used as KPI. I wonder if we should prefer fixed sized int, aka int32_t for exported so_fibnum. Thought on either 32bit or 64bit architectures sizeof int == sizeof int32_t. |
sys/kern/uipc_socket.c | ||
---|---|---|
5036 | The fib of socket is readonly once set. So I think no need to read it under lock. |
sys/kern/uipc_socket.c | ||
---|---|---|
5036 | Somewhat surprisingly, this is not true: see the SO_SETFIB setsockopt handler. Right now, that option handler does not use any locking. I have a patch which adds it in order to synchronize a new check. In particular, I want to disallow changing the FIB of a listening socket, so we have: SOCK_LOCK(so); if (SOLISTENING(so)) { error = EINVAL; ... since SOLISTENING() requires some synchronization. So, I prefer to keep the locking here, even though it is formally unnecessary for now. |
sys/kern/uipc_socket.c | ||
---|---|---|
5036 | Yes, you are right. I missed SO_SETFIB setsockopt handler while doing the quick review. |