handled MIO_DNS_RRT_Q_ANY/MAILA/MAILB/AXFR in brief mode of dnc resolve
This commit is contained in:
parent
11e50cd5c8
commit
20de4ae2db
@ -673,6 +673,20 @@ static void on_dnc_resolve (mio_svc_dnc_t* dnc, mio_dns_msg_t* reqmsg, mio_errnu
|
|||||||
if (pi->ancount < 0) goto no_valid_reply;
|
if (pi->ancount < 0) goto no_valid_reply;
|
||||||
|
|
||||||
/* in the brief mode, we inspect the answer section only */
|
/* in the brief mode, we inspect the answer section only */
|
||||||
|
if (reqmsgxtn->qtype == MIO_DNS_RRT_Q_ANY)
|
||||||
|
{
|
||||||
|
/* return A or AAAA for ANY in the brief mode */
|
||||||
|
for (i = 0; i < pi->ancount; i++)
|
||||||
|
{
|
||||||
|
if (pi->rr.an[i].rrtype == MIO_DNS_RRT_A || pi->rr.an[i].rrtype == MIO_DNS_RRT_AAAA)
|
||||||
|
{
|
||||||
|
match_found:
|
||||||
|
if (reqmsgxtn->on_resolve) reqmsgxtn->on_resolve (dnc, reqmsg, status, &pi->rr.an[i], MIO_SIZEOF(pi->rr.an[i]));
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < pi->ancount; i++)
|
for (i = 0; i < pi->ancount; i++)
|
||||||
{
|
{
|
||||||
/* it is a bit time taking to retreive the query type from the packet
|
/* it is a bit time taking to retreive the query type from the packet
|
||||||
@ -681,9 +695,9 @@ static void on_dnc_resolve (mio_svc_dnc_t* dnc, mio_dns_msg_t* reqmsg, mio_errnu
|
|||||||
switch (reqmsgxtn->qtype)
|
switch (reqmsgxtn->qtype)
|
||||||
{
|
{
|
||||||
case MIO_DNS_RRT_Q_ANY:
|
case MIO_DNS_RRT_Q_ANY:
|
||||||
/* if you want to get the full RRs, don't use the brief mode. */
|
case MIO_DNS_RRT_Q_AFXR: /* AFXR doesn't make sense in the brief mode. just treat it like ANY */
|
||||||
if (pi->rr.an[i].rrtype == MIO_DNS_RRT_A || pi->rr.an[i].rrtype == MIO_DNS_RRT_AAAA) goto match_found;
|
/* no A or AAAA found. so give the first entry in the answer */
|
||||||
break;
|
goto match_found;
|
||||||
|
|
||||||
case MIO_DNS_RRT_Q_MAILA:
|
case MIO_DNS_RRT_Q_MAILA:
|
||||||
/* if you want to get the full RRs, don't use the brief mode. */
|
/* if you want to get the full RRs, don't use the brief mode. */
|
||||||
@ -696,17 +710,10 @@ static void on_dnc_resolve (mio_svc_dnc_t* dnc, mio_dns_msg_t* reqmsg, mio_errnu
|
|||||||
pi->rr.an[i].rrtype == MIO_DNS_RRT_MR || pi->rr.an[i].rrtype == MIO_DNS_RRT_MINFO) goto match_found;
|
pi->rr.an[i].rrtype == MIO_DNS_RRT_MR || pi->rr.an[i].rrtype == MIO_DNS_RRT_MINFO) goto match_found;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MIO_DNS_RRT_Q_AFXR:
|
|
||||||
default:
|
default:
|
||||||
if (pi->rr.an[i].rrtype == reqmsgxtn->qtype)
|
if (pi->rr.an[i].rrtype == reqmsgxtn->qtype) goto match_found;
|
||||||
{
|
|
||||||
match_found:
|
|
||||||
if (reqmsgxtn->on_resolve) reqmsgxtn->on_resolve (dnc, reqmsg, status, &pi->rr.an[i], MIO_SIZEOF(pi->rr.an[i]));
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
goto no_valid_reply;
|
goto no_valid_reply;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user