Hello! I was looking around for a solution which would allow me to un-forward already locally forwarded port but had no luck. So I decided to try and add it myself. I am not a good C coder, in fact, I've never really coded under unix before(it's just half a year since I fully moved from windowz). Here is what I made by now: http://www.linuxquestions.org/questions/programming-9/c-coding-hacking-ssh-dynamic-local-port-forwarding-implementation-786608/ By querying ~C and "-KL<port>" now it is possible to remove local listener and later, reuse it to forward to another destination. I didn't test it with specifying bind address, and I guess that will probably fail anyways since I've only one input param in newly created function. If this hack can be of any help and developed further, to be added in OpenSSH later: that would be great! In fact I just had nothing to do and some guy on forum posted that question about impossibility of removing local port forward in openssh so I took some time and tried to hack sources to implement that myself, just my curiosity. Maybe if I'll wish, I'll get back to this later and see if I can improve it and make it not as ugly hack as it is now :) Anyway, can someone explain me why such an easy thingy has not been fully implemented recently? Noone ever asked? Noone ever thought? Or it was me who searched not good enough? Anyways it is neither in stable nor in SVN releases. Dynamic un-forwarding works great in PuTTY, for instance. Konstantin.
I'm something of a fan of -D and socksifying client apps. Better than littering local port namespace, anyway. On Feb 3, 2010, at 2:12 PM, Konstantin Leonov <edk at caribbeanblue.ru> wrote:> Hello! > > I was looking around for a solution which would allow me to un-forward > already locally forwarded port but had no luck. > > So I decided to try and add it myself. > I am not a good C coder, in fact, I've never really coded under unix > before(it's just half a year since I fully moved from windowz). Here > is what I made by now: > http://www.linuxquestions.org/questions/programming-9/c-coding-hacking-ssh-dynamic-local-port-forwarding-implementation-786608/ > By querying ~C and "-KL<port>" now it is possible to remove local > listener and later, reuse it to forward to another destination. > I didn't test it with specifying bind address, and I guess that will > probably fail anyways since I've only one input param in newly created > function. > > If this hack can be of any help and developed further, to be added in > OpenSSH later: that would be great! In fact I just had nothing to do > and some guy on forum posted that question about impossibility of > removing local port forward in openssh so I took some time and tried > to hack sources to implement that myself, just my curiosity. > Maybe if I'll wish, I'll get back to this later and see if I can > improve it and make it not as ugly hack as it is now :) > > Anyway, can someone explain me why such an easy thingy has not been > fully implemented recently? Noone ever asked? Noone ever thought? Or > it was me who searched not good enough? Anyways it is neither in > stable nor in SVN releases. Dynamic un-forwarding works great in > PuTTY, for instance. > > Konstantin. > _______________________________________________ > openssh-unix-dev mailing list > openssh-unix-dev at mindrot.org > https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
On Thu, 4 Feb 2010, Konstantin Leonov wrote:> Hello! > > I was looking around for a solution which would allow me to un-forward > already locally forwarded port but had no luck.I plan to add this through the ControlMaster socket, but haven't got around to it yet. Hopefully I will get it in before 5.4, but it isn't looking likely. Until then I recommend you use -D/DynamicForward and a socks client, e.g. OpenBSD's netcat or Goto-san's connect.c[1] -d [1] http://www.meadowy.org/~gotoh/ssh/connect.c