github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/socket_ip_tunnel.txt (about)

     1  # Copyright 2020 syzkaller project authors. All rights reserved.
     2  # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  include <uapi/linux/if_tunnel.h>
     5  include <uapi/linux/ip6_tunnel.h>
     6  include <uapi/linux/if.h>
     7  include <uapi/linux/in.h>
     8  include <uapi/linux/ip.h>
     9  include <net/ip.h>
    10  
    11  # Fallback tunnels and placeholder names "syztnl*".
    12  ipv4_tunnel_names = "ip_vti0", "tunl0", "gre0", "gretap0", "erspan0", "sit0", "syztnl0", "syztnl1", "syztnl2"
    13  ipv6_tunnel_names = "ip6tnl0", "ip6_vti0", "ip6gre0", "syztnl0", "syztnl1", "syztnl2"
    14  
    15  ip_tunnel_protocols = IPPROTO_IPIP, IPPROTO_GRE, IPPROTO_IPV6
    16  ip_tunnel_io_flags = GRE_CSUM, GRE_ROUTING, GRE_KEY, GRE_SEQ, GRE_STRICT, GRE_REC, GRE_ACK, GRE_FLAGS, GRE_VERSION, VTI_ISVTI
    17  
    18  type ipv4_header_only ipv4_packet_t[flags[ip_tunnel_protocols, int8], void]
    19  
    20  # IPv4 tunnel parameters
    21  ip_tunnel_parm {
    22  	name	string[ipv4_tunnel_names, IFNAMSIZ]
    23  	link	ifindex
    24  	i_flags	flags[ip_tunnel_io_flags, int16be]
    25  	o_flags	flags[ip_tunnel_io_flags, int16be]
    26  	i_key	int32be
    27  	o_key	int32be
    28  	iph	ipv4_header_only
    29  }
    30  
    31  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
    32  
    33  # IPv6 tunnel parameters
    34  ip6_tnl_parm2 {
    35  	name		string[ipv6_tunnel_names, IFNAMSIZ]
    36  	link		ifindex
    37  	proto		flags[ip_tunnel_protocols, int8]
    38  	encap_limit	int8
    39  	hop_limit	int8
    40  	flowinfo	int32be
    41  	flags		flags[ipv6_tunnel_flags, int32]
    42  	laddr		ipv6_addr
    43  	raddr		ipv6_addr
    44  	i_flags		flags[ip_tunnel_io_flags, int16be]
    45  	o_flags		flags[ip_tunnel_io_flags, int16be]
    46  	i_key		int32be
    47  	o_key		int32be
    48  }
    49  
    50  type ifreq_ipv4_tunnel ifreq_dev_t[ipv4_tunnel_names, ptr[inout, ip_tunnel_parm]]
    51  type ifreq_ipv6_tunnel ifreq_dev_t[ipv6_tunnel_names, ptr[inout, ip6_tnl_parm2]]
    52  
    53  ip_tunnel_prl {
    54  	addr		ipv4_addr
    55  	flags		flags[ip_tunnel_prl_flags, int16]
    56  	__reserved	const[0, int16]
    57  	datalen		bytesize[data, int32]
    58  	__reserved2	const[0, int32]
    59  	data		array[ip_tunnel_prl$1]	(out)
    60  }
    61  
    62  ip_tunnel_prl$1 {
    63  	addr		ipv4_addr
    64  	flags		flags[ip_tunnel_prl_flags, int16]
    65  	__reserved	const[0, int16]
    66  	datalen		const[0, int32]
    67  	__reserved2	const[0, int32]
    68  }
    69  
    70  ip_tunnel_prl_flags = PRL_DEFAULT
    71  
    72  type ifreq_ip_tunnel_prl ifreq_dev_t["sit0", ptr[inout, ip_tunnel_prl]]
    73  
    74  ip_tunnel_6rd {
    75  	prefix		ipv6_addr
    76  	relay_prefix	ipv4_addr
    77  	prefixlen	int16[0:32]
    78  	relay_prefixlen	int16[0:32]
    79  }
    80  
    81  type ifreq_ip_tunnel_6rd ifreq_dev_t["sit0", ptr[inout, ip_tunnel_6rd]]
    82  
    83  # Repeat IP tunnel syscall variants here until #1913 is resolved.
    84  # IPv4 ioctls
    85  ioctl$sock_ipv4_tunnel_SIOCGETTUNNEL(fd sock_udp, cmd const[SIOCGETTUNNEL], arg ptr[inout, ifreq_ipv4_tunnel])
    86  ioctl$sock_ipv4_tunnel_SIOCADDTUNNEL(fd sock_udp, cmd const[SIOCADDTUNNEL], arg ptr[inout, ifreq_ipv4_tunnel])
    87  ioctl$sock_ipv4_tunnel_SIOCDELTUNNEL(fd sock_udp, cmd const[SIOCDELTUNNEL], arg ptr[inout, ifreq_ipv4_tunnel])
    88  ioctl$sock_ipv4_tunnel_SIOCCHGTUNNEL(fd sock_udp, cmd const[SIOCCHGTUNNEL], arg ptr[inout, ifreq_ipv4_tunnel])
    89  # SIOC***PRL
    90  ioctl$sock_ipv6_tunnel_SIOCGETPRL(fd sock_udp, cmd const[SIOCGETPRL], arg ptr[inout, ifreq_ip_tunnel_prl])
    91  ioctl$sock_ipv6_tunnel_SIOCADDPRL(fd sock_udp, cmd const[SIOCADDPRL], arg ptr[inout, ifreq_ip_tunnel_prl])
    92  ioctl$sock_ipv6_tunnel_SIOCDELPRL(fd sock_udp, cmd const[SIOCDELPRL], arg ptr[inout, ifreq_ip_tunnel_prl])
    93  ioctl$sock_ipv6_tunnel_SIOCCHGPRL(fd sock_udp, cmd const[SIOCCHGPRL], arg ptr[inout, ifreq_ip_tunnel_prl])
    94  # SIOC***6RD
    95  ioctl$sock_ipv6_tunnel_SIOCGET6RD(fd sock_udp, cmd const[SIOCGET6RD], arg ptr[inout, ifreq_ipv4_tunnel])
    96  ioctl$sock_ipv6_tunnel_SIOCADD6RD(fd sock_udp, cmd const[SIOCADD6RD], arg ptr[inout, ifreq_ip_tunnel_6rd])
    97  ioctl$sock_ipv6_tunnel_SIOCDEL6RD(fd sock_udp, cmd const[SIOCDEL6RD], arg ptr[inout, ifreq_ip_tunnel_6rd])
    98  ioctl$sock_ipv6_tunnel_SIOCCHG6RD(fd sock_udp, cmd const[SIOCCHG6RD], arg ptr[inout, ifreq_ip_tunnel_6rd])
    99  
   100  # IPv6 ioctls
   101  # SIOC***TUNNEL
   102  ioctl$sock_ipv6_tunnel_SIOCGETTUNNEL(fd sock_udp6, cmd const[SIOCGETTUNNEL], arg ptr[inout, ifreq_ipv6_tunnel])
   103  ioctl$sock_ipv6_tunnel_SIOCADDTUNNEL(fd sock_udp6, cmd const[SIOCADDTUNNEL], arg ptr[inout, ifreq_ipv6_tunnel])
   104  ioctl$sock_ipv6_tunnel_SIOCDELTUNNEL(fd sock_udp6, cmd const[SIOCDELTUNNEL], arg ptr[inout, ifreq_ipv6_tunnel])
   105  ioctl$sock_ipv6_tunnel_SIOCCHGTUNNEL(fd sock_udp6, cmd const[SIOCCHGTUNNEL], arg ptr[inout, ifreq_ipv6_tunnel])