github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/freebsd/socket_inet.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 <sys/types.h>
     5  include <sys/socket.h>
     6  include <sys/sockio.h>
     7  include <netinet/in.h>
     8  
     9  # IP sockets
    10  
    11  resource sock_in[sock]
    12  resource ifindex[int32]
    13  
    14  sockaddr_in {
    15  	len	len[parent, int8]
    16  	family	const[AF_INET, int8]
    17  	port	sock_port
    18  	addr	ipv4_addr
    19  	pad	array[const[0, int8], 8]
    20  }
    21  
    22  sockaddr_storage_in {
    23  	addr	sockaddr_in
    24  	pad	array[const[0, int64], 14]
    25  }
    26  
    27  socket$inet(domain const[AF_INET], type flags[socket_type], proto int8) sock_in
    28  accept$inet(fd sock_in, peer ptr[out, sockaddr_in, opt], peerlen ptr[inout, len[peer, int32]]) sock_in
    29  accept4$inet(fd sock_in, peer ptr[out, sockaddr_in, opt], peerlen ptr[inout, len[peer, int32]], flags flags[accept_flags]) sock_in
    30  bind$inet(fd sock_in, addr ptr[in, sockaddr_in], addrlen len[addr])
    31  connect$inet(fd sock_in, addr ptr[in, sockaddr_in], addrlen len[addr])
    32  sendto$inet(fd sock_in, buf buffer[in], len len[buf], f flags[send_flags], addr ptr[in, sockaddr_in, opt], addrlen len[addr])
    33  recvfrom$inet(fd sock_in, buf buffer[out], len len[buf], f flags[recv_flags], addr ptr[in, sockaddr_in, opt], addrlen len[addr])
    34  getsockname$inet(fd sock_in, addr ptr[out, sockaddr_in], addrlen ptr[inout, len[addr, int32]])
    35  getpeername$inet(fd sock_in, peer ptr[out, sockaddr_in], peerlen ptr[inout, len[peer, int32]])
    36  
    37  # Generic IP options
    38  
    39  inet_option_types_int = IP_TOS, IP_TTL, IP_HDRINCL, IP_RECVOPTS, IP_RETOPTS, IP_RECVTTL, IP_RECVTOS, IP_RECVORIGDSTADDR, IP_MINTTL
    40  
    41  inet_option_types_buf = IP_OPTIONS, IP_IPSEC_POLICY, IP_MSFILTER, MCAST_JOIN_GROUP, MCAST_LEAVE_GROUP, sockopt_opt_ip_mreq, sockopt_opt_ip_mreqsrc, sockopt_opt_group_source_req
    42  
    43  getsockopt$inet_int(fd sock_in, level const[IPPROTO_IP], optname flags[inet_option_types_int], optval ptr[out, int32], optlen ptr[inout, len[optval, int32]])
    44  setsockopt$inet_int(fd sock_in, level const[IPPROTO_IP], optname flags[inet_option_types_int], optval ptr[in, int32], optlen len[optval])
    45  getsockopt$inet_buf(fd sock_in, level const[IPPROTO_IP], optname flags[inet_option_types_buf], optval buffer[out], optlen ptr[inout, len[optval, int32]])
    46  setsockopt$inet_buf(fd sock_in, level const[IPPROTO_IP], optname flags[inet_option_types_buf], optval buffer[in], optlen len[optval])
    47  
    48  # Specific IP options
    49  
    50  sockopt_opt_ip_opts = IP_OPTIONS
    51  
    52  getsockopt$inet_opts(fd sock_in, level const[IPPROTO_IP], optname flags[sockopt_opt_ip_opts], optval buffer[out], optlen ptr[inout, len[optval, int32]])
    53  setsockopt$inet_opts(fd sock_in, level const[IPPROTO_IP], optname flags[sockopt_opt_ip_opts], optval buffer[in], optlen len[optval])
    54  
    55  sockopt_opt_ip_mreq = IP_ADD_MEMBERSHIP, IP_DROP_MEMBERSHIP, IP_MULTICAST_IF
    56  
    57  getsockopt$inet_mreq(fd sock_in, level const[IPPROTO_IP], optname flags[sockopt_opt_ip_mreq], optval ptr[out, ip_mreq], optlen ptr[inout, len[optval, int32]])
    58  setsockopt$inet_mreq(fd sock_in, level const[IPPROTO_IP], optname flags[sockopt_opt_ip_mreq], optval ptr[in, ip_mreq], optlen len[optval])
    59  getsockopt$inet_mreqn(fd sock_in, level const[IPPROTO_IP], optname flags[sockopt_opt_ip_mreq], optval ptr[out, ip_mreqn], optlen ptr[inout, len[optval, int32]])
    60  setsockopt$inet_mreqn(fd sock_in, level const[IPPROTO_IP], optname flags[sockopt_opt_ip_mreq], optval ptr[in, ip_mreqn], optlen len[optval])
    61  
    62  sockopt_opt_ip_mreqsrc = IP_ADD_SOURCE_MEMBERSHIP, IP_BLOCK_SOURCE, IP_DROP_SOURCE_MEMBERSHIP, IP_UNBLOCK_SOURCE
    63  
    64  getsockopt$inet_mreqsrc(fd sock_in, level const[IPPROTO_IP], optname flags[sockopt_opt_ip_mreqsrc], optval ptr[out, ip_mreq_source], optlen ptr[inout, len[optval, int32]])
    65  setsockopt$inet_mreqsrc(fd sock_in, level const[IPPROTO_IP], optname flags[sockopt_opt_ip_mreqsrc], optval ptr[in, ip_mreq_source], optlen len[optval])
    66  
    67  setsockopt$inet_msfilter(fd sock_in, level const[IPPROTO_IP], optname const[IP_MSFILTER], optval ptr[in, ip_msfilter], optlen len[optval])
    68  
    69  setsockopt$inet_MCAST_JOIN_GROUP(fd sock_in, level const[IPPROTO_IP], optname const[MCAST_JOIN_GROUP], optval ptr[in, group_req_in], optlen len[optval])
    70  setsockopt$inet_MCAST_LEAVE_GROUP(fd sock_in, level const[IPPROTO_IP], optname const[MCAST_LEAVE_GROUP], optval ptr[in, group_req_in], optlen len[optval])
    71  
    72  sockopt_opt_group_source_req = MCAST_JOIN_SOURCE_GROUP, MCAST_LEAVE_SOURCE_GROUP, MCAST_BLOCK_SOURCE, MCAST_UNBLOCK_SOURCE
    73  
    74  setsockopt$inet_group_source_req(fd sock_in, level const[IPPROTO_IP], optname flags[sockopt_opt_group_source_req], optval ptr[in, group_source_req_in], optlen len[optval])
    75  
    76  ip_mreq {
    77  	imr_multiaddr	ipv4_addr
    78  	imr_interface	ipv4_addr
    79  }
    80  
    81  ip_mreqn {
    82  	imr_multiaddr	ipv4_addr
    83  	imr_address	ipv4_addr
    84  	imr_ifindex	ifindex
    85  }
    86  
    87  ip_mreq_source {
    88  	imr_multiaddr	ipv4_addr
    89  	imr_interface	ipv4_addr
    90  	imr_sourceaddr	ipv4_addr
    91  }
    92  
    93  ip_msfilter {
    94  	imsf_multiaddr	ipv4_addr
    95  	imsf_interface	ipv4_addr
    96  	imsf_fmode	flags[ip_msfilter_mode, int32]
    97  	imsf_numsrc	len[imsf_slist, int32]
    98  	imsf_slist	array[ipv4_addr]
    99  }
   100  
   101  ip_msfilter_mode = MCAST_INCLUDE, MCAST_EXCLUDE
   102  
   103  group_req_in {
   104  	gr_interface	int32
   105  	gr_group	sockaddr_storage_in
   106  }
   107  
   108  group_source_req_in {
   109  	gsr_interface	int32
   110  	gsr_group	sockaddr_storage_in
   111  	gsr_source	sockaddr_storage_in
   112  }