mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-27 18:02:17 +03:00
emulation on host: fix binding from a particular interface (#7372)
allows to effectively use virtual interfaces (ifconfig eth0:1) with a different IP address
This commit is contained in:
@ -76,9 +76,8 @@ bool mockUDPListen (int sock, uint32_t dstaddr, uint16_t port, uint32_t mcast)
|
||||
|
||||
// Filling server information
|
||||
servaddr.sin_family = AF_INET;
|
||||
//servaddr.sin_addr.s_addr = global_ipv4_netfmt?: dstaddr;
|
||||
(void) dstaddr;
|
||||
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
servaddr.sin_addr.s_addr = htonl(global_source_address);
|
||||
servaddr.sin_port = htons(mockport);
|
||||
|
||||
// Bind the socket with the server address
|
||||
@ -97,8 +96,7 @@ bool mockUDPListen (int sock, uint32_t dstaddr, uint16_t port, uint32_t mcast)
|
||||
|
||||
struct ip_mreq mreq;
|
||||
mreq.imr_multiaddr.s_addr = mcast;
|
||||
//mreq.imr_interface.s_addr = global_ipv4_netfmt?: htonl(INADDR_ANY);
|
||||
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
|
||||
mreq.imr_interface.s_addr = htonl(global_source_address);
|
||||
if (global_ipv4_netfmt)
|
||||
{
|
||||
#if __APPLE__
|
||||
|
Reference in New Issue
Block a user