Commit graph

507 commits

Author SHA1 Message Date
XANTRONIX Development
2f5c877762 Fix uninitialized memory in patty_kiss_tnc_driver() 2024-03-01 00:20:47 -05:00
XANTRONIX Development
4b1e0ff46d Better variable name in patty_kiss_tnc_recv() 2024-03-01 00:20:47 -05:00
XANTRONIX Development
16b46168b2 Remove unneeded variable in patty_kiss_tnc_recv() 2024-03-01 00:20:47 -05:00
XANTRONIX Development
bd1238e0bd Improve frame encoding error handling, reporting
Changes:

    * Improve error detection in patty_ax25_frame_encode()

    * Make patty_ax25_frame_encode() set EOVERFLOW when encoding beyond
      the caller specified limit

    * Make patty_ax25_frame_encode_reply_to() set EOVERFLOW when
      encoding beyond the caller specified limit
2024-03-01 00:20:47 -05:00
XANTRONIX Development
30b17d337b Fix #include cycle in include/patty/kiss/tnc.h 2024-03-01 00:20:47 -05:00
XANTRONIX Development
00fd626757 Fix patty_conf_read() backslash escape bug
Fix patty_conf_read() bug wherein backslash escapes simply did not
work as intended
2024-03-01 00:20:47 -05:00
XANTRONIX Development
cb33d799ff Implement patty_ax25_if_driver
Changes:

    * Implement patty_ax25_if_driver type, providing a vtable with
      pointers to methods implementing an AX.25 interface PHY

    * Implement patty_ax25_if_name() to return a pointer to the name
      string of an AX.25 interface

    * Decouple patty_kiss_tnc from src/if.c using patty_ax25_if_driver

    * Remove port input/output arguments from patty_kiss_tnc_send()
      and patty_kiss_tnc_recv(), respectively; use 0 as the default,
      but keep the port argument in patty_kiss_frame_send()

    * Implement patty_ax25_if_fd() to return file descriptor backing a
      PHY; use this rather than patty_kiss_tnc_fd() in src/server.c to
      further decouple interfaces from their implementation

    * Remove 'enum patty_ax25_if_type' type; refactor constructor
      patty_ax25_if_new() to no longer take this as an argument, but
      rather a patty_ax25_if_driver to use to instantiate the PHY
      with the information pointer passed

    * Break out patty_kiss_tnc code from src/kiss.c into src/tnc.c,
      leaving only patty_kiss_frame_send() in the original; this is
      needed to prevent a cyclic dependency within patty_ax25_sock and
      other areas

    * Rename patty_bin_if_config() to patty_bin_if_create(); a separate
      patty_bin_if_config() will likely be created later as necessary
      to change an existing interface

    * Split PHY-specific interface configuration code into separate
      delegates in bin/if.c

    * Implement usage of patty_error to better capture internal error
      states not currently representable with semantic error numbers
      while configuring and instantiating PHYs

    * Pass patty_error object to patty_bin_kiss_config() to receive
      detailed error information
2024-03-01 00:20:47 -05:00
XANTRONIX Development
356b25fd94 Implement src/error.c
Implement src/error.c to provide the patty_error type, to allow easy
error string formatting, error state checking, and error clearing
2024-03-01 00:20:47 -05:00
XANTRONIX Development
2c3a461ee9 PATTY_AX25_ADDRESS_LEN -> PATTY_AX25_ADDRSTRLEN 2024-03-01 00:20:47 -05:00
XANTRONIX Development
6213acc06f Update .gitignore 2024-03-01 00:20:47 -05:00
XANTRONIX Development
a06a7d3ac7 Remove unused struct if_context from bin/pattyd.c 2024-03-01 00:20:47 -05:00
XANTRONIX Development
c201dba833 Fix -f flag in bin/pattyd.c 2024-03-01 00:20:47 -05:00
XANTRONIX Development
f513f252bc Consistently mention [tioarg ...] in pattyd(8) 2024-03-01 00:20:47 -05:00
XANTRONIX Development
0886730131 Add bin/ax25dump.8
Initial implementation of bin/ax25dump.8 man page

Other changes:

    * Make consistent mention of [tioarg ...], rather than tioflags
      or tioargs

    * Small bin/Makefile improvements to assist in installing man
      pages for different manual sections
2024-03-01 00:20:47 -05:00
XANTRONIX Development
cc530fcccc Use getopt_long() to reject flags w/usage output 2024-03-01 00:20:47 -05:00
XANTRONIX Development
bb118be462 Implement daemonization in bin/pattyd
Implement daemonization in bin/pattyd using daemon(3)
2024-03-01 00:20:47 -05:00
XANTRONIX Development
188d43f98d Improve error reporting, CLI code reuse
Changes:

    * Move network interface configuration logic from bin/pattyd.c to
      bin/if.c; implement a more robust state machine

    * Move KISS TNC configuration code from bin/pattyd.c to bin/kiss.c

    * Ensure configuration file name, line number, and erroneous part
      of an expression are clearly indicated upon failure

Other changes:

    * Improve bin/Makefile to rebuild objects when accompanying header
      files change

    * Refer to HEADERS_SUBDIR, not HEADER_SUBDIR, in Makefiles
2024-03-01 00:20:47 -05:00
XANTRONIX Development
4c2f92af22 Move examples/ax25dump.c to bin/
Changes:

    * Move examples/ax25dump.c to bin/ax25dump.c; deprecate the other
      similar program, examples/decode.c

    * Implement support for reading KISS frames from a file, much in
      the manner of examples/decode.c
2024-03-01 00:20:47 -05:00
XANTRONIX Development
24c94c25dc More .gitignore updates 2024-03-01 00:20:47 -05:00
XANTRONIX Development
34b854c6cc Initial implementation of doc/pattyd.conf.5
Add doc/pattyd.conf.5 to document the pattyd configuration file format
2024-03-01 00:20:47 -05:00
XANTRONIX Development
db9078e1d2 Add more .gitignore entries 2024-03-01 00:20:47 -05:00
XANTRONIX Development
8be30c5584 Mention bug re: -f flag in bin/pattyd.8 2024-03-01 00:20:47 -05:00
XANTRONIX Development
939f849e43 Fix minor mdoc warning in bin/pattyd.8 2024-03-01 00:20:47 -05:00
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