Commit graph

484 commits

Author SHA1 Message Date
XANTRONIX Development
821b76551c Fix call to rm in examples/Makefile 'clean' rule 2024-03-01 00:20:47 -05:00
XANTRONIX Development
a350602e0d Fix call to rm in bin/Makefile 'clean' rule 2024-03-01 00:20:47 -05:00
XANTRONIX Development
ee866273d7 Fix bug with ./configure on Darwin 2024-03-01 00:20:47 -05:00
XANTRONIX Development
83977e115f Replace some tabs with spaces in ./configure 2024-03-01 00:20:47 -05:00
XANTRONIX Development
7571c6f97b Improve BSD man page location detection
Improve BSD man page location detection by using /usr/share/man as the
system default
2024-03-01 00:20:47 -05:00
XANTRONIX Development
bfd97bb7e5 Add OS-specific man path support in ./configure 2024-03-01 00:20:47 -05:00
XANTRONIX Development
50458abaec Initial implementation of bin/pattyd.8 2024-03-01 00:20:47 -05:00
XANTRONIX Development
867472975b Add 'install' rule to Makefile 2024-03-01 00:20:47 -05:00
XANTRONIX Development
d78eee7113 Define _GNU_SOURCE in bin/pattyd.c for ptsname() 2024-03-01 00:20:47 -05:00
XANTRONIX Development
89b0ed7dc7 Make sure 'clean' in bin/Makefile removes .o files 2024-03-01 00:20:47 -05:00
XANTRONIX Development
05081df9c6 Add support for --prefix= flag to ./configure 2024-03-01 00:20:47 -05:00
XANTRONIX Development
220be99359 Fix bugs in ./configure
Fix bugs in ./configure wherein build.mk is written in src/, not mk/
2024-03-01 00:20:47 -05:00
XANTRONIX Development
a1cabeb1e1 Move paths to build/install tools to mk/build.mk 2024-03-01 00:20:47 -05:00
XANTRONIX Development
8aac3c521b Add 'install' rule to bin/Makefile 2024-03-01 00:20:47 -05:00
XANTRONIX Development
639ec8beb7 Implement bin/pattyd.c
Changes:

    * Implement src/conf.c, patty_conf_read(), to read a configuration
      file to support a OpenBSD-style configuration file format

    * Implement bin/pattyd.c to use patty_conf_read() to read a
      configuration file and apply its settings to a patty_daemon
      object as it is read; also implement a --standalone|-s flag to
      allow the user to start a patty server without having to write
      a configuration file

    * Refactor patty_daemon_if_add() to accept a patty_ax25_if object;
      this is necessary as bin/pattyd.c needs to be able to validate
      the addresses given in a configuration file 'if' statement

    * Refactor patty_ax25_server_new() to no longer accept a client
      socket path; instead, patty_ax25_server_start() now accepts the
      client socket path

    * Remove the client socket 'path' member from patty_ax25_server in
      src/server.c

    * Refactor patty_kiss_tnc_new() to accept only one argument, a
      patty_kiss_tnc_info object containing flags and settings needed
      to open a device, use an existing file descriptor, or change
      termios settings as appropriate

    * Remove patty_kiss_tnc_new_fd(), as its functionality now exists
      in patty_kiss_tnc_new() itself

    * Add a 'flags' field to patty_kiss_tnc_info; use this bit field
      to determine whether a path or file descriptor is provided by
      the caller

    * Make patty_ax25_if_new() accept an interface name argument, as
      names are explicitly required when declaring new interfaces in
      configuration files

    * Make patty_kiss_tnc_new() able to accept /dev/ptmx as a device
      name, regardless of whether this character device exists on a
      given platform; when provided, a pseudo TTY pair is allocated
      with openpty()

    * Refactor examples/ax25dump.c to use the new patty_kiss_tnc_new()
      calling convention

    * Refactor examples/decode.c to use the new patty_kiss_tnc_new()
      calling convention

    * Remove examples/daemon.c in favor of bin/pattyd.c

    * Rename examples/patty.conf to examples/pattyd.conf; modify to
      provide values which would actually function
2024-03-01 00:20:47 -05:00
XANTRONIX Development
b0e9ae6e0d Improved portability in ./configure
Improved portability in ./configure to add detection for various smaller
items, such as headers necessary for openpty(3), et cetera; improve
overall script structure
2024-03-01 00:20:47 -05:00
XANTRONIX Development
dde4d1d62f Add 1-second sleep() before end of examples/listen.c 2024-03-01 00:20:47 -05:00
XANTRONIX Development
0603c716a8 Added examples/login.c 2024-03-01 00:20:47 -05:00
XANTRONIX Development
adaeb0d6d2 Use openpty(3) to open PTYs
Use openpty(3) to open PTYs, to achieve compatibility with OpenBSD as
posix_openpty() returns a file descriptor which does not block on
read() nor select()
2024-03-01 00:20:47 -05:00
XANTRONIX Development
8f3bcc3d41 Use posix_openpt() for creating pseudo TTY pairs
Use posix_openpt() for creating pseudo TTY pairs, rather than depending
on the presence of /dev/ptmx, which is not a portable assumption
2024-03-01 00:20:47 -05:00
XANTRONIX Development
854d3bc9a7 Fix bug in patty_ax25_if_addr_add()
Fix bug in patty_ax25_if_addr_add() wherein, due to a typo of memcpy()
rather than memcmp(), the function would never fail to add an address
to an interface, even if it already exists on the interface
2024-03-01 00:20:47 -05:00
XANTRONIX Development
5cb98de5d0 Allow setting baud, flow control for TNCs
Changes:

    * Add argument to patty_kiss_tnc_new(), patty_kiss_tnc_new_fd(),
      a pointer to patty_kiss_tnc_info, to allow specifying baud and
      flow control

    * Rework patty_ax25_if_kiss_tnc_info to hold patty_kiss_tnc_info as
      a hack to allow instantiating a KISS TNC-based network interface
      with desired baud and flow control
2024-03-01 00:20:47 -05:00
XANTRONIX Development
9734c97f35 Implement src/daemon.c
Implement src/daemon.c to provide a high level method to instantiate a
patty server

Changes:

    * Refactor src/server.c, src/route.c, src/if.c methods which accept
      callsign arguments to use a patty_ax25_addr pointer instead; this
      has significantly reduced the number of redundant calls to
      patty_ax25_pton()

    * Decouple patty_ax25_addr from patty_ax25_if_info types when
      creating new interfaces with patty_ax25_if_new(); instead, take a
      separate patty_ax25_addr argument

    * Split patty_ax25_server_run() into the following methods:

          - patty_ax25_server_start()
          - patty_ax25_server_stop()
          - patty_ax25_server_event_handle()

      This is intended to allow possible integration into other event
      loops.

    * Implement src/daemon.c to allow quick instantiation of a server,
      interfaces, and routes, and to encapsulate the setting of
      configuration variables; callsigns and interface names are handled
      as character strings

    * Rename examples/server.c to examples/daemon.c; reimplement in
      terms of the patty_daemon code

    *
2024-03-01 00:20:47 -05:00
XANTRONIX Development
0fecccd7c3 Missed a spot with patty_ax25_pton() fix 2024-03-01 00:20:47 -05:00
XANTRONIX Development
116bf788d5 Implement patty_client_ping()
Implement patty_client_ping() to provide a means of testing if a client
connection is still active
2024-03-01 00:20:47 -05:00
XANTRONIX Development
5edb889471 Use tcflush() before tcsetattr() in src/kiss.c 2024-03-01 00:20:47 -05:00
XANTRONIX Development
6bb71a37ff Fix segfault in patty_ax25_if_addr_match() 2024-03-01 00:20:47 -05:00
XANTRONIX Development
fb982742f5 Use tx_slots() inline function in src/sock.c 2024-03-01 00:20:47 -05:00
XANTRONIX Development
44ec0040a8 Use Timer T1 retry counter for DISC sequence 2024-03-01 00:20:47 -05:00
XANTRONIX Development
aff5eabff3 More concise 2024-03-01 00:20:47 -05:00
XANTRONIX Development
c04fb3c845 Reset retries when acking pending I frames 2024-03-01 00:20:47 -05:00
XANTRONIX Development
b360d7fc23 Send unacked I frame or RR on Timer T1 expiry 2024-03-01 00:20:47 -05:00
XANTRONIX Development
2e360976bf Rename patty_ax25_sock.rx_buf to io_buf
Rename patty_ax25_sock.rx_buf to io_buf, as the buffer is not used for
receiving frames from an interface, but rather from reading local data
to write to a remote peer

