question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Telnet "_handle_control_chars_response" gets stuck in the infinite loop

See original GitHub issue

Some of my switches sends in telnet: IAC WILL ECHO IAC WILL SUPPRESS-GO-AHEAD before login prompt. If they do not receive: IAC DO ECHO IAC DO SUPPRESS-GO-AHEAD they will repeat control characters infinitely, so “_handle_control_chars_response” gets stuck in the infinite loop. https://github.com/carlmontanari/scrapli/blob/81d7700746fa41773b93601b9c909de5e3d9c2f2/scrapli/transport/plugins/asynctelnet/transport.py#L86-L91

I’ve changed that code to:

            if cmd in (DO, DONT):
                # if server says do/dont we always say wont for that option
                self.stdin.write(IAC + WONT + c)
            elif cmd in WILL:
                # if server says will we always say do for that option
                self.stdin.write(IAC + DO + c)
            elif cmd in WONT:
                # if server says wont we always say dont for that option
                self.stdin.write(IAC + DONT + c)

And it works. No more loops.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
carlmontanaricommented, Jul 27, 2021

Awesome, just pushed to develop. Thanks again! Hopefully this is the last of the asynctelnet gremlins! 😁

1reaction
carlmontanaricommented, Jul 27, 2021

Ok, tested your fix and looks like everything is working as expected on all the test platforms I have!

Let me know if you wanna PR or want me to just slap it in there, up to you!

Thanks for the help with this!

Carl

Read more comments on GitHub >

github_iconTop Results From Across the Web

BusyBox
1 fixes a case where in ash, "wait" never finishes. Bug fix release. 1.31. 1 has fixes for dc, ash (PS1 expansion fix),...
Read more >
External protocols in C-Kermit
The external protocol programs themselves are unaware that they have been redirected over a TELNET connection, and so even if they would know ......
Read more >
LiteBSD/ckc302.txt at master - GitHub
handle \fpattern() in the MINPUT parse loop, so it never worked. The code ... get stuck) but alarm() / signal() are not not...
Read more >
ckc200.txt - Columbia University
Several complaints appeared recently about Kermit hanging or going into infinite loops, but they are not necessarily related, since one involves IKSD (which ......
Read more >
Changes - LYNX
Even with this change, lynx.exe is 50% larger when using slang than with pdcurses ... to prevent infinite loop when the focus moves...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found