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()
Changes:
* Implement handle_sock_dgram() to specifically handle datagram
(UI frame-only) sockets; this fixes issues wherein logic
specific to SOCK_STREAM timers would be erroneously applied
to datagram sockets
* Always tick Timers T1, T2 and T3
* Some slight code reorganization for improved readability of
control flow
Fix select() portability issues in src/server.c by using gettimeofday()
immediately prior to and after calling select() to calculate elapsed
time since blocking on select()
Implement PATTY_AX25_SOCK_DGRAM type sockets as a means of exchanging UI
frames between stations without requiring calling code to encode and
decode UI frames explicitly
Add SOCK_PARAMS to patty_client_setsockopt() to allow for setting
(presently) the MTU and TX window of a given socket to accommodate the
needs of specific remote stations
Implement the SOCK_WAIT and SOCK_READY socket flow control states to
indicate a Receive Ready or Receive Not Ready state on the remote end
Other changes:
* Fix issue wherein flow control was never halted when the remote
end has received k (window) number of frames without the sending
station asking for acknowledgment
Changes:
* Reimplement patty_ax25_sock_send() to be geared specifically for
sending raw frames; the function which formerly held this name is
now a private method
* Implement patty_ax25_sock_recv() to receive a frame from a raw
socket
* Implement patty_ax25_sock_recv_pending() to determine how many raw
frames are pending receipt in the buffer
* When handling raw sockets, use patty_ax25_sock_recv_pending() to
ensure any raw pending frames read from a client intended for
transmission on an interface are read completely
Changes:
* When associating a promiscuous socket with an interface, rather
than creating a patty_kiss_tnc object, simply store the socket
file descriptor and use patty_kiss_frame_send() to send incoming
or outgoing frames for that interface to the promiscuous socket
* Add special initialization code in src/sock.c for SOCK_RAW; don't
allocate any buffers, but instead set a few flags and otherwise
use 0-initialized defaults
* Implement handle_sock_raw() in src/server.c to check to see if any
raw frames are pending, and if so, send them to the associated
interface if provided by setsockopt()
* Make patty_ax25_sock_bind_if() only call the function
patty_ax25_if_add_promisc() only if the socket status is PROMISC;
this allows support for non-promiscuous sockets used for outbound
purposes
Changes:
* When handling RR commands with the P/F flag set, check to see if
the socket file descriptor is currently being monitored; if so,
reply RR, otherwise reply RNR
* When handling RNR commands with the P/F flag set, apply the same
aforementioned logic as used for handling RR commands
* When handling RNR responses, clear the socket file descriptor so
as to avoid infinite loop polling and to indicate that the remote
station cannot receive packets currently
Changes:
* Rename seq_send to vs, ie, V(S)
* Rename seq_recv to vr, ie, V(R)
* Ensure handling RR responses updates V(S) with the N(R) value of
the received frame
Fix issues with TX slots in src/sock.c wherein packets saved for resend
would not be able to be resent, as their total length was not encoded
properly into the slot structure
Changes:
* Fix Classes of Operations and HDLC parameter bit flags in
include/patty/ax25.h to match the documentation after more careful
analysis; resolve issues with byte order
* Add support for previously missing HDLC parameters to function
patty_print_params()
* Fix Info TX/RX field encodings to be in bits, rather than bytes
* Implement patty_ax25_sock_realloc_bufs() to reallocate buffers
based on current window and I frame sizes
* Implement patty_ax25_sock_params_upgrade() to upgrade a socket's
parameters to the AX.25 v2.2 documented defaults; this will not
change parameters if the socket is already set to v2.2
* Implement patty_ax25_sock_params_max() to upgrade a socket's
parameters to the highest values supported by patty
* Reimplement patty_ax25_sock_send_xid() to send highest desired
parameters, rather than the values currently set on the socket
* When receiving XID frames destined to listening sockets, use
patty_ax25_sock_params_max() to negotiate from high to low
parameters
* When receiving SABME flags, use patty_ax25_sock_params_upgrade()
to ensure at least base AX.25 v2.2 parameter defaults are set
* Fix issue where outbound connections initiated with XID were
unable to time out after N retries