<div dir="ltr">Hi Willem,<div><br></div><div>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.</div><div><br></div><div>Thanks,</div><div>Supraja</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 26, 2021 at 3:26 PM Willem Toorop <<a href="mailto:willem@nlnetlabs.nl">willem@nlnetlabs.nl</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Supraja,<br>
<br>
Here is an example of a query sending a ECS option (containing<br>
<a href="http://185.49.140.0/22" rel="noreferrer" target="_blank">185.49.140.0/22</a>), a NSID option and a Client Cookie to an authoritative<br>
server. Because it is an authoritative server, the Recursion Desired bit<br>
is set to 0.<br>
<br>
getdns_query -s @<a href="http://216.239.32.10" rel="noreferrer" target="_blank">216.239.32.10</a> '{<br>
header: { rd: 0 }<br>
, add_opt_parameters:<br>
{ options: [ { option_code: 3<br>
, option_data: "" }<br>
, { option_code: 8<br>
, option_data: 0x00011600B9318C }<br>
]<br>
}<br>
}' <a href="http://o-o.myaddr.l.google.com" rel="noreferrer" target="_blank">o-o.myaddr.l.google.com</a>. TXT +edns_cookies<br>
<br>
This authoritative (which is one of Google's b.t.w.) does not respond to<br>
the NSID and COOKIE option, but it does return the ECS option in a TXT RR:<br>
<br>
{<br>
"answer_type": GETDNS_NAMETYPE_DNS,<br>
"canonical_name": <bindata for <a href="http://o-o.myaddr.l.google.com" rel="noreferrer" target="_blank">o-o.myaddr.l.google.com</a>.>,<br>
"replies_full":<br>
[<br>
<bindata of 0x0c4384000001000200000001036f2d6f...><br>
],<br>
"replies_tree":<br>
[<br>
{<br>
"additional":<br>
[<br>
{<br>
"do": 0,<br>
"extended_rcode": 0,<br>
"rdata":<br>
{<br>
"options":<br>
[<br>
{<br>
"option_code": 8,<br>
"option_data": <bindata of 0x00011616b9318c><br>
}<br>
],<br>
"rdata_raw": <bindata of 0x0008000700011616b9318c><br>
},<br>
"type": GETDNS_RRTYPE_OPT,<br>
"udp_payload_size": 512,<br>
"version": 0,<br>
"z": 0<br>
}<br>
],<br>
"answer":<br>
[<br>
{<br>
"class": GETDNS_RRCLASS_IN,<br>
"name": <bindata for <a href="http://o-o.myaddr.l.google.com" rel="noreferrer" target="_blank">o-o.myaddr.l.google.com</a>.>,<br>
"rdata":<br>
{<br>
"rdata_raw": <bindata of 0x0d3138352e34392e3134312e3237>,<br>
"txt_strings":<br>
[<br>
<bindata of "185.49.141.27"><br>
]<br>
},<br>
"ttl": 60,<br>
"type": GETDNS_RRTYPE_TXT<br>
},<br>
{<br>
"class": GETDNS_RRCLASS_IN,<br>
"name": <bindata for <a href="http://o-o.myaddr.l.google.com" rel="noreferrer" target="_blank">o-o.myaddr.l.google.com</a>.>,<br>
"rdata":<br>
{<br>
"rdata_raw": <bindata of 0x2365646e73302d636c69656e742d7375...>,<br>
"txt_strings":<br>
[<br>
<bindata of "edns0-client-subnet 185.49.140.0"...><br>
]<br>
},<br>
"ttl": 60,<br>
"type": GETDNS_RRTYPE_TXT<br>
}<br>
],<br>
"answer_type": GETDNS_NAMETYPE_DNS,<br>
"authority": [],<br>
"canonical_name": <bindata for <a href="http://o-o.myaddr.l.google.com" rel="noreferrer" target="_blank">o-o.myaddr.l.google.com</a>.>,<br>
"header":<br>
{<br>
"aa": 1,<br>
"ad": 0,<br>
"ancount": 2,<br>
"arcount": 1,<br>
"cd": 0,<br>
"id": 3139,<br>
"nscount": 0,<br>
"opcode": GETDNS_OPCODE_QUERY,<br>
"qdcount": 1,<br>
"qr": 1,<br>
"ra": 0,<br>
"rcode": GETDNS_RCODE_NOERROR,<br>
"rd": 0,<br>
"tc": 0,<br>
"z": 0<br>
},<br>
"question":<br>
{<br>
"qclass": GETDNS_RRCLASS_IN,<br>
"qname": <bindata for <a href="http://o-o.myaddr.l.google.com" rel="noreferrer" target="_blank">o-o.myaddr.l.google.com</a>.>,<br>
"qtype": GETDNS_RRTYPE_TXT<br>
}<br>
}<br>
],<br>
"status": GETDNS_RESPSTATUS_GOOD<br>
}<br>
<br>
Does this help you further?<br>
<br>
Cheers,<br>
<br>
-- Willem<br>
<br>
Op 24-02-2021 om 19:49 schreef supraja sridhar via Users:<br>
> Hi,<br>
> <br>
> I want to send ECS and a string in the EDNS field to a DNS resolver<br>
> using a Getdns query.<br>
> <br>
> Following are the steps I am following to implement the same - <br>
> <br>
> A dict for opt parameters.<br>
> A list for options.<br>
> A dict for the ECS option and another one EDNS. <br>
> Set the ECS options at index 0 in the options list and EDNS in the<br>
> options list at index 1.<br>
> <br>
> But I see neither the ECS nor the EDNS option being set. It would be<br>
> helpful if someone can share an example snippet to achieve the same.<br>
> <br>
> Thanks,<br>
> Supraja<br>
> <br>
> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@lists.getdnsapi.net" target="_blank">Users@lists.getdnsapi.net</a><br>
> <a href="https://lists.getdnsapi.net/mailman/listinfo/users" rel="noreferrer" target="_blank">https://lists.getdnsapi.net/mailman/listinfo/users</a><br>
> <br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div>Regards,<br></div>S.SUPRAJA<br></div>MIT<br></div></div>