[ldns-users] how to check existence of EDNS in read packet
darryl at rodden.us
Tue Oct 26 15:03:51 UTC 2010
If you are using ldns_wire2pkt(), you can call ldns_pkt_edns() to determine
if the received packet has EDNS or not.
----- Original Message -----
From: "Bedrich Kosata" <bedrich.kosata at nic.cz>
To: <ldns-users at open.nlnetlabs.nl>
Sent: Monday, October 25, 2010 10:54 PM
Subject: Re: [ldns-users] how to check existence of EDNS in read packet
> On 10/25/2010 06:21 PM, Ray Bellis wrote:
>> On 25 Oct 2010, at 14:40, Bedrich Kosata wrote:
>>> 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
>>> 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)
> Unfortunately, this does not seem to be the case. This structure only
> contains the optional data that might be present in the OPT RR, but which
> is often empty and thus this value is NULL.
> It seems that the best I could do, is to use "ldns_pkt_edns" which tells
> if there is data in the packet that would require use of EDNS. However,
> this function is meant to be used when constructing a packet, so it would
> not be reliable in case the packet arrived with OPT RR but contained
> zeroes in every field.
> It would be cool, if there could be an indicator value in the ldns_pkt
> struct which would tell if there was an OPT RR in the raw data.
> Best regards
> Bedrich Kosata
> CZ.NIC Labs <http://labs.nic.cz>
> ldns-users mailing list
> ldns-users at open.nlnetlabs.nl
More information about the ldns-users