Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There are at least 2 ways to achieve this.

  1. Use treeitem.text. For example:

    local ti = tlv_tree:add (f.tlvvalue_ipv4, buffer(offset, tlvlen))
    tlv_tree:append_text (", myip: " .. ti.text)

  2. Format the data from the buffer. For example:

    tlv_tree:append_text (string.format(", myip: %u.%u.%u.%u",
    buffer(offset, 1):uint(), buffer(offset + 1, 1):uint(),
    buffer(offset + 2, 1):uint(), buffer(offset + 3, 1):uint()))

Solution #1 has the advantage of displaying the resolved IP address for you as well, assuming resolution is enabled. If you don't want the resolved IP address displayed, then you can use Solution #2.