Skip to content

Commit af2ad37

Browse files
committed
Merge branch 'bugfix/dns_table_full' into 'master'
fix(dns): Fix a bug of the seq number is overflow See merge request sdk/ESP8266_NONOS_SDK!256
2 parents fa245d2 + 2d5c19b commit af2ad37

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

VERSION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ phy:
1717
gitlab:
1818
driver : 5a2a54b4
1919
json : f55d5fee
20-
lwip : eaca5185
20+
lwip : 5c01bdee
2121
mbedtls : 82b93fe5
22-
smartconfig : ea1d4a13(v2.5.5)
22+
smartconfig : ea1d4a13(v2.5.5)

lib/liblwip.a

-25 KB
Binary file not shown.

third_party/lwip/core/dns.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,17 @@ dns_enqueue(const char *name, dns_found_callback found, void *callback_arg)
896896
if ((dns_seqno - pEntry->seqno) > lseq) {
897897
lseq = dns_seqno - pEntry->seqno;
898898
lseqi = i;
899+
} else {
900+
if (pEntry->seqno >= (0xFF - DNS_TABLE_SIZE)) {
901+
static u8 index = 0;
902+
if ((pEntry->seqno - (0xFF - DNS_TABLE_SIZE)) == index) {
903+
index ++;
904+
lseqi = i;
905+
if (index == DNS_TABLE_SIZE) {
906+
index = 0;
907+
}
908+
}
909+
}
899910
}
900911
}
901912
}
@@ -918,13 +929,17 @@ dns_enqueue(const char *name, dns_found_callback found, void *callback_arg)
918929

919930
/* fill the entry */
920931
pEntry->state = DNS_STATE_NEW;
921-
pEntry->seqno = dns_seqno++;
932+
pEntry->seqno = dns_seqno;
922933
pEntry->found = found;
923934
pEntry->arg = callback_arg;
924935
namelen = LWIP_MIN(os_strlen(name), DNS_MAX_NAME_LENGTH-1);
925936
MEMCPY(pEntry->name, name, namelen);
926937
pEntry->name[namelen] = 0;
927938

939+
dns_seqno ++;
940+
if (dns_seqno == 0xFF) {
941+
dns_seqno = 0;
942+
}
928943
/* force to send query without waiting timer */
929944
dns_check_entry(i);
930945

0 commit comments

Comments
 (0)