resolved: make counter for redirects smaller
It can never go above 16, so let's use a narrower type. Order will be adjusted later to remove holes.
This commit is contained in:
@@ -12,8 +12,10 @@
|
||||
|
||||
#define QUERIES_MAX 2048
|
||||
#define AUXILIARY_QUERIES_MAX 64
|
||||
#define CNAME_REDIRECTS_MAX 16
|
||||
|
||||
assert_cc(AUXILIARY_QUERIES_MAX < UINT8_MAX);
|
||||
assert_cc(CNAME_REDIRECTS_MAX < UINT8_MAX);
|
||||
|
||||
static int dns_query_candidate_new(DnsQueryCandidate **ret, DnsQuery *q, DnsScope *s) {
|
||||
DnsQueryCandidate *c;
|
||||
@@ -984,9 +986,9 @@ static int dns_query_cname_redirect(DnsQuery *q, const DnsResourceRecord *cname)
|
||||
|
||||
assert(q);
|
||||
|
||||
q->n_cname_redirects++;
|
||||
if (q->n_cname_redirects > CNAME_REDIRECT_MAX)
|
||||
if (q->n_cname_redirects >= CNAME_REDIRECTS_MAX)
|
||||
return -ELOOP;
|
||||
q->n_cname_redirects++;
|
||||
|
||||
r = dns_question_cname_redirect(q->question_idna, cname, &nq_idna);
|
||||
if (r < 0)
|
||||
|
||||
@@ -64,7 +64,7 @@ struct DnsQuery {
|
||||
int ifindex;
|
||||
|
||||
DnsTransactionState state;
|
||||
unsigned n_cname_redirects;
|
||||
uint8_t n_cname_redirects;
|
||||
|
||||
LIST_HEAD(DnsQueryCandidate, candidates);
|
||||
sd_event_source *timeout_event_source;
|
||||
@@ -154,5 +154,3 @@ static inline uint64_t dns_query_reply_flags_make(DnsQuery *q) {
|
||||
dns_query_fully_confidential(q)) |
|
||||
(q->answer_query_flags & (SD_RESOLVED_FROM_MASK|SD_RESOLVED_SYNTHETIC));
|
||||
}
|
||||
|
||||
#define CNAME_REDIRECT_MAX 16
|
||||
|
||||
Reference in New Issue
Block a user