[getdns-users] Using EDNS and ECS in Getdns query
Willem Toorop
willem at nlnetlabs.nl
Fri Feb 26 23:15:25 UTC 2021
Op 26-02-2021 om 12:07 schreef supraja sridhar:
> Hi Willem,
>
> Yes, this definitely helps. I am trying to use the C APIs to achieve the
> same. It will be helpful if you can provide a sample using the C APIs
> for the same.
Sure, attached is a C example sending a ECS option and a PADDING option.
Cheers,
-- Willem
>
> Thanks,
> Supraja
>
> On Fri, Feb 26, 2021 at 3:26 PM Willem Toorop <willem at nlnetlabs.nl
> <mailto:willem at nlnetlabs.nl>> wrote:
>
> Hi Supraja,
>
> Here is an example of a query sending a ECS option (containing
> 185.49.140.0/22 <http://185.49.140.0/22>), a NSID option and a
> Client Cookie to an authoritative
> server. Because it is an authoritative server, the Recursion Desired bit
> is set to 0.
>
> getdns_query -s @216.239.32.10 <http://216.239.32.10> '{
> header: { rd: 0 }
> , add_opt_parameters:
> { options: [ { option_code: 3
> , option_data: "" }
> , { option_code: 8
> , option_data: 0x00011600B9318C }
> ]
> }
> }' o-o.myaddr.l.google.com <http://o-o.myaddr.l.google.com>. TXT
> +edns_cookies
>
> This authoritative (which is one of Google's b.t.w.) does not respond to
> the NSID and COOKIE option, but it does return the ECS option in a
> TXT RR:
>
> {
> "answer_type": GETDNS_NAMETYPE_DNS,
> "canonical_name": <bindata for o-o.myaddr.l.google.com
> <http://o-o.myaddr.l.google.com>.>,
> "replies_full":
> [
> <bindata of 0x0c4384000001000200000001036f2d6f...>
> ],
> "replies_tree":
> [
> {
> "additional":
> [
> {
> "do": 0,
> "extended_rcode": 0,
> "rdata":
> {
> "options":
> [
> {
> "option_code": 8,
> "option_data": <bindata of 0x00011616b9318c>
> }
> ],
> "rdata_raw": <bindata of 0x0008000700011616b9318c>
> },
> "type": GETDNS_RRTYPE_OPT,
> "udp_payload_size": 512,
> "version": 0,
> "z": 0
> }
> ],
> "answer":
> [
> {
> "class": GETDNS_RRCLASS_IN,
> "name": <bindata for o-o.myaddr.l.google.com
> <http://o-o.myaddr.l.google.com>.>,
> "rdata":
> {
> "rdata_raw": <bindata of 0x0d3138352e34392e3134312e3237>,
> "txt_strings":
> [
> <bindata of "185.49.141.27">
> ]
> },
> "ttl": 60,
> "type": GETDNS_RRTYPE_TXT
> },
> {
> "class": GETDNS_RRCLASS_IN,
> "name": <bindata for o-o.myaddr.l.google.com
> <http://o-o.myaddr.l.google.com>.>,
> "rdata":
> {
> "rdata_raw": <bindata of
> 0x2365646e73302d636c69656e742d7375...>,
> "txt_strings":
> [
> <bindata of "edns0-client-subnet 185.49.140.0"...>
> ]
> },
> "ttl": 60,
> "type": GETDNS_RRTYPE_TXT
> }
> ],
> "answer_type": GETDNS_NAMETYPE_DNS,
> "authority": [],
> "canonical_name": <bindata for o-o.myaddr.l.google.com
> <http://o-o.myaddr.l.google.com>.>,
> "header":
> {
> "aa": 1,
> "ad": 0,
> "ancount": 2,
> "arcount": 1,
> "cd": 0,
> "id": 3139,
> "nscount": 0,
> "opcode": GETDNS_OPCODE_QUERY,
> "qdcount": 1,
> "qr": 1,
> "ra": 0,
> "rcode": GETDNS_RCODE_NOERROR,
> "rd": 0,
> "tc": 0,
> "z": 0
> },
> "question":
> {
> "qclass": GETDNS_RRCLASS_IN,
> "qname": <bindata for o-o.myaddr.l.google.com
> <http://o-o.myaddr.l.google.com>.>,
> "qtype": GETDNS_RRTYPE_TXT
> }
> }
> ],
> "status": GETDNS_RESPSTATUS_GOOD
> }
>
> Does this help you further?
>
> Cheers,
>
> -- Willem
>
> Op 24-02-2021 om 19:49 schreef supraja sridhar via Users:
> > Hi,
> >
> > I want to send ECS and a string in the EDNS field to a DNS resolver
> > using a Getdns query.
> >
> > Following are the steps I am following to implement the same -
> >
> > A dict for opt parameters.
> > A list for options.
> > A dict for the ECS option and another one EDNS.
> > Set the ECS options at index 0 in the options list and EDNS in the
> > options list at index 1.
> >
> > But I see neither the ECS nor the EDNS option being set. It would be
> > helpful if someone can share an example snippet to achieve the same.
> >
> > Thanks,
> > Supraja
> >
> > _______________________________________________
> > Users mailing list
> > Users at lists.getdnsapi.net <mailto:Users at lists.getdnsapi.net>
> > https://lists.getdnsapi.net/mailman/listinfo/users
> <https://lists.getdnsapi.net/mailman/listinfo/users>
> >
>
>
>
> --
> Regards,
> S.SUPRAJA
> MIT
-------------- next part --------------
A non-text attachment was scrubbed...
Name: query-ecs.c
Type: text/x-csrc
Size: 4079 bytes
Desc: not available
URL: <http://lists.getdnsapi.net/pipermail/users/attachments/20210227/096424da/attachment.bin>
More information about the Users
mailing list