cminyard / ser2net

Serial to network interface, allows TCP/UDP to serial port connections
GNU General Public License v2.0
405 stars 73 forks source link

Unable to establish ckermit connection with ser2net 4.3 #57

Closed cotardp closed 3 years ago

cotardp commented 3 years ago

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 '^]'.
  2. 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


3. 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
cminyard commented 3 years ago

On Tue, Oct 19, 2021 at 04:43:14AM -0700, cotardp wrote:

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.

Yeah, it's not going to work, I botched a couple of things. The problem is in the gensio library, is it possible for you to try the end of the git tree there? I just pushed some changes.

I had to disable carrier watch and flow control to make it work, but the serial port I tried didn't have flow control or modem control.

Thanks,

-corey

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 '^]'.
  2. 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


3. 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

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/cminyard/ser2net/issues/57
cotardp commented 3 years ago

Hello,

I tested with last version of gensio. It seems to work better with kermit, but the standard "telnet" does not work anymore. Anyway, if you solution depends on flow control deactivation, then it's problematic for me.

What I want to achieve is to control the port with RFC2217 and modify at runtime speed, parity, flow control etc. The c-kermit tool is supporting it, and moreover, it supports scripting. I tried to use the gensiot tool but it does not seem to be scriptable. Maybe gensiot is scriptable and I missed this feature in the man? Or do you know any other rfc2217 scriptable client compatible with ser2net?

cminyard commented 3 years ago

On Wed, Oct 20, 2021 at 04:55:16AM -0700, cotardp wrote:

Hello,

I tested with last version of gensio. It seems to work better with kermit, but the standard "telnet" does not work anymore.

It seems to work fine for me. Did you test with end of tree or latest released version?

Anyway, if you solution depends on flow control deactivation, then it's problematic for me.

kermit turns on remote hardware flow control by default. If you don't have that, there's not much I can do. You'll have to tell kermit to not enable it.

What I want to achieve is to control the port with RFC2217 and modify at runtime speed, parity, flow control etc. The c-kermit tool is supporting it, and moreover, it supports scripting.

Well, it's working now. I'm not sure what the deal is with telnet on your side. Can you give more information? I can give you some tools to trace the data so I can tell what is going on.

I tried to use the gensiot tool but it does not seem to be scriptable. Maybe gensiot is scriptable and I missed this feature in the man?

It's not really scriptable. You can control all those things from gensiot using key sequence, but it would be a pain.

Or do you know any other rfc2217 scriptable client compatible with ser2net?

If you are willing to program in python, gensio has python interface. Outside of that I don't know anything.

-corey

cotardp commented 3 years ago

Hi,

I did use: gensio@db44bc622c9775002097aa64d76df3f86b145152 sernet@4696088bc3626ea920056ac0495f5d6521179495

Compiled from a Debian 11 chroot, and transfered ser2net binary to my system.

Using telnet:

telnet localhost 15010
Trying localhost...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.

As you see, connection gets closed and I cannot reconnect after.

Using kermit:

kermit -c -j localhost:1510
 DNS Lookup...  Trying 127.0.0.1...  Reverse DNS Lookup... (OK)
 lab-test connected on port 1510
 Negotiations...
?Connection closed by peer.
?Telnet Option negotiation error.
Connecting to host localhost:1510
 Escape character: Ctrl-\ (ASCII 28, FS): enabled
Type the escape character followed by C to get back,
or followed by ? to see other options.

?Connection closed by peer.
?Carrier required but not detected.
***********************************
 Hint: To CONNECT to a serial device that
 is not presenting the Carrier Detect signal,
 first tell C-Kermit to:

   SET CARRIER-WATCH OFF

***********************************

C-Kermit 9.0.305 OPEN SOURCE: Alpha.02, 19 Sep 2020, for Linux+SSL+KRB5 (64-bit)
 Copyright (C) 1985, 2020,
  Trustees of Columbia University in the City of New York.
Type ? or HELP for help.
(/tmp/) C-Kermit>

About script, I will look at gensio python interface to see if it can fit my need.

cminyard commented 3 years ago

On Thu, Oct 21, 2021 at 09:36:28AM -0700, cotardp wrote:

Hi,

I did use: @. @.

