Git Product home page Git Product logo

ser2net's People

Contributors

cminyard avatar ffontaine avatar jameshilliard avatar jpangburn avatar jpewdev avatar kaechele avatar konradgraefe avatar longshine avatar mhei avatar mistydemeo avatar plars avatar sbertin-telular avatar sebastien-petitdemange avatar uplogix-mmcclain avatar yegorich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ser2net's Issues

telnet-brk-on-sync man page issues

Hi,

in the ser2net.yaml man page, telnet-brk-on-sync is spelled telnet_brk_on_sync, and the sentence "If a telnet is received" is probably missing the word "sync".

Greetings
Marc

About section UDP instead of UCP

I think the about text of the repo meant to say TCP/UDP instead of

Serial to network interface, allows TCP/UCP to serial port

disconnected USB won't release socket

I have found an issue using Ser2net 4.1.1 with gensio 1.3.1 using the following configuration, where if the USB device is disconnected while a Socket is established then something goes wrong, even if only disconnected briefly. The socket remains established and un-usable. Unfortunately, the socket remains even after the remote side has disconnected, resulting in the channel becoming unavailable. I would expect when the USB device is destructed that the associated socket would drop, releasing local resources. I also note that it cannot be disconnected using the control console. The only method I have found to recover is to stop and restart ser2net other than rebooting. I am using a Raspberry Pi 3B "8 (jessie)" with USB to Serial adaptors on a USB HUB.

I am not sure what logs I can supply that would help. As I don't know if the problem is with gensio or with ser2net. Whereas the problem is very reproducible and I suspect would demonstrate on any other Linux system.

Your assistance is appreciated.

%YAML 1.1
---

admin:
  accepter: telnet,1999

define: &banner1 Ser2net \N,\p,\d,\I \r\n

connection: &2001
  accepter: telnet,tcp,2001
  timeout: 600
  enable: on
  connector: serialdev,/dev/ttyTS11,115200n81,LOCAL
  options:
    banner: *banner1
    kickolduser: true

"Segmentation fault" from "Sending Break"

Hello, I have been very successfully using ser2net on Raspberry Pi 3b+ running Raspbian GNU/Linux 10 (buster), as to provide a connection from Telnet to Serial Ports. Replacing older Cisco Terminal Servers.
Thank you. - Big Fan of this work

I have found recently that when I send a "Send Break" I see that Ser2net does a Segment Fault, using Ser2net Version 4.3.3.
I have just built the most recent gensio 8/14/2021 "Initialize sockaddr structures" and still see the problem. And do not see a more recent version of Ser2net. my GIT pulls are up to date on the Master.

Output

tns@thqlccpmsts03:~/ser2net $ sudo /usr/sbin/ser2net -c /etc/ser2net.conf -d -l
Unable to start mdns: Operation not supported
Segmentation fault
tns@thqlccpmsts03:~/ser2net $ 

Version

tns@thqlccpmsts03:~/ser2net $ sudo /usr/sbin/ser2net -v
/usr/sbin/ser2net version 4.3.3

Config File

tns@thqlccpmsts03:~/ser2net $ cat /etc/ser2net.conf
%YAML 1.1
---

admin:
  accepter: telnet,1999

define: &banner1 Ser2net \N,\p,\d,\I \r\n

connection: &2002
  accepter: telnet,tcp,2002
  timeout: 600
  enable: on
  connector: serialdev,/dev/ttyTS2,115200n81,LOCAL
  options:
    banner: *banner1
    kickolduser: true

connection: &3002
  accepter: telnet,tcp,3002
  timeout: 600
  enable: on
  connector: serialdev,/dev/ttyTS2,9600n81,LOCAL
  options:
    banner: *banner1
    kickolduser: true

FYI - I do not see this segment fault on older version 2.9.1 using RiPi Jessy.

I had expected to see more debug. Where I am not an expert on this, so please let me know if there is more and how to get it. And if there is a way to get the version of gensio that I built, beside saying the lastest. It might be nice for Ser2net's -v command to also print the version of the gensio library it is using.

Thanks in advance for any help about the Send Break.

ser2net 3.5 in Debian 10 hangs when data length to send is 0

I used ser2net 2.9.1 from Debian 9 without problems. Since updating to ser2net 3.5 with Debian 10 I faced an issue that my application does not longer work. After doing a git bisect I figured out that with commit be3cffd the problem was introduced.

This seems to be the problem:

+    to_send = buf->cursize - *pos;
+    if (to_send <= 0)
+       /* Don't send empty packets, that can confuse UDP clients. */
+       return;
+
+    reterr = sendto(netcon->fd, buf->buf + *pos, to_send,

I see that with that the code ends up in a loop that point where to_send is negative,

Add support for arbitrary baudrates

I'm using an FTDI device (USB/Serial) with a non-standard baudrate (1250000). I can't use ser2net because it refuses such baudrate. I can work on adding support for arbitrary baudrates if that sounds useful.

/etc/ser2net/ser2net.yaml not used by default

Using freshly compiled ser2net version 4.3.3

I read this as /etc/ser2net/ser2net.yaml is used by default:

/usr/local/sbin/ser2net: Valid parameters are:
  -c <config file> - use a config file besides /etc/ser2net/ser2net.yaml

However this is not what I see on my computer:

$ sudo /usr/local/sbin/ser2net 
Unable to start mdns: Operation not supported
~/src/ser2net-4.3.3$ sudo ps aux | grep ser2net
xxxxxx  13451  0.0  0.0   6720   520 pts/0    S+   20:31   0:00 grep --color=auto ser2net

$ sudo /usr/local/sbin/ser2net -c /etc/ser2net/ser2net.yaml 
Unable to start mdns: Operation not supported
~/src/ser2net-4.3.3$ sudo ps aux | grep ser2net
root     13464  0.0  0.0   4360   304 ?        S    20:33   0:00 /usr/local/sbin/ser2net -c /etc/ser2net/ser2net.yaml
xxxxxx  13466  0.0  0.0   6720   556 pts/0    S+   20:33   0:00 grep --color=auto ser2net

The program starts only if configuration file name provided explicitly with -c option.

ser2net version 3.5.3 crashed when reconnection occured from client side.

Hi. thank you for wonderful ser2net.

I am using ser2net 3.4.3( committed on29 Jun 2020 4f073e6)

as title, it is crashed when reconnection occurred from client side.

1st connection is ok.
but when 2nd connection, the ser2net(v3.5.3) is crashed.

I see the it is not release version but, in previous version(3.5.2), because some data are dropped, i moved 3.5.3.

when the code executed with gdb, the double free occurred in dataxfer.c at 2025 line when 2nd connection establish.

thank you.

Tracefile month as number format gives 0-11 for months

I'm wondering if the tracefile month as number formatter 'm' is working as planned. Years and days are correct to the calendar, but the range for months is 0-11, not 1-12

TRACEFILE:test:/var/log/test_\p-\Y-\m-\D_\H\i\s.log

On 2021 08 26, a logfile with a month of 7 is generated. I'm thinking this should be 8 (for August) in this example.
test_2013-2021-7-26_145329.log

This is the relevant code, in either ser2net_str.c in master or dataxfer.c in 3.5x

            case 'D':
            {
                char d[10], *dp;
                snprintf(d, sizeof(d), "%d", time->tm_mday);
                for (dp = d; *dp; dp++)
                    op(data, *dp);
                break;
            }

Maybe it should be time->tm_mday + 1 ?

Hex escapes not working in banner

I wanted to use the banner to place port info (rate, tty, etc) in my xterm title.
Works if I directly use an esc char, but not if I use \x1b.

For example: BANNER:title:\x1b]0;port \p device \d\a

The problem is in dataxfer.c. isdigit() is being called instead of isxdigit().

Patch attached.

ser2net.patch.gz

Ser2net ability to handle pseudo-serial ports.

Linux offers the ability to provide simulated serial ports as /dev/pty.
ser2net will accept these ports in /etc/ser2net.conf and run with this configuration without issuing errors, however without function either.
Could you please take a look, if providing ser2net compatibility with /dev/ptys would have been a big effort or only a minor change?
Thank you!

yaml configuration for TRACEFILE?

First off - thanks for such a great tool! It meets most of what I need for a project that I'm working on.

What I think I need is an example (in the new yaml format) to specify the trace file, similar to the old TRACEFILE:name:value form. I've tried setting up a define: and that seems to work for banners, but not for tb/tr/t2 options. I've also tried using straight-up strings with these options with no joy.

Here is what my current configuration looks like:

%YAML 1.1

define: &confver 1.0
define: &banner1 This is a banner for port \N(\p)\r\n
define: &log1 "/var/log/cicada0"

connection: &con00
accepter: telnet(rfc2217),tcp,7000
connector: serialdev,/dev/ttyUSB0,115200n81,local
options:
banner: *banner1
tb: *log1

In syslog, I continue to get an error:
/var/log/user.log:Jan 28 21:54:19 beaglebone ser2net: Tracefile /var/log/cicada0 not found, it will be ignored

I get this error both when I use the indirection (*log1) or when I put an explicit string there (with and without double quotes).

I turned on DEBUG in the yaml parsing and it looks like the define: is properly parsed (e.g. same as banner1).

Normally I wouldn't care about this but the application is for serial port data logging, and the tracefile seemed to be a perfect fit for that.

Do you have an example (in the yaml format) for specifying a tracefile?

Could you add feature for support client mode?

Hi,
First , ser2net is a very great tool.
In many cases, openwrt device is in LAN, need to connect to the server on the cloud, ser2net recevie modbus tcp request from cloud server and translates to modbus rtu .
so could you add tcp client mode to support: send a handshake packet to server when connected to server and send heartbeat packet in period.

UDP: max-connections: not sending serial data to all connections

I might be doing something wrong because I thought this worked before.
Here is my config on server:

connection: &server
  accepter: udp,2222
  connector: serialdev,/dev/ttymxc2,115200n81,local
  options:
    max-connections: 5

On client Ubuntu machine. I run socat UDP:<server ip address>:2222 - on two different terminals and each terminal can send to the serial port on the server, but the serial data only goes to the last UDP connection to talk to it. I expected it to go to both UDP "connections" like TCP does.

tcpdump on server: (ip addresses removed)

00:51:37.934721 IP CLIENT.53830 > SERVER.2222: UDP, length 5
00:51:41.778652 IP 1CLIENT.53844 > SERVER.2222: UDP, length 5
00:51:44.259535 IP SERVER.2222 > CLIENT.53844: UDP, length 1
00:51:44.408302 IP SERVER.2222 > CLIENT.53844: UDP, length 1
00:51:44.581623 IP SERVER.2222 > CLIENT.53844: UDP, length 1
00:51:52.270478 IP CLIENT.53830 > SERVER.2222: UDP, length 7
00:51:54.420475 IP SERVER.2222 > CLIENT.53830: UDP, length 1
00:51:54.545983 IP SERVER.2222 > CLIENT.53830: UDP, length 1

Not releasing USB device when disabling port

I have an application where a device connected via USB can get commands from a script, written directly to /dev/ttyUSB0, or from an app connected via TCP port 4030. The script can communicate via the device file after boot until a connection is made on 4030, and then it can never write to it again, even after disabling the port using the ser2net control port (setportenabled 4030 off). IMO, ser2net shouldn't keep the device tied up while the port is disabled.

[Support Request] Hardware serial at the host and client

I'm trying to use ser2net at "both ends" of a serial connection, that is:

Hardware serial <-62k8N2-> ser2net on Raspi OS <-> tcp local network <-> ser2net on Raspi OS <-62k8N2-> Hardware serial

I can successfully get as far as connecting to a hardware serial over the network from a client machine using a pty, but I can't work out how to link a hardware serial back up at the client side. I guess I'm asking if ser2net can be used as "net2ser"?

I'm sorry to have to ask, but I simply can't find any clues in my research!

More info.: I'm trying to communicate between a Yaesu FT857d radio and face-place control panel over IP.

just a question: what does ser2net transmit in raw mode?

Please allow me a question, since I was not successful in replacing a ser2net connection to a blackbox program by a direct TCP connection, both on localhost.

Which protocol is used for a raw ser2net connection?
TCP - UDP?
Every byte received on the serial port will be passed 1-1 to the TCP-UDP socket, OK?
Does is use some kind of wrapping around? X-on X-off? Checksums...?

Thankyou for your enlightment.

Unable to start mdns: Out of memory

I am trying to use ser2net to make a zigbee usb stick available to containers in a kubernetes cluster. However i am stuck with an error that i ony get when running ser2net in a container.

When running in a container i get a Unable to start mdns: Out of memory error and ser2net does not start. I can reproduce this on docker, k3s and podman using a container built with the following dockerfile:

FROM debian:bookworm-slim
RUN apt update && apt install -y ser2net && rm -rf /var/lib/apt/lists/*
CMD ["ser2net"]

I tried running ser2net -d -l -l -c <config file> in the container as advised in openhab/openhab-core#1511 but there is no additional output.

Option to translate "backspace" key to CTRL-H

We have ser2net running on a single board computer (SBC- https://libre.computer/products/boards/roc-rk3328-cc/ running Debuan Buster from this armbian image: https://www.armbian.com/renegade/

When anyone telnets to a serial device hosted on the SBC, they are unable to use the "backspace" key and have to instead use CTRL-H. Som programs like Minicom have a feature to turn on the auto-translation of BS to CTRL-H. Would ser2net be able to also provide this feature? I would think that adding this feature would be fairly simple.

I've spent countless hours trying to tinker around with stty settings on both my client PC and the SBC running ser2net without any luck. It would be awesome to be able to enable this with an addition to the config file.

Unable to establish ckermit connection with ser2net 4.3

Hello,

With ser2net 4.3 I cannot establish a kermit connection anymore.
According to the page https://github.com/cminyard/ser2net kermit should be working with ser2net.
However, I found no working configuration to make it work.

The following configuration is done on the server:

%YAML 1.1
---
define: &confver 1.0

connection: &my-board
  accepter: telnet(rfc2217),15010
  connector: serialdev,
    /dev/ttySER1-3,
    115200n81,
    local
  options:
   max-connections: 5
  1. When using telnet, the connection is established correctly:
$ telnet localhost 15010
Trying ::1...
Connected to localhost.
Escape character is '^]'.
  1. When using ckermit, the connection fails as follow:
$ kermit -c -j localhost:15010
 DNS Lookup...  Trying 127.0.0.1...  Reverse DNS Lookup... (OK)
 localhost connected on port 15010
 Negotiations................................
*************************
The Telnet server is not sending required responses.

?Telnet waiting for response to DO KERMIT

You can continue to wait or you can cancel with Ctrl-C.
In case the Telnet server never responds as required,
you can try connecting to this host with TELNET /NOWAIT.
Use SET HINTS OFF to suppress further hints.
*************************
..........................................................................................
?Telnet Protocol Timeout - connection closed
?Telnet waiting for response to DO KERMIT
?Telnet Option negotiation error.
can't open host connection
  1. Note that using ckermit on the control port (15000) does work:
$ kermit -c -j localhost:15000
 DNS Lookup...  Trying 127.0.0.1...  Reverse DNS Lookup... (OK)
 localhost connected on port 15000
Connecting to host localhost:15000
 Escape character: Ctrl-\ (ASCII 28, FS): enabled
Type the escape character followed by C to get back,
or followed by ? to see other options.
----------------------------------------------------
->

I am using the following environment:

  • Debian 11.1
  • ser2net 4.3.3-1
  • ckermit 305~alpha02-1

Syntax Change 3.x -> 4.0

Many home automation projects use an older version of the ser2net syntax to forward serial ports over the network.

For example, zigbee2mqtt uses 20108:raw:0:/dev/ttyACM0:115200 8DATABITS NONE 1STOPBIT for their example here: https://www.zigbee2mqtt.io/how_tos/how_to_connect_to_a_remote_adapter.html

With that syntax going away (or already gone, not sure based on documentation), I'm trying to find an updated syntax.

As such, I have the following yaml:

%YAML 1.1
---
define: &conbee "/dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE1995807-if00"
connection: &con01
  accepter: tcp,2001
  connector: serialdev,*(conbee),115200n81,kickolduser=true,local
  enable: on

In my case, I get the error: "Error while opening socket" on the remote end. I suspect the issue is with the "raw" state set in the old syntax. I haven't found a matching syntax in either ser2net or ser2net.yaml's man file.

Is there any advice from the devs/users?

proper translation between old and new config format

this is what I have in the old style configuration file /etc/ser2net.conf:
192.168.1.6,4001:raw:600:/dev/usbcom1:115200 8DATABITS NONE 1STOPBIT NOBREAK banner1

with this configuration I can connect from the remote host and work with a com port.

Now I'm trying to do the same with the new style configuration in /etc/ser2net/ser2net.yaml:

connection: &con1
    accepter: tcp,192.168.1.6,4001
    connector: serialdev,/dev/usbcom1,115200n81,local

My terminal connects as before, then nothing.

[Q] How to specify XON/XOFF flow control in ser2net.yaml?

I've been using ser2net with a bunch of serial devices before. So I had for example a Ember Zigbee adaptor connected via:

/etc/ser2net.conf:

#Ember, BitronVideo BV10/2010
10003:raw:0:/dev/zigbee:57600 8DATABITS NONE 1STOPBIT XONXOFF

From the man pages, I'm not able to figure out, how to specify XON/XOFF flow control in the ser2net.yaml.
I simply guessed:

connection: &Zigbee
  accepter: telnet(rfc2217),tcp,2222
  connector: serialdev,
    /dev/zigbee,
    57600n81 local xonxoff
  options:
    mdns: true
    mdns-sysattrs: true

Ser2net seems to accept the xonxoff parameter as in older versions and the tcp connection got established. But I'm still not able to open the remote serial port.

May I ask, if the above is the correct setting in ser2net.yaml equivalent to ser2net.conf above?

warning if old format configuration file is read

Hi,

please consider printing a warning if an old format configuration file is encountered. This will motivate users of the program to migrate to the new yaml format and makes it also easier for distribution packages.

Greetings
Marc

Cannot reconnect after broken connection

Hi,
I can successfully connect my computer A to linux computer B with ser2net using telnet and everything works as intended. However, when connection is broken (for example I remove ethernet cable) and then try to connect again, I cannot do that. Ser2net responds that port is already in use.
It seems like ser2net doesn't even know that it lost connection with device.
Is there any workaround for this issue?

My configuration file looks like this:
3020:telnet:0:/dev/ttyUSB0: 9600

udp connback doesn't work unless accepter is also udp

Using version 4.3.3.

I tried making ser2net act as a client only, which to me, means I don't want an accepter. I set accepter to null and set connback to tcp,localhost,1234 which worked fine.

Then I switched connback to udp,localhost,1234 and I got this error:

ser2net[7903]: Unable to allocate connect back port server, addr udp,localhost,1234: Operation not supported

Then I switched the accepter to be udp,8888 and it now worked as expected. But now ser2net is acting as a server on port 8888 which I don't want.

librt is required unconditionally

In 4f36de5, -lrt was added to the LDFLAGS unconditionally in order to provide clock_gettime. Not all OSs use the librt name; for example, OS X provides clock_gettime in its libc, and doesn't have a library by that name. It would be great to add a check so that -lrt is only passed when necessary.

Telnet issues with RFC2217 and NetSerial

Hi,
I have been working to get ser2net working with the NetSerial PC client (https://pcmicro.com/NetSerial/). I am currently using v3.5.2 of ser2net, but I have seen similar problems with v4.1.8.

When connecting from a PC using the NetSerial client, I get a runaway back and forth of telnet commands (BINARY_TRANSMISSION and SUPPRESS_GO_AHEAD). This problem appears to be similar to the one here: #8. I fixed it for the NetSerial client by modifying the initial values of telnet_cmds[] in dataxfer.c and removing WILL BINARY TRANSMISSION from telnet_init_seq[] in the same file. I don't know if this problem is due to NetSerial's client or the ser2net server.

A second problem occurred when I connected the NetSerial client, then disconnected, then connected again. In this case I got runaway DO/DONT WILL/WONT ECHO commands between the client and server.

I think the second problem is due to a bug in telnet.c in the function telnet_init(). This function sets the cmds member of the telnet_data_t structure to be equal to the passed-in cmds pointer. This means that the telnet_data_t structure has a member that points to the static telnet_cmds[] array in dataxfer.c. The problem is that all telnet data connections will point to this same array.

The telnet_cmds[] array includes state information about the telnet connection. So all telnet data connections share the same state, which of course is not correct since each should be independent. In my test case, disconnecting and reconnecting caused the new connection to continue with the state of the previous connection.

I fixed this problem by changing telnet_init() to copy the telnet_cmds array into a new array that I added to the telnet_data_t structure, and setting the cmds point in this structure to point to the new array. In this way, each connection has its own array of cmds.

unable to forward/open serial port from /dev/ttyACM0 (Ender 3) printer

I have use case where I am trying to to share a serial port over a network

admin:
  accepter: telnet,ipv4,2000

connection: &con01
  enable: on 
  accepter: ipv4,tcp,1234
  connector: serialdev,/dev/ttyACM0,115200n81,local
  options:
    kickolduser: true
    trace-both: /tmp/ser.log

However when I netcat/telnet the the port 1234. I get the error

╰─$ telnet localhost 1234
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Device open failure: Value or file not found
Connection closed by foreign host.

when open the port /dev/ttyACM0 using screen /dev/ttyACM0 115200 everything works. Not sure what the issue is. I have run as my user and root as well to eliminate any issues.

Does this have to do with the ACM device emulating a serial port? and some issues w/ that?

Difficulties to set up ser2net / Unable to start mdns: Operation not supported

Hello,

I'm having some difficulties setting up ser2net on my rpi3b+.

Steps ive done:

Update RPI --

sudo apt update

sudo apt upgrade

--

Download and install gensio 2.2.9 from sourceforge --

wget https://sourceforge.net/projects/ser2net/files/gensio-2.2.9.tar.gz

tar -xzvf gensio-2.2.9.tar.gz

cd gensio-2.2.9/

./configure

make

sudo make install

--

Download and install libyaml 0.2.5 --

wget https://pyyaml.org/download/libyaml/yaml-0.2.5.tar.gz

tar -xzvf yaml-0.2.5.tar.gz

cd yaml-0.2.5/

./configure

make

sudo make install

--

Download and install ser2net 4.3.3 --

wget https://sourceforge.net/projects/ser2net/files/ser2net-4.3.3.tar.gz

tar -xzvf ser2net-4.3.3.tar.gz

cd ser2net-4.3.3/

./configure

make

sudo make install

--

After installation I checked with

dmesg | grep tty

where my serial connector is connected to.

Output:
[54836.730052] usb 1-1.3.1: pl2303 converter now attached to ttyUSB0
[54836.783194] usb 1-1.3.2: pl2303 converter now attached to ttyUSB1
[54836.828199] usb 1-1.3.3: pl2303 converter now attached to ttyUSB2
[54837.039337] usb 1-1.3.4: pl2303 converter now attached to ttyUSB3

I made sure to go to the usr/local/etc/ser2net folder and create a ser2net.yaml file there

from a previous older version of ser2net (Version: 3.5) I got the contents of the .yaml file and I also tried to make the config like the instructions..

Contents from previous installation:
%YAML 1.1

define: &confver 1.0
BANNER:banner:this is ser2net TCP port \p device \d  serial parms \s\r\n
4001:telnet:600:/dev/ttyUSB0:9600 8DATABITS NONE 1STOPBIT banner

When starting with any user results in
->

pi@raspberrypi:~ $ sudo -u pi ser2net
Unable to start mdns: Operation not supported
yaml parsing error at line 4 column 0: could not find expected ':'

Ive also tried putting the ':' where it wanted it but it just gave the same output.

Contents of my file as the instructions told me:

%YAML 1.1
---
define: &confver 1.0
#
define: &banner Connected to port \N(\d)\r\n
#
default:
      name: local
      value: true
      class: serialdev
#
default:
      name: mdns
      value: false
#
default:
      name: mdns-sysattrs
      value: true
#
connection: &con0
      accepter: telnet(rfc2217),tcp,4001
      connector: serialdev,
                 serial/by-path/platform-3f980000.usb-usb-0:1.1.3.1:1.0-port0,
                 9600n81,local

When running with any user results in:

pi@raspberrypi:~ $ sudo -u pi ser2net
Unable to start mdns: Operation not supported

I dont really know what the problem here is as Ive followed the steps that are needed..

no error on duplicate instance

I started ser2net from 2 different console with ser2net -n and both returned no error; by closing the first instance my TCP connection got dropped, and could not connect again, despite the 2' instance of ser2net still running without error.

Since UUCP locking is enabled, and ser2net properly generate locks, i would expect the second instance to not start at all and return error, or return warning and check on the lock in loop until become available.

USB path is not valid?

I'm about to test the mdns discovery feature with ser2net to announce my serial devices for the use with rfc2217.
That's my ser2net config file (device names are symlinked via udev rules):

%YAML 1.1
---
define: &banner \r\nser2net port \p device \d [\B] (Debian GNU/Linux)\r\n\r\n

connection: &Zigbee
  accepter: telnet(rfc2217),tcp,2222
  connector: serialdev,
    /dev/zigbee,
    57600n81,local
  options:
    mdns: true
    mdns-sysattrs: true
    mdns-name: Zigbee

connection: &BlueGiga
  accepter: telnet(rfc2217),tcp,2223
  connector: serialdev,
        /dev/bluegiga,
        115200n81,local
  options:
    mdns: true
    mdns-sysattrs: true
    mdns-name: Bluegiga

When starting the ser2net service it complains about an invalid usb path for the second device, the BlueGiga serial bluetooth adaptor:

SerialPi-1:/etc# systemctl status ser2net
● ser2net.service - Serial port to network proxy
     Loaded: loaded (/lib/systemd/system/ser2net.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2021-12-15 09:23:58 GMT; 7min ago
       Docs: man:ser2net(8)
   Main PID: 806 (ser2net)
      Tasks: 1 (limit: 2059)
        CPU: 46ms
     CGroup: /system.slice/ser2net.service
             └─806 /usr/sbin/ser2net -n -c /etc/ser2net.yaml -P /run/ser2net.pid

Dec 15 09:23:58 SerialPi-1 systemd[1]: Starting Serial port to network proxy...
Dec 15 09:23:58 SerialPi-1 systemd[1]: Started Serial port to network proxy.
**Dec 15 09:23:58 SerialPi-1 ser2net[806]: Device BlueGiga: usb path is not valid: /sys/class/tty/../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3:1.0/tty/ttyACM0**

But the path is there:

SerialPi-1:/etc# ls /sys/class/tty/../../devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3:1.0/tty/ttyACM0
dev  device  power  subsystem  uevent

When browsing for the serial devices, they show up anyway:

=     lo IPv4 Bluegiga                                      _iostream._tcp       local
   hostname = [SerialPi-1.local]
   address = [127.0.0.1]
   port = [2223]
   txt = ["devicetype=serialusb" "gensiostack=telnet(rfc2217),tcp" "provider=ser2net"]
=     lo IPv4 Zigbee                                        _iostream._tcp       local
   hostname = [SerialPi-1.local]
   address = [127.0.0.1]
   port = [2222]
   txt = ["product=BV 2010/10" "manufacturer=Silicon Labs" "serial=xxxxxxxx" "idVendor=10c4" "idProduct=8b34" "interface=BV 2010/10" "bInterfaceNumber=00" "devicetype=serialusb" "gensiostack=telnet(rfc2217),tcp" "provider=ser2net"]

So just in the mdns the device description txt the vendor and name etc. is missing.
Is it just cosmetic?

lsusb gets the full information:

root@SerialPi-1:/etc# lsusb
Bus 001 Device 005: ID 2458:0001 Bluegiga Technologies BLED112 Bluetooth 4.0 Single Mode Dongle
Bus 001 Device 004: ID 10c4:8b34 Silicon Labs BV 2010/10

EDIT:
Should mention the environment:

RaspberryPi 3B with Raspberry Pi OS Bullseye
Linux SerialPi-1 5.10.63-v7+ #1488 SMP Thu Nov 18 16:14:44 GMT 2021 armv7l GNU/Linux

Broken pipe after "Could not turn off break..."

Hi,

I have an Arduino connected to a Pi via USB. I'm using ser2net for remote control over TCP. Sometimes the connection breaks with the message:

"Could not turn off break for device /dev/ttyAMA0 port 2353: Broken pipe"

Only resetting the Arduino helps. Is there any way to avoid this?

configuration:

2358:raw:1000:/dev/ttyACM0:9600 HANGUP_WHEN_DONE disable-chardelay

"disable-chardelay" was just an attempt.

Thanks
Andre

reconf / configure bombs out on Debian sid

Hi,

I am trying to build ser2net 4.3 on Debian and the configure process fails. The following log was obtained in a freshly unpacked tarball:

[86/5067]mh@salida:~/packages/ser2net $ tar --extract --file ser2net_4.3.0.orig.tar.gz 
[87/5068]mh@salida:~/packages/ser2net $ cd ser2net-4.3.0/
/home/mh/packages/ser2net/ser2net-4.3.0
[88/5068]mh@salida:~/packages/ser2net/ser2net-4.3.0 $ ls
absout.h       controller.h  gbuf.h       Makefile.am   readconfig.h  ser2net.h       yamlconf.c
addsysattrs.c  COPYING       INSTALL      NEWS          README        ser2net.init
auth.c         dataxfer.c    led.c        port.c        README.rst    ser2net_str.c
AUTHORS        dataxfer.h    led.h        portconfig.c  reconf*       ser2net.yaml
ChangeLog      defaults.c    led_sysfs.c  port.h        rotator.c     ser2net.yaml.5
configure.ac   defaults.h    led_sysfs.h  portinfo.c    ser2net.8     tests/
controller.c   gbuf.c        m4/          readconfig.c  ser2net.c     trace.c
[89/5069]mh@salida:~/packages/ser2net/ser2net-4.3.0 $ ./reconf
libtoolize: putting auxiliary files in '.'.
libtoolize: linking file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: linking file 'm4/libtool.m4'
libtoolize: linking file 'm4/ltoptions.m4'
libtoolize: linking file 'm4/ltsugar.m4'
libtoolize: linking file 'm4/ltversion.m4'
libtoolize: linking file 'm4/lt~obsolete.m4'
configure.ac:49: error: possibly undefined macro: AC_CHECK_LIB
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:52: error: possibly undefined macro: AC_CHECK_HEADER
configure.ac:53: error: possibly undefined macro: AC_MSG_ERROR
configure.ac:4: installing './ar-lib'
configure.ac:3: installing './compile'
configure.ac:5: installing './config.guess'
configure.ac:5: installing './config.sub'
configure.ac:2: installing './install-sh'
configure.ac:2: installing './missing'
Makefile.am: installing './depcomp'
tests/Makefile.am:4: warning: shell readlink -f $(top_builddir: non-POSIX variable name
tests/Makefile.am:4: (probably a GNU make extension)
tests/Makefile.am:5: warning: shell readlink -f $(top_srcdir: non-POSIX variable name
tests/Makefile.am:5: (probably a GNU make extension)
parallel-tests: installing './test-driver'
[90/5070]mh@salida:~/packages/ser2net/ser2net-4.3.0 $ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking for ar... ar
checking the archiver (ar) interface... ar
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether gcc is Clang... no
checking whether pthreads work with "-pthread" and "-lpthread"... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking whether more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
checking whether make supports nested variables... (cached) yes
checking for ANSI C header files... (cached) yes
checking for main in -lnsl... yes
./configure: line 13040: syntax error near unexpected token `GENSIO,'
./configure: line 13040: `PKG_CHECK_MODULES(GENSIO, libgensio, LIBS=$GENSIO_LIBS,'
2 [91/5071]mh@salida:~/packages/ser2net/ser2net-4.3.0 $ dpkg --list 'auto*' | cat
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name             Version      Architecture Description
+++-================-============-============-=====================================================
ii  autoconf         2.69-11.1    all          automatic configure script builder
ii  autopoint        0.19.8.1-10  all          autopoint program from GNU gettext
ii  autotools-dev    20180224.1   all          Update infrastructure for config.{guess,sub} files
[92/5072]mh@salida:~/packages/ser2net/ser2net-4.3.0 $ 

segfault connecting to a sol device

Using the latest revision and using a configuration like this one:

30009:telnet:0:sol.lan -U username -P password 1.2.3.4

solterm works without a problem.

I have this segfault when I'm connecting with telnet:

Program received signal SIGSEGV, Segmentation fault.
0x000055555555d192 in setup_port (port=0x5555557869d0, netcon=0x555555786080, is_reconfig=false) at dataxfer.c:1948
1948 if (port->io.f->setup(&port->io, port->portname, &errstr,
(gdb) backtrace
#0 0x000055555555d192 in setup_port (port=0x5555557869d0, netcon=0x555555786080, is_reconfig=false) at dataxfer.c:1948
#1 0x000055555555d776 in handle_port_accept (port=0x5555557869d0, new_fd=6, netcon=0x555555786080) at dataxfer.c:2088
#2 0x000055555555e4fb in handle_accept_port_read (fd=8, data=0x5555557869d0) at dataxfer.c:2432
#3 0x000055555556b45c in handle_selector_call (sel=0x55555577a280, i=8, fdset=0x555555784280, handler=0x55555555e165 <handle_accept_port_read>) at selector.c:871
#4 0x000055555556b993 in process_fds_epoll (sel=0x55555577a280, tvtimeout=0x7fffffffdde0) at selector.c:965
#5 0x000055555556bba7 in sel_select (sel=0x55555577a280, send_sig=0x55555556c652 <wake_thread_send_sig>, thread_id=140737488346720, cb_data=0x0, timeout=0x0) at selector.c:1007
#6 0x000055555556c6cf in op_loop (dummy=0x0) at ser2net.c:275
#7 0x000055555556d6af in main (argc=4, argv=0x7fffffffdfa8) at ser2net.c:729

Don't hesitate if you need more info.

failed at first start but succesful restart

Hi I run this onb raspberryPi with newest raspbian.
the first start (after reboot) always failed with

Dec 07 18:23:40 raspberrypi ser2net[460]: Invalid port name/number: Invalid data to parameter on line 24 column 0
Dec 07 18:23:40 raspberrypi ser2net[460]: Invalid port name/number: Invalid data to parameter on line 24 column 0
Dec 07 18:23:40 raspberrypi ser2net[460]: Invalid port name/number: Invalid data to parameter on line 33 column 0
Dec 07 18:23:40 raspberrypi ser2net[460]: Invalid port name/number: Invalid data to parameter on line 33 column 0

a restart runs successful

root@raspberrypi:/home/sff00009# service ser2net status
● ser2net.service - Serial port to network proxy
Loaded: loaded (/lib/systemd/system/ser2net.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2021-12-07 18:23:39 CET; 6min ago
Docs: man:ser2net(8)
Main PID: 460 (ser2net)
Tasks: 1 (limit: 1597)
CPU: 88ms
CGroup: /system.slice/ser2net.service
└─460 /usr/sbin/ser2net -n -c /etc/ser2net.yaml -P /run/ser2net.pid

Dec 07 18:23:39 raspberrypi systemd[1]: Starting Serial port to network proxy...
Dec 07 18:23:39 raspberrypi systemd[1]: Started Serial port to network proxy.
Dec 07 18:23:40 raspberrypi ser2net[460]: Invalid port name/number: Invalid data to parameter on line 24 column 0
Dec 07 18:23:40 raspberrypi ser2net[460]: Invalid port name/number: Invalid data to parameter on line 24 column 0
Dec 07 18:23:40 raspberrypi ser2net[460]: Invalid port name/number: Invalid data to parameter on line 33 column 0
Dec 07 18:23:40 raspberrypi ser2net[460]: Invalid port name/number: Invalid data to parameter on line 33 column 0
root@raspberrypi:/home/sff00009# service ser2net restart
root@raspberrypi:/home/sff00009# service ser2net status
● ser2net.service - Serial port to network proxy
Loaded: loaded (/lib/systemd/system/ser2net.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2021-12-07 18:30:27 CET; 1s ago
Docs: man:ser2net(8)
Main PID: 1370 (ser2net)
Tasks: 1 (limit: 1597)
CPU: 26ms
CGroup: /system.slice/ser2net.service
└─1370 /usr/sbin/ser2net -n -c /etc/ser2net.yaml -P /run/ser2net.pid

root@raspberrypi:/home/sff00009# ser2net -v
ser2net version 4.3.3
root@raspberrypi:/home/sff00009# cat /etc/ser2net.yaml
%YAML 1.1

This is a ser2net configuration file, tailored to be rather

simple.

Find detailed documentation in ser2net.yaml(5)

A fully featured configuration file is in

/usr/share/doc/ser2net/examples/ser2net.yaml.gz

If you find your configuration more useful than this very simple

one, please submit it as a bugreport

define: &banner \r\nser2net port \p device \d [\B] (Debian GNU/Linux)\r\n\r\n

connection: &tb001
accepter: telnet(rfc2217),tcp,2001
enable: on
options:
banner: *banner
kickolduser: false
telnet-brk-on-sync: true
max-connections: 4
connector: serialdev,/dev/portserver/tb001,115200n81,local

connection: &tb002
accepter: telnet(rfc2217),tcp,2002
enable: on
options:
banner: *banner
kickolduser: false
telnet-brk-on-sync: true
max-connections: 4
connector: serialdev,/dev/portserver/tb002,115200n81,local
root@raspberrypi:/home/sff00009# lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
root@raspberrypi:/home/sff00009# uname -a
Linux raspberrypi 5.10.82-v7+ #1497 SMP Fri Dec 3 16:26:57 GMT 2021 armv7l GNU/Linux
root@raspberrypi:/home/sff00009# apt info ser2net
Package: ser2net
Version: 4.3.3-1
Priority: optional
Section: utils
Maintainer: Marc Haber [email protected]
Installed-Size: 197 kB
Pre-Depends: init-system-helpers (>= 1.58)
Depends: lsb-base (>= 3.0-6), libc6 (>= 2.4), libgensio0 (>= 2.2.4), libyaml-0-2
Suggests: telnet
Homepage: https://github.com/cminyard/ser2net
Download-Size: 78.9 kB
APT-Manual-Installed: yes
APT-Sources: http://raspbian.raspberrypi.org/raspbian bullseye/main armhf Packages
Description: Serial port to network proxy
This daemon allows telnet and tcp sessions to be established with a
host's serial ports. Combined with a terminal emulator, this can be a
very simple means to configure network devices or other equipment with
a serial port. This is remarkably similar to the reverse telnet
feature of some Cisco routers.

root@raspberrypi:/home/sff00009#

error messages on bootup "ser2net[625]: Invalid port name/number: Invalid data to parameter on line 7 column 0"

Hi
if I boot my system i see error messages in syslog
ser2net[625]: Invalid port name/number: Invalid data to parameter on line 30 column 0
and connections to the port are not possible.

after a systemctl restart ser2net the port is accessible.

my ser2net.yaml

%YAML 1.1
define: &banner \r\nser2net port \p device \d [\B] (Debian GNU/Linux)\r\n\r\n
connection: &zigbee
  accepter: tcp,20108
  connector: serialdev,/dev/ttyUSB0,115200n81,local
  options:
    kickolduser: true

My Proxmox host OS: Linux MSNUC 5.11.22-2-pve #1 SMP PVE 5.11.22-4 (Tue, 20 Jul 2021 21:40:02 +0200) x86_64 GNU/Linux

Segmentation fault when trying to write to serial port

Had ser2net v2.x loaded on Ubuntu 18.04 and it was working fine with the following ser2net.conf file line.
5001:raw:0:/dev/ttyUSB0:115200

Upgraded to the latest version of ser2net v4.3 and now I am receiving a segmentation fault with the same configuration file. However reading the port works absolutely fine. It's only when I try to write to the port that it fails.

admin@ubuntu1804:/etc/ser2net$ ser2net -c ser2net.conf -p 5000 -d
ser2net:WARNING: Using old config file format, this will go away
soon.  Please switch to the yaml-based format.
Segmentation fault

I thought it could be something about the old conf file so I upgraded to the yaml style.

So I've made on with these lines

connection: &con00
  accepter: tcp,5001
  timeout: 0
  connector: serialdev,/dev/ttyUSB-HGI80,115200n81,local

However it's the same issue.

admin@ubuntu1804:/etc/ser2net$ ser2net -c ser2net.yaml -p 5000 -d
ser2net[7434]: Admin port already configured on line 303 column 0
Admin port already configured on line 303 column 0
Segmentation fault

I can see the write message coming in on the admin interface monitor, but the moment I see the line appear on the monitor, I see the Segmentation fault on the other window when ser2net is currently on the command line.

What might be going on?

every second restart attempt fails

Running ser2net 3.5.2 on Debian Buster.
Occasionally noticed that every 2nd restart attempt fails:

# systemctl status ser2net.service
● ser2net.service - LSB: Allows network connections to serial ports
   Loaded: loaded (/etc/init.d/ser2net; generated)
   Active: active (running) since Sat 2020-07-04 12:17:55 ; 10min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 9857 ExecStart=/etc/init.d/ser2net start (code=exited, status=0/SUCCESS)
    Tasks: 1 (limit: 4168)
   Memory: 1.4M
   CGroup: /system.slice/ser2net.service
           └─9873 /usr/sbin/ser2net -c /etc/ser2net.conf -P /run/ser2net.pid

Jul 04 12:17:55 cubox systemd[1]: Starting LSB: Allows network connections to serial ports...
Jul 04 12:17:55 cubox ser2net[9871]: ser2net startup
Jul 04 12:17:55 cubox ser2net[9857]: Starting Serial port to network proxy: ser2net.
Jul 04 12:17:55 cubox systemd[1]: Started LSB: Allows network connections to serial ports.
root@cubox:~# 
root@cubox:~# systemctl restart ser2net.service
Job for ser2net.service failed because the control process exited with error code.
See "systemctl status ser2net.service" and "journalctl -xe" for details.
root@cubox:~# 
root@cubox:~# systemctl restart ser2net.service
root@cubox:~# 
root@cubox:~# systemctl restart ser2net.service
Job for ser2net.service failed because the control process exited with error code.
See "systemctl status ser2net.service" and "journalctl -xe" for details.
root@cubox:~# 

Problem with windows telnet client

I observed an abnormal behavior of ser2net while connecting from Windows telnet client. Telnet command options are exchanged forever between ser2net server and Windows telnet client.

image

The figure above is a snapshot of packet capture.
x.x.x.100: ser2net server
x.x.x.49: Windows telnet client

In the figure, ser2net sends "fffb03:fffb01:fffe01:fffd00" command to the client.

According to my analysis, the following commands are exchanged and last four sequences are repeated forever. (I omitted leading 0xff pattern)

image

Is there any reasons for this behavior ?

Anyway, console connection is still valid and I didn't observe any other problem.

conf not working with new version yaml

Hi,

with the old version the ser2net.conf file worked with:

3331:raw:0:/dev/ttyACM0:115200 8DATABITS NONE 1STOPBIT banner

if I try to configure the ser2et.yaml file with the new version that I am attaching
ser2net.txt

it doesn't work ... Can you help me out?

ser2net: gensio.c:2667: gensio_list_add_tail: Assertion failed

Hi,

I successfully built the latest ser2net on a Raspberry Pi, but when I tried to run it it aborts with this error:

ser2net: gensio.c:2667: gensio_list_add_tail: Assertion `link->list == NULL && link->next == NULL && link->prev == NULL' failed.

I have tried this on a pi4 running the latest OS (2021-01-11-raspios-buster-armhf),
and on a pi3B running an older OS.

According to strace, the ser2net configuration file is never opened.

I'm not sure if this is useful: the abort happens right after ser2net talks to DBUS:
send - "AUTH EXTERNAL 31303030"
read - "OK fa4443262b67f5cb6c32a80b60462"
send - "NEGOTIATE_UNIX_FD"
read - "AGREE_UNIX_FD"
send - "BEGIN"

Last few lines of strace output:

socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0) = 6
connect(6, {sa_family=AF_UNIX, sun_path="/var/run/dbus/system_bus_socket"}, 33) = 0
fcntl64(6, F_GETFL) = 0x2 (flags O_RDWR)
fcntl64(6, F_SETFL, O_RDWR|O_NONBLOCK) = 0
geteuid32() = 1000
getsockname(6, {sa_family=AF_UNIX}, [128->2]) = 0
poll([{fd=6, events=POLLOUT}], 1, 0) = 1 ([{fd=6, revents=POLLOUT}])
send(6, "\0", 1, MSG_NOSIGNAL) = 1
send(6, "AUTH EXTERNAL 31303030\r\n", 24, MSG_NOSIGNAL) = 24
poll([{fd=6, events=POLLIN}], 1, -1) = 1 ([{fd=6, revents=POLLIN}])
read(6, "OK fa4443262b67f5cb6c32a80b60462"..., 2048) = 37
poll([{fd=6, events=POLLOUT}], 1, -1) = 1 ([{fd=6, revents=POLLOUT}])
send(6, "NEGOTIATE_UNIX_FD\r\n", 19, MSG_NOSIGNAL) = 19
poll([{fd=6, events=POLLIN}], 1, -1) = 1 ([{fd=6, revents=POLLIN}])
read(6, "AGREE_UNIX_FD\r\n", 2048) = 15
poll([{fd=6, events=POLLOUT}], 1, -1) = 1 ([{fd=6, revents=POLLOUT}])
send(6, "BEGIN\r\n", 7, MSG_NOSIGNAL) = 7
poll([{fd=6, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=6, revents=POLLOUT}])
sendmsg(6, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="l\1\0\1\0\0\0\0\1\0\0\0n\0\0\0\1\1o\0\25\0\0\0/org/fre"..., iov_len=128}, {iov_base="", iov_len=0}], msg_iovlen=2, msg_controllen=0, msg_flags=0}, MSG_NOSIGNAL) = 128
clock_gettime(CLOCK_MONOTONIC, {tv_sec=536, tv_nsec=962047310}) = 0
poll([{fd=6, events=POLLIN}], 1, 25000) = 1 ([{fd=6, revents=POLLIN}])
recvmsg(6, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="l\2\1\1\n\0\0\0\1\0\0\0=\0\0\0\6\1s\0\5\0\0\0:1.25\0\0\0"..., iov_len=2048}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_CMSG_CLOEXEC) = 260
recvmsg(6, {msg_namelen=0}, MSG_CMSG_CLOEXEC) = -1 EAGAIN (Resource temporarily unavailable)
write(2, "ser2net: gensio.c:2667: gensio_l"..., 129ser2net: gensio.c:2667: gensio_list_add_tail: Assertion `link->list == NULL && link->next == NULL && link->prev == NULL' failed.
) = 129
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6fe3000
rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [], 8) = 0
getpid() = 12191
gettid() = 12191
tgkill(12191, 12191, SIGABRT) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=12191, si_uid=1000} ---
+++ killed by SIGABRT +++

Segmentation fault by closing Telnet to Admin

I have just discovered you fork to Ser2net and very much like the improvements.

Where I have found that I can Seg Fault the latest version. Simply by disconnecting the Telnet Session to the Admin Acceptor. It works correctly if the user types "exit" or "quit" at the Admin prompt. But when closed by the Telnet client while at the Admin prompt the below happens.

root@raspberrypi(buster):~# /usr/sbin/ser2net -c /etc/ser2net.conf -n -d &
[1] 4757
root@raspberrypi(buster):~# telnet localhost 1999
Trying ::1...
Connected to localhost.
Escape character is '^]'.
-> version
ser2net version 4.1
-> exit Using the Exit Command with expected result
Connection closed by foreign host.
root@raspberrypi(buster):~#
root@raspberrypi(buster):~# telnet localhost 1999
Trying ::1...
Connected to localhost.
Escape character is '^]'.
-> version
ser2net version 4.1
-> I typed Ctl+]
telnet> q Not using the exit command
Connection closed.
[1]+ Segmentation fault /usr/sbin/ser2net -c /etc/ser2net.conf -n -d Opps Something bad Happened.
root@raspberrypi(buster):~# telnet localhost 1999
Trying ::1...
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
root@raspberrypi(buster):~#

Here is the config file
root@raspberrypi(buster):~# cat /etc/ser2net.conf
%YAML 1.1
---
admin:
__accepter: telnet,tcp,1999
define: &banner1 Ser2net \N,\p,\d,\I \r\n
connection: &CON0
__accepter: telnet,tcp,2011
__timeout: 600
__enable: on
__connector: serialdev,/dev/ttyUSB0,115200n81,LOCAL
__options:
____banner: *banner1
____kickolduser: true
root@LNN-TerminalServer-QA:~#

The problem occurs on Jessie also. And from different telnet clients. I have not tried earlier versions of this fork. Where I know the standard release package at 2.9.1 does not have this issue.

Disabling CTS/DTR Clarification.

I've got the latest ser2net working (with the yaml config file).

If you read man ser2net, you see the lines

       setportconfig <network port> <config>
              Set the port configuration as in the device configuration in the /etc/ser2net/ser2net.yaml  file.
              If conflicting options are specified, the last option will be the one used.  Note that these will
              not change until the port is disconnected and connected again.  Options 300,  1200,  2400,  4800,
              9600,  19200, 38400, 57600, 115200 set the various baud rates.  The following speed may be avail‐
              able if your system has the values defined and your hardware supports it: 230400, 460800, 500000,
              576000,  921600, 1000000, 1152000, 1500000, 2000000, 2500000, 3000000, 3500000, 4000000.  Parity,
              databits, and stopbits may be specified in the classical manner after the speed, as  in  9600N81.
              This has the following format: <speed>[N|E|O|M|S[5|6|7|8[1|2]]].  Setting serial options this way
              does not work on SOL, SOL has fixed N81 serial options.  EVEN, ODD, NONE (MARK and SPACE if  sup‐
              ported)  set  the parity.  1STOPBIT, 2STOPBITS set the number of stop bits.  7DATABITS, 8DATABITS
              set the number of data bits.  [-]XONXOFF turns on (- off) XON/XOFF support.  [-]RTSCTS  turns  on
              (-  off)  hardware  flow control.  [-]LOCAL ignores (- checks) the modem control lines (DCD, DTR,
              etc.)

Specifically regarding RTSCTS and LOCAL options, these can be set from the admin interface. Is there a way to add those to the "connector" line? or are those toggled through the "options:" lines from within the config file?

Are they even settable from the config file?

Unable to start mdns: Operation not supported

ser2net version 4.3.3

Starting the program always gives an error: Unable to start mdns: Operation not supported
configuration file is in the new format, tried using in the connection

options:
        mdns: false

but that does not help

serial port stop working

I am using an unstable connection, and sometimes when i reconnect to ser2net (3.5.1) i get no serial communication, and no error (running with ser2net -n).

If i cat the serial port, i see the data coming.

The TCP connection is successfully established, as telnet/netcat does not time out, simply there is no data.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.