Jelajahi Sumber

wireshark: fix Lua 5.4 bitwise operation (#1776)

The Nebula Wireshark dissector uses bit32.band() when parsing the
Nebula packet type. On Wireshark builds using Lua 5.4, bit32 is not
available, which causes dissection to fail with:

Lua Error: nebula.lua:65: attempt to index a nil value (global 'bit32')

Wireshark bundles Lua BitOp and exposes it globally as bit for Lua
dissectors. This is the documented API for maximum backwards
compatibility across supported Lua versions.

Use bit.band() instead of bit32.band().
zorvios 3 bulan lalu
induk
melakukan
02471b4121
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  1. 1 1
      dist/wireshark/nebula.lua

+ 1 - 1
dist/wireshark/nebula.lua

@@ -62,7 +62,7 @@ function nebula.dissector(tvbuf, pktinfo, root)
     tree:add(pf_version, tvbuf:range(0,1))
     tree:add(pf_version, tvbuf:range(0,1))
     local type = tree:add(pf_type,    tvbuf:range(0,1))
     local type = tree:add(pf_type,    tvbuf:range(0,1))
 
 
-    local nebula_type = bit32.band(tvbuf:range(0,1):uint(), 0x0F)
+    local nebula_type = bit.band(tvbuf:range(0,1):uint(), 0x0F)
     if nebula_type == 0 then
     if nebula_type == 0 then
         local stage = tvbuf(8,8):uint64()
         local stage = tvbuf(8,8):uint64()
         tree:add(pf_subtype_handshake, tvbuf:range(1,1))
         tree:add(pf_subtype_handshake, tvbuf:range(1,1))