pengnam / freebsd-netlink

GSOC 2021

Home Page:https://www.FreeBSD.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

freebsd-netlink

Design document

FreeBSD link

This repository includes an implementation of netlink for FreeBSD 14.0-CURRENT. The implementation includes netlink, a working rtnetlink for the most critical path, and a half-finished genetlink. Implementation can be easily seen by looking at the pull-request which compares the implementation with the commit that it is based from.

Set-up

The configuration is meant for netlink to be installed as a module. Instructions assume that the user is starting from a fresh FreeBSD instance. The instance can be obtained from AWS ec2 community marketplace. This repository was configured with FreeBSD14.0-current

  1. Download this github as /usr/src
  2. Build and install the kernel
  3. In /usr/src/sys/modules/netlink, run make
  4. Install module created using make load

User-level Library

A user level netlink library (libmnl) was ported to FreeBSD. Port was needed to change some basic data types and change a few enums. The userlevel library is here: git@github.com:pengnam/libmnl-freebsd.git . Installation is done through standard automake tools.

Headers

As per common practice, I have seperated the userspace API from the kernel API (that has access to the userspace API). I kept it simple, and I kept the userspace api in linux/netlink.h and the kernel api in net/netlink.h

Major TODOs:

  1. m_buf handling: we currently assume the initial m_get to retreive a message of a sufficient size for a packet which allows us to write straight into the buffer instead of using m_append. The reason for this is because when "closing" a message, we call nlmsg_end or other functions to end the header, we use pointer artihmethic to determine the size of the message. Alternative is to call m_pullup before calling nlmsg_end on the message, or to continuously resize and transfer the message when more data is needed.
  2. module: currently installing netlink as a module rather than as part of the kernel tree
  3. genetlink: doit and dumpit functions need to be implemented

About

GSOC 2021

https://www.FreeBSD.org/

License:Other


Languages

Language:C 63.6%Language:C++ 23.2%Language:Roff 5.1%Language:Shell 2.8%Language:Assembly 1.4%Language:Makefile 1.3%Language:Perl 0.8%Language:HTML 0.3%Language:M4 0.3%Language:Python 0.3%Language:Yacc 0.2%Language:DTrace 0.2%Language:NASL 0.2%Language:Objective-C 0.1%Language:Awk 0.1%Language:Lex 0.0%Language:Lua 0.0%Language:Forth 0.0%Language:CMake 0.0%Language:RPC 0.0%Language:Scilab 0.0%Language:C# 0.0%Language:CSS 0.0%Language:Java 0.0%Language:PHP 0.0%Language:1C Enterprise 0.0%Language:Raku 0.0%Language:AGS Script 0.0%Language:Julia 0.0%Language:GAP 0.0%Language:Ruby 0.0%Language:Batchfile 0.0%Language:Emacs Lisp 0.0%Language:Tcl 0.0%Language:Starlark 0.0%Language:Smarty 0.0%Language:Pawn 0.0%Language:TeX 0.0%Language:Vim Script 0.0%Language:sed 0.0%Language:PostScript 0.0%Language:GDB 0.0%Language:Turing 0.0%Language:IGOR Pro 0.0%Language:SWIG 0.0%Language:DIGITAL Command Language 0.0%Language:Limbo 0.0%Language:Haskell 0.0%Language:KRL 0.0%Language:Scheme 0.0%Language:Max 0.0%Language:AIDL 0.0%Language:JavaScript 0.0%Language:D 0.0%Language:Module Management System 0.0%Language:R 0.0%Language:SmPL 0.0%Language:Rebol 0.0%Language:VBScript 0.0%Language:GLSL 0.0%Language:ChucK 0.0%Language:Terra 0.0%