esp8266 / esp8266/Arduino

mDNS responder kills DHCP server on lwip v2

Open
#6,114 8 comments 1 reaction 0 assignees View on GitHub
component: MDNS component: network type: bug
Dominant language
C++
Stars
16.7k
Forks
13.1k
PR merge metrics
No merged PRs in 30d

Description

### Basic Infos

- [x] This issue complies with the [issue POLICY doc](https://github.com/esp8266/Arduino/blob/master/POLICY.md).
- [x] I have read the documentation at [readthedocs](https://arduino-esp8266.readthedocs.io/en/latest) and the issue is not addressed there.
- [ ] I have tested that the issue is present in current master branch (aka latest git).
- [x] I have searched the issue tracker for a similar issue.
- [x] If there is a stack dump, I have decoded it (no stack dump).
- [x] I have filled out all fields below.

#### Platform

- Hardware: [ESP-12]
- Core Version: [2.5.1]
- Development Env: [Arduino IDE]
- Operating System: [Slackware Linux]

### Settings in IDE

- Module: [Nodemcu v0.9]
- Flash Mode: [unknown]
- Flash Size: [4MB/1MB]
- lwip Variant: [v1.4|v2 Higher Bandwidth]
- Reset Method: [unknown]
- Flash Frequency: [unknown]
- CPU Frequency: [80Mhz]
- Upload Using: [SERIAL]
- Upload Speed: [115200] (serial upload only)

### Problem Description

I'm trying to connect to a WiFi on startup, wait for a timeout, then open an AP to allow the user to connect.

This works fine on lwip v1.4.
This works fine on lwip v2 Higher Bandwith with MDNS disabled (lines starting with MDNS commented out of the MCVE below)
This fails on lwip v2 Higher Bandwith with MDNS enabled - the client connects to the WiFi but does not receive an IP address and the Serial port debugging shows:

ERROR: dhcps send ack (error -13)
ERROR: dhcps send ack (error -13)
ERROR: send_offer (error -13)
ERROR: send_offer (error -13)

Note: I have replaced all the "check for connection or timeout" handling with a simple delay(5000) in the MCVE below. Same problem.

### [MCVE] Sketch

```cpp
#include
#include

void setup() {
Serial.begin(115200);
Serial.setDebugOutput(true);

WiFi.begin("undef", "undef");
delay(5000);

// open an AP for configuration if connection failed
WiFi.disconnect();
WiFi.mode(WIFI_AP_STA);
WiFi.softAP("aptest");

MDNS.begin("config");
MDNS.addService("http", "tcp", 80);
}

void loop() {
MDNS.update();
}
```

### Debug Messages from serial port

```
SDK:2.2.1(cfd48f3)/Core:2.5.1=20501000/lwIP:STABLE-2_1_2_RELEASE/glue:1.1-7-g82abda3/BearSSL:a143020
mode : sta(a0:20:a6:13:6c:ac) + softAP(a2:20:a6:13:6c:ac)
add if0
scandone
no undef found, reconnect after 1s
reconnect
scandone
bcn 0
del if1
add if1
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100
add 1
aid 1
station: 10:0b:a9:7b:e0:44 join, AID = 1
ERROR: dhcps send ack (error -13)
ERROR: dhcps send ack (error -13)
ERROR: send_offer (error -13)
ERROR: send_offer (error -13)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.