[beken-72xx] Enable mDNS responder, set IGMP flag on netif

This commit is contained in:
Kuba Szczodrzyński
2022-06-30 20:33:08 +02:00
parent 0e0fe334cd
commit f071f57abf
4 changed files with 13 additions and 7 deletions

View File

@@ -57,16 +57,16 @@ Wire | ❗ | ❌
Wi-Fi STA/AP/Mixed | ✔️ | ✔️/❌/❌ Wi-Fi STA/AP/Mixed | ✔️ | ✔️/❌/❌
Wi-Fi Events | ✔️ | ❌ Wi-Fi Events | ✔️ | ❌
TCP Client (SSL) | ✔️ (✔️) | ✔️ (❗) TCP Client (SSL) | ✔️ (✔️) | ✔️ (❗)
TCP Server | ✔️ | TCP Server | ✔️ | ✔️
IPv6 | ❌ | ❌ IPv6 | ❌ | ❌
HTTP Client (SSL) | ✔️ (✔️) | ❓ HTTP Client (SSL) | ✔️ (✔️) | ❓
HTTP Server | ✔️ | HTTP Server | ✔️ | ✔️
NVS / Preferences | ❌ | ❌ NVS / Preferences | ❌ | ❌
SPIFFS | ❌ | ❌ SPIFFS | ❌ | ❌
BLE | - | ❌ BLE | - | ❌
NTP | ❌ | ❌ NTP | ❌ | ❌
OTA | ✔️ | ❌ OTA | ✔️ | ❌
MDNS | ✔️ | MDNS | ✔️ | ✔️
MQTT | ✅ | ❌ MQTT | ✅ | ❌
SD | ❌ | ❌ SD | ❌ | ❌

View File

@@ -59,15 +59,16 @@ mDNS::~mDNS() {}
bool mDNS::begin(const char *hostname) { bool mDNS::begin(const char *hostname) {
mdns_resp_init(); mdns_resp_init();
struct netif *netif = netif_list; struct netif *netif = netif_list;
uint8_t enabled = 0;
while (netif != NULL) { while (netif != NULL) {
// TODO: detect mdns_netif_client_id by checking netif_get_client_data() // TODO: detect mdns_netif_client_id by checking netif_get_client_data()
// and finding the requested hostname in struct mdns_host // and finding the requested hostname in struct mdns_host
if (netif_is_up(netif) && mdns_resp_add_netif(netif, hostname, 255) != ERR_OK) { if (netif_is_up(netif) && mdns_resp_add_netif(netif, hostname, 255) == ERR_OK) {
return false; enabled++;
} }
netif = netif->next; netif = netif->next;
} }
return true; return enabled > 0;
} }
void mDNS::end() { void mDNS::end() {

View File

@@ -331,11 +331,15 @@ env.AddLibrary(
"+<lwip-2.0.2/port/*.c>", "+<lwip-2.0.2/port/*.c>",
"+<lwip-2.0.2/src/api/*.c>", "+<lwip-2.0.2/src/api/*.c>",
"+<lwip-2.0.2/src/apps/ping/*.c>", "+<lwip-2.0.2/src/apps/ping/*.c>",
"+<lwip-2.0.2/src/apps/mdns/*.c>",
"+<lwip-2.0.2/src/core/*.c>", "+<lwip-2.0.2/src/core/*.c>",
"+<lwip-2.0.2/src/core/ipv4/*.c>", "+<lwip-2.0.2/src/core/ipv4/*.c>",
"+<lwip-2.0.2/src/core/ipv6/*.c>", "+<lwip-2.0.2/src/core/ipv6/*.c>",
"+<lwip-2.0.2/src/netif/ethernet.c>", "+<lwip-2.0.2/src/netif/ethernet.c>",
"+<dhcpd/*.c>", "+<dhcpd/*.c>",
# use ethernetif.c from AliOS since it enables netif IGMP flag
"-<lwip-2.0.2/port/ethernetif.c>",
"+<$SDK_DIR/beken378/alios/lwip-2.0.2/port/ethernetif.c>",
], ],
includes=[ includes=[
"+<lwip-2.0.2/port>", "+<lwip-2.0.2/port>",

View File

@@ -4,4 +4,5 @@
#include_next "lwipopts.h" #include_next "lwipopts.h"
#define LWIP_MDNS_RESPONDER 1 #define LWIP_MDNS_RESPONDER 1
#define LWIP_NUM_NETIF_CLIENT_DATA 1