Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-users: Re: [Wireshark-users] Wireshark Lua question.

From: Stig Bjørlykke <stig.bjorlykke@xxxxxxxxx>
Date: Mon, 5 Oct 2009 22:50:53 +0200
On 5. okt. 2009, at 22.07, Morita, Bill wrote:

I am seeking help in how to access the source and destination IP from a TCP packet in a LUA dissector of a protocol that uses TCP for transport.

You can use two methods to fetch the IP address:

1. The value in the "Source" column can be fetched from pinfo.src.

2. The value in "ip.src" can be fetched using a Field:

ip_src_f = Field.new("ip.src") ; must be registred outside the dissector

  if ip_src_f() then
    ip_src = ip_src_f().value
  end


When printing you have to use tostring(pinfo.src) or ip_src_f().label


--
Stig Bjørlykke