2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 15:05:23 +00:00

define DNS_OPT_EDNSOPTIONS

This commit is contained in:
Mark Andrews
2014-02-20 13:55:21 +11:00
parent 86a85a3bbd
commit 72ba6ba736
4 changed files with 13 additions and 13 deletions

View File

@@ -2349,8 +2349,7 @@ setup_lookup(dig_lookup_t *lookup) {
if (lookup->udpsize > 0 || lookup->dnssec || if (lookup->udpsize > 0 || lookup->dnssec ||
lookup->edns > -1 || lookup->ecs_addr != NULL) lookup->edns > -1 || lookup->ecs_addr != NULL)
{ {
#define EDNSOPTS 3 dns_ednsopt_t opts[DNS_OPT_EDNSOPTIONS];
dns_ednsopt_t opts[EDNSOPTS];
int i = 0; int i = 0;
if (lookup->udpsize == 0) if (lookup->udpsize == 0)
@@ -2359,7 +2358,7 @@ setup_lookup(dig_lookup_t *lookup) {
lookup->edns = 0; lookup->edns = 0;
if (lookup->nsid) { if (lookup->nsid) {
INSIST(i < EDNSOPTS); INSIST(i < DNS_OPT_EDNSOPTIONS);
opts[i].code = DNS_OPT_NSID; opts[i].code = DNS_OPT_NSID;
opts[i].length = 0; opts[i].length = 0;
opts[i].value = NULL; opts[i].value = NULL;
@@ -2380,7 +2379,7 @@ setup_lookup(dig_lookup_t *lookup) {
/* Round up prefix len to a multiple of 8 */ /* Round up prefix len to a multiple of 8 */
addrl = (prefixlen + 7) / 8; addrl = (prefixlen + 7) / 8;
INSIST(i < EDNSOPTS); INSIST(i < DNS_OPT_EDNSOPTIONS);
opts[i].code = DNS_OPT_CLIENT_SUBNET; opts[i].code = DNS_OPT_CLIENT_SUBNET;
opts[i].length = addrl + 4; opts[i].length = addrl + 4;
check_result(result, "isc_buffer_allocate"); check_result(result, "isc_buffer_allocate");
@@ -2409,7 +2408,7 @@ setup_lookup(dig_lookup_t *lookup) {
#ifdef ISC_PLATFORM_USESIT #ifdef ISC_PLATFORM_USESIT
if (lookup->sit) { if (lookup->sit) {
INSIST(i < EDNSOPTS); INSIST(i < DNS_OPT_EDNSOPTIONS);
opts[i].code = DNS_OPT_SIT; opts[i].code = DNS_OPT_SIT;
if (lookup->sitvalue != NULL) { if (lookup->sitvalue != NULL) {
isc_buffer_t b; isc_buffer_t b;

View File

@@ -122,7 +122,6 @@
#endif #endif
#define SIT_SIZE 24 /* 8 + 4 + 4 + 8 */ #define SIT_SIZE 24 /* 8 + 4 + 4 + 8 */
#define EDNSOPTS 2
/*% nameserver client manager structure */ /*% nameserver client manager structure */
struct ns_clientmgr { struct ns_clientmgr {
@@ -1378,7 +1377,7 @@ client_addopt(ns_client_t *client) {
dns_view_t *view; dns_view_t *view;
dns_resolver_t *resolver; dns_resolver_t *resolver;
isc_uint16_t udpsize; isc_uint16_t udpsize;
dns_ednsopt_t ednsopts[EDNSOPTS]; dns_ednsopt_t ednsopts[DNS_OPT_EDNSOPTIONS];
int count = 0; int count = 0;
unsigned int flags; unsigned int flags;
@@ -1407,7 +1406,7 @@ client_addopt(ns_client_t *client) {
} else } else
nsidp = ns_g_server->server_id; nsidp = ns_g_server->server_id;
INSIST(count < EDNSOPTS); INSIST(count < DNS_OPT_EDNSOPTIONS);
ednsopts[count].code = DNS_OPT_NSID; ednsopts[count].code = DNS_OPT_NSID;
ednsopts[count].length = strlen(nsidp); ednsopts[count].length = strlen(nsidp);
ednsopts[count].value = (unsigned char *)nsidp; ednsopts[count].value = (unsigned char *)nsidp;
@@ -1426,7 +1425,7 @@ client_addopt(ns_client_t *client) {
compute_sit(client, now, nonce, &buf); compute_sit(client, now, nonce, &buf);
INSIST(count < EDNSOPTS); INSIST(count < DNS_OPT_EDNSOPTIONS);
ednsopts[count].code = DNS_OPT_SIT; ednsopts[count].code = DNS_OPT_SIT;
ednsopts[count].length = SIT_SIZE; ednsopts[count].length = SIT_SIZE;
ednsopts[count].value = sit; ednsopts[count].value = sit;

View File

@@ -109,6 +109,9 @@
/*%< Experimental options [65001...65534] as per RFC6891 */ /*%< Experimental options [65001...65534] as per RFC6891 */
#define DNS_OPT_SIT 65001 /*%< SIT opt code */ #define DNS_OPT_SIT 65001 /*%< SIT opt code */
/*%< The number of EDNS options we know about. */
#define DNS_OPT_EDNSOPTIONS 3
#define DNS_MESSAGE_REPLYPRESERVE (DNS_MESSAGEFLAG_RD|DNS_MESSAGEFLAG_CD) #define DNS_MESSAGE_REPLYPRESERVE (DNS_MESSAGEFLAG_RD|DNS_MESSAGEFLAG_CD)
#define DNS_MESSAGEEXTFLAG_REPLYPRESERVE (DNS_MESSAGEEXTFLAG_DO) #define DNS_MESSAGEEXTFLAG_REPLYPRESERVE (DNS_MESSAGEEXTFLAG_DO)

View File

@@ -141,7 +141,6 @@
* Maximum EDNS0 input packet size. * Maximum EDNS0 input packet size.
*/ */
#define RECV_BUFFER_SIZE 4096 /* XXXRTH Constant. */ #define RECV_BUFFER_SIZE 4096 /* XXXRTH Constant. */
#define EDNSOPTS 2
/*% /*%
* This defines the maximum number of timeouts we will permit before we * This defines the maximum number of timeouts we will permit before we
@@ -1838,7 +1837,7 @@ resquery_send(resquery_t *query) {
isc_boolean_t cleanup_cctx = ISC_FALSE; isc_boolean_t cleanup_cctx = ISC_FALSE;
isc_boolean_t secure_domain; isc_boolean_t secure_domain;
isc_boolean_t connecting = ISC_FALSE; isc_boolean_t connecting = ISC_FALSE;
dns_ednsopt_t ednsopts[EDNSOPTS]; dns_ednsopt_t ednsopts[DNS_OPT_EDNSOPTIONS];
unsigned ednsopt = 0; unsigned ednsopt = 0;
isc_uint16_t hint = 0, udpsize = 0; /* No EDNS */ isc_uint16_t hint = 0, udpsize = 0; /* No EDNS */
@@ -2066,7 +2065,7 @@ resquery_send(resquery_t *query) {
#endif #endif
} }
if (reqnsid) { if (reqnsid) {
INSIST(ednsopt < EDNSOPTS); INSIST(ednsopt < DNS_OPT_EDNSOPTIONS);
ednsopts[ednsopt].code = DNS_OPT_NSID; ednsopts[ednsopt].code = DNS_OPT_NSID;
ednsopts[ednsopt].length = 0; ednsopts[ednsopt].length = 0;
ednsopts[ednsopt].value = NULL; ednsopts[ednsopt].value = NULL;
@@ -2074,7 +2073,7 @@ resquery_send(resquery_t *query) {
} }
#ifdef ISC_PLATFORM_USESIT #ifdef ISC_PLATFORM_USESIT
if (reqsit) { if (reqsit) {
INSIST(ednsopt < EDNSOPTS); INSIST(ednsopt < DNS_OPT_EDNSOPTIONS);
ednsopts[ednsopt].code = DNS_OPT_SIT; ednsopts[ednsopt].code = DNS_OPT_SIT;
ednsopts[ednsopt].length = (isc_uint16_t) ednsopts[ednsopt].length = (isc_uint16_t)
dns_adb_getsit(fctx->adb, dns_adb_getsit(fctx->adb,