Compiled from a Debian 11 chroot, and transfered to my system.

Using telnet:

telnet localhost 15010
Trying localhost...
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.

As you see, connection gets closed and I cannot reconnect after.

Hmm, that's really strange. Can you change your accepter line to:

accepter: telnet(rfc2217),trace(dir=both,file=tracefile),tcp,15010

and send me the contents of tracefile?

Also, what telnet version are you using?

Using kermit:

kermit -c -j localhost:1510
 DNS Lookup...  Trying 127.0.0.1...  Reverse DNS Lookup... (OK)
 lab-test connected on port 1510
 Negotiations...
?Connection closed by peer.
?Telnet Option negotiation error.
Connecting to host localhost:1510
 Escape character: Ctrl-\ (ASCII 28, FS): enabled
Type the escape character followed by C to get back,
or followed by ? to see other options.

?Connection closed by peer.
?Carrier required but not detected.
***********************************
 Hint: To CONNECT to a serial device that
 is not presenting the Carrier Detect signal,
 first tell C-Kermit to:

   SET CARRIER-WATCH OFF

***********************************

C-Kermit 9.0.305 OPEN SOURCE: Alpha.02, 19 Sep 2020, for Linux+SSL+KRB5 (64-bit)
 Copyright (C) 1985, 2020,
  Trustees of Columbia University in the City of New York.
Type ? or HELP for help.
(/tmp/) C-Kermit>

If your hardware is not providing carrier, then it's not going to work without doing the "set carrier watch off".

If it is, it appears that ser2net is doing the right thing to provide carrier signals over rfc2217.

So I have two serial ports on my machine connected with a null modem. I hook ser2net to one end. If the other end is unconnected, connecting with ser2net with kermit results in the "set carrier watch off" thing. If I open the other end with gensiot and connect, everything works fine.

I did find a bug in kermit (C-Kermit 9.0.305), if you do: kermit -c -b 115200 -j localhost:15010 then it sets the speed to 115200, then it sends another message setting the speed to 38400. You have to do another "set speed 115200" to make it work.

About script, I will look at gensio python interface to see if it can fit my need.

Yeah, the trouble is that you will be programming, not scripting. But if you are up for that, it's a lot more powerful.

There are some examples in the gensio examples directory, but the aren't great. All the documentation is in man pages. More docs need to be written, but that takes time :-(.

-corey

cotardp commented 3 years ago

Hi,

Ok it was my mistake. I forgot to copy the recompiled libgensio.so.0 to the system... With the updated version it works! Thank you for the fix.

I also found the bug about setting speed to 115200. Thx for the hint.

I still have an issue. Once connected with kermit, I cannot send commands anymore. Any character I typed, either from telnet or kermit is ignored. I can see the incoming traffic (I have a u-boot on the remote system stating), but I cannot interact with it anymore.

About the python binding, it looks perfect for my need, I will most likely use it.

cminyard commented 3 years ago

On Oct 23, 2021 05:32, cotardp @.***> wrote: Hi, Ok it was my mistake. I forgot to copy the recompiled libgensio.so.0 to the system... With the updated version it works! Thank you for the fix. I also found the bug about setting speed to 115200. Thx for the hint. I still have an issue. Once connected with kermit, I cannot send commands anymore. Any character I typed, either from telnet or kermit is ignored. I can see the incoming traffic (I have a u-boot on the remote system stating), but I cannot interact with it anymore.Did you try "set flowcontrol none" in Kermit?-corey About the python binding, it looks perfect for my need, I will most likely use it.

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.

cotardp commented 3 years ago

Did you try "set flowcontrol none" in Kermit?-corey

It works better with this setting ;) Any chance to have this fix available soon on debian bulleseye apt repo ?

cminyard commented 3 years ago

On Sun, Oct 24, 2021 at 02:13:08AM -0700, cotardp wrote:

Did you try "set flowcontrol none" in Kermit?-corey It works better with this setting ;) Any chance to have this fix available soon on debian bulleseye apt repo ?

I'm going to be doing a release soon, but I'm waiting for some BSD build issues to be verified. Once all those are fixed I'll be releasing.

I don't have any control over the debian release, though.

-corey

cotardp commented 3 years ago

Ack. Thank you.