In working on a lua extension, I want to be able to extract multiple instances of a field within a single packet. For example, in DNS, it's not uncommon to have multiple responses to a query. As an example, in this dns capture file, there are multiple responses in packets 4, 24 and 29. What I would like to do is get all instances of a field such as dns.resp.name for those packets using lua. Here is what I have so far:
However, this doesn’t work. If invoked with this command line:
all I get is the first dns_name infinitely repeated until I halt the program. What I want is just the finite list of actual answers. I am the using very latest SVN version (version 35289 from /trunk) on Windows, but I get the same result on Linux. asked 01 Jan ‘11, 16:50 beroset |
One Answer:
OK, I finally got it. The key is that if there may be multiple values, one must use a lua table as The working version of this code sample is this: There may some merit in adding a bit more text to the auto-generated documentation to make this point clearer. I'll look into doing that.answered 02 Jan '11, 06:04 beroset |