Package: ser2net
Version: 3.5-2
Severity: normal

Dear Maintainer,

I have been using ser2net to expose a device connected a serial port of microPC.

As the original host application was showing some spurious errors on large transfers,
I enabled tracelogs (see config below).


The tracelogs showed strange behaviour: On a certain command, the device should have responded with a sequence of 2 replies, but the tracelogs showed basically a repeat of the first reply.

I assume this is due to the logging function looking at the beginning of the to-be-sent buffer, as the reply happened to include a \377 (which is the telnet escape char) which was duplicated.


Excerpt from strace:
# command below should elicit a 2x5 byte response, starting with 0x35 0x1c and 0x35 0x1b
read(0, "5\32\350\0S", 64)              = 5
write(2, "2021/09/14 14:27:18 tcp  35 1a e8 00 53           |5...S|\n", 58) = 58
write(1, "5\32\350\0S", 5)              = 5
# so far correct

read(1, "5\34\377\377S", 32)            = 5
write(2, "2021/09/14 14:27:18 term 35 1c ff ff 53           |5...S|\n", 58) = 58
# device answers, first packet, logging is correct

--- SIGUSR1 {si_signo=SIGUSR1, si_code=SI_TKILL, si_pid=21545, si_uid=0} ---
read(1, "5\33\0\4S", 28)                = 5
write(2, "2021/09/14 14:27:18 term 35 1c ff ff ff           |5....|\n", 58) = 58
# device answers, second packet. Logging is wrong. Should be 35 1b 00 04 53
# note that we actually see the first packet, and the last 53 is replaced by ff # I assume this is due to the already-escaped buffer below being logged from the
# beginning:

--- SIGUSR1 {si_signo=SIGUSR1, si_code=SI_TKILL, si_pid=21545, si_uid=0} ---
--- SIGUSR1 {si_signo=SIGUSR1, si_code=SI_TKILL, si_pid=21545, si_uid=0} ---
write(0, "5\34\377\377\377\377S5\33\0\4S", 12) = 12
# both answers go over the network in one packet, doubling the \377 = ff is correct due to telnet escape rules

Unfortunately cannot update the microPC to stable to verify this is not in the most recent version.

Functionality of the packet is not affected, but it cost me several hours of debugging time to find the
logging is incorrect, as opposed to the device malfunctioning.

Thanks for your efforts,



Andreas Beck



-- System Information:

Debian Release: 10.10

  APT prefers oldstable-updates

  APT policy: (500, 'oldstable-updates'), (500, 'oldstable')

Architecture: amd64 (x86_64)



Kernel: Linux 4.19.0-17-amd64 (SMP w/4 CPU cores)

Kernel taint flags: TAINT_WARN, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE

Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)

Shell: /bin/sh linked to /usr/bin/dash

Init: systemd (via /run/systemd/system)

LSM: AppArmor: enabled



Versions of packages ser2net depends on:

ii libc6     2.28-10

ii libwrap0  7.6.q-28

ii lsb-base  10.2019051400



ser2net recommends no packages.



Versions of packages ser2net suggests:

ii telnet  0.17-41.2



-- Configuration Files:

/etc/ser2net.conf changed:

BANNER:banner:\r\nser2net port \p device \d [\s] (Debian GNU/Linux)\r\n\r\n

TRACEFILE:trace:/tmp/ser2net\p.log

4711:telnet:600:/dev/ttyUSB0:38400 8DATABITS NONE 1STOPBIT tb=trace hexdump timestamp

4712:telnet:600:/dev/pts/0:38400 8DATABITS NONE 1STOPBIT tb=trace hexdump timestamp





-- no debconf information

Reply via email to