Adding a custom layer 3 protocol driver

Cedric Velandres cedric.velandres at
Fri Jun 25 06:59:53 EDT 2021

Hi everyone,

We're currently developing a new communication using custom layer 2 and 3
that we'll be using in a cubesat and I'm looking on how to create the layer
3 driver for linux (similar to af_inet.c but the headers are completely
different). I've read something similar in a thread about a previously
asked question here, but it didn't really answer my questions. And so, my
questions are:

1. Will it suffice to patch linux/socket.h and insert the PF_xxxx before
PF_MAX then use the added PF_xxxx as family in struct net_proto_family?
2. Is there another way to do the above without patching and only in an
out-of-tree module?
3. How do I expose the new AF_xxxx to userspace? It seems like macros for
AF_xxxx are placed in bits/socket.h, but I haven't found a way to patch it.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Kernelnewbies mailing list