You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
000: A = P[12:2]
001: if (A == 34525) goto 2 else goto 10
002: A = P[22:4]
003: if (A == 4294967295) goto 4 else goto 10
004: A = P[26:4]
005: if (A == 4008636142) goto 6 else goto 10
006: A = P[30:4]
007: A &= 4294950912
008: if (A == 65536) goto 9 else goto 10
009: return 65535
010: return 0
BPF cross-compiled to Lua
return function (P, length)
local A = 0
if 14 > length then return false end
A = bit.bor(bit.lshift(P[12], 8), P[12+1])
if not (A==34525) then goto L9 end
if 26 > length then return false end
A = bit.bor(bit.lshift(P[22], 24),bit.lshift(P[22+1], 16), bit.lshift(P[22+2], 8), P[22+3])
if not (A==-1) then goto L9 end
if 30 > length then return false end
A = bit.bor(bit.lshift(P[26], 24),bit.lshift(P[26+1], 16), bit.lshift(P[26+2], 8), P[26+3])
if not (A==-286331154) then goto L9 end
if 34 > length then return false end
A = bit.bor(bit.lshift(P[30], 24),bit.lshift(P[30+1], 16), bit.lshift(P[30+2], 8), P[30+3])
A = bit.band(A, -16384)
if not (A==65536) then goto L9 end
do return true end
::L9::
do return false end
error("end of bpf")
end
Direct pflang compilation
local band = require("bit").band
local cast = require("ffi").cast
return function(P,length)
if length < 54 then return false end
if cast("uint16_t*", P+12)[0] ~= 56710 then return false end
if cast("uint32_t*", P+22)[0] ~= 4294967295 then return false end
if cast("uint32_t*", P+26)[0] ~= 4008636142 then return false end
return band(cast("uint32_t*", P+30)[0],12648447) == 256
end