Re: git: 7e5bf68495cc - main - netlink: add netlink support
Date: Sat, 01 Oct 2022 16:40:05 UTC
> On 1 Oct 2022, at 17:35, Shawn Webb <shawn.webb@hardenedbsd.org> wrote: > > On Sat, Oct 01, 2022 at 02:19:03PM +0000, Alexander V. Chernikov wrote: >> The branch main has been updated by melifaro: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=7e5bf68495cc0a8c9793a338a8a02009a7f6dbb6 >> >> commit 7e5bf68495cc0a8c9793a338a8a02009a7f6dbb6 >> Author: Alexander V. Chernikov <melifaro@FreeBSD.org> >> AuthorDate: 2022-01-20 21:39:21 +0000 >> Commit: Alexander V. Chernikov <melifaro@FreeBSD.org> >> CommitDate: 2022-10-01 14:15:35 +0000 >> >> netlink: add netlink support >> >> Netlinks is a communication protocol currently used in Linux kernel to modify, >> read and subscribe for nearly all networking state. Interfaces, addresses, routes, >> firewall, fibs, vnets, etc are controlled via netlink. >> It is async, TLV-based protocol, providing 1-1 and 1-many communications. >> >> The current implementation supports the subset of NETLINK_ROUTE >> family. To be more specific, the following is supported: >> * Dumps: >> - routes >> - nexthops / nexthop groups >> - interfaces >> - interface addresses >> - neighbors (arp/ndp) >> * Notifications: >> - interface arrival/departure >> - interface address arrival/departure >> - route addition/deletion >> * Modifications: >> - adding/deleting routes >> - adding/deleting nexthops/nexthops groups >> - adding/deleting neghbors >> - adding/deleting interfaces (basic support only) >> * Rtsock interaction >> - route events are bridged both ways >> >> The implementation also supports the NETLINK_GENERIC family framework. >> >> Implementation notes: >> Netlink is implemented via loadable/unloadable kernel module, >> not touching many kernel parts. >> Each netlink socket uses dedicated taskqueue to support async operations >> that can sleep, such as interface creation. All message processing is >> performed within these taskqueues. >> >> Compatibility: >> Most of the Netlink data models specified above maps to FreeBSD concepts >> nicely. Unmodified ip(8) binary correctly works with >> interfaces, addresses, routes, nexthops and nexthop groups. Some >> software such as net/bird require header-only modifications to compile >> and work with FreeBSD netlink. >> >> Reviewed by: imp >> Differential Revision: https://reviews.freebsd.org/D36002 >> MFC after: 2 months >> --- >> etc/mtree/BSD.include.dist | 4 + >> sys/modules/Makefile | 1 + >> sys/modules/netlink/Makefile | 17 + >> sys/net/route.c | 11 + >> sys/net/route/route_ctl.h | 7 + >> sys/net/rtsock.c | 42 ++ >> sys/netlink/netlink.h | 257 +++++++++ >> sys/netlink/netlink_ctl.h | 102 ++++ >> sys/netlink/netlink_debug.h | 82 +++ >> sys/netlink/netlink_domain.c | 689 +++++++++++++++++++++++ >> sys/netlink/netlink_generic.c | 472 ++++++++++++++++ >> sys/netlink/netlink_generic.h | 112 ++++ >> sys/netlink/netlink_io.c | 528 ++++++++++++++++++ >> sys/netlink/netlink_linux.h | 54 ++ >> sys/netlink/netlink_message_parser.c | 472 ++++++++++++++++ >> sys/netlink/netlink_message_parser.h | 270 +++++++++ >> sys/netlink/netlink_message_writer.c | 686 +++++++++++++++++++++++ >> sys/netlink/netlink_message_writer.h | 250 +++++++++ >> sys/netlink/netlink_module.c | 228 ++++++++ >> sys/netlink/netlink_route.c | 135 +++++ >> sys/netlink/netlink_route.h | 43 ++ >> sys/netlink/netlink_var.h | 142 +++++ >> sys/netlink/route/common.h | 213 ++++++++ >> sys/netlink/route/iface.c | 857 +++++++++++++++++++++++++++++ >> sys/netlink/route/iface_drivers.c | 165 ++++++ >> sys/netlink/route/ifaddrs.h | 90 +++ >> sys/netlink/route/interface.h | 245 +++++++++ >> sys/netlink/route/neigh.c | 571 +++++++++++++++++++ >> sys/netlink/route/neigh.h | 105 ++++ >> sys/netlink/route/nexthop.c | 1000 ++++++++++++++++++++++++++++++++++ >> sys/netlink/route/nexthop.h | 102 ++++ >> sys/netlink/route/route.c | 972 +++++++++++++++++++++++++++++++++ >> sys/netlink/route/route.h | 366 +++++++++++++ >> sys/netlink/route/route_var.h | 101 ++++ >> 34 files changed, 9391 insertions(+) >> > > Hey Alexander, > > This commit broke buildworld: Should be fixed by 11ca01e9aa47 (currently building to see if that’s the last one) > > ===> tests/atf_python/sys/net (includes) > ===> etc (includes) > make[3]: warning: /etc: Permission denied. > ===> etc/termcap (includes) > ===> etc/sendmail (includes) > 53.93 real 36.66 user 11.99 sys > cd /usr/src; time env MACHINE_ARCH=amd64 MACHINE=amd64 CPUTYPE= CC="cc -target x86_64-unknown-freebsd14.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin" CXX="c++ -target x86_64-unknown-freebsd14.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin" CPP="cpp -target x86_64-unknown-freebsd14.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin" AS="as" AR="ar" LD="ld" LLVM_LINK="" NM=nm OBJCOPY="objcopy" RANLIB=ranlib STRINGS= SIZE="size" STRIPBIN="strip" INSTALL="install -U" PATH=/usr/obj/usr/src/amd64.amd64/tmp/bin:/usr/obj/usr/src/amd64.amd64/tmp/usr/sbin:/usr/obj/usr/src/amd64.amd64/tmp/usr/bin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/sbin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/bin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/bin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/libexec::/sbin:/bin:/usr/sbin:/usr/bin SYSROOT=/usr/obj/usr/src/amd64.amd64/tmp make -f Makefile.inc1 BWPHASE=includes DESTDIR=/usr/obj/usr/src/amd64.amd64/tmp test-includes > cd /usr/src/tools/build/test-includes; MACHINE_ARCH=amd64 MACHINE=amd64 CPUTYPE= CC="cc -target x86_64-unknown-freebsd14.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin -target x86_64-unknown-freebsd14.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin" CXX="c++ -target x86_64-unknown-freebsd14.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin -target x86_64-unknown-freebsd14.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin" CPP="cpp -target x86_64-unknown-freebsd14.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin -target x86_64-unknown-freebsd14.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin" AS="as" AR="ar" LD="ld" LLVM_LINK="" NM=nm OBJCOPY="objcopy" RANLIB=ranlib STRINGS= SIZE="size" STRIPBIN="strip" INSTALL="install -U" PATH=/usr/obj/usr/src/amd64.amd64/tmp/bin:/usr/obj/usr/src/amd64.amd64/tmp/usr/sbin:/usr/obj/usr/src/amd64.amd64/tmp/usr/bin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/sbin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/bin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/bin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/libexec::/usr/obj/usr/src/amd64.amd64/tmp/bin:/usr/obj/usr/src/amd64.amd64/tmp/usr/sbin:/usr/obj/usr/src/amd64.amd64/tmp/usr/bin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/sbin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/bin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/bin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/libexec::/sbin:/bin:/usr/sbin:/usr/bin SYSROOT=/usr/obj/usr/src/amd64.amd64/tmp make DESTDIR=/usr/obj/usr/src/amd64.amd64/tmp test-includes > cc -target x86_64-unknown-freebsd14.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin -target x86_64-unknown-freebsd14.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin -O2 -pipe -fno-common -DHARDENEDBSD -g -gz=zlib -mretpoline -flto -MD -MF.depend.netlink_netlink.o -MTnetlink_netlink.o -std=gnu99 -Wno-format-zero-length -fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Wnested-externs -Wold-style-definition -Wno-pointer-sign -Wmissing-variable-declarations -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=unused-but-set-variable -Qunused-arguments -c netlink_netlink.c -o netlink_netlink.o > netlink_netlink.c:1:10: fatal error: 'netlink/netlink.h' file not found > #include <netlink/netlink.h> > ^~~~~~~~~~~~~~~~~~~ > 1 error generated. > *** Error code 1 > > Stop. > make[3]: stopped in /usr/src/tools/build/test-includes > *** Error code 1 > > Stop. > make[2]: stopped in /usr/src > > Thanks, > > -- > Shawn Webb > Cofounder / Security Engineer > HardenedBSD > > https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc