If you like BoxMatrix then please contribute Supportdata, Supportdata2, Firmware and/or Hardware (get in touch).
My metamonk@yahoo.com is not reachable by me since september. Please use hippie2000@webnmail.de instead.

Netlink-Sockets

From BoxMatrix


BoxMatrix >> System >> Netlink-Sockets @ BoxMatrix   -   IRC-Chat   -   Translate: de es fr it nl pl
News Selectors Models Accessories Components Environment Config Commands System Webif Software Develop Lexicon Community Project Gallery

Devices Filesystems Partitions Sockets Netlink Pipes Interfaces Bridges Ports Events Sources Sinks AVMIPC Processes Watchdogs Memory Slab Vmalloc ProcFS SysFS Research

Info
Netlink sockets are similar to Linux-Sockets just they are not files in the filesystem so they don't have names. They only could be identified by the PID of the owner process, which is 0 for <kernel> internal sockets. Linux-Sockets rely on a running filessystem so they are used for communication between userspace processes. Netlink sockets don't have any dependency to devices, filesystems or network stacks, so they work at any time and could be used in kernel and userspace and between both.

Netlink sockets are grouped into protocol families for different purposes, which have names and could be listed here. For the dependencies the name of the owner process PID could be gathered for sockets of each family. This is not safe since these PIDs need to be unique and only the first socket created by a process can inherit its PID, further sockets of the same process get random unique IDs. These unresolvable dependencies are marked <unknown>.

While Linux-Sockets can only unicast (one socket at each end) netlink sockets can additionally multicast. This is handled by a bitmask of up to 32 multicasting groups per family, each bit representing one group. 0x0 means unicasting, 0xffffffff means all 32 groups of the same family (not recommended). Multicasting is mainly used for NETLINK_ROUTE rtnetlink sockets, where all bits are defined, and for NETLINK_GENERIC sockets, which do not have defined bits and may even vary across probes. That is why AVM provided a lookup function in recent firmware. Enough info to start a Netlink-Groups section.


Netlink-Sockets[edit]

Goto:   Netlink-Families  -  Netlink-Groups  -  FRITZ!OS  -  TODO

Netlink-Families[edit]

Daily updated index of all netlink families found scanning Supportdata2 probes. Last update: 2023-01-27 05:17 GMT.
The label (netlink) in the Netlink-Family column shows there are other objects in this wiki using this name.
The Mod column shows the amount of models using the respective family. Click the column header to sort by this number.
This list only covers netlink families found in FRITZ!OS *so far*. This list may grow with more Supportdata2 probes.
Families 23-31 are custom families which could be created by the Kernel function netlink_kernel_create, see here,

Netlink-Groups[edit]

Daily updated index of all multicasting groups found scanning Supportdata2 probes. Last update: 2023-01-27 05:17 GMT.
The label (nlgroup) in the Netlink-Group column shows there are other objects in this wiki using this name.
The Mod column shows the amount of models using the respective group. Click the column header to sort by this number.
This list only covers netlink groups found in FRITZ!OS *so far*. This list likely grows with more Supportdata2 probes.

FRITZ!OS[edit]

procfs[edit]

There's a procfs interface to netlink at:

/proc/net/netlink
/proc/<pid>/net/netlink            # pid may be 'self'
/proc/<pid>/task/<id>/net/netlink

These all contain the same table, the list of all netlink sockets in the system.

root@fritz0:/var/mod/root# cat /proc/net/netlink

sk       Eth Pid        Groups   Rmem     Wmem     Dump     Locks     Drops     Inode
...
cee61100 0   1816       0000055b 0        0        0        2         0         7473    
...
ce62bfc0 0   3022784190 00000000 0        0        0        2         0         2002    

From line 2682+ in net/netlink/af_netlink.c (blame, raw):

seq_printf(seq, "%pK %-3d %-10u %08x %-8d %-8d %-5d %-8d %-8u %-8lu\n",

  s,                                     # sk      Address of the socket structure
  s->sk_protocol,                        # Eth     Bit number of the Netlink-Family
  nlk->portid,                           # Pid     Port id, <pid> or random number
  nlk->groups ? (u32)nlk->groups[0] : 0, # Groups  Bit mask of subscribed Netlink-Groups
  sk_rmem_alloc_get(s),                  # Rmem
  sk_wmem_alloc_get(s),                  # Wmem
  nlk->cb_running,                       # Dump
  refcount_read(&s->sk_refcnt),          # Locks
  atomic_read(&s->sk_drops),             # Drops
  sock_i_ino(s)                          # Inode

In net/netlink/af_netlink.h (blame, raw) the portid is defined unsigned u32. It is printed %-10u. 0xFFFFFFFF is
4,294,967,295, a 10 digit number. Normally portid is the PID of the process owning the socket, but it may as well be
a huge number,

libewnwlinux[edit]

See the NETLINK_GENERIC article.

libnl[edit]

In fw 7.14 AVM started to add the libnl-3.so netlink socket API suite to FRITZ!OS.
It includes a set or libraries to handle different socket families, and is mainly used by third party commands.

See also the Netlink Protocol Library Suite (libnl) docs.

TODO[edit]

Find more details about these families:

Find more details about these groups:

Fact-Box