Skip to content

Conversation

@jaywonchung
Copy link
Contributor

Quickly implemented port forwarding closure.

Reference: https://github.com/openssh/openssh-portable/blob/059ed698a47c9af541a49cf754fd09f984ac5a21/PROTOCOL.mux#L189

The request is pretty much the exact same as requesting port forwarding, except that the protocol code is MUX_C_CLOSE_FWD (0x10000007) and the server does not return a MUX_S_REMOTE_PORT.

I realized that the verb "close" aligns better with the protocol doc's language than "cancel". If this gets merged, on the openssh repo, I think I'll rename the APIs (i.e., replace "cancel" with "close").

CC. @NobodyXu

Copy link
Member

@NobodyXu NobodyXu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for putting up this PR!

I will a few suggestions, and it looks great to me!

@jaywonchung
Copy link
Contributor Author

I checked socket closure by checking whether read() returns 0, which seems to mean that the connection is closed. CI is passing in my fork (https://github.com/jaywonchung/openssh-mux-client/actions/runs/10793796561). However, I'm honestly not very knowledgeable in sockets and networking. Please see if this is acceptable.

Copy link
Member

@NobodyXu NobodyXu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@NobodyXu NobodyXu merged commit 714fa2e into openssh-rust:main Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants