for kernel 4.19
analyse when kernel receive generical netlink message, how kernel processing it.
- nl80211.c: interface for wireless generic netlink programming, in /net/wireless dir, is cfg80211 module
- nl80211.h: the data structure for nl80211.c, in /net/wireless dir, is cfg80211 module
- genetlink.h: genl data structure, in your system /usr/src/linux-head-xxx/include/net dir
- genetlink.c: genl operation, the interface for nl80211.c, in linux-source/net/netlink dir, is netlink_diag module
- netlink.h: netlink operation, in your system /usr/src/linux-head-xxx/include/net dir
- nlattr.c: netlink attribute operation, in linux-source/lib dir
- kernel received message put into genl_info, how kernel put it?
- use nl80211.c's function process it, for example, nl80211_get_wiphy
- and then put the processed message into struct sk_buf
进入内核的源码目录net/wireless
1.修改trace.h文件中的最后的路径为当前目录的路径
2.把Makefile删掉
添加这个Kbuild文件,然后执行下面的命令
make -C /lib/modules/$(uname -r)/build/ M=$PWD
how the kernel get struct genl_info
File | Data structure/Function | Description | Link |
---|---|---|---|
include/net/mac802.11.h | struct ieee80211_tx_info |
||
include/linux/skbuff.h | skb_put_data | copy data to skb | |
include/linux/netdevice.h | struct net_device_ops |
This structure defines the management hooks for network devices | link |
include/linux/skbuff.h | struct sk_buff |
a metadata structure and does not hold any packet data(?) | link |
uapi/linux/if_ether.h | skb->protocol | struct sk_buff protocol filed(only ethernet frame type?) |
link |
include/uapi/linux/nl80211.h | enum nl80211_iftype |
(virtual) interface types | link |
/net/core/dev.c | netif_rx |
send buffer to network stack | link |
/usr/src
uname -r
- https://kernel.ubuntu.com/git/ubuntu/ubuntu-focal.git/refs/tags (Ubuntu)
- https://gitlab.com/kalilinux/packages/linux (Kali linux)
- https://github.com/chen172/ruby_script/tree/main/download_cgit_directory (Ubuntu)
- diret download from web ui, gitlab support download directory (Kali linux)