[Xastir] error in xastir_udp_client?

Tom Russo russo at bogodyn.org
Sat Apr 3 10:33:51 PDT 2021


After fixing this problem, I reviewed all other uses of "recvfrom" in the 
code and find that every single one of the other uses is preceded by 
an initialization of fromlen to sizeof(buffer).  This one was an outlier.

On Sat, Apr 03, 2021 at 11:32:07AM -0600, we recorded a bogon-computron collision of the <russo at bogodyn.org> flavor, containing:
> Yes, that really does seem like an error.  The manual is clear and says
> that length should be initialized to the length of the buffer.
> 
> With a change as simple as this I am comfortable just making the change,
> pushing to github, and letting users verify that it doesn't break their
> use cases.  I have already done so.
> 
> On Sat, Apr 03, 2021 at 12:23:13PM -0500, we recorded a bogon-computron collision of the <kg4wsv at gmail.com> flavor, containing:
> > 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
> > _______________________________________________
> > Xastir mailing list
> > Xastir at lists.xastir.org
> > http://xastir.org/mailman/listinfo/xastir
> 
> -- 
> Tom Russo    KM5VY
> Tijeras, NM  
> 
>  echo "prpv_a'rfg_cnf_har_cvcr" | sed -e 's/_/ /g' | tr [a-m][n-z] [n-z][a-m]
> 
> _______________________________________________
> Xastir mailing list
> Xastir at lists.xastir.org
> http://xastir.org/mailman/listinfo/xastir

-- 
Tom Russo    KM5VY
Tijeras, NM  

 echo "prpv_a'rfg_cnf_har_cvcr" | sed -e 's/_/ /g' | tr [a-m][n-z] [n-z][a-m]



More information about the Xastir mailing list