This code relies on an older version of language-c.
The 0.6.1 version has a different API from the 0.8.2. version of language-c.
So we have to use an older Nixpkgs commit hash to utilise this.
We have to use:
cabal2nix -f Generators . >./cabal.nix
Then when we are in the shell.
cabal configure -f Generators
Hopefully that works.
To run the Generate command, we need:
pushd Scripts
runhaskell ./GenerateConstants.hs ../System/Linux/Netlink/Constants.hs
popd
The base netlink only supports 32 families.
Here are the official families of netlink:
NETLINK_ROUTE
- rtnetlink stuffNETLINK_W1
NETLINK_USERSOCK
NETLINK_FIREWALL
- removedNETLINK_INET_DIAG
- query info about socketsNETLINK_SOCK_DIAG
NETLINK_NFLOG
- some log for netlink?NETLINK_XFRM
- ipsecNETLINK_SELINUX
- selinix eventsNETLINK_ISCSI
- ISCSINETLINK_AUDIT
- auditingNETLINK_FIB_LOOKUP
- FIB lookupNETLINK_CONNECTOR
NETLINK_NETFILTER
- is this important?NETLINK_GENERIC
NETLINK_CRYPTO
With regards to NETLINK_GENERIC
, we have:
- GenlHeader (this is the family header)
- GenlData (this also a family header, as it wraps around GenlHeader)
GenlPacket a = Packet (GenlData a)
The constants it wants appears to be:
CTRL_CMD_
... control command
CTRL_ATTR_
... control attribute
CTRL_ATTR_MCAST
- control attribute multicast?
Generic netlink controller is implemented as a standard generic netlink user, however it listens on a special preallocated generic netlink channel. So the controller is like a special thing.
Generic netlink comms are essentially a series of different communication channels which are multiplexed on a single netlink family. Comm channels are uniquely identified by channel numbers which are dynamically allocated by the generic netlink controller. The controller is a special Gen netlink user which listens on a fixed communication channel number 0x10. Kernel or userspace users which provide services over the generic netlink bus, establish new channels by registering their services with the gen netlink controller. Users who want to use a service, query the controller to see if the service exists and to determine the correct channel number.
A gen netlink message has:
- netlink message header
- gen netlink message header 32 bits?
- optional user specific message header
- optional gen netlink message payload