Other changes:

    * Fix issue wherein patty_ax25_sock.n_maxlen_tx was not used for
      reading local data when sending I frames
2024-03-01 00:20:47 -05:00
XANTRONIX Development
5a61a3057a Slight lines-of-code reduction
Slight lines-of-code reduction without any functional changes
2024-03-01 00:20:47 -05:00
XANTRONIX Development
fcef17a8b1 Better management of Timers T1 and T3
Changes:

    * Ensure Timer T1 is stopped when Timer T3 is active

    * Ensure Timer T1 is started when an acknowledgement from the peer
      does not acknowledge all I frames previously sent
2024-03-01 00:20:47 -05:00
XANTRONIX Development
25f2a0abe9 Make patty_ax25_sock_ack() return 1 if N(R) = V(A)
Make patty_ax25_sock_ack() return 1 if N(R) = V(A), to provide a
convenient means of verifying that an acknowledgement from the peer is
at least valid for current sequence variables, even if no new frames are
acknowledged; patty_ax25_sock_ack_pending() can always be used to
determine when frames are still pending acknowledgement
2024-03-01 00:20:47 -05:00
XANTRONIX Development
582c7f04d6 Don't stop Timer T3 only when stopping I transmit 2024-03-01 00:20:47 -05:00
XANTRONIX Development
5ccd2efbda Rearrange patty_ax25_sock struct definition
Rearrange patty_ax25_sock struct definition for better readability and
cohesion, and for the sake of future documentation
2024-03-01 00:20:47 -05:00
XANTRONIX Development
ec9066167b Stop flow before sending last I frame in window
Stop flow before sending last I frame in window; furthermore, this last
I frame will have the P/F flag set to 1, to implicitly request a RR, RNR
or REJ response as appropriate
2024-03-01 00:20:47 -05:00
XANTRONIX Development
826653f0d9 Remove unused patty_ax25_sock_flow_full()
Remove unused patty_ax25_sock_flow_full(), in favor of the previously
implemented patty_ax25_sock_flow_left(), as a better means of
determining what flow control measures to take and how to interrogate
the peer for readiness to receive with minimal overhead
2024-03-01 00:20:47 -05:00
XANTRONIX Development
dfa2ff547a Implement patty_ax25_sock_flow_left()
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
2024-03-01 00:20:47 -05:00
XANTRONIX Development
df9efb8b3a Start Timer T3 when starting Timer T1 after expiry
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
2024-03-01 00:20:47 -05:00
XANTRONIX Development
99a48af087 Stop Timer T2 when sending RR on k/2 unacked
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
2024-03-01 00:20:47 -05:00
XANTRONIX Development
3b1e341851 Fix switch case fallthrough bugs in src/server.c
Fix switch case fallthrough bugs in src/server.c in the following
functions:

    * handle_rr()

    * handle_rnr()

    * handle_rej()
2024-03-01 00:20:47 -05:00
XANTRONIX Development
c6af57b245 Only set P/F flag on I frames when window is hit
Changes:

    * In src/sock.c, inline function control_i(), only set the P/F flag
      when the window of the peer has just received up to its window
2024-03-01 00:20:47 -05:00
XANTRONIX Development
b619fffb32 Always send RR when Timer T3 runs out
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
2024-03-01 00:20:47 -05:00
XANTRONIX Development
609a7271e5 Minor formatting tweaks for searchability 2024-03-01 00:20:47 -05:00
XANTRONIX Development
d88e8512b8 Adhere to P/F procedure on I frames 2024-03-01 00:20:47 -05:00
XANTRONIX Development
bdbab9c5e7 Disregard TEST, UA and XID not addressed to iface 2024-03-01 00:20:47 -05:00
XANTRONIX Development
222e51100e Implement SSID suffix stringes in pton()/ntop()
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
2024-03-01 00:20:47 -05:00