Skip to content

Commit

Permalink
Merge branch 'bugfix/dns_table_full' into 'master'
Browse files Browse the repository at this point in the history
fix(dns): Fix a bug of the seq number is overflow

See merge request sdk/ESP8266_NONOS_SDK!256
  • Loading branch information
xcguang committed Jan 3, 2020
2 parents fa245d2 + 2d5c19b commit af2ad37
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
4 changes: 2 additions & 2 deletions VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ phy:
gitlab:
driver : 5a2a54b4
json : f55d5fee
lwip : eaca5185
lwip : 5c01bdee
mbedtls : 82b93fe5
smartconfig : ea1d4a13(v2.5.5)
smartconfig : ea1d4a13(v2.5.5)
Binary file modified lib/liblwip.a
Binary file not shown.
17 changes: 16 additions & 1 deletion third_party/lwip/core/dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,17 @@ dns_enqueue(const char *name, dns_found_callback found, void *callback_arg)
if ((dns_seqno - pEntry->seqno) > lseq) {
lseq = dns_seqno - pEntry->seqno;
lseqi = i;
} else {
if (pEntry->seqno >= (0xFF - DNS_TABLE_SIZE)) {
static u8 index = 0;
if ((pEntry->seqno - (0xFF - DNS_TABLE_SIZE)) == index) {
index ++;
lseqi = i;
if (index == DNS_TABLE_SIZE) {
index = 0;
}
}
}
}
}
}
Expand All @@ -918,13 +929,17 @@ dns_enqueue(const char *name, dns_found_callback found, void *callback_arg)

/* fill the entry */
pEntry->state = DNS_STATE_NEW;
pEntry->seqno = dns_seqno++;
pEntry->seqno = dns_seqno;
pEntry->found = found;
pEntry->arg = callback_arg;
namelen = LWIP_MIN(os_strlen(name), DNS_MAX_NAME_LENGTH-1);
MEMCPY(pEntry->name, name, namelen);
pEntry->name[namelen] = 0;

dns_seqno ++;
if (dns_seqno == 0xFF) {
dns_seqno = 0;
}
/* force to send query without waiting timer */
dns_check_entry(i);

Expand Down

0 comments on commit af2ad37

Please sign in to comment.