Implement patty_ax25_sock_flow_left() as a means to determine how many
I frames a peer may receive; this can be used to determine when to set
the P/F bit of outgoing I frames to implicitly require an RR or RNR
acknowledgement
Start Timer T3 when starting Timer T1 after expiry, to avoid a situation
wherein two RR command polling frames may be sent within close proximity
of one another
When handling I frames, stop Timer T2 if the number of unacknowledged
frames has reached k/2
Other changes:
* Provide annotations from the AX.25 v2.2 standards document
* Improve implementation of I frame reception P/F procedure
Always send RR when Timer T3 runs out, as we are not likely (with modern
hardware with MMUs) to be unable to receive; furthermore, RNR would have
only been sent erroneously if the outward flow of traffic had been
stopped
Implement SSID suffix stringes in pton()/ntop() to make it more
straightforward to specify addresses to bind, connect to, or add routes
for
Changes:
* Implement SSID suffix string formatting in patty_ax25_ntop(); drop
the 'ssid' pointer argument
* Implement SSID suffix string parsing in patty_ax25_pton(); drop
the 'ssid' argument
* Change all calls to patty_ax25_ntop() and patty_ax25_pton() to use
their new calling convention
Changes:
* Make TX slots only large enough to hold the info field of an I
frame; do not save header information
* Fix issue wherein patty_ax25_sock_resend() would resend the N(R)
value of an I frame as it was originally sent, even if this is
incorrect for a given situation
* Make control_i() in src/sock.c accept a V(S) sequence argument, as
this can sometimes be independent of the socket current V(S) value
* Declare control field functions as inline in src/sock.c
Changes:
* Use patty_ax25_sock_reset() when receiving a FRMR, SABM, or SABME
frame
* Reply to an SABM or SABME frame with a UA when received by an
ESTABLISHED socket
Implement AX.25 v2.2, Section 6.4.6 "Receiving Acknowledgement"
semantics more consistently
Changes:
* Add frame_ack() method in src/server.c to unify logic for
acknowledging frames and handling I frame transmission flow
control
* Ensure that the Timer T1 retry counter is reset as appropriate
when Timer T1 is restarted
* Add excerpts from the AX.25 v2.2 documentation to accompanying
code to better document the purpose of important aspects of the
state machine and protocol
* When receiving an S frame with N(R) acknowledgement of a frame
sent earlier than indicated by V(S), set V(S) to that N(R) value
* Implement patty_ax25_sock_resend_pending() as a means to resend
one frame previously sent which remains unacknowledged; this
uses V(S) to determine the frame to resend, and increments V(S) if
there was indeed an unacknowledged frame
* Call patty_ax25_sock_resend_pending() in src/server.c, method
handle_sock() to send a single frame previously sent but pending
acknowledgement
Changes:
* Make patty_ax25_sock_ack() take a N(R) argument directly, rather
than having the caller specify N(R)-1
* Only perform acknowledgement of frames within the range between
V(A) and N(R)-1
Implement patty_timer_init() to allow the caller to specify a timer
value to use each time patty_timer_start() is called, obviating the need
to pass the same argument redundantly; if the timer value must be
changed, then another call to patty_timer_init() may be used
Implement frame segmentation/reassembly state machine as per AX.25 v2.2
specifications, as per Section 6.6 "Disassembler/Reassembler" and
associated appendices
Reduced default I frame info field to 127 bytes so as to hopefully
better coincide with common TNC firmware; it is suspected (but not
confirmed that they do include the protocol identifier as part of the
info field length
Use default I frame lengths for common TNCs per version; for AX.25
prior to 2.2, use 128, otherwise, use 255, the maximum for Kenwood and
possibly other Kantronics-style TNCs
When a remote station wishes to connect by sending an XID frame, use
Timer T1 to send an XID response up to the retry count before closing
the socket pending negotiation
Changes:
* Add validation to accept() to ensure file descriptors provided
refer to SOCK_STREAM sockets in the SOCK_LISTENING state
* Rather than writing a reply to the patty client socket when
accepting a SABM or SABME request, write a message to the
remote end of the listening socket; this avoids issues wherein
a client receives an unexpected accept() response that may be
unrelated to another pending request; this also allows client
code to use select(2) on listening sockets
* In patty_client_accept(), send the initial request to validate
that the local socket can accept connections, and then wait for
a connection to be made, reading a message written to the
listening socket from the patty server
* Allow select(2) to notify on accepted connections
Changes:
* Don't clear socket from an interface's promiscuous socket table if
the socket state is not SOCK_PROMISC
* Destroy socket TNC if socket type is SOCK_RAW
* Only attempt to close socket file descriptors >0
Changes:
* Replace usage of gettimeofday() with clock_gettime() in the main
event loop, patty_ax25_server_run(), as gettimeofday() apparently
goes backwards in time occasionally, as per:
https://bugzilla.redhat.com/show_bug.cgi?id=174390
Thanks Iain MM0ROR!
* Fix patty_timer_expired() to properly return true if the
remaining number of seconds is zero, but the remaining higher
precision time is less than zero
* Implement patty_timer_sub() to subtract two struct timespec
values, as glibc lacks timespecsub()