diff options
| author | Simran Kathpalia <skathpalia3@gmail.com> | 2021-05-20 19:12:15 +0530 |
|---|---|---|
| committer | Mark Johnston <markjdb@gmail.com> | 2021-05-29 11:29:48 -0400 |
| commit | 325a8dab43fe8af46c179dcb4e2426613440fe85 (patch) | |
| tree | a983a5210e79d8089766f0f3c4c757b0daef7489 /sys | |
| parent | ac9ea14a1211fc8f0009e08bfb72b90875a7da41 (diff) | |
sys/freebsd: added bpf(4) ioctl
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/freebsd/dev_bpf.txt | 152 | ||||
| -rw-r--r-- | sys/freebsd/dev_bpf.txt.const | 88 |
2 files changed, 240 insertions, 0 deletions
diff --git a/sys/freebsd/dev_bpf.txt b/sys/freebsd/dev_bpf.txt new file mode 100644 index 000000000..b548d56d6 --- /dev/null +++ b/sys/freebsd/dev_bpf.txt @@ -0,0 +1,152 @@ +# Copyright 2021 syzkaller project authors. All rights reserved. +# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +include <ioccom.h> +include <fcntl.h> +include <sys/types.h> +include <sys/time.h> +include <sys/socket.h> +include <net/if.h> +include <net/bpf.h> + +resource fd_bpf[fd] + +openat$bpd(fd const[AT_FDCWD], file ptr[in, string["/dev/bpf"]], flags flags[open_flags], mode const[0]) fd_bpf + +define BIOCGDLTLIST32 3221766777 +define BIOCSRTIMEOUT32 2148024941 +define BIOCGRTIMEOUT32 1074283118 +define BIOCSETF32 2148024935 +define BIOCSETFNR32 2148024962 +define BIOCSETWF32 2148024955 + +ioctl$BIOCGBLEN(fd fd_bpf, cmd const[BIOCGBLEN], arg ptr[out, int32]) +ioctl$BIOCSBLEN(fd fd_bpf, cmd const[BIOCSBLEN], arg ptr[inout, int32]) +ioctl$BIOCGDLT(fd fd_bpf, cmd const[BIOCGDLT], arg ptr[out, int32]) +ioctl$BIOCGDLTLIST(fd fd_bpf, cmd const[BIOCGDLTLIST], arg ptr[inout, bpf_dltlist]) +ioctl$BIOCSDLT(fd fd_bpf, cmd const[BIOCSDLT], arg ptr[in, int32]) +ioctl$BIOCPROMISC(fd fd_bpf, cmd const[BIOCPROMISC]) +ioctl$BIOCFLUSH(fd fd_bpf, cmd const[BIOCFLUSH]) +ioctl$BIOCGETIF(fd fd_bpf, cmd const[BIOCGETIF], arg ptr[out, ifreq]) +ioctl$BIOCSETIF(fd fd_bpf, cmd const[BIOCSETIF], arg ptr[in, ifreq]) +ioctl$BIOCSRTIMEOUT(fd fd_bpf, cmd const[BIOCSRTIMEOUT], arg ptr[in, timeval]) +ioctl$BIOCGRTIMEOUT(fd fd_bpf, cmd const[BIOCGRTIMEOUT], arg ptr[out, timeval]) +ioctl$BIOCGSTATS(fd fd_bpf, cmd const[BIOCGSTATS], arg ptr[out, bpf_stat]) +ioctl$BIOCIMMEDIATE(fd fd_bpf, cmd const[BIOCIMMEDIATE], arg ptr[in, int32]) +ioctl$BIOCSETF(fd fd_bpf, cmd const[BIOCSETF], arg ptr[in, bpf_program]) +ioctl$BIOCSETFNR(fd fd_bpf, cmd const[BIOCSETFNR], arg ptr[in, bpf_program]) +ioctl$BIOCSETWF(fd fd_bpf, cmd const[BIOCSETWF], arg ptr[in, bpf_program]) +ioctl$BIOCVERSION(fd fd_bpf, cmd const[BIOCVERSION], arg ptr[out, bpf_version]) +ioctl$BIOCGRSIG(fd fd_bpf, cmd const[BIOCGRSIG], arg ptr[out, int32]) +ioctl$BIOCSRSIG(fd fd_bpf, cmd const[BIOCSRSIG], arg ptr[in, int32]) +ioctl$BIOCSHDRCMPLT(fd fd_bpf, cmd const[BIOCSHDRCMPLT], arg ptr[in, int32]) +ioctl$BIOCGHDRCMPLT(fd fd_bpf, cmd const[BIOCGHDRCMPLT], arg ptr[out, int32]) +ioctl$BIOCSDIRECTION(fd fd_bpf, cmd const[BIOCSDIRECTION], arg ptr[in, flags[direction_flags, int32]]) +ioctl$BIOCGDIRECTION(fd fd_bpf, cmd const[BIOCGDIRECTION], arg ptr[out, int32]) +ioctl$BIOCSTSTAMP(fd fd_bpf, cmd const[BIOCSTSTAMP], arg ptr[in, int32]) +ioctl$BIOCGTSTAMP(fd fd_bpf, cmd const[BIOCGTSTAMP], arg ptr[out, int32]) +ioctl$BIOCFEEDBACK(fd fd_bpf, cmd const[BIOCFEEDBACK], arg ptr[in, int32]) +ioctl$BIOCLOCK(fd fd_bpf, cmd const[BIOCLOCK]) +ioctl$BIOCGETBUFMODE(fd fd_bpf, cmd const[BIOCGETBUFMODE], arg ptr[out, int32]) +ioctl$BIOCSETBUFMODE(fd fd_bpf, cmd const[BIOCSETBUFMODE], arg ptr[in, flags[bufmode_flags, int32]]) +ioctl$BIOCSETZBUF(fd fd_bpf, cmd const[BIOCSETZBUF], arg ptr[in, bpf_zbuf]) +ioctl$BIOCGETZMAX(fd fd_bpf, cmd const[BIOCGETZMAX], arg ptr[out, int32]) +ioctl$BIOCROTZBUF(fd fd_bpf, cmd const[BIOCROTZBUF], arg ptr[out, bpf_zbuf]) + +ioctl$BIOCGDLTLIST32(fd fd_bpf, cmd const[BIOCGDLTLIST32], arg ptr[inout, bpf_dltlist32]) +ioctl$BIOCSRTIMEOUT32(fd fd_bpf, cmd const[BIOCSRTIMEOUT32], arg ptr[in, timeval32]) +ioctl$BIOCGRTIMEOUT32(fd fd_bpf, cmd const[BIOCGRTIMEOUT32], arg ptr[out, timeval32]) +ioctl$BIOCSETF32(fd fd_bpf, cmd const[BIOCSETF32], arg ptr[in, bpf_program32]) +ioctl$BIOCSETFNR32(fd fd_bpf, cmd const[BIOCSETFNR32], arg ptr[in, bpf_program32]) +ioctl$BIOCSETWF32(fd fd_bpf, cmd const[BIOCSETWF32], arg ptr[in, bpf_program32]) + +bpf_dltlist32 { + bfl_len int32 + bfl_list int32 +} + +bpf_dltlist { + bfl_len len[bfl_list, int32] + bfl_list ptr[in, array[int32]] +} + +bpf_stat { + bs_recv int32 + bs_drop int32 +} + +bpf_program32 { + bf_len int32 + bf_insns int32 +} + +bpf_program { + bf_len len[bf_insns, int32] + bf_insns ptr[in, array[bpf_insn]] +} + +define BPF_MAJOR_VERSION 1 +define BPF_MINOR_VERSION 1 + +bpf_version { + bv_major const[BPF_MAJOR_VERSION, int16] + bv_minor const[BPF_MINOR_VERSION, int16] +} + +bpf_insn { + code int16 + jt int8 + jf int8 + k int32 +} + +bpf_zbuf { + bz_bufa ptr[in, array[int8]] + bz_bufb ptr[in, array[int8]] + bz_buflen len[bz_bufa, int32] +} + +define IFNAMSIZ 16 + +ifreq { + ifr_name const[IFNAMSIZ, int8] + ifr_ifru ifr_ifru +} + +ifreq_buffer { + length len[buffer, int32] + buffer ptr[in, array[int8]] +} + +ifr_ifru [ + ifru_addr sockaddr + ifru_dstaddr sockaddr + ifru_broadaddr sockaddr + ifru_buffer ifreq_buffer + ifru_flags array[int16, 2] + ifru_index int16 + ifru_jid int32 + ifru_metric int32 + ifru_mtu int32 + ifru_phys int32 + ifru_media int32 + ifru_data ptr[in, array[int8]] + ifru_cap array[int32, 2] + ifru_fib int32 + ifru_vlan_pcp int8 +] + +sockaddr { + sa_len int8 + sa_family flags[address_family, int8] + sa_data array[int8, 14] +} + +timeval32 { + tv_sec int32 + tv_used int32 +} + +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 +direction_flags = BPF_D_IN, BPF_D_INOUT, BPF_D_OUT +bufmode_flags = BPF_BUFMODE_BUFFER, BPF_BUFMODE_ZBUF diff --git a/sys/freebsd/dev_bpf.txt.const b/sys/freebsd/dev_bpf.txt.const new file mode 100644 index 000000000..8eba7b48e --- /dev/null +++ b/sys/freebsd/dev_bpf.txt.const @@ -0,0 +1,88 @@ +# Code generated by syz-sysgen. DO NOT EDIT. +arches = 386, amd64 +AF_APPLETALK = 16 +AF_ARP = 35 +AF_ATM = 30 +AF_BLUETOOTH = 36 +AF_CCITT = 10 +AF_CHAOS = 5 +AF_CNT = 21 +AF_COIP = 20 +AF_DATAKIT = 9 +AF_DECnet = 12 +AF_DLI = 13 +AF_ECMA = 8 +AF_HYLINK = 15 +AF_IMPLINK = 3 +AF_INET = 2 +AF_INET6 = 28 +AF_IPX = 23 +AF_ISDN = 26 +AF_ISO = 7 +AF_LAT = 14 +AF_LINK = 18 +AF_NATM = 29 +AF_NETBIOS = 6 +AF_NETGRAPH = 32 +AF_OSI = 7 +AF_PUP = 4 +AF_ROUTE = 17 +AF_SCLUSTER = 34 +AF_SIP = 24 +AF_SLOW = 33 +AF_SNA = 11 +AF_UNIX = 1 +AT_FDCWD = 18446744073709551516 +BIOCFEEDBACK = 2147762812 +BIOCFLUSH = 536887912 +BIOCGBLEN = 1074020966 +BIOCGDIRECTION = 1074020982 +BIOCGDLT = 1074020970 +BIOCGDLTLIST = 3222291065 +BIOCGDLTLIST32 = 3221766777 +BIOCGETBUFMODE = 1074020989 +BIOCGETIF = 1075855979 +BIOCGETZMAX = 1074283135 +BIOCGHDRCMPLT = 1074020980 +BIOCGRSIG = 1074020978 +BIOCGRTIMEOUT = 1074807406 +BIOCGRTIMEOUT32 = 1074283118 +BIOCGSTATS = 1074283119 +BIOCGTSTAMP = 1074020995 +BIOCIMMEDIATE = 2147762800 +BIOCLOCK = 536887930 +BIOCPROMISC = 536887913 +BIOCROTZBUF = 1075331712 +BIOCSBLEN = 3221504614 +BIOCSDIRECTION = 2147762807 +BIOCSDLT = 2147762808 +BIOCSETBUFMODE = 2147762814 +BIOCSETF = 2148549223 +BIOCSETF32 = 2148024935 +BIOCSETFNR = 2148549250 +BIOCSETFNR32 = 2148024962 +BIOCSETIF = 2149597804 +BIOCSETWF = 2148549243 +BIOCSETWF32 = 2148024955 +BIOCSETZBUF = 2149073537 +BIOCSHDRCMPLT = 2147762805 +BIOCSRSIG = 2147762803 +BIOCSRTIMEOUT = 2148549229 +BIOCSRTIMEOUT32 = 2148024941 +BIOCSTSTAMP = 2147762820 +BIOCVERSION = 1074020977 +BPF_BUFMODE_BUFFER = 1 +BPF_BUFMODE_ZBUF = 2 +BPF_D_IN = 0 +BPF_D_INOUT = 1 +BPF_D_OUT = 2 +BPF_MAJOR_VERSION = 1 +BPF_MINOR_VERSION = 1 +IFNAMSIZ = 16 +SYS_ioctl = 54 +SYS_openat = 499 +pseudo_AF_HDRCMPLT = 31 +pseudo_AF_KEY = 27 +pseudo_AF_PIP = 25 +pseudo_AF_RTIP = 22 +pseudo_AF_XTP = 19 |
