1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

Fix ESP8266LLMNR for build with lwip2 (#3821)

* Fix for build with lwip2

* Fix for lwip2: Removed unnecessary #ifdefs

* Remove duplicate define for BIT
This commit is contained in:
Develo 2017-11-16 13:41:24 -03:00 committed by GitHub
parent 5b925697ec
commit 9f2dcd6892
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,7 +50,7 @@ extern "C" {
//#define LLMNR_DEBUG //#define LLMNR_DEBUG
#define BIT(x) (1 << (x)) //BIT(x) is defined in tools/sdk/c_types.h
#define FLAGS_QR BIT(15) #define FLAGS_QR BIT(15)
#define FLAGS_OP_SHIFT 11 #define FLAGS_OP_SHIFT 11
@ -226,14 +226,15 @@ void LLMNRResponder::_process_packet() {
Serial.println("(no matching RRs)"); Serial.println("(no matching RRs)");
#endif #endif
struct ip_info remote_ip_info; ip_addr_t remote_ip;
remote_ip_info.ip.addr = _conn->getRemoteAddress(); remote_ip.addr = _conn->getRemoteAddress();
struct ip_info ip_info; struct ip_info ip_info;
bool match_ap = false; bool match_ap = false;
if (wifi_get_opmode() & SOFTAP_MODE) { if (wifi_get_opmode() & SOFTAP_MODE) {
wifi_get_ip_info(SOFTAP_IF, &ip_info); wifi_get_ip_info(SOFTAP_IF, &ip_info);
if (ip_info.ip.addr && ip_addr_netcmp(&remote_ip_info.ip, &ip_info.ip, &ip_info.netmask)) if (ip_info.ip.addr && ip_addr_netcmp(&remote_ip, &ip_info.ip, &ip_info.netmask))
match_ap = true; match_ap = true;
} }
if (!match_ap) if (!match_ap)
wifi_get_ip_info(STATION_IF, &ip_info); wifi_get_ip_info(STATION_IF, &ip_info);
@ -272,8 +273,8 @@ void LLMNRResponder::_process_packet() {
}; };
_conn->append(reinterpret_cast<const char*>(rr), sizeof(rr)); _conn->append(reinterpret_cast<const char*>(rr), sizeof(rr));
} }
_conn->setMulticastInterface(remote_ip_info.ip); _conn->setMulticastInterface(remote_ip);
_conn->send(&remote_ip_info.ip, _conn->getRemotePort()); _conn->send(&remote_ip, _conn->getRemotePort());
} }
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_LLMNR) #if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_LLMNR)