Page MenuHomeFreeBSD

socket: Move SO_SETFIB handling to protocol layers
AcceptedPublic

Authored by markj on Fri, Jan 24, 5:04 PM.

Details

Reviewers
glebius
Group Reviewers
network
Summary

In particular, we store a FIB number in both struct socket and in struct
inpcb. When updating the FIB number with setsockopt(SO_SETFIB), make
the update atomic. This is required to support the new bind_all_fibs
mode, since in that mode changing the FIB of a bound socket is not
permitted.

This requires a bit more code, but avoids a layering violation in
sosetopt(), where we hard-code the list of protocol families that
implement SO_SETFIB.

Sponsored by: Klara, Inc.
Sponsored by: Stormshield

Diff Detail

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

Event Timeline

markj requested review of this revision.Fri, Jan 24, 5:04 PM

The change definitely improves, but some questions remain :) Why do we need to store fib both in socket and inpcb? I believe it belongs only to the inpcb, cause many sockets (unix, netlink, ...) doesn't have a notion of forwarding. The rtsock(4) doesn't have notion of forwarding, but we use it configure other protocols forwarding, hence it needs fib. But it has its own pcb that of course can store fib.

This revision is now accepted and ready to land.Fri, Jan 24, 5:49 PM