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

     1  # Copyright 2019 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 <linux/net.h>
     5  include <uapi/linux/netlink.h>
     6  include <uapi/linux/genetlink.h>
     7  include <uapi/linux/l2tp.h>
     8  
     9  resource sock_l2tp[sock_in]
    10  resource sock_l2tp6[sock_in6]
    11  
    12  type l2tp_conn_id int32[0:4]
    13  
    14  socket$l2tp(domain const[AF_INET], type const[SOCK_DGRAM], proto const[IPPROTO_L2TP]) sock_l2tp
    15  bind$l2tp(fd sock_l2tp, addr ptr[in, sockaddr_l2tpip], addrlen len[addr])
    16  connect$l2tp(fd sock_l2tp, addr ptr[in, sockaddr_l2tpip], addrlen len[addr])
    17  sendto$l2tp(fd sock_l2tp, buf ptr[in, array[int8]], len bytesize[buf], f flags[send_flags], addr ptr[in, sockaddr_l2tpip, opt], addrlen len[addr])
    18  recvfrom$l2tp(fd sock_l2tp, buf ptr[out, array[int8]], len bytesize[buf], f flags[recv_flags], addr ptr[out, sockaddr_l2tpip, opt], addrlen len[addr])
    19  getsockname$l2tp(fd sock_l2tp, addr ptr[out, sockaddr_l2tpip], addrlen ptr[inout, len[addr, int32]])
    20  getpeername$l2tp(fd sock_l2tp, peer ptr[out, sockaddr_l2tpip], peerlen ptr[inout, len[peer, int32]])
    21  
    22  socket$l2tp6(domain const[AF_INET6], type const[SOCK_DGRAM], proto const[IPPROTO_L2TP]) sock_l2tp6
    23  bind$l2tp6(fd sock_l2tp6, addr ptr[in, sockaddr_l2tpip6], addrlen len[addr])
    24  connect$l2tp6(fd sock_l2tp6, addr ptr[in, sockaddr_l2tpip6], addrlen len[addr])
    25  sendto$l2tp6(fd sock_l2tp6, buf ptr[in, array[int8]], len bytesize[buf], f flags[send_flags], addr ptr[in, sockaddr_l2tpip6, opt], addrlen len[addr])
    26  recvfrom$l2tp6(fd sock_l2tp6, buf ptr[out, array[int8]], len bytesize[buf], f flags[recv_flags], addr ptr[out, sockaddr_l2tpip6, opt], addrlen len[addr])
    27  getsockname$l2tp6(fd sock_l2tp6, addr ptr[out, sockaddr_l2tpip6], addrlen ptr[inout, len[addr, int32]])
    28  getpeername$l2tp6(fd sock_l2tp6, peer ptr[out, sockaddr_l2tpip6], peerlen ptr[inout, len[peer, int32]])
    29  
    30  sockaddr_l2tpip {
    31  	l2tp_family	const[AF_INET, int16]
    32  	l2tp_unused	const[0, int16]
    33  	l2tp_addr	ipv4_addr
    34  	l2tp_conn_id	l2tp_conn_id
    35  	__pad		const[0, int32]
    36  }
    37  
    38  sockaddr_l2tpip6 {
    39  	l2tp_family	const[AF_INET6, int16]
    40  	l2tp_unused	const[0, int16]
    41  	l2tp_flowinfo	int32be
    42  	l2tp_addr	ipv6_addr
    43  	l2tp_scope_id	int32
    44  	l2tp_conn_id	l2tp_conn_id
    45  }
    46  
    47  resource genl_l2tp_family_id[int16]
    48  type msghdr_nl_l2tp[CMD] msghdr_netlink[netlink_msg_t[genl_l2tp_family_id, genlmsghdr_t[CMD], l2tp_nl_policy]]
    49  
    50  syz_genetlink_get_family_id$l2tp(name ptr[in, string["l2tp"]], fd sock_nl_generic) genl_l2tp_family_id
    51  
    52  sendmsg$L2TP_CMD_NOOP(fd sock_nl_generic, msg ptr[in, msghdr_nl_l2tp[L2TP_CMD_NOOP]], f flags[send_flags])
    53  sendmsg$L2TP_CMD_TUNNEL_CREATE(fd sock_nl_generic, msg ptr[in, msghdr_nl_l2tp[L2TP_CMD_TUNNEL_CREATE]], f flags[send_flags])
    54  sendmsg$L2TP_CMD_TUNNEL_DELETE(fd sock_nl_generic, msg ptr[in, msghdr_nl_l2tp[L2TP_CMD_TUNNEL_DELETE]], f flags[send_flags])
    55  sendmsg$L2TP_CMD_TUNNEL_MODIFY(fd sock_nl_generic, msg ptr[in, msghdr_nl_l2tp[L2TP_CMD_TUNNEL_MODIFY]], f flags[send_flags])
    56  sendmsg$L2TP_CMD_TUNNEL_GET(fd sock_nl_generic, msg ptr[in, msghdr_nl_l2tp[L2TP_CMD_TUNNEL_GET]], f flags[send_flags])
    57  sendmsg$L2TP_CMD_SESSION_CREATE(fd sock_nl_generic, msg ptr[in, msghdr_nl_l2tp[L2TP_CMD_SESSION_CREATE]], f flags[send_flags])
    58  sendmsg$L2TP_CMD_SESSION_DELETE(fd sock_nl_generic, msg ptr[in, msghdr_nl_l2tp[L2TP_CMD_SESSION_DELETE]], f flags[send_flags])
    59  sendmsg$L2TP_CMD_SESSION_MODIFY(fd sock_nl_generic, msg ptr[in, msghdr_nl_l2tp[L2TP_CMD_SESSION_MODIFY]], f flags[send_flags])
    60  sendmsg$L2TP_CMD_SESSION_GET(fd sock_nl_generic, msg ptr[in, msghdr_nl_l2tp[L2TP_CMD_SESSION_GET]], f flags[send_flags])
    61  
    62  l2tp_nl_policy [
    63  	L2TP_ATTR_PW_TYPE		nlattr[L2TP_ATTR_PW_TYPE, flags[l2tp_pwtype, int16]]
    64  	L2TP_ATTR_ENCAP_TYPE		nlattr[L2TP_ATTR_ENCAP_TYPE, flags[l2tp_encap_type, int16]]
    65  	L2TP_ATTR_OFFSET		nlattr[L2TP_ATTR_OFFSET, int16]
    66  	L2TP_ATTR_DATA_SEQ		nlattr[L2TP_ATTR_DATA_SEQ, int8]
    67  	L2TP_ATTR_L2SPEC_TYPE		nlattr[L2TP_ATTR_L2SPEC_TYPE, flags[l2tp_l2spec_type, int8]]
    68  	L2TP_ATTR_L2SPEC_LEN		nlattr[L2TP_ATTR_L2SPEC_LEN, int8]
    69  	L2TP_ATTR_PROTO_VERSION		nlattr[L2TP_ATTR_PROTO_VERSION, int8[2:3]]
    70  	L2TP_ATTR_CONN_ID		nlattr[L2TP_ATTR_CONN_ID, l2tp_conn_id]
    71  	L2TP_ATTR_PEER_CONN_ID		nlattr[L2TP_ATTR_PEER_CONN_ID, l2tp_conn_id]
    72  	L2TP_ATTR_SESSION_ID		nlattr[L2TP_ATTR_SESSION_ID, l2tp_session[int32]]
    73  	L2TP_ATTR_PEER_SESSION_ID	nlattr[L2TP_ATTR_PEER_SESSION_ID, l2tp_session[int32]]
    74  	L2TP_ATTR_UDP_CSUM		nlattr[L2TP_ATTR_UDP_CSUM, bool8]
    75  # TODO: what is this vlan id? It sure needs to match something somewhere. Is it a confused name for vlan tag?...
    76  	L2TP_ATTR_VLAN_ID		nlattr[L2TP_ATTR_VLAN_ID, int16]
    77  	L2TP_ATTR_DEBUG			nlattr[L2TP_ATTR_DEBUG, bool32]
    78  	L2TP_ATTR_RECV_SEQ		nlattr[L2TP_ATTR_RECV_SEQ, int8]
    79  	L2TP_ATTR_SEND_SEQ		nlattr[L2TP_ATTR_SEND_SEQ, int8]
    80  	L2TP_ATTR_LNS_MODE		nlattr[L2TP_ATTR_LNS_MODE, int8]
    81  # L2TP_ATTR_USING_IPSEC is output
    82  	L2TP_ATTR_RECV_TIMEOUT		nlattr[L2TP_ATTR_RECV_TIMEOUT, int64]
    83  	L2TP_ATTR_FD			nlattr[L2TP_ATTR_FD, l2tp_tunnel_fd]
    84  	L2TP_ATTR_IP_SADDR		nlattr[L2TP_ATTR_IP_SADDR, ipv4_addr]
    85  	L2TP_ATTR_IP_DADDR		nlattr[L2TP_ATTR_IP_DADDR, ipv4_addr]
    86  	L2TP_ATTR_UDP_SPORT		nlattr[L2TP_ATTR_UDP_SPORT, sock_port]
    87  	L2TP_ATTR_UDP_DPORT		nlattr[L2TP_ATTR_UDP_DPORT, sock_port]
    88  	L2TP_ATTR_MTU			nlattr[L2TP_ATTR_MTU, int16]
    89  	L2TP_ATTR_MRU			nlattr[L2TP_ATTR_MRU, int16]
    90  # L2TP_ATTR_STATS is output
    91  	L2TP_ATTR_IP6_SADDR		nlattr[L2TP_ATTR_IP6_SADDR, ipv6_addr]
    92  	L2TP_ATTR_IP6_DADDR		nlattr[L2TP_ATTR_IP6_DADDR, ipv6_addr]
    93  	L2TP_ATTR_IFNAME		nlattr[L2TP_ATTR_IFNAME, devname]
    94  	L2TP_ATTR_COOKIE		nlattr[L2TP_ATTR_COOKIE, int64]
    95  	L2TP_ATTR_PEER_COOKIE		nlattr[L2TP_ATTR_PEER_COOKIE, int64]
    96  	L2TP_ATTR_UDP_ZERO_CSUM6_TX	nlattr[L2TP_ATTR_UDP_ZERO_CSUM6_TX, bool8]
    97  	L2TP_ATTR_UDP_ZERO_CSUM6_RX	nlattr[L2TP_ATTR_UDP_ZERO_CSUM6_RX, bool8]
    98  # L2TP_ATTR_PAD is output
    99  ] [varlen]
   100  
   101  l2tp_tunnel_fd [
   102  	udp	sock_udp
   103  	udp6	sock_udp6
   104  	l2tp	sock_l2tp
   105  	l2tp6	sock_l2tp6
   106  ]
   107  
   108  l2tp_pwtype = L2TP_PWTYPE_NONE, L2TP_PWTYPE_ETH_VLAN, L2TP_PWTYPE_ETH, L2TP_PWTYPE_PPP, L2TP_PWTYPE_PPP_AC, L2TP_PWTYPE_IP
   109  l2tp_l2spec_type = L2TP_L2SPECTYPE_NONE, L2TP_L2SPECTYPE_DEFAULT
   110  l2tp_encap_type = L2TP_ENCAPTYPE_UDP, L2TP_ENCAPTYPE_IP