Commit Graph

88 Commits

Author SHA1 Message Date
Frank Rolsted Jensen 299cfcabb5 fix mssing deref of tty data when destroyed 2024-03-21 13:03:43 +01:00
Frank Rolsted Jensen b47cb98a69 Comments updated 2023-10-13 09:24:44 +02:00
Frank Rolsted Jensen cb6509861f Client index included in debug output 2023-10-13 09:23:18 +02:00
Frank Rolsted Jensen 2f0cea6f73 fix mutex unlock if open fails 2023-10-13 09:21:25 +02:00
Frank Rolsted Jensen 015da8a55e Allow multiple clients to open the ttynvt device
This patch allows multiple clients to open the ttynvt device at the same time.
This is useful if an application wants to get/set termios (ioctls) while the
device is already opened by an other application.
2023-10-04 10:53:39 +02:00
Kim Woelders 4fce33a5d7 ttynvt version 0.16 v0.16 2023-03-13 09:40:44 +01:00
Kim Woelders b2115e5fea nvtsrv: Optionally echo all input from client 2023-02-17 06:51:27 +01:00
Kim Woelders b25eb00bc5 nvtsrv: Use nvt_log for printing output 2023-02-17 06:50:47 +01:00
Kim Woelders b6faf87c3a nvtsrv: Input processing changes, send all from console 2023-02-17 06:45:20 +01:00
Kim Woelders 674ed45ebf nvttest: Use nvt_log for printing output 2023-02-17 06:45:20 +01:00
Kim Woelders f02de1ae99 nvttest: Write more data 2023-02-17 06:45:20 +01:00
Kim Woelders b65d44abe5 ttynvt: Ignore ioctls entirely in raw mode
Without this minicom Tx does not reach the server.
There may be better solutions.
2023-02-16 18:39:29 +01:00
Kim Woelders d1f46f7dbe ttynvt: Enable disabling telnet processing
Similar to suggestion by Jo Luxer:
"Make applications work, which expect a tty but the remote end is just a
network port."
https://gitlab.com/lars-thrane-as/ttynvt/-/merge_requests/9
2023-02-16 17:16:21 +01:00
Kim Woelders 20c393c053 ttynvt: Add some parentheses for clarity
Not strictly required.
2023-02-16 11:39:43 +01:00
Kim Woelders 02d90b7634 nvttest: Add test tool 2023-02-15 19:33:41 +01:00
Kim Woelders 4e14ef1956 nvtsrv: Add test server 2023-02-15 19:33:41 +01:00
Kim Woelders d0bf492b10 ttynvt: Some cosmetics in the telnet department 2023-02-15 19:33:41 +01:00
Kim Woelders 84c54c5504 socket: Add server socket fucntions
About to be used in test code.
2023-02-15 19:33:41 +01:00
Kim Woelders a978e86c82 socket: Move host:port parsing to socket function 2023-02-15 19:33:41 +01:00
Kim Woelders a49f95a300 build: Move stuff to be shared to lib/ (nvt_log, socket) 2023-02-15 19:33:41 +01:00
Kim Woelders ac58d1a470 ttynvt: Move socket function to seperate file 2023-02-15 19:33:41 +01:00
Kim Woelders cc038383fe autofoo: Move warning flags setup to configure.ac 2023-02-15 19:33:41 +01:00
Kim Woelders ad077571f8 ttynvt: Optionally add delay during close
Optionally "Give network and remote end some time to close the
connection".

More or less like suggested by Jo Luxer:
https://gitlab.com/lars-thrane-as/ttynvt/-/merge_requests/4
2023-02-15 19:33:41 +01:00
Kim Woelders 8bf4b7705d ttynvt: Add overall access lock
Different processes or threads accessing the device simultaneously or
rapidly after each other could cause problems.

Based on suggestion by Jo Luxer:
https://gitlab.com/lars-thrane-as/ttynvt/-/merge_requests/4
2023-02-15 19:33:41 +01:00
Kim Woelders cac5be0ddc ttynvt: Some refactoring
Move ttynvt_release() to avoid forward declaration.
Introduce _ttynvt_ctx_create/destroy().
2023-02-15 19:33:41 +01:00
Kim Woelders 3ab1dd5cc7 ttynvt: Avoid potential "net read error" in _read_net() when closing
ttynvt_release() may be called when the poll thread is blocked in a
read(FD_NET) (maybe also read(FD_MASTER) - not sure).
So ttynvt_release() sets rel_pending before closing the fd, but too late
as the read() will return an error when the fd is closed, and before the
thread is cancelled.

Now we cancel/join the thread before closing the file descriptor(s).
2023-02-15 19:33:41 +01:00
Kim Woelders 94bd59e1e0 ttynvt: Partial read fix
Somehow forgotten initially.
2023-02-15 19:33:41 +01:00
Kim Woelders 5fb11097e1 logging: Log to stderr instead of stdout
Logging to stdout often becomes garbled due to the multiple treads
involved.
2023-02-12 10:22:26 +01:00
Kim Woelders 895cfffc6b logging: Add quiet option
Mostly for debug?
Sometimes logging changes timing.
2023-02-12 10:22:26 +01:00
Kim Woelders 6e5c44eb29 logging: Some refactoring 2023-02-10 13:19:02 +01:00
Kim Woelders 05b9b13b04 ttynvt: Tweak some log/debug messages 2023-02-10 13:18:49 +01:00
Kim Woelders 9e99ec69b4 configure.ac: Cleanups
- Drop pkg_version/pkg_revision stuff
- Drop obsolete AC_HEADER_STDC
2022-08-19 07:18:26 +02:00
Kim Woelders 72f0058e27 Add some compiler warnings 2022-08-19 06:45:48 +02:00
Kim Woelders 50a6b600bf ttynvt version 0.15 v0.15 2022-08-10 07:25:52 +02:00
Kim Woelders 465f31ba87 Avoid some cast-qual warnings 2022-01-16 20:10:48 +01:00
Frank Rolsted Jensen 90c5387613 Clear pollin flag when input buffer is flushed
The pollin flag must be cleared when the input buffer (pty slave) is
flushed. This ensures that the POLLIN event is not signaled to the application,
when there is not data to read.
2022-01-16 19:43:37 +01:00
Frank Rolsted Jensen 6bf10a6901 Support for software flow control 2021-10-29 17:57:34 +02:00
Kim Woelders f759c0e3cc Correct termios2 baud rate calculation
Based on suggestion by joluxer <linuxer@quantentunnel.de>.
2021-06-18 17:10:22 +02:00
Kim Woelders 0606891b78 Add indent profile + formatting tweak 2021-06-18 16:17:13 +02:00
joluxer 899596fd5b Use all baudrate for traditional termios known to linux kernel 5.10. 2021-06-18 16:17:13 +02:00
joluxer a21ba0cb9c Make some variable storage bit width agnostic for transport. 2021-06-18 16:17:13 +02:00
Kim Woelders 8f03384964 print_help(): Add missing options to run in foreground
Suggested by joluxer <linuxer@quantentunnel.de>.
2021-06-18 16:17:13 +02:00
Kim Woelders b314659125 Fix potentially incorrect speed check
We don't know if tio is termios or termios2.
2021-06-18 07:21:53 +02:00
Kim Woelders 42a4e2e062 ttynvt_ioctl(): Cleanups around TCSET.. handling
Avoid nested switches and unnecessary block level.
2021-06-18 07:21:53 +02:00
Kim Woelders 0b402cdb6b Remove pointless CFLAGS_OPT
It would normally be overridden by the default automake CFLAGS="-g -O2".
2021-06-14 18:35:10 +02:00
Kim Woelders 302ed6d796 Include asm/ioctls.h for TCSETSF2 and friends
Some targets appear to need that.
2021-01-20 18:34:53 +01:00
Kim Woelders bf11b1dd15 Add support for termios2 ioctls
Based on patch by Thomas Shaddack <shaddack@shaddack.mauriceward.com>
https://www.improwis.com/projects/sw_SerialOverIP_RFC2217/
2021-01-14 07:41:43 +01:00
Kim Woelders 33de2e875c Add a couple of debug logs
From patch by Thomas Shaddack <shaddack@shaddack.mauriceward.com>
https://www.improwis.com/projects/sw_SerialOverIP_RFC2217/
2021-01-14 07:40:40 +01:00
Kim Woelders eccd32fdfb telnet_param.h: Show hex codes too
Inspired by Thomas Shaddack <shaddack@shaddack.mauriceward.com>
https://www.improwis.com/projects/sw_SerialOverIP_RFC2217/
2021-01-14 07:19:05 +01:00
Kim Woelders 089b733f27 Indent 2021-01-14 07:18:48 +01:00