Make dissector add the ports table upon detection for udp too
This commit is contained in:
1 parent
4b8d16d028
commit
b8cab8f68d
2 files changed
+12
-1
No files matched your search
@@ -46,8 +46,9 @@ jobs:
|
||||
name: Luacheck
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Run luacheck
|
||||
uses: nebularg/actions-luacheck@v1
|
||||
with:
|
||||
files: 'dissector/baichuan.lua'
|
||||
args: --globals Dissector,Proto,ProtoField,base,ByteArray,DESEGMENT_ONE_MORE_SEGMENT,DissectorTable
|
||||
args: --globals Dissector Proto ProtoField base ByteArray DESEGMENT_ONE_MORE_SEGMENT DissectorTable
|
||||
@@ -716,6 +716,7 @@ function bc_protocol.dissector(buffer, pinfo, tree)
|
||||
end
|
||||
--- END UDP CONTENT
|
||||
|
||||
local added_udp_ports = {}
|
||||
local function heuristic_checker_udp(buffer, pinfo, tree)
|
||||
-- guard for length
|
||||
local length = buffer:len()
|
||||
@@ -730,6 +731,15 @@ local function heuristic_checker_udp(buffer, pinfo, tree)
|
||||
return false
|
||||
end
|
||||
|
||||
if added_udp_ports[pinfo.dst_port] == nil then
|
||||
table.insert(added_udp_ports, pinfo.dst_port)
|
||||
DissectorTable.get("udp.port"):add(pinfo.dst_port, bc_protocol)
|
||||
end
|
||||
if added_udp_ports[pinfo.src_port] == nil then
|
||||
table.insert(added_udp_ports, pinfo.src_port)
|
||||
DissectorTable.get("udp.port"):add(pinfo.src_port, bc_protocol)
|
||||
end
|
||||
|
||||
bc_protocol.dissector(buffer, pinfo, tree)
|
||||
return true
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user