github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/socket_key.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 # AF_KEY support. 5 6 include <linux/socket.h> 7 include <linux/net.h> 8 include <linux/pfkeyv2.h> 9 include <linux/ipsec.h> 10 11 resource sock_key[sock] 12 13 socket$key(domain const[AF_KEY], type const[SOCK_RAW], proto const[PF_KEY_V2]) sock_key 14 15 openat$pfkey(fd const[AT_FDCWD], file ptr[in, string["/proc/self/net/pfkey"]], flags flags[open_flags], mode const[0]) fd 16 17 sendmsg$key(fd sock_key, msg ptr[in, send_msghdr_key], f flags[send_flags]) 18 19 send_msghdr_key { 20 msg_name const[0, intptr] 21 msg_namelen const[0, int32] 22 msg_iov ptr[in, iovec_sadb_msg] 23 msg_iovlen const[1, intptr] 24 msg_control const[0, intptr] 25 msg_controllen const[0, intptr] 26 msg_flags const[0, int32] 27 } 28 29 iovec_sadb_msg { 30 addr ptr[in, sadb_msg] 31 len bytesize[addr, intptr] 32 } 33 34 sadb_msg { 35 sadb_msg_version const[PF_KEY_V2, int8] 36 sadb_msg_type int8[SADB_RESERVED:SADB_MAX] 37 sadb_msg_errno int8 38 sadb_msg_satype flags[sadb_satype, int8] 39 sadb_msg_len bytesize8[parent, int16] 40 sadb_msg_reserved const[0, int16] 41 sadb_msg_seq netlink_seq 42 sadb_msg_pid netlink_port_id 43 ext_headers array[sadb_ext_hdr] 44 } [packed] 45 46 sadb_ext_hdr [ 47 sadb_sa sadb_sa 48 sadb_lifetime sadb_lifetime 49 sadb_address sadb_address 50 sadb_key sadb_key 51 sadb_ident sadb_ident 52 sadb_spirange sadb_spirange 53 sadb_x_policy sadb_x_policy 54 sadb_x_sa2 sadb_x_sa2 55 sadb_x_nat_t_type sadb_x_nat_t_type 56 sadb_x_nat_t_port sadb_x_nat_t_port 57 sadb_x_sec_ctx sadb_x_sec_ctx 58 sadb_x_kmaddress sadb_x_kmaddress 59 sadb_x_filter sadb_x_filter 60 ] [varlen] 61 62 sadb_sa { 63 sadb_len bytesize8[parent, int16] 64 sadb_exttype const[SADB_EXT_SA, int16] 65 sadb_sa_spi xfrm_spi 66 sadb_sa_replay int8 67 sadb_sa_state int8 68 sadb_sa_auth int8[SADB_AALG_NONE:SADB_AALG_MAX] 69 sadb_sa_encrypt int8[SADB_X_CALG_NONE:SADB_X_CALG_MAX] 70 sadb_sa_flags flags[sadb_sa_flags, int32] 71 } [packed, align[8]] 72 73 sadb_sa_flags = SADB_SAFLAGS_PFS, SADB_SAFLAGS_NOPMTUDISC, SADB_SAFLAGS_DECAP_DSCP, SADB_SAFLAGS_NOECN 74 75 sadb_lifetime { 76 sadb_len bytesize8[parent, int16] 77 sadb_exttype flags[sadb_lifetime_type, int16] 78 sadb_lifetime_allocations int32 79 sadb_lifetime_bytes int64 80 sadb_lifetime_addtime int64 81 sadb_lifetime_usetime int64 82 } [packed, align[8]] 83 84 sadb_address { 85 sadb_len bytesize8[parent, int16] 86 sadb_exttype flags[sadb_address_type, int16] 87 sadb_address_proto flags[xfrm_proto, int8] 88 sadb_address_prefixlen flags[xfrm_prefixlens, int8] 89 sadb_address_reserved const[0, int16] 90 addr sadb_address_addr 91 } [packed, align[8]] 92 93 sadb_address_addr [ 94 in sockaddr_in 95 in6 sockaddr_in6 96 ] [varlen] 97 98 sadb_key { 99 sadb_len bytesize8[parent, int16] 100 sadb_exttype flags[sadb_key_type, int16] 101 sadb_key_bits bitsize[key, int16] 102 sadb_key_reserved const[0, int16] 103 key array[int8] 104 } [packed, align[8]] 105 106 sadb_ident { 107 sadb_len bytesize8[parent, int16] 108 sadb_exttype flags[sadb_ident_type, int16] 109 sadb_ident_type int16 110 sadb_ident_reserved const[0, int16] 111 sadb_ident_id int64 112 } [packed, align[8]] 113 114 sadb_spirange { 115 sadb_len bytesize8[parent, int16] 116 sadb_exttype const[SADB_EXT_SPIRANGE, int16] 117 sadb_spirange_min xfrm_spi 118 sadb_spirange_max xfrm_spi 119 sadb_spirange_reserved const[0, int32] 120 } [packed, align[8]] 121 122 sadb_x_policy { 123 sadb_len bytesize8[parent, int16] 124 sadb_exttype const[SADB_X_EXT_POLICY, int16] 125 sadb_x_policy_type int16[IPSEC_POLICY_DISCARD:IPSEC_POLICY_BYPASS] 126 sadb_x_policy_dir flags[ipsec_policy_dir, int8] 127 sadb_x_policy_reserved const[0, int8] 128 sadb_x_policy_id xfrm_policy_index 129 sadb_x_policy_priority int32 130 policy sadb_x_ipsecrequest 131 } [packed, align[8]] 132 133 sadb_x_ipsecrequest { 134 sadb_x_ipsecrequest_len bytesize8[parent, int16] 135 sadb_x_ipsecrequest_proto flags[xfrm_proto, int16] 136 sadb_x_ipsecrequest_mode int8 137 sadb_x_ipsecrequest_level int8 138 sadb_x_ipsecrequest_reserved1 const[0, int16] 139 sadb_x_ipsecrequest_reqid int32 140 sadb_x_ipsecrequest_reserved2 const[0, int32] 141 saddr sadb_filter_addr 142 daddr sadb_filter_addr 143 } [packed, align[8]] 144 145 sadb_x_sa2 { 146 sadb_len bytesize8[parent, int16] 147 sadb_exttype const[SADB_X_EXT_SA2, int16] 148 sadb_x_sa2_mode int8 149 sadb_x_sa2_reserved1 const[0, int8] 150 sadb_x_sa2_reserved2 const[0, int16] 151 sadb_x_sa2_sequence netlink_seq 152 sadb_x_sa2_reqid xfrm_req_id 153 } [packed, align[8]] 154 155 sadb_x_nat_t_type { 156 sadb_len bytesize8[parent, int16] 157 sadb_exttype const[SADB_X_EXT_NAT_T_TYPE, int16] 158 sadb_x_nat_t_type_type int8 159 sadb_x_nat_t_type_reserved array[const[0, int8], 3] 160 } [packed, align[8]] 161 162 sadb_x_nat_t_port { 163 sadb_len bytesize8[parent, int16] 164 sadb_exttype flags[sadb_nat_port_type, int16] 165 sadb_x_nat_t_port_port sock_port 166 sadb_x_nat_t_port_reserved const[0, int16] 167 } [packed, align[8]] 168 169 sadb_x_sec_ctx { 170 sadb_len bytesize8[parent, int16] 171 sadb_exttype const[SADB_X_EXT_SEC_CTX, int16] 172 sadb_x_ctx_alg int8 173 sadb_x_ctx_doi int8 174 sadb_x_ctx_len bytesize[ctx, int16] 175 ctx array[int8] 176 } [packed, align[8]] 177 178 sadb_x_kmaddress { 179 sadb_len bytesize8[parent, int16] 180 sadb_exttype const[SADB_X_EXT_KMADDRESS, int16] 181 sadb_x_kmaddress_reserved const[0, int32] 182 src sadb_address_addr 183 dst sadb_address_addr 184 } [packed, align[8]] 185 186 sadb_x_filter { 187 sadb_len bytesize8[parent, int16] 188 sadb_exttype const[SADB_X_EXT_FILTER, int16] 189 sadb_x_filter_saddr sadb_filter_addr 190 sadb_x_filter_daddr sadb_filter_addr 191 sadb_x_filter_family flags[socket_domain, int16] 192 sadb_x_filter_splen flags[sadb_filter_addr_len, int8] 193 sadb_x_filter_dplen flags[sadb_filter_addr_len, int8] 194 } [packed, align[8]] 195 196 sadb_filter_addr [ 197 in ipv4_addr 198 in6 ipv6_addr 199 ] 200 201 sadb_satype = SADB_SATYPE_UNSPEC, SADB_SATYPE_AH, SADB_SATYPE_ESP, SADB_SATYPE_RSVP, SADB_SATYPE_OSPFV2, SADB_SATYPE_RIPV2, SADB_SATYPE_MIP, SADB_X_SATYPE_IPCOMP, SADB_SATYPE_MAX 202 sadb_lifetime_type = SADB_EXT_LIFETIME_CURRENT, SADB_EXT_LIFETIME_HARD, SADB_EXT_LIFETIME_SOFT 203 sadb_address_type = SADB_EXT_ADDRESS_SRC, SADB_EXT_ADDRESS_DST, SADB_EXT_ADDRESS_PROXY, SADB_X_EXT_NAT_T_OA 204 sadb_key_type = SADB_EXT_KEY_AUTH, SADB_EXT_KEY_ENCRYPT 205 sadb_ident_type = SADB_EXT_IDENTITY_SRC, SADB_EXT_IDENTITY_DST 206 sadb_nat_port_type = SADB_X_EXT_NAT_T_SPORT, SADB_X_EXT_NAT_T_DPORT 207 ipsec_policy_dir = IPSEC_DIR_ANY, IPSEC_DIR_INBOUND, IPSEC_DIR_OUTBOUND, IPSEC_DIR_FWD, IPSEC_DIR_MAX 208 sadb_filter_addr_len = 4, 16