-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash when resolving .local hostname when no DNS servers are present (IDFGH-5094) #6878
Labels
Comments
github-actions
bot
changed the title
Crash when resolving .local hostname when no DNS servers are present
Crash when resolving .local hostname when no DNS servers are present (IDFGH-5094)
Apr 15, 2021
Thanks for reporting, we will look into. |
espressif-bot
added
Status: In Progress
Work is in progress
and removed
Status: Opened
Issue is new
labels
Apr 22, 2021
@RJPoelstra Thanks for your reporting. We will fix this problem in the future version. |
espressif-bot
added
Resolution: Done
Issue is done internally
Status: Done
Issue is done internally
and removed
Status: In Progress
Work is in progress
labels
May 8, 2021
espressif-bot
pushed a commit
that referenced
this issue
May 17, 2021
This commit brings two esp-lwip fixes to IDF: 1) Add configuration to disable DHCP client identification espressif/esp-lwip@2195f74 This config could be used to disable option 61 in DHCP packets, so that clients will be identified by their chaddr only. (This is the lwip upstream original behaviour) 2) Fix server_idx increasing to DNS_MAX_SERVERS and trigger the LWIP_ASSERT espressif/esp-lwip@5a567d5 When lwip doesn't have DNS server and resolve a domain address, the server_idx will increase to DNS_MAX_SERVERS, which will trigger the LWIP_ASSERT and make device crash. Closes #6878
projectgus
pushed a commit
that referenced
this issue
Jun 30, 2021
This commit brings two esp-lwip fixes to IDF: 1) Add configuration to disable DHCP client identification espressif/esp-lwip@2195f74 This config could be used to disable option 61 in DHCP packets, so that clients will be identified by their chaddr only. (This is the lwip upstream original behaviour) 2) Fix server_idx increasing to DNS_MAX_SERVERS and trigger the LWIP_ASSERT espressif/esp-lwip@5a567d5 When lwip doesn't have DNS server and resolve a domain address, the server_idx will increase to DNS_MAX_SERVERS, which will trigger the LWIP_ASSERT and make device crash. Closes #6878
espressif-bot
pushed a commit
that referenced
this issue
Dec 4, 2021
This commit brings two esp-lwip fixes to IDF: 1) Add configuration to disable DHCP client identification espressif/esp-lwip@2195f74 This config could be used to disable option 61 in DHCP packets, so that clients will be identified by their chaddr only. (This is the lwip upstream original behaviour) 2) Fix server_idx increasing to DNS_MAX_SERVERS and trigger the LWIP_ASSERT espressif/esp-lwip@5a567d5 When lwip doesn't have DNS server and resolve a domain address, the server_idx will increase to DNS_MAX_SERVERS, which will trigger the LWIP_ASSERT and make device crash. Closes #6878
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Environment
git describe --tags
to find it): v4.4-dev-744-g1cb31e509xtensa-esp32-elf-gcc --version
to find it): xtensa-esp32-elf-gcc (crosstool-NG esp-2020r3) 8.4.0Problem Description
When lwip doesn't have DNS server (as is the case when it has a self-assigned IP) and a
hostname.local
address is resolved,abort()
is called because it tries to use a DNS server that is out-of-bounds for thedns_servers
array.The problem is actually created in dns.c:1093. There it seems to loop over the
dns_servers
increasingserver_idx
looking for a valid DNS server. As there are no DNS servers it doesn't find one, but it leavesserver_idx
atDNS_MAX_SERVERS
. A few lines lower (1097) it callsdns_send()
with the now invalid dns entry (dns_send()
checks thatserver_idx
<DNS_MAX_SERVERS
).This can be fixed in dns.c:1092 by replacing
with
(Note the + 1)
This prevents
server_idx
from becoming larger thanDNS_MAX_SERVERS
.Expected Behavior
The hostname is resolved using mDNS.
Actual Behavior
abort()
is calledSteps to reproduce
Code to reproduce this issue
Some excerpts:
The hostname to resolve:
Debug Logs
Other items if possible
The text was updated successfully, but these errors were encountered: