[Xastir] error in xastir_udp_client?

Jason KG4WSV kg4wsv at gmail.com
Sat Apr 3 10:23:13 PDT 2021


TL;DR Jason thinks there's a bug in xastir_udp_cleint. possible fix below.

I'm running the ADS-B script for the first time on a new system, odroid N2
(64 bit ARM, standard odroid distribution of Ubuntu 18.04 LTS).
xastir_udp_client fails frequently (like every second or third execution)
with recfrom: invalid argument. full output is:

$ ./bin/ads-b.pl --dump1090host 192.168.88.29 planes 10163
xastir user PLANES pass 10163
ABDD4A           427kn  358�                    - (U.S.)

ABDD4A  37175ft               ABDD4A (U.S.)       PLANES>APRS::TACTICAL
:ABDD4A=ABDD4A (U.S.)
recvfrom: Invalid argument
Trying next address to send to
Received NACK from Xastir: Callsign/Passcode don't match?
$

This same activity results in xastir outputting the following:

Received datagram from ::1: PLANES,10163,-identify
-identify
x_spider udp:  user:PLANES  pass:10163
Received datagram from ::1: PLANES,10163
PLANES>APRS::TACTICAL :ABDD4A=ABDD4A (U.S.)
x_spider udp:  user:PLANES  pass:10163
Received datagram from 127.0.0.1: ACKXastir received UDP packet without
"TO_INET," string


After a bit of googling and RTFMing, I found this in the recvfrom(2) man
page:

    In this case, addrlen is a value-result
       argument.  Before the call, it should be initialized to the size of
the
       buffer associated with src_addr.

I found that, when I added a length = sizeof() call as TFM specifies, my
problem went away.

The suspect code is in try_exchange(). In the current code length is
uninitialized.

$ diff xastir_udp_client.c xastir_udp_client.c-dist
101d100
<   length = sizeof(from);
$

That's immediately before the call to recvfrom().


Before adding this call it would run for a few seconds before exiting.
With the fix it's been running for at least 10 minutes or so, no errors.


-Jason
kg4wsv


More information about the Xastir mailing list