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

     1  # Copyright 2017 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/ip.h>
     5  include <linux/ipv6.h>
     6  include <linux/route.h>
     7  include <uapi/linux/route.h>
     8  include <uapi/linux/ipv6_route.h>
     9  include <uapi/linux/mroute6.h>
    10  include <uapi/linux/netfilter_ipv6/ip6_tables.h>
    11  
    12  # IPv6 sockets
    13  
    14  resource sock_in6[sock]
    15  
    16  sockaddr_in6 {
    17  	family	const[AF_INET6, int16]
    18  	port	sock_port
    19  	flow	int32be
    20  	addr	ipv6_addr
    21  	scope	int32
    22  }
    23  
    24  sockaddr_storage_in6 {
    25  	addr	sockaddr_in6
    26  } [size[SOCKADDR_STORAGE_SIZE], align[PTR_SIZE]]
    27  
    28  socket$inet6(domain const[AF_INET6], type flags[socket_type], proto int32) sock_in6
    29  accept$inet6(fd sock_in6, peer ptr[out, sockaddr_in6, opt], peerlen ptr[inout, len[peer, int32]]) sock_in6
    30  accept4$inet6(fd sock_in6, peer ptr[out, sockaddr_in6, opt], peerlen ptr[inout, len[peer, int32]], flags flags[accept_flags]) sock_in6
    31  bind$inet6(fd sock_in6, addr ptr[in, sockaddr_in6], addrlen len[addr])
    32  connect$inet6(fd sock_in6, addr ptr[in, sockaddr_in6], addrlen len[addr])
    33  sendto$inet6(fd sock_in6, buf buffer[in], len len[buf], f flags[send_flags], addr ptr[in, sockaddr_in6, opt], addrlen len[addr])
    34  recvfrom$inet6(fd sock_in6, buf buffer[out], len len[buf], f flags[recv_flags], addr ptr[in, sockaddr_in6, opt], addrlen len[addr])
    35  getsockname$inet6(fd sock_in6, addr ptr[out, sockaddr_in6], addrlen ptr[inout, len[addr, int32]])
    36  getpeername$inet6(fd sock_in6, peer ptr[out, sockaddr_in6], peerlen ptr[inout, len[peer, int32]])
    37  
    38  # Generic IPv6 options
    39  
    40  inet6_option_types_int = IPV6_ADDRFORM, IPV6_2292PKTINFO, IPV6_2292HOPOPTS, IPV6_2292DSTOPTS, IPV6_2292RTHDR, IPV6_CHECKSUM, IPV6_2292HOPLIMIT, IPV6_NEXTHOP, IPV6_AUTHHDR, IPV6_FLOWINFO, IPV6_UNICAST_HOPS, IPV6_MULTICAST_IF, IPV6_MULTICAST_HOPS, IPV6_MULTICAST_LOOP, IPV6_ROUTER_ALERT, IPV6_MTU_DISCOVER, IPV6_MTU, IPV6_RECVERR, IPV6_V6ONLY, IPV6_FLOWINFO_SEND, IPV6_HDRINCL, IPV6_RECVPKTINFO, IPV6_RECVHOPLIMIT, IPV6_HOPLIMIT, IPV6_RECVHOPOPTS, IPV6_RECVRTHDR, IPV6_RECVDSTOPTS, IPV6_RECVPATHMTU, IPV6_DONTFRAG, IPV6_RECVTCLASS, IPV6_TCLASS, IP6T_SO_ORIGINAL_DST, IPV6_AUTOFLOWLABEL, IPV6_ADDR_PREFERENCES, IPV6_MINHOPCOUNT, IPV6_RECVORIGDSTADDR, IPV6_TRANSPARENT, IPV6_UNICAST_IF, MRT6_INIT, MRT6_DONE, MRT6_DEL_MIF, MRT6_VERSION, MRT6_ASSERT, MRT6_PIM, MRT6_TABLE, IPV6_FREEBIND
    41  
    42  inet6_option_types_buf = IPV6_2292PKTOPTIONS, IPV6_FLOWLABEL_MGR, IPV6_IPSEC_POLICY, IPV6_XFRM_POLICY, MCAST_JOIN_GROUP, MCAST_LEAVE_GROUP, MCAST_MSFILTER, IPV6_PKTINFO, IPV6_PATHMTU, IP6T_SO_GET_REVISION_MATCH, IP6T_SO_GET_REVISION_TARGET, MRT6_ADD_MIF, MRT6_ADD_MFC, MRT6_DEL_MFC, MRT6_ADD_MFC_PROXY, MRT6_DEL_MFC_PROXY, sockopt_opt_ipv6_mreq, sockopt_opt_group_source_req
    43  
    44  getsockopt$inet6_int(fd sock_in6, level const[IPPROTO_IPV6], optname flags[inet6_option_types_int], optval ptr[out, int32], optlen ptr[inout, len[optval, int32]])
    45  setsockopt$inet6_int(fd sock_in6, level const[IPPROTO_IPV6], optname flags[inet6_option_types_int], optval ptr[in, int32], optlen len[optval])
    46  getsockopt$inet6_buf(fd sock_in6, level const[IPPROTO_IPV6], optname flags[inet6_option_types_buf], optval buffer[out], optlen ptr[inout, len[optval, int32]])
    47  setsockopt$inet6_buf(fd sock_in6, level const[IPPROTO_IPV6], optname flags[inet6_option_types_buf], optval buffer[in], optlen len[optval])
    48  
    49  # Specific IPv6 options
    50  
    51  # http://lxr.free-electrons.com/ident?i=do_ipv6_setsockopt
    52  # http://lxr.free-electrons.com/ident?i=do_ipv6_getsockopt
    53  
    54  setsockopt$inet6_IPV6_ADDRFORM(fd sock_in6, level const[IPPROTO_IPV6], optname const[IPV6_ADDRFORM], optval ptr[in, const[AF_INET, int32]], optlen len[optval])
    55  
    56  sockopt_opt_ipv6_opts = IPV6_HOPOPTS, IPV6_RTHDRDSTOPTS, IPV6_RTHDR, IPV6_DSTOPTS
    57  
    58  getsockopt$inet6_opts(fd sock_in6, level const[IPPROTO_IPV6], optname flags[sockopt_opt_ipv6_opts], optval buffer[out], optlen ptr[inout, len[optval, int32]])
    59  setsockopt$inet6_opts(fd sock_in6, level const[IPPROTO_IPV6], optname flags[sockopt_opt_ipv6_opts], optval ptr[in, ipv6_ext_header], optlen len[optval])
    60  
    61  sockopt_opt_ipv6_mreq = IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP, IPV6_JOIN_ANYCAST, IPV6_LEAVE_ANYCAST
    62  
    63  getsockopt$inet6_mreq(fd sock_in6, level const[IPPROTO_IPV6], optname flags[sockopt_opt_ipv6_mreq], optval ptr[out, ipv6_mreq], optlen ptr[inout, len[optval, int32]])
    64  setsockopt$inet6_mreq(fd sock_in6, level const[IPPROTO_IPV6], optname flags[sockopt_opt_ipv6_mreq], optval ptr[in, ipv6_mreq], optlen len[optval])
    65  
    66  setsockopt$inet6_IPV6_FLOWLABEL_MGR(fd sock_in6, level const[IPPROTO_IPV6], optname const[IPV6_FLOWLABEL_MGR], optval ptr[in, in6_flowlabel_req], optlen len[optval])
    67  getsockopt$inet6_IPV6_FLOWLABEL_MGR(fd sock_in6, level const[IPPROTO_IPV6], optname const[IPV6_FLOWLABEL_MGR], optval ptr[inout, in6_flowlabel_req], optlen ptr[inout, len[optval, int32]])
    68  
    69  getsockopt$inet6_IPV6_IPSEC_POLICY(fd sock_in6, level const[IPPROTO_IPV6], optname const[IPV6_IPSEC_POLICY], optval ptr[out, xfrm_filter], optlen ptr[inout, len[optval, int32]])
    70  setsockopt$inet6_IPV6_IPSEC_POLICY(fd sock_in6, level const[IPPROTO_IPV6], optname const[IPV6_IPSEC_POLICY], optval ptr[in, xfrm_filter], optlen len[optval])
    71  getsockopt$inet6_IPV6_XFRM_POLICY(fd sock_in6, level const[IPPROTO_IPV6], optname const[IPV6_XFRM_POLICY], optval ptr[out, xfrm_filter], optlen ptr[inout, len[optval, int32]])
    72  setsockopt$inet6_IPV6_XFRM_POLICY(fd sock_in6, level const[IPPROTO_IPV6], optname const[IPV6_XFRM_POLICY], optval ptr[in, xfrm_filter], optlen len[optval])
    73  
    74  setsockopt$inet6_MCAST_JOIN_GROUP(fd sock_in6, level const[IPPROTO_IPV6], optname const[MCAST_JOIN_GROUP], optval ptr[in, group_req_in6], optlen len[optval])
    75  setsockopt$inet6_MCAST_LEAVE_GROUP(fd sock_in6, level const[IPPROTO_IPV6], optname const[MCAST_LEAVE_GROUP], optval ptr[in, group_req_in6], optlen len[optval])
    76  
    77  setsockopt$inet6_group_source_req(fd sock_in6, level const[IPPROTO_IPV6], optname flags[sockopt_opt_group_source_req], optval ptr[in, group_source_req_in6], optlen len[optval])
    78  
    79  setsockopt$inet6_MCAST_MSFILTER(fd sock_in6, level const[IPPROTO_IPV6], optname const[MCAST_MSFILTER], optval ptr[in, group_filter_in6], optlen len[optval])
    80  
    81  setsockopt$inet6_IPV6_PKTINFO(fd sock_in6, level const[IPPROTO_IPV6], optname const[IPV6_PKTINFO], optval ptr[in, in6_pktinfo], optlen len[optval])
    82  setsockopt$inet6_IPV6_HOPOPTS(fd sock_in6, level const[IPPROTO_IPV6], optname const[IPV6_HOPOPTS], optval ptr[in, ipv6_hopopts_ext_header], optlen len[optval])
    83  setsockopt$inet6_IPV6_RTHDR(fd sock_in6, level const[IPPROTO_IPV6], optname const[IPV6_RTHDR], optval ptr[in, ipv6_rt_hdr], optlen len[optval])
    84  setsockopt$inet6_IPV6_RTHDRDSTOPTS(fd sock_in6, level const[IPPROTO_IPV6], optname const[IPV6_RTHDRDSTOPTS], optval ptr[in, ipv6_dstopts_ext_header], optlen len[optval])
    85  setsockopt$inet6_IPV6_DSTOPTS(fd sock_in6, level const[IPPROTO_IPV6], optname const[IPV6_DSTOPTS], optval ptr[in, ipv6_dstopts_ext_header], optlen len[optval])
    86  
    87  # TODO: IPV6_PATHMTU
    88  # TODO: IP6T_SO_GET_REVISION_MATCH, IP6T_SO_GET_REVISION_TARGET
    89  
    90  getsockopt$inet6_mtu(fd sock_in6, level const[IPPROTO_IPV6], optname const[IPV6_MTU_DISCOVER], optval ptr[out, flags[ip_mtu_discover, int32]], optlen ptr[inout, len[optval, int32]])
    91  setsockopt$inet6_mtu(fd sock_in6, level const[IPPROTO_IPV6], optname const[IPV6_MTU_DISCOVER], optval ptr[in, flags[ip_mtu_discover, int32]], optlen len[optval])
    92  
    93  ipv6_mreq {
    94  	multi	ipv6_addr
    95  	ifindex	ifindex
    96  }
    97  
    98  in6_flowlabel_req {
    99  	flr_dst		ipv6_addr
   100  	flr_label	int32
   101  	flr_action	flags[flr_actions, int8]
   102  	flr_share	flags[flr_shares, int8]
   103  	flr_flags	flags[flr_flags, int16]
   104  	flr_expires	int16
   105  	flr_linger	int16
   106  	__flr_pad	const[0, int32]
   107  }
   108  
   109  flr_actions = IPV6_FL_A_GET, IPV6_FL_A_PUT, IPV6_FL_A_RENEW
   110  flr_shares = IPV6_FL_S_NONE, IPV6_FL_S_EXCL, IPV6_FL_S_PROCESS, IPV6_FL_S_USER, IPV6_FL_S_ANY
   111  flr_flags = IPV6_FL_F_CREATE, IPV6_FL_F_EXCL, IPV6_FL_F_REFLECT, IPV6_FL_F_REMOTE
   112  
   113  group_req_in6 {
   114  	gr_interface	int32
   115  	gr_group	sockaddr_storage_in6
   116  }
   117  
   118  group_source_req_in6 {
   119  	gsr_interface	int32
   120  	gsr_group	sockaddr_storage_in6
   121  	gsr_source	sockaddr_storage_in6
   122  }
   123  
   124  group_filter_in6 {
   125  	gf_interface	int32
   126  	gf_group	sockaddr_storage_in6
   127  	gf_fmode	flags[ip_msfilter_mode, int32]
   128  	gf_numsrc	len[gf_slist, int32]
   129  	gf_slist	array[sockaddr_storage_in6]
   130  }
   131  
   132  in6_pktinfo {
   133  	ipi6_addr	ipv6_addr
   134  	ipi6_ifindex	ifindex
   135  }
   136  
   137  # IPv6 ioctls
   138  
   139  # http://lxr.free-electrons.com/ident?i=inet6_ioctl
   140  
   141  ioctl$sock_inet6_SIOCADDRT(fd sock_in6, cmd const[SIOCADDRT], arg ptr[in, in6_rtmsg])
   142  ioctl$sock_inet6_SIOCDELRT(fd sock_in6, cmd const[SIOCDELRT], arg ptr[in, in6_rtmsg])
   143  
   144  ioctl$sock_inet6_SIOCSIFADDR(fd sock_in6, cmd const[SIOCSIFADDR], arg ptr[in, in6_ifreq])
   145  ioctl$sock_inet6_SIOCDIFADDR(fd sock_in6, cmd const[SIOCDIFADDR], arg ptr[in, in6_ifreq])
   146  ioctl$sock_inet6_SIOCSIFDSTADDR(fd sock_in6, cmd const[SIOCSIFDSTADDR], arg ptr[in, in6_ifreq])
   147  
   148  rtmsg_metrics = IP6_RT_PRIO_USER, IP6_RT_PRIO_ADDRCONF
   149  
   150  rtmsg_flags = RTF_UP, RTF_GATEWAY, RTF_HOST, RTF_REINSTATE, RTF_DYNAMIC, RTF_MODIFIED, RTF_MTU, RTF_WINDOW, RTF_IRTT, RTF_REJECT, RTF_DEFAULT, RTF_ALLONLINK, RTF_ADDRCONF, RTF_PREFIX_RT, RTF_ANYCAST, RTF_NONEXTHOP, RTF_EXPIRES, RTF_ROUTEINFO, RTF_CACHE, RTF_FLOW, RTF_POLICY, RTF_PCPU, RTF_LOCAL
   151  
   152  in6_rtmsg {
   153  	rtmsg_dst	ipv6_addr
   154  	rtmsg_src	ipv6_addr
   155  	rtmsg_gateway	ipv6_addr
   156  	rtmsg_type	int32
   157  	rtmsg_dst_len	int16
   158  	rtmsg_src_len	int16
   159  	rtmsg_metric	flags[rtmsg_metrics, int32]
   160  	rtmsg_info	intptr
   161  	rtmsg_flags	flags[rtmsg_flags, int32]
   162  	rtmsg_ifindex	ifindex
   163  }
   164  
   165  in6_ifreq {
   166  	ifr6_addr	ipv6_addr
   167  	ifr6_prefixlen	int32[0:128]
   168  	ifr6_ifindex	ifindex
   169  }
   170  
   171  # sendmsg for ip_cmsg_send, ip6_datagram_send_ctl
   172  
   173  msghdr_inet6 {
   174  	msg_name	ptr[in, sockaddr_in6, opt]
   175  	msg_namelen	len[msg_name, int32]
   176  	msg_iov		ptr[in, array[iovec_in]]
   177  	msg_iovlen	len[msg_iov, intptr]
   178  	msg_control	ptr[in, array[cmsghdr_inet6], opt]
   179  	msg_controllen	bytesize[msg_control, intptr]
   180  	msg_flags	const[0, int32]
   181  }
   182  
   183  mmsghdr_inet6 {
   184  	msg_hdr	msghdr_inet6
   185  	msg_len	const[0, int32]
   186  }
   187  
   188  cmsghdr_inet6 [
   189  	pktinfo		cmsghdr_t[SOL_IPV6, IPV6_PKTINFO, in6_pktinfo]
   190  	flowinfo	cmsghdr_t[SOL_IPV6, IPV6_FLOWINFO, int32be]
   191  	hopopts_2292	cmsghdr_t[SOL_IPV6, IPV6_HOPOPTS, ipv6_hopopts_ext_header]
   192  	hopopts		cmsghdr_t[SOL_IPV6, IPV6_HOPOPTS, ipv6_hopopts_ext_header]
   193  	dstopts_2292	cmsghdr_t[SOL_IPV6, IPV6_2292DSTOPTS, ipv6_dstopts_ext_header]
   194  	dstopts		cmsghdr_t[SOL_IPV6, IPV6_RTHDRDSTOPTS, ipv6_dstopts_ext_header]
   195  	rthdrdstopts	cmsghdr_t[SOL_IPV6, IPV6_RTHDRDSTOPTS, ipv6_dstopts_ext_header]
   196  	rthdr_2292	cmsghdr_t[SOL_IPV6, IPV6_RTHDR, ipv6_rt_hdr]
   197  	rthdr		cmsghdr_t[SOL_IPV6, IPV6_RTHDR, ipv6_rt_hdr]
   198  	hoplimit_2292	cmsghdr_t[SOL_IPV6, IPV6_2292HOPLIMIT, int32]
   199  	hoplimit	cmsghdr_t[SOL_IPV6, IPV6_HOPLIMIT, int32]
   200  	tclass		cmsghdr_t[SOL_IPV6, IPV6_TCLASS, int32]
   201  	dontfrag	cmsghdr_t[SOL_IPV6, IPV6_DONTFRAG, int32]
   202  ] [varlen]
   203  
   204  sendmsg$inet6(fd sock_in6, msg ptr[in, msghdr_inet6], f flags[send_flags])
   205  sendmmsg$inet6(fd sock_in6, mmsg ptr[in, array[mmsghdr_inet6]], vlen len[mmsg], f flags[send_flags])