Netlink Sockets Tour
Last updated 2002-01-31 10:42 am
Cast a spell on the socket!
| First of all, open a NETLINK socket with socket(). |
| Argument | Value | Description |
| 1st: Address family | AF_NETLINK | Address family is NETLINK |
| 2nd: Socket type | SOCK_RAW | Raw network protocol access |
| 3rd: Netlink family | NETLINK_ROUTE | Modify most of IPv4 control parameters |
| NETLINK_FIREWALL | Receive packets sent by IPv4 firewall |
|
| NETLINK_ARPD | Manage ARP table from user space |
|
| NETLINK_ROUTE6 | IPv6 routing table update |
|
| NETLINK_IP6_FW | Currently not implemented |
|
| NETLINK_TAPBASE | Ethertap device |
|
| NETLINK_SKIP | Reserved for ENskip |
Welcome to the dungeon of Linux networking code!
init/main.c/do_basic_setup()
| Final setup functions are called from do_baseic_setup() in init/main.c. |
| sock_init() is also called in this function. |
|
do_basic_setup() manages interesting jobs including initial RAM disk (initrd), and so on. |
|
net/socket.c/sock_init()
| At the beginning of function, you can see a familiar message. |
Initialize address families. NPROTO is currently defined as 32.include/linux/net.h:#define NPROTO 32 /* should be enough for now.. */ |
|
net/socket.c/proto_init()
| Network protocol table is stored in a global array, protocols[], which is defined in net/protocols.c. |
| All of built in protocols will be kicked out. |
| In short, net_families[ PF_NETLINK ] = &netlink_family_ops will be executed. |
|
|
|
|