added MIO_SVC_DNC_RESOLVE_FLAG_DNSSEC

This commit is contained in:
hyung-hwan 2020-07-04 16:37:46 +00:00
parent 8b1ccab4c8
commit 7ac3b8b078
3 changed files with 13 additions and 21 deletions

View File

@ -709,6 +709,7 @@ static void on_dnc_resolve(mio_svc_dnc_t* dnc, mio_dns_msg_t* reqmsg, mio_errnum
if (pi->hdr.rcode == MIO_DNS_RCODE_BADCOOKIE) if (pi->hdr.rcode == MIO_DNS_RCODE_BADCOOKIE)
{ {
/* TODO: must retry?? there shoudl be no RRs in the payload */ /* TODO: must retry?? there shoudl be no RRs in the payload */
//if (mio_svc_dnc_resolve(dnc, mio_svc_dnc_getqnamefromreqmsg(reqmsg), mio_svc_dnc_getqtypefromreqmsg(qtype), mio_svc_dnc_getresolflagsfromreqmsg(resolve_flags), on_dnc_resolve, 0) >= 0) return;
} }
if (mio_svc_dnc_checkclientcookie(dnc, reqmsg, pi) == 0) if (mio_svc_dnc_checkclientcookie(dnc, reqmsg, pi) == 0)
@ -1003,12 +1004,12 @@ static int schedule_timer_job_after (mio_t* mio, const mio_ntime_t* fire_after,
static void send_test_query (mio_t* mio, const mio_ntime_t* now, mio_tmrjob_t* job) static void send_test_query (mio_t* mio, const mio_ntime_t* now, mio_tmrjob_t* job)
{ {
//if (!mio_svc_dnc_resolve((mio_svc_dnc_t*)job->ctx, "www.microsoft.com", MIO_DNS_RRT_CNAME, MIO_SVC_DNC_RESOLVE_FLAG_COOKIE, on_dnc_resolve, 0)) //if (!mio_svc_dnc_resolve((mio_svc_dnc_t*)job->ctx, "www.microsoft.com", MIO_DNS_RRT_CNAME, MIO_SVC_DNC_RESOLVE_FLAG_COOKIE, on_dnc_resolve, 0))
if (!mio_svc_dnc_resolve((mio_svc_dnc_t*)job->ctx, "mailserver.manyhost.net", MIO_DNS_RRT_A, MIO_SVC_DNC_RESOLVE_FLAG_COOKIE, on_dnc_resolve, 0)) if (!mio_svc_dnc_resolve((mio_svc_dnc_t*)job->ctx, "mailserver.manyhost.net", MIO_DNS_RRT_A, MIO_SVC_DNC_RESOLVE_FLAG_COOKIE | MIO_SVC_DNC_RESOLVE_FLAG_DNSSEC, on_dnc_resolve, 0))
{ {
printf ("resolve attempt failure ---> mailserver.manyhost.net\n"); printf ("resolve attempt failure ---> mailserver.manyhost.net\n");
} }
if (!mio_svc_dnc_resolve((mio_svc_dnc_t*)job->ctx, "ns2.switch.ch", MIO_DNS_RRT_A, MIO_SVC_DNC_RESOLVE_FLAG_COOKIE, on_dnc_resolve, 0)) if (!mio_svc_dnc_resolve((mio_svc_dnc_t*)job->ctx, "ns2.switch.ch", MIO_DNS_RRT_A, MIO_SVC_DNC_RESOLVE_FLAG_COOKIE | MIO_SVC_DNC_RESOLVE_FLAG_DNSSEC, on_dnc_resolve, 0))
{ {
printf ("resolve attempt failure ---> ns2.switch.ch\n"); printf ("resolve attempt failure ---> ns2.switch.ch\n");
} }
@ -1227,7 +1228,8 @@ for (i = 0; i < 5; i++)
reply_tmout.nsec = 0; reply_tmout.nsec = 0;
//mio_bcstrtoskad (mio, "8.8.8.8:53", &servaddr); //mio_bcstrtoskad (mio, "8.8.8.8:53", &servaddr);
mio_bcstrtoskad (mio, "130.59.31.29:53", &servaddr); // ns2.switch.ch mio_bcstrtoskad (mio, "198.41.0.4:53", &servaddr); // a.root-servers.net
//mio_bcstrtoskad (mio, "130.59.31.29:53", &servaddr); // ns2.switch.ch
//mio_bcstrtoskad (mio, "134.119.216.86:53", &servaddr); // ns.manyhost.net //mio_bcstrtoskad (mio, "134.119.216.86:53", &servaddr); // ns.manyhost.net
//mio_bcstrtoskad (mio, "[fe80::c7e2:bd6e:1209:ac1b]:1153", &servaddr); //mio_bcstrtoskad (mio, "[fe80::c7e2:bd6e:1209:ac1b]:1153", &servaddr);
//mio_bcstrtoskad (mio, "[fe80::c7e2:bd6e:1209:ac1b%eno1]:1153", &servaddr); //mio_bcstrtoskad (mio, "[fe80::c7e2:bd6e:1209:ac1b%eno1]:1153", &servaddr);

View File

@ -884,28 +884,12 @@ static void on_dnc_resolve (mio_svc_dnc_t* dnc, mio_dns_msg_t* reqmsg, mio_errnu
if (resolxtn->flags & MIO_SVC_DNC_RESOLVE_FLAG_COOKIE) if (resolxtn->flags & MIO_SVC_DNC_RESOLVE_FLAG_COOKIE)
{ {
/* ------------------------------------------------- */
if (pi->edns.cookie.server_len > 0) if (pi->edns.cookie.server_len > 0)
{ {
/* remember the server cookie received to use it with other new requests */ /* remember the received server cookie to use it with other new requests */
MIO_MEMCPY (dnc->cookie.data.server, pi->edns.cookie.data.server, pi->edns.cookie.server_len); MIO_MEMCPY (dnc->cookie.data.server, pi->edns.cookie.data.server, pi->edns.cookie.server_len);
dnc->cookie.server_len = pi->edns.cookie.server_len; dnc->cookie.server_len = pi->edns.cookie.server_len;
} }
#if 0
if (pi->hdr.rcode == MIO_DNS_RCODE_BADCOOKIE)
{
/* TODO: retry it */
#if 0
if (mio_svc_dnc_resolve(dnc, qname, resolxtn->qtype, resolxtn->flags, on_dnc_resolve, resolxtn->xtnsize) <= -1)
{
}
#endif
/*how to retry?*/
}
#endif
/* ------------------------------------------------- */
} }
if (!(resolxtn->flags & MIO_SVC_DNC_RESOLVE_FLAG_BRIEF)) if (!(resolxtn->flags & MIO_SVC_DNC_RESOLVE_FLAG_BRIEF))
@ -1031,6 +1015,11 @@ mio_dns_msg_t* mio_svc_dnc_resolve (mio_svc_dnc_t* dnc, const mio_bch_t* qname,
qedns.beoptr = &beopt_cookie; qedns.beoptr = &beopt_cookie;
} }
if (resolve_flags & MIO_SVC_DNC_RESOLVE_FLAG_DNSSEC)
{
qedns.dnssecok = 1;
}
reqmsg = make_dns_msg(dnc, &qhdr, &qr, 1, MIO_NULL, 0, &qedns, on_dnc_resolve, MIO_SIZEOF(*resolxtn) + xtnsize); reqmsg = make_dns_msg(dnc, &qhdr, &qr, 1, MIO_NULL, 0, &qedns, on_dnc_resolve, MIO_SIZEOF(*resolxtn) + xtnsize);
if (reqmsg) if (reqmsg)
{ {

View File

@ -407,8 +407,9 @@ enum mio_svc_dnc_resolve_flag_t
/* the following flag bits are resolver specific. it must not overlap with send flag bits */ /* the following flag bits are resolver specific. it must not overlap with send flag bits */
MIO_SVC_DNC_RESOLVE_FLAG_BRIEF = (1 << 8), MIO_SVC_DNC_RESOLVE_FLAG_BRIEF = (1 << 8),
MIO_SVC_DNC_RESOLVE_FLAG_COOKIE = (1 << 9), MIO_SVC_DNC_RESOLVE_FLAG_COOKIE = (1 << 9),
MIO_SVC_DNC_RESOLVE_FLAG_DNSSEC = (1 << 10),
MIO_SVC_DNC_RESOLVE_FLAG_ALL = (MIO_SVC_DNC_RESOLVE_FLAG_PREFER_TCP | MIO_SVC_DNC_RESOLVE_FLAG_TCP_IF_TC | MIO_SVC_DNC_RESOLVE_FLAG_BRIEF | MIO_SVC_DNC_RESOLVE_FLAG_COOKIE) MIO_SVC_DNC_RESOLVE_FLAG_ALL = (MIO_SVC_DNC_RESOLVE_FLAG_PREFER_TCP | MIO_SVC_DNC_RESOLVE_FLAG_TCP_IF_TC | MIO_SVC_DNC_RESOLVE_FLAG_BRIEF | MIO_SVC_DNC_RESOLVE_FLAG_COOKIE | MIO_SVC_DNC_RESOLVE_FLAG_DNSSEC)
}; };
typedef enum mio_svc_dnc_resolve_flag_t mio_svc_dnc_resolve_flag_t; typedef enum mio_svc_dnc_resolve_flag_t mio_svc_dnc_resolve_flag_t;