Implement `portfwd-loopback-choice'. Works on local side in Unix as
[u/mdw/putty] / portfwd.c
index 16f001a..dd8e655 100644 (file)
--- a/portfwd.c
+++ b/portfwd.c
@@ -203,9 +203,10 @@ static int pfd_accepting(Plug p, void *sock)
 
 
 /* Add a new forwarding from port -> desthost:destport
- sets up a listener on the local machine on port
+ sets up a listener on the local machine on (srcaddr:)port
  */
-char *pfd_addforward(char *desthost, int destport, int port, void *backhandle)
+char *pfd_addforward(char *desthost, int destport, char *srcaddr, int port,
+                    void *backhandle)
 {
     static struct plug_function_table fn_table = {
        pfd_closing,
@@ -231,7 +232,7 @@ char *pfd_addforward(char *desthost, int destport, int port, void *backhandle)
     pr->waiting = NULL;
     pr->backhandle = backhandle;
 
-    pr->s = s = new_listener(port, (Plug) pr, !cfg.lport_acceptall);
+    pr->s = s = new_listener(srcaddr, port, (Plug) pr, !cfg.lport_acceptall);
     if ((err = sk_socket_error(s))) {
        sfree(pr);
        return err;