mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 01:53:45 +01:00
Make the protocol dissector heuristic (#14335)
This commit is contained in:
parent
1d9c9710d7
commit
16aaef097a
@ -1280,13 +1280,14 @@ do
|
|||||||
|
|
||||||
function p_minetest.dissector(buffer, pinfo, tree)
|
function p_minetest.dissector(buffer, pinfo, tree)
|
||||||
|
|
||||||
-- Add Minetest tree item and verify the ID
|
-- Defer if payload doesn't have Minetest's magic number
|
||||||
|
if buffer(0,4):uint() ~= minetest_id then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Add Minetest tree item
|
||||||
local t = tree:add(p_minetest, buffer(0,8))
|
local t = tree:add(p_minetest, buffer(0,8))
|
||||||
t:add(f_id, buffer(0,4))
|
t:add(f_id, buffer(0,4))
|
||||||
if buffer(0,4):uint() ~= minetest_id then
|
|
||||||
t:add_expert_info(PI_UNDECODED, PI_WARN, "Invalid ID, this is not a Minetest packet")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- ID is valid, so replace packet's shown protocol
|
-- ID is valid, so replace packet's shown protocol
|
||||||
pinfo.cols.protocol = "Minetest"
|
pinfo.cols.protocol = "Minetest"
|
||||||
@ -1339,12 +1340,11 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
pinfo.cols.info:append(" (" .. reliability_info .. ")")
|
pinfo.cols.info:append(" (" .. reliability_info .. ")")
|
||||||
|
return true
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- FIXME Is there a way to let the dissector table check if the first payload bytes are 0x4f457403?
|
p_minetest:register_heuristic("udp", p_minetest.dissector)
|
||||||
DissectorTable.get("udp.port"):add(30000, p_minetest)
|
|
||||||
DissectorTable.get("udp.port"):add(30001, p_minetest)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user