hello, I'm attempting to write a Lua tap to grab DNS info from some pcap files using tshark. I have one problem: every approach I've tried to get the dns.qry.class or dns.resp.class entities returns nil, even on packets that I know are dns packets (dns.qry.name, for example, isn't nil). Example code:
That bit of code always finds that the qry class is nil. I've tried downloading the nightly build of wireshark also, but that's giving me the same result. Does anyone have hints as to what I'm doing wrong here, or is there a bug in tshark's lua interface? asked 20 Dec '11, 11:27 gclef |
2 Answers:
This is a bug either in the Lua interface or in the DNS dissector [which should probably be reported]. I recreated your symptom using the DNS sample capture. The interesting thing is that Wireshark knows which packets contain For some reason, the same Lua tap can detect answered 22 Dec '11, 18:05 helloworld |
It's a deficiency of the field specification in Lua. It uses the display filter string as identification of the field. But there's no guarantee of uniqueness of this string for each individual field. If you look in the DNS dissector there are two fields using this filter string: hf_dns_qry_class and hf_dns_qry_class_mdns. The Lua script uses the latter, which isn't assigned a representation with your capture. It does get assigned one with the mDNS sample capture. answered 23 Dec '11, 00:12 Jaap ♦ |
Thanks for this. I will probably file a bug, but, having not dug into the source code that much, I want to make sure I've got the bug wording right. Would this be clear enough: the lua field specification for dns fields should check both the hf_dns_qry_class and hf_dns_qry_class_mdns fields, and use whichever one has a value.
Thanks.
I would phrase the bug as "Lua should handle field names for which there are multiple registered fields"; this problem is NOT DNS-specific (X.25 also has multiple registered fields with the same name, for example, to handle both mod-8 and mod-128 mode).
@gclef: Use your own wording referring to Lua, the DNS dissector is irrelevant in itself. Add a reference to this Ask item as an example.