aboutsummaryrefslogtreecommitdiffstats
path: root/sys/linux/socket_netlink_generic.txt
blob: ceeecd1e3a4a719970a8896f7be3f09df7a88395 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Copyright 2017 syzkaller project authors. All rights reserved.
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

# AF_NETLINK/NETLINK_GENERIC support.

# TODO: describe APIs of specific genetlink families.

include <linux/net.h>
include <uapi/linux/netlink.h>
include <uapi/linux/genetlink.h>

resource sock_nl_generic[sock_netlink]

socket$nl_generic(domain const[AF_NETLINK], type const[SOCK_RAW], proto const[NETLINK_GENERIC]) sock_nl_generic

sendmsg$nl_generic(fd sock_nl_generic, msg ptr[in, msghdr_nl_generic], f flags[send_flags])

msghdr_nl_generic {
	addr	ptr[in, sockaddr_nl_kern]
	addrlen	len[addr, int32]
	vec	ptr[in, iovec_nl_generic]
	vlen	const[1, intptr]
	ctrl	const[0, intptr]
	ctrllen	const[0, intptr]
	f	flags[send_flags, int32]
}

iovec_nl_generic {
	data	ptr[in, netlink_msg_generic]
	len	bytesize[data, intptr]
}

netlink_msg_generic {
	len	len[parent, int32]
	type	int16[NLMSG_MIN_TYPE:NLMSG_MAX_TYPE]
	flags	flags[netlink_msg_flags, int16]
	seq	netlink_seq
	pid	netlink_port_id
	hdr	genlmsghdr
# No body. Generic attribute can represent a random body.
	attrs	array[nl_generic_attr]
} [align_4]

genlmsghdr {
	cmd		int8[0:32]
	version		const[NFNETLINK_V0, int8]
	reserved	const[0, int16]
} [align_4]