aboutsummaryrefslogtreecommitdiffstats
path: root/sys/linux/socket_ip_tunnel.txt
blob: 7ef29816c22736cc2ff7f7d9d2928592f372cbe5 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Copyright 2020 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.

include <uapi/linux/if_tunnel.h>
include <uapi/linux/ip6_tunnel.h>
include <uapi/linux/if.h>
include <uapi/linux/in.h>
include <uapi/linux/ip.h>
include <net/ip.h>

# Fallback tunnels and placeholder names "syztnl*".
ipv4_tunnel_names = "ip_vti0", "tunl0", "gre0", "gretap0", "erspan0", "sit0", "syztnl0", "syztnl1", "syztnl2"
ipv6_tunnel_names = "ip6tnl0", "ip6_vti0", "ip6gre0", "syztnl0", "syztnl1", "syztnl2"

ip_tunnel_protocols = IPPROTO_IPIP, IPPROTO_GRE, IPPROTO_IPV6
ip_tunnel_io_flags = GRE_CSUM, GRE_ROUTING, GRE_KEY, GRE_SEQ, GRE_STRICT, GRE_REC, GRE_ACK, GRE_FLAGS, GRE_VERSION, VTI_ISVTI

type ipv4_header_only ipv4_packet_t[flags[ip_tunnel_protocols, int8], void]

# IPv4 tunnel parameters
ip_tunnel_parm {
	name	string[ipv4_tunnel_names, IFNAMSIZ]
	link	ifindex
	i_flags	flags[ip_tunnel_io_flags, int16be]
	o_flags	flags[ip_tunnel_io_flags, int16be]
	i_key	int32be
	o_key	int32be
	iph	ipv4_header_only
}

ipv6_tunnel_flags = IP6_TNL_F_IGN_ENCAP_LIMIT, IP6_TNL_F_USE_ORIG_TCLASS, IP6_TNL_F_USE_ORIG_FLOWLABEL, IP6_TNL_F_MIP6_DEV, IP6_TNL_F_RCV_DSCP_COPY, IP6_TNL_F_USE_ORIG_FWMARK, IP6_TNL_F_ALLOW_LOCAL_REMOTE

# IPv6 tunnel parameters
ip6_tnl_parm2 {
	name		string[ipv6_tunnel_names, IFNAMSIZ]
	link		ifindex
	proto		flags[ip_tunnel_protocols, int8]
	encap_limit	int8
	hop_limit	int8
	flowinfo	int32be
	flags		flags[ipv6_tunnel_flags, int32]
	laddr		ipv6_addr
	raddr		ipv6_addr
	i_flags		flags[ip_tunnel_io_flags, int16be]
	o_flags		flags[ip_tunnel_io_flags, int16be]
	i_key		int32be
	o_key		int32be
}

type ifreq_ipv4_tunnel ifreq_dev_t[ipv4_tunnel_names, ptr[inout, ip_tunnel_parm]]
type ifreq_ipv6_tunnel ifreq_dev_t[ipv6_tunnel_names, ptr[inout, ip6_tnl_parm2]]

ip_tunnel_prl {
	addr		ipv4_addr
	flags		flags[ip_tunnel_prl_flags, int16]
	__reserved	const[0, int16]
	datalen		bytesize[data, int32]
	__reserved2	const[0, int32]
	data		array[ip_tunnel_prl$1]	(out)
}

ip_tunnel_prl$1 {
	addr		ipv4_addr
	flags		flags[ip_tunnel_prl_flags, int16]
	__reserved	const[0, int16]
	datalen		const[0, int32]
	__reserved2	const[0, int32]
}

ip_tunnel_prl_flags = PRL_DEFAULT

type ifreq_ip_tunnel_prl ifreq_dev_t["sit0", ptr[inout, ip_tunnel_prl]]

ip_tunnel_6rd {
	prefix		ipv6_addr
	relay_prefix	ipv4_addr
	prefixlen	int16[0:32]
	relay_prefixlen	int16[0:32]
}

type ifreq_ip_tunnel_6rd ifreq_dev_t["sit0", ptr[inout, ip_tunnel_6rd]]

# Repeat IP tunnel syscall variants here until #1913 is resolved.
# IPv4 ioctls
ioctl$sock_ipv4_tunnel_SIOCGETTUNNEL(fd sock_udp, cmd const[SIOCGETTUNNEL], arg ptr[inout, ifreq_ipv4_tunnel])
ioctl$sock_ipv4_tunnel_SIOCADDTUNNEL(fd sock_udp, cmd const[SIOCADDTUNNEL], arg ptr[inout, ifreq_ipv4_tunnel])
ioctl$sock_ipv4_tunnel_SIOCDELTUNNEL(fd sock_udp, cmd const[SIOCDELTUNNEL], arg ptr[inout, ifreq_ipv4_tunnel])
ioctl$sock_ipv4_tunnel_SIOCCHGTUNNEL(fd sock_udp, cmd const[SIOCCHGTUNNEL], arg ptr[inout, ifreq_ipv4_tunnel])
# SIOC***PRL
ioctl$sock_ipv6_tunnel_SIOCGETPRL(fd sock_udp, cmd const[SIOCGETPRL], arg ptr[inout, ifreq_ip_tunnel_prl])
ioctl$sock_ipv6_tunnel_SIOCADDPRL(fd sock_udp, cmd const[SIOCADDPRL], arg ptr[inout, ifreq_ip_tunnel_prl])
ioctl$sock_ipv6_tunnel_SIOCDELPRL(fd sock_udp, cmd const[SIOCDELPRL], arg ptr[inout, ifreq_ip_tunnel_prl])
ioctl$sock_ipv6_tunnel_SIOCCHGPRL(fd sock_udp, cmd const[SIOCCHGPRL], arg ptr[inout, ifreq_ip_tunnel_prl])
# SIOC***6RD
ioctl$sock_ipv6_tunnel_SIOCGET6RD(fd sock_udp, cmd const[SIOCGET6RD], arg ptr[inout, ifreq_ipv4_tunnel])
ioctl$sock_ipv6_tunnel_SIOCADD6RD(fd sock_udp, cmd const[SIOCADD6RD], arg ptr[inout, ifreq_ip_tunnel_6rd])
ioctl$sock_ipv6_tunnel_SIOCDEL6RD(fd sock_udp, cmd const[SIOCDEL6RD], arg ptr[inout, ifreq_ip_tunnel_6rd])
ioctl$sock_ipv6_tunnel_SIOCCHG6RD(fd sock_udp, cmd const[SIOCCHG6RD], arg ptr[inout, ifreq_ip_tunnel_6rd])

# IPv6 ioctls
# SIOC***TUNNEL
ioctl$sock_ipv6_tunnel_SIOCGETTUNNEL(fd sock_udp6, cmd const[SIOCGETTUNNEL], arg ptr[inout, ifreq_ipv6_tunnel])
ioctl$sock_ipv6_tunnel_SIOCADDTUNNEL(fd sock_udp6, cmd const[SIOCADDTUNNEL], arg ptr[inout, ifreq_ipv6_tunnel])
ioctl$sock_ipv6_tunnel_SIOCDELTUNNEL(fd sock_udp6, cmd const[SIOCDELTUNNEL], arg ptr[inout, ifreq_ipv6_tunnel])
ioctl$sock_ipv6_tunnel_SIOCCHGTUNNEL(fd sock_udp6, cmd const[SIOCCHGTUNNEL], arg ptr[inout, ifreq_ipv6_tunnel])