Commit graph

587 commits

Author SHA1 Message Date
cc94d615ec Use CFLAGS_ prefix for CFLAGS sub-parts 2024-03-01 00:20:47 -05:00
f80cc4055f Implement interface resetting
Changes:

    * Implement patty_ax25_if_reset() to allow pattyd(8) to attempt to
      reset the network interface in the event of an I/O error

    * Move existing link resetting code in src/aprs_is.c to
      patty_ax25_aprs_is_reset(); allow src/server.c to call this rather
      than within src/aprs_is.c itself

    * Implement patty_kiss_tnc_reset(); this simply sets errno to ENOSYS
      and returns -1 for the time being
2024-03-01 00:20:47 -05:00
021eca720d Search for patty.sock in ax25dump(8), tncd(8)
Changes:

    * Modify patty_client_new() to accept NULL as a Unix domain socket
      path; when NULL is provided, search for the pattyd(8) socket in
      pattyd.sock, followed by the default full socket path,
      /var/run/patty/patty.sock

    * Modify bin/ax25dump.c, bin/tncd.c to use default socket paths when
      calling patty_client_new() by defaulting to NULL when no -s flag
      is provided
2024-03-01 00:20:47 -05:00
1ca11de03f Use intptr_t, not int64_t, for pointer->int casts 2024-03-01 00:20:47 -05:00
c359682928 Use %zx specifier in patty_print_hexdump() 2024-03-01 00:20:47 -05:00
b05202e9bf Use size_t for length in patty_list 2024-03-01 00:20:47 -05:00
00879d33c5 Fix strncpy() compilation warnings
Fix strncpy() compilation warnings wherein the target string length did
not account for a nul terminator
2024-03-01 00:20:47 -05:00
58d9a37786 Don't include patty/ax25.h in includes 2024-03-01 00:20:47 -05:00
dacfa282e7 Prevent #include loop in include/ax25/aprs_is.h 2024-03-01 00:20:47 -05:00
6a18811b04 Make patty/client.h types opaque 2024-03-01 00:20:47 -05:00
4f2f01ec0a Refactor patty_kiss_tnc_new()
Refactor patty_kiss_tnc_new() into the following initialization methods:

    * init_sock()
    * init_device()
    * init_termios()
2024-03-01 00:20:47 -05:00
ab3679b788 Die when too many arguments are given to ax25dump 2024-03-01 00:20:47 -05:00
7fdf3a8416 More argument parsing fixes 2024-03-01 00:20:47 -05:00
6942af9832 Slight tweaks to argument parsing 2024-03-01 00:20:47 -05:00
379264a956 Use getopt_long() in bin/tncd.c 2024-03-01 00:20:47 -05:00
535e71c472 Use getopt_long() in bin/ax25dump.c
Use getopt_long() in bin/ax25dump.c to accept Unix domain socket and
interface name arguments for dumping packets from a connected pattyd(8)
process
2024-03-01 00:20:47 -05:00
4fb64760b6 Change names of sock, PID file #defines
Change names of sock, PID file #defines in include/patty/daemon.h
2024-03-01 00:20:47 -05:00
a672b4e44a Use heap-allocated buffer in ax25dump(8) 2024-03-01 00:20:47 -05:00
5b59b163d2 Bring interfaces down when an error is encountered
Modify src/server.c to bring interfaces down when an I/O error is
encountered
2024-03-01 00:20:47 -05:00
8e118a3b56 Implement interface statuses in src/if.c
Implement interface statuses in src/if.c to represent interfaces that
are down, up, or in an erroneous condition
2024-03-01 00:20:47 -05:00
6148977adf Fix bug parsing KISS frames not for port 0
Fix bug parsing KISS frames not for port 0 in patty_kiss_tnc_drain();
furthermore, ensure frames are only handled when they are indeed for
port 0
2024-03-01 00:20:47 -05:00
14354337cc Ensure dropped packets are not counted as RXed
Ensure dropped packets are not counted as RXed in the following
interface drivers:

    * src/tnc.c
    * src/aprs_is.c
2024-03-01 00:20:47 -05:00
f127bd2fc2 Track received frames, bytes in src/aprs_is.c 2024-03-01 00:20:47 -05:00
986f329dd7 Track received frames, bytes in src/tnc.c 2024-03-01 00:20:47 -05:00
59fce6bdf9 Track sent frames, bytes in src/aprs_is.c 2024-03-01 00:20:47 -05:00
1e3d919fd5 Track dropped frames in src/aprs_is.c 2024-03-01 00:20:47 -05:00
675e6cf727 Implement patty_ax25_if_addr_set()
Changes:

    * Remove the initial address argument from patty_ax25_if_new()

    * Implement patty_ax25_if_addr_set() to set the AX.25 address of an
      interface at any time
