Always show opt length in Wireshark dissector
authorJoseph C. Lehner <joseph.c.lehner@gmail.com>
Mon, 2 Mar 2020 10:47:05 +0000 (11:47 +0100)
committerJoseph C. Lehner <joseph.c.lehner@gmail.com>
Mon, 2 Mar 2020 10:47:05 +0000 (11:47 +0100)
wireshark-nmrp.lua

index 6463ccfb50db9dc0bd9bde89c07820dd6c504849..234d9eb7e405bf0765cf56cf80d89783d5f7a42b 100644 (file)
@@ -52,13 +52,14 @@ function nmrp_dissect_opt(opt, buffer, tree)
                return
        end
 
+       tree:add(opt_len_f, buffer(2, 2))
+
        if opt == 0x01 or opt == 0x0181 then
                tree:add(buffer(4), "Value: " .. buffer(4):string())
        elseif opt == 0x02 then
                tree:add(buffer(4, 4), "Address: " .. tostring(buffer(4, 4):ipv4()))
                tree:add(buffer(8, 4), "Netmask: " .. tostring(buffer(8, 4):ipv4()))
        else
-               tree:add(opt_len_f, buffer(2, 2))
                tree:add(opt_data_f, buffer(4, buffer:len() - 4))
        end
 end