mirror of
				https://github.com/esp8266/Arduino.git
				synced 2025-11-03 14:33:37 +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:
		@@ -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
 | 
			
		||||
@@ -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);
 | 
			
		||||
@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user