2024-03-01 00:20:47 -05:00
7415ef8573 Add arg names to functions in patty/ax25/aprs_is.h 2024-03-01 00:20:47 -05:00
2b931ec357 Implement patty_ax25_if_ready()
Implement patty_ax25_if_ready() to provide a means of testing an
interface's readiness for performing I/O; this may also be used in the
future for some interface drivers which may require occasional keepalive
timers to maintain a link
2024-03-01 00:20:47 -05:00
4604cccdb4 Rename patty_ax25_sock_assembler_ready()
Rename patty_ax25_sock_assembler_ready() to assembler_pending() to
better fit naming conventions; ready() is meant more for "does this
channel have any I/O readiness conditions", whereas pending() is best
suited for "does this state machine have a frame pending receipt"
2024-03-01 00:20:47 -05:00
80469ac535 Rename patty_ax25_if_ready() to if_pending()
Rename patty_ax25_if_ready() to if_pending() in src/if.c, as well as in
each driver implementing this method and any direct invocations of said
driver methods
2024-03-01 00:20:47 -05:00
b97b927e0c Remove unused patty_ax25_if_pending()
Remove unused patty_ax25_if_pending() from src/if.c, as well as from all
drivers implementing this method
2024-03-01 00:20:47 -05:00
50d0af3f35 Remove unused patty_ax25_sock_recv_pending() 2024-03-01 00:20:47 -05:00
92164908aa Remove declaration of unimplemented method
Remove declaration of unimplemented method from include/patty/kiss/tnc.h
2024-03-01 00:20:47 -05:00
530d2a4555 Add bin/tncd.8 2024-03-01 00:20:47 -05:00
65ae821342 Re-establish broken APRS-IS connections
Re-establish broken APRS-IS connections in src/aprs_is.c; when read() or
write() sets errno to EIO, attempt at most 3 times to re-establish the
APRS-IS connection per read()/write() failure; if the maximum number of
attempts is met, the I/O operation is considered a total failure
2024-03-01 00:20:47 -05:00
88743a5754 Decouple interface names from patty_ax25_if
Changes:

    * Remove interface name argument from patty_ax25_if_new()

    * Add interface name argument to patty_ax25_server_if_add()

    * Add interface name argument to patty_daemon_if_add()

    * In src/server.c, implement 'struct if_entry' to hold the interface
      name, file descriptor, and pointer to a patty_ax25_if object, to
      recouple names to their respective interfaces

    * Add a return argument to patty_bin_if_create() to store a pointer
      to a new interface name created from a declaration
2024-03-01 00:20:47 -05:00
61c17f8026 Skip non-SOCK_STREAM in aprs_is_connect() 2024-03-01 00:20:47 -05:00
fa34ba9e7c Attempt to set raw attributes on new socket PTYs
Attempt to set raw attributes on new socket PTYs to fix an issue on
Linux wherein any data written to a socket before the PTY subordinate
has been opened would be looped back in canonical mode, causing
frame errors; if tcsetattr() fails (usually on a non-Linux platform),
set errno to 0
2024-03-01 00:20:47 -05:00
9dd27b5924 Remove useless expression from patty_client_ping() 2024-03-01 00:20:47 -05:00
54d6324dea Fix invalid return in patty_ax25_aprs_is_send()
Fix invalid return in patty_ax25_aprs_is_send() wherein the number of
bytes written to APRS-IS was returned, rather than the number of AX.25
packet bytes; the number of bytes read is the more important value as it
is used later for repeating the frame to promiscuous mode SOCK_RAW
sockets
2024-03-01 00:20:47 -05:00
9f6f775ee4 Simplify handle_sock_raw() in src/server.c 2024-03-01 00:20:47 -05:00
754491b692 Update .gitignore 2024-03-01 00:20:47 -05:00
62f4f2ca7c Improve bin/tncd.c
Changes:

    * Ensure TNC PTYs are closed on error

    * Instead of waiting indefinitely, use patty_client_ping() to poll
      the status of the patty daemon to exit in a timely manner
2024-03-01 00:20:47 -05:00
e053d6cdbc Drop patty_kiss_tnc_recv() from handle_sock_raw()
Refactor handle_sock_raw() in src/server.c to remove usage of
patty_kiss_tnc_recv() in favor of its component methods:

    * patty_kiss_tnc_fill()
    * patty_kiss_tnc_drain()
    * patty_kiss_tnc_ready()
    * patty_kiss_tnc_flush()
2024-03-01 00:20:47 -05:00
50eaef806d Reset TNC command state on frame end 2024-03-01 00:20:47 -05:00
26716a5b2a Fix handling of SOCK_RAW frames
Fix issue handling SOCK_RAW frames wherein patty_ax25_sock_send() is
used instead of patty_ax25_if_send() to send frames through the
interface bound to the socket
2024-03-01 00:20:47 -05:00
bec778de7b Implement bin/tncd.c
Implement bin/tncd.c to expose a network interface as a KISS TNC device
over a PTY
2024-03-01 00:20:47 -05:00
3cf9d4093a Add patty_client_read(), patty_client_write()
Add patty_client_read(), patty_client_write() to allow direct I/O with
a pattyd(8) process from a patty_client object
2024-03-01 00:20:47 -05:00
df84f68678 Prevent server dying on invalid client requests 2024-03-01 00:20:47 -05:00