mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-13 20:51:36 +08:00
don't use default source address for onboard udp link, wait on remote
This commit is contained in:
@@ -1814,10 +1814,12 @@ MavlinkReceiver::receive_thread(void *arg)
|
||||
|
||||
struct sockaddr_in * srcaddr_last = _mavlink->get_client_source_address();
|
||||
int localhost = (127 << 24) + 1;
|
||||
if (srcaddr_last->sin_addr.s_addr == htonl(localhost) && srcaddr.sin_addr.s_addr != htonl(localhost)) {
|
||||
if ((srcaddr_last->sin_addr.s_addr == htonl(localhost) && srcaddr.sin_addr.s_addr != htonl(localhost))
|
||||
|| (_mavlink->get_mode() == Mavlink::MAVLINK_MODE_ONBOARD && !_mavlink->get_client_source_initialized())) {
|
||||
// if we were sending to localhost before but have a new host then accept him
|
||||
memcpy(srcaddr_last, &srcaddr, sizeof(srcaddr));
|
||||
PX4_WARN("UDP source addr changed: %s", inet_ntoa(srcaddr.sin_addr));
|
||||
_mavlink->set_client_source_initialized();
|
||||
}
|
||||
#endif
|
||||
/* if read failed, this loop won't execute */
|
||||
|
||||
Reference in New Issue
Block a user