Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Connection to Enterasys B2 Switch #266

Closed
wants to merge 1 commit into from

Conversation

egroeper
Copy link
Contributor

Connecting to an Enterasys B2 Switch (using demo_simple.py) for an
interactive shell doesn't work:

Connected. Getting Shell...
DEBUG:paramiko.transport:[chan 1] Max packet in: 34816 bytes
DEBUG:paramiko.transport:[chan 1] Max packet out: 16384
bytes
INFO:paramiko.transport:Secsh channel 1 opened.
ERROR:paramiko.transport:Channel request for unknown
channel 0
*** Caught exception: <class 'paramiko.SSHException'>: Channel closed.

The channels gets opened with index 1 on client
(paramiko) side and index 0 on server (switch)
side.
Probably the switch doesn't support this and
replies to the pty request with a wrong channel
id. Because of that paramiko closes the
connection.

This can be solved (or worked around) easily by
initialising _channel_counter with 0.
This is what other clients, like openssh do.

I don't see a problem with initialising this
counter with 0.
Would this be acceptable?

@lndbrg
Copy link
Contributor

lndbrg commented Mar 4, 2014

I guess this works well with other normal hosts and devices? If so this should be a no brainer.

@egroeper
Copy link
Contributor Author

egroeper commented Mar 7, 2014

Yes. Here it works well with other hosts and devices.

Connecting to an Enterasys B2 Switch (using demo_simple.py) for an
interactive shell doesn't work:

    Connected. Getting Shell...
    DEBUG:paramiko.transport:[chan 1] Max packet in: 34816 bytes
    DEBUG:paramiko.transport:[chan 1] Max packet out: 16384
    bytes
    INFO:paramiko.transport:Secsh channel 1 opened.
    ERROR:paramiko.transport:Channel request for unknown
    channel 0
    *** Caught exception: <class 'paramiko.SSHException'>: Channel closed.

The channels gets opened with index 1 on client
(paramiko) side and index 0 on server (switch)
side.
Probably the switch doesn't support this and
replies to the pty request with a wrong channel
id. Because of that paramiko closes the
connection.

This can be solved (or worked around) easily by
initialising _channel_counter with 0.
This is what other clients, like openssh do.

I don't see a problem with initialising this
counter with 0.
@egroeper
Copy link
Contributor Author

I rebased my feature branch to ease up merging.
I don't think the current build problems have to do with my fix.

@lndbrg
Copy link
Contributor

lndbrg commented Dec 13, 2014

I re-triggered the build.

@bitprophet
Copy link
Member

@lndbrg Dunno if this is really 'high priority', how many users are targeting this specific type of switch? ;)

Still sounds ok, needs a changelog entry for sure though, moderate chance some folks are relying on (or at least aware of) the current 1-indexing and may have a confuse when it changes. I can do this when I prep for release.

@bitprophet bitprophet modified the milestones: 2.0, 1.15.2 et al Dec 15, 2014
@lndbrg
Copy link
Contributor

lndbrg commented Dec 16, 2014

I REJECT THE NOTION THAT I ACTUALLY ADDED THAT LABEL!

@bitprophet
Copy link
Member

@lndbrg http://note.io/1GtklCe ;)

@bitprophet
Copy link
Member

Confirmed this change doesn't appear to break Paramiko or Fabric's test suites.

Also dug into the OpenSSH source and confirmed that it begins channel numbering at 0: variable init in loop at 0 here and assignment to 'self' (channel id) here (definition of 'self' here)

bitprophet added a commit that referenced this pull request Dec 17, 2014
@bitprophet
Copy link
Member

Cherry-picked back to bugfix branch, which Github can't follow. Merged to master now. Closing!

@bitprophet bitprophet closed this Dec 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants