github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/freebsd/dev_bpf.txt (about) 1 # Copyright 2021 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 <ioccom.h> 5 include <fcntl.h> 6 include <sys/types.h> 7 include <sys/time.h> 8 include <sys/socket.h> 9 include <net/if.h> 10 include <net/bpf.h> 11 12 resource fd_bpf[fd] 13 14 openat$bpf(fd const[AT_FDCWD], file ptr[in, string["/dev/bpf"]], flags flags[open_flags], mode const[0]) fd_bpf 15 16 define BIOCGDLTLIST32 3221766777 17 define BIOCSRTIMEOUT32 2148024941 18 define BIOCGRTIMEOUT32 1074283118 19 define BIOCSETF32 2148024935 20 define BIOCSETFNR32 2148024962 21 define BIOCSETWF32 2148024955 22 23 ioctl$BIOCGBLEN(fd fd_bpf, cmd const[BIOCGBLEN], arg ptr[out, int32]) 24 ioctl$BIOCSBLEN(fd fd_bpf, cmd const[BIOCSBLEN], arg ptr[inout, int32]) 25 ioctl$BIOCGDLT(fd fd_bpf, cmd const[BIOCGDLT], arg ptr[out, int32]) 26 ioctl$BIOCGDLTLIST(fd fd_bpf, cmd const[BIOCGDLTLIST], arg ptr[inout, bpf_dltlist]) 27 ioctl$BIOCSDLT(fd fd_bpf, cmd const[BIOCSDLT], arg ptr[in, int32]) 28 ioctl$BIOCPROMISC(fd fd_bpf, cmd const[BIOCPROMISC]) 29 ioctl$BIOCFLUSH(fd fd_bpf, cmd const[BIOCFLUSH]) 30 ioctl$BIOCGETIF(fd fd_bpf, cmd const[BIOCGETIF], arg ptr[out, ifreq]) 31 ioctl$BIOCSETIF(fd fd_bpf, cmd const[BIOCSETIF], arg ptr[in, ifreq]) 32 ioctl$BIOCSRTIMEOUT(fd fd_bpf, cmd const[BIOCSRTIMEOUT], arg ptr[in, timeval]) 33 ioctl$BIOCGRTIMEOUT(fd fd_bpf, cmd const[BIOCGRTIMEOUT], arg ptr[out, timeval]) 34 ioctl$BIOCGSTATS(fd fd_bpf, cmd const[BIOCGSTATS], arg ptr[out, bpf_stat]) 35 ioctl$BIOCIMMEDIATE(fd fd_bpf, cmd const[BIOCIMMEDIATE], arg ptr[in, int32]) 36 ioctl$BIOCSETF(fd fd_bpf, cmd const[BIOCSETF], arg ptr[in, bpf_program]) 37 ioctl$BIOCSETFNR(fd fd_bpf, cmd const[BIOCSETFNR], arg ptr[in, bpf_program]) 38 ioctl$BIOCSETWF(fd fd_bpf, cmd const[BIOCSETWF], arg ptr[in, bpf_program]) 39 ioctl$BIOCVERSION(fd fd_bpf, cmd const[BIOCVERSION], arg ptr[out, bpf_version]) 40 ioctl$BIOCGRSIG(fd fd_bpf, cmd const[BIOCGRSIG], arg ptr[out, int32]) 41 ioctl$BIOCSRSIG(fd fd_bpf, cmd const[BIOCSRSIG], arg ptr[in, int32]) 42 ioctl$BIOCSHDRCMPLT(fd fd_bpf, cmd const[BIOCSHDRCMPLT], arg ptr[in, int32]) 43 ioctl$BIOCGHDRCMPLT(fd fd_bpf, cmd const[BIOCGHDRCMPLT], arg ptr[out, int32]) 44 ioctl$BIOCSDIRECTION(fd fd_bpf, cmd const[BIOCSDIRECTION], arg ptr[in, flags[direction_flags, int32]]) 45 ioctl$BIOCGDIRECTION(fd fd_bpf, cmd const[BIOCGDIRECTION], arg ptr[out, int32]) 46 ioctl$BIOCSTSTAMP(fd fd_bpf, cmd const[BIOCSTSTAMP], arg ptr[in, int32]) 47 ioctl$BIOCGTSTAMP(fd fd_bpf, cmd const[BIOCGTSTAMP], arg ptr[out, int32]) 48 ioctl$BIOCFEEDBACK(fd fd_bpf, cmd const[BIOCFEEDBACK], arg ptr[in, int32]) 49 ioctl$BIOCLOCK(fd fd_bpf, cmd const[BIOCLOCK]) 50 ioctl$BIOCGETBUFMODE(fd fd_bpf, cmd const[BIOCGETBUFMODE], arg ptr[out, int32]) 51 ioctl$BIOCSETBUFMODE(fd fd_bpf, cmd const[BIOCSETBUFMODE], arg ptr[in, flags[bufmode_flags, int32]]) 52 ioctl$BIOCSETZBUF(fd fd_bpf, cmd const[BIOCSETZBUF], arg ptr[in, bpf_zbuf]) 53 ioctl$BIOCGETZMAX(fd fd_bpf, cmd const[BIOCGETZMAX], arg ptr[out, int32]) 54 ioctl$BIOCROTZBUF(fd fd_bpf, cmd const[BIOCROTZBUF], arg ptr[out, bpf_zbuf]) 55 56 ioctl$BIOCGDLTLIST32(fd fd_bpf, cmd const[BIOCGDLTLIST32], arg ptr[inout, bpf_dltlist32]) 57 ioctl$BIOCSRTIMEOUT32(fd fd_bpf, cmd const[BIOCSRTIMEOUT32], arg ptr[in, timeval32]) 58 ioctl$BIOCGRTIMEOUT32(fd fd_bpf, cmd const[BIOCGRTIMEOUT32], arg ptr[out, timeval32]) 59 ioctl$BIOCSETF32(fd fd_bpf, cmd const[BIOCSETF32], arg ptr[in, bpf_program32]) 60 ioctl$BIOCSETFNR32(fd fd_bpf, cmd const[BIOCSETFNR32], arg ptr[in, bpf_program32]) 61 ioctl$BIOCSETWF32(fd fd_bpf, cmd const[BIOCSETWF32], arg ptr[in, bpf_program32]) 62 63 bpf_dltlist32 { 64 bfl_len int32 65 bfl_list int32 66 } 67 68 bpf_dltlist { 69 bfl_len len[bfl_list, int32] 70 bfl_list ptr[in, array[int32]] 71 } 72 73 bpf_stat { 74 bs_recv int32 75 bs_drop int32 76 } 77 78 bpf_program32 { 79 bf_len int32 80 bf_insns int32 81 } 82 83 bpf_program { 84 bf_len len[bf_insns, int32] 85 bf_insns ptr[in, array[bpf_insn]] 86 } 87 88 define BPF_MAJOR_VERSION 1 89 define BPF_MINOR_VERSION 1 90 91 bpf_version { 92 bv_major const[BPF_MAJOR_VERSION, int16] 93 bv_minor const[BPF_MINOR_VERSION, int16] 94 } 95 96 bpf_insn { 97 code int16 98 jt int8 99 jf int8 100 k int32 101 } 102 103 bpf_zbuf { 104 bz_bufa ptr[in, array[int8]] 105 bz_bufb ptr[in, array[int8]] 106 bz_buflen len[bz_bufa, int32] 107 } 108 109 define IFNAMSIZ 16 110 111 ifreq { 112 ifr_name const[IFNAMSIZ, int8] 113 ifr_ifru ifr_ifru 114 } 115 116 ifreq_buffer { 117 length len[buffer, int32] 118 buffer ptr[in, array[int8]] 119 } 120 121 ifr_ifru [ 122 ifru_addr sockaddr 123 ifru_dstaddr sockaddr 124 ifru_broadaddr sockaddr 125 ifru_buffer ifreq_buffer 126 ifru_flags array[int16, 2] 127 ifru_index int16 128 ifru_jid int32 129 ifru_metric int32 130 ifru_mtu int32 131 ifru_phys int32 132 ifru_media int32 133 ifru_data ptr[in, array[int8]] 134 ifru_cap array[int32, 2] 135 ifru_fib int32 136 ifru_vlan_pcp int8 137 ] 138 139 sockaddr { 140 sa_len int8 141 sa_family flags[address_family, int8] 142 sa_data array[int8, 14] 143 } 144 145 timeval32 { 146 tv_sec int32 147 tv_used int32 148 } 149 150 address_family = AF_UNIX, AF_INET, AF_IMPLINK, AF_PUP, AF_CHAOS, AF_NETBIOS, AF_ISO, AF_OSI, AF_ECMA, AF_DATAKIT, AF_CCITT, AF_SNA, AF_DECnet, AF_DLI, AF_LAT, AF_HYLINK, AF_APPLETALK, AF_ROUTE, AF_LINK, pseudo_AF_XTP, AF_COIP, AF_CNT, pseudo_AF_RTIP, AF_IPX, AF_SIP, pseudo_AF_PIP, AF_ISDN, pseudo_AF_KEY, AF_INET6, AF_NATM, AF_ATM, pseudo_AF_HDRCMPLT, AF_NETGRAPH, AF_SLOW, AF_SCLUSTER, AF_ARP, AF_BLUETOOTH 151 direction_flags = BPF_D_IN, BPF_D_INOUT, BPF_D_OUT 152 bufmode_flags = BPF_BUFMODE_BUFFER, BPF_BUFMODE_ZBUF