Date: Tue, 07 Jun 2011 13:09:48 +0400 From: "Alexander V. Chernikov" <melifaro@ipfw.ru> To: net@freebsd.org, Julian Elischer <julian@freebsd.org> Subject: rtsock changes for multiple fibs support Message-ID: <4DEDEADC.8060607@ipfw.ru>
next in thread | raw e-mail | index | archive | help
Hello list! At the moment multiple fib support is completely broken in route(4) (described in kern/134931) Linux supports fibs via its netlink protocol. OpenBSD makes rtsock version bump for the same for a while ago. Since 9.0 is approaching it is a good time to make some changes to routing socket: Goals: * Permit fib to be get/set via route(4) interface * Keep existing ABI/API as much as possible * Permit various route(4) headers changes without breaking ABI Proposed structure changes: add uint16_t fib uint16_t reserved to rt_msghdr, if_msghdr, ifa_msghdr, ifma_msghdr, if_announcemsghdr Proposed changes to undocumented sysctl route dump interface: * Add (optional) .FIB.RTSOCK_VERSION to sysctl net.route.0.ADDRESS_FAMILY.NET_RT_DUMP.FLAGS oid: * document such interface in route(4) Proposed ABI keeping techniques: RTSOCK: 1) Add SO_RTSOCKVERSION to SOL_SOCKET setsockopt level 2) Determine rtsock version via __FreeBSD_version checking 3) Add net.rtsock.force_version sysctl 4) Do __FreeBSD_version && rtsock version bump Rtsock version selection algorithm: if SO_RTSOCKVERSION is set on socket: => use selected version (or return -1 in setsockopt) else if net.rtsock.force_version > 0 => use forced version else net.rtsock.force_version == 0 => use version based on __FreeBSD_version check Examples: "New" binaries (build with new headers): * have __FreeBSD_version >= X so "current" rtsock version is used "Old" binaries (from 7.X/8.X etc..): * have __FreeBSD_version < X so "previous" rtsock version is used Old/New binaries with New/Old libraries using rtsock: This is the most tricky part. Major routing software (quagga, openbgpd, bird) do not use libraries for rtsock interaction, however such libraries exists (libpdel, for example) What can be done: (required) Add explicit rtsock version request vie SO_RTSOCKVERSION in all FreeBSD base code (route(8), netstat(8), ...) (optional) Add patches for SO_RTSOCKVERSION to ported versions/upstream versions of libpdel (and possibly for routing daemons) If someone wants to use newly-compiled library (or binary) for which __FreeBSD_version check happens incorrectly he can explicitly set net.rtsock.force_version to needed value. This will not break all software aware of SO_RTSOCKVERSION (base binaries). Those measures can't cover all 100 percent of users, but maybe 99 is enough? Anyway, rebuilding world/userland with this patch should not break anything. Problems can arise only when some recompilation based on new headers is done. SYSCTL ROUTE DUMP: SO_RTSOCKVERSION is replaced by more detailed sysctl request described in the beginning, the rest approach is exactly the same (patches for base/ports, etc..) If this is more or less reasonable approach I can provide patch doing all of the above till the end of this week
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4DEDEADC.8060607>