Merge pull request #360 from getdnsapi/bugfix/private_ecs_with_family

Bugfix #359: edns_client_subnet_private should set family
This commit is contained in:
wtoorop 2017-11-28 16:59:37 +01:00 committed by GitHub
commit b105faad7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 9 deletions

View File

@ -1,3 +1,7 @@
* 201?-??-??: Version 1.?.?
* Bugfix #359: edns_client_subnet_private should set family
Thanks Daniel Areiza
* 2017-11-11: Version 1.2.1 * 2017-11-11: Version 1.2.1
* Handle more I/O error cases. Also, when an I/O error does occur, * Handle more I/O error cases. Also, when an I/O error does occur,
never stop listening (with servers), and never stop listening (with servers), and

View File

@ -151,15 +151,19 @@ calc_new_cookie(getdns_upstream *upstream, uint8_t *cookie)
static getdns_return_t static getdns_return_t
attach_edns_client_subnet_private(getdns_network_req *req) attach_edns_client_subnet_private(getdns_network_req *req)
{ {
/* see /* see https://tools.ietf.org/html/rfc7871#section-7.1.2
* https://tools.ietf.org/html/draft-ietf-dnsop-edns-client-subnet-04#section-6 */ * all-zeros is a request to not leak the data further:
/* all-zeros is a request to not leak the data further: */ * A two byte FAMILY field is a SHOULD even when SOURCE
/* "\x00\x00" FAMILY: 0 (because no address) */ * and SCOPE are 0.
/* "\x00" SOURCE PREFIX-LENGTH: 0 */ * "\x00\x02" FAMILY: 2 for IPv6 upstreams in network byte order, or
/* "\x00"; SCOPE PREFIX-LENGTH: 0 */ * "\x00\x01" FAMILY: 1 for IPv4 upstreams in network byte order, then:
return _getdns_network_req_add_upstream_option(req, * "\x00" SOURCE PREFIX-LENGTH: 0
GLDNS_EDNS_CLIENT_SUBNET, * "\x00"; SCOPE PREFIX-LENGTH: 0
4, NULL); */
return _getdns_network_req_add_upstream_option(
req, GLDNS_EDNS_CLIENT_SUBNET, 4,
( req->upstream->addr.ss_family == AF_INET6
? "\x00\x02\x00\x00" : "\x00\x01\x00\x00" ));
} }
static getdns_return_t static getdns_return_t