Page MenuHomeFreeBSD

socket: Export the FIB number of sockets
ClosedPublic

Authored by markj on Mon, Oct 28, 5:04 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 18, 4:59 PM
Unknown Object (File)
Fri, Nov 15, 10:06 PM
Unknown Object (File)
Mon, Nov 4, 9:14 PM
Unknown Object (File)
Sat, Nov 2, 5:25 AM
Unknown Object (File)
Sat, Nov 2, 4:58 AM
Unknown Object (File)
Fri, Nov 1, 11:06 AM

Details

Summary

Sponsored by: Klara, Inc.
Sponsored by: Stormshield

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 60225
Build 57109: arc lint + arc unit

Event Timeline

markj requested review of this revision.Mon, Oct 28, 5:04 PM
zlei added a subscriber: zlei.

Looks good to me.

sys/sys/socketvar.h
618

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.

This revision is now accepted and ready to land.Fri, Nov 1, 6:57 AM
sys/kern/uipc_socket.c
5047

The fib of socket is readonly once set. So I think no need to read it under lock.

markj marked an inline comment as done.Fri, Nov 1, 1:05 PM
markj added inline comments.
sys/kern/uipc_socket.c
5047

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
5047

Yes, you are right. I missed SO_SETFIB setsockopt handler while doing the quick review.

This revision was automatically updated to reflect the committed changes.