Skip to content

Fix ESP8266LLMNR for build with lwip2 #3821

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

Merged
merged 4 commits into from
Nov 16, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions libraries/ESP8266LLMNR/ESP8266LLMNR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ extern "C" {

//#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_OP_SHIFT 11
Expand Down Expand Up @@ -226,14 +226,15 @@ void LLMNRResponder::_process_packet() {
Serial.println("(no matching RRs)");
#endif

struct ip_info remote_ip_info;
remote_ip_info.ip.addr = _conn->getRemoteAddress();
ip_addr_t remote_ip;
remote_ip.addr = _conn->getRemoteAddress();

struct ip_info ip_info;
bool match_ap = false;
if (wifi_get_opmode() & SOFTAP_MODE) {
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))
match_ap = true;
if (ip_info.ip.addr && ip_addr_netcmp(&remote_ip, &ip_info.ip, &ip_info.netmask))
match_ap = true;
}
if (!match_ap)
wifi_get_ip_info(STATION_IF, &ip_info);
Expand Down Expand Up @@ -272,8 +273,8 @@ void LLMNRResponder::_process_packet() {
};
_conn->append(reinterpret_cast<const char*>(rr), sizeof(rr));
}
_conn->setMulticastInterface(remote_ip_info.ip);
_conn->send(&remote_ip_info.ip, _conn->getRemotePort());
_conn->setMulticastInterface(remote_ip);
_conn->send(&remote_ip, _conn->getRemotePort());
}

#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_LLMNR)
Expand Down