Skip to content

Commit

Permalink
pflua: do not cdef struct bpf_ins (collides with ljsyscall)
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneia committed Nov 25, 2019
1 parent ea955a8 commit 01f11e9
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/pflua/src/pf/types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ struct pcap_pkthdr {
-- with the high-bit set as negative int32_t values, so we do the same
-- for all of our 32-bit values including the "k" field in BPF
-- instructions.
ffi.cdef[[
struct bpf_insn { uint16_t code; uint8_t jt, jf; int32_t k; };
struct bpf_program { uint32_t bf_len; struct bpf_insn *bf_insns; };
]]
local bpf_program_mt = {
__len = function (program) return program.bf_len end,
__index = function (program, idx)
Expand All @@ -50,8 +46,8 @@ local bpf_program_mt = {
end
}

bpf_insn = ffi.typeof("struct bpf_insn")
bpf_program = ffi.metatype("struct bpf_program", bpf_program_mt)
bpf_insn = ffi.typeof("struct { uint16_t code; uint8_t jt, jf; int32_t k; }")
bpf_program = ffi.metatype("struct { uint32_t bf_len; struct bpf_insn *bf_insns; }", bpf_program_mt)
pcap_record = ffi.typeof("struct pcap_record")
pcap_pkthdr = ffi.typeof("struct pcap_pkthdr")

Expand Down

0 comments on commit 01f11e9

Please sign in to comment.