Skip to content

Commit 9f2dcd6

Browse files
authored
Fix ESP8266LLMNR for build with lwip2 (#3821)
* Fix for build with lwip2 * Fix for lwip2: Removed unnecessary #ifdefs * Remove duplicate define for BIT
1 parent 5b92569 commit 9f2dcd6

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

libraries/ESP8266LLMNR/ESP8266LLMNR.cpp

+8-7
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ extern "C" {
5050

5151
//#define LLMNR_DEBUG
5252

53-
#define BIT(x) (1 << (x))
53+
//BIT(x) is defined in tools/sdk/c_types.h
5454

5555
#define FLAGS_QR BIT(15)
5656
#define FLAGS_OP_SHIFT 11
@@ -226,14 +226,15 @@ void LLMNRResponder::_process_packet() {
226226
Serial.println("(no matching RRs)");
227227
#endif
228228

229-
struct ip_info remote_ip_info;
230-
remote_ip_info.ip.addr = _conn->getRemoteAddress();
229+
ip_addr_t remote_ip;
230+
remote_ip.addr = _conn->getRemoteAddress();
231+
231232
struct ip_info ip_info;
232233
bool match_ap = false;
233234
if (wifi_get_opmode() & SOFTAP_MODE) {
234235
wifi_get_ip_info(SOFTAP_IF, &ip_info);
235-
if (ip_info.ip.addr && ip_addr_netcmp(&remote_ip_info.ip, &ip_info.ip, &ip_info.netmask))
236-
match_ap = true;
236+
if (ip_info.ip.addr && ip_addr_netcmp(&remote_ip, &ip_info.ip, &ip_info.netmask))
237+
match_ap = true;
237238
}
238239
if (!match_ap)
239240
wifi_get_ip_info(STATION_IF, &ip_info);
@@ -272,8 +273,8 @@ void LLMNRResponder::_process_packet() {
272273
};
273274
_conn->append(reinterpret_cast<const char*>(rr), sizeof(rr));
274275
}
275-
_conn->setMulticastInterface(remote_ip_info.ip);
276-
_conn->send(&remote_ip_info.ip, _conn->getRemotePort());
276+
_conn->setMulticastInterface(remote_ip);
277+
_conn->send(&remote_ip, _conn->getRemotePort());
277278
}
278279

279280
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_LLMNR)

0 commit comments

Comments
 (0)