[ldns-users] how to check existence of EDNS in read packet

Ray Bellis Ray.Bellis at nominet.org.uk
Mon Oct 25 16:21:37 UTC 2010

On 25 Oct 2010, at 14:40, Bedrich Kosata wrote:

> Hello,
> I have the following problem. When parsing DNS packets, I need to know if an OPT RR containing EDNS is present. However, it seems that ldns parses this RR separately and then removes it from the additional section.
> What is the best way to find out if this RR was present in the original data? I need this to find out if the zero returned for edns version is a real value or a default one.
> It seems that the best I can do for now is to use the value of _edns_udp_size, but this could be zero as well (at least in theory), could it not?
> I would be glad for any insight.

This function should give you the original EDNS RR (if any)

  ldns_rdf *ldns_pkt_edns_data(const ldns_pkt *packet)


More information about the ldns-users mailing list