1- /* $OpenBSD: clientloop.c,v 1.305 2017/09/19 04:24:22 djm Exp $ */
1+ /* $OpenBSD: clientloop.c,v 1.306 2017/10/23 05:08:00 djm Exp $ */
22/*
33 * Author: Tatu Ylonen <ylo@cs.hut.fi>
44 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1605,23 +1605,25 @@ client_request_agent(struct ssh *ssh, const char *request_type, int rchan)
16051605 return c ;
16061606}
16071607
1608- int
1608+ char *
16091609client_request_tun_fwd (struct ssh * ssh , int tun_mode ,
16101610 int local_tun , int remote_tun )
16111611{
16121612 Channel * c ;
16131613 int fd ;
1614+ char * ifname = NULL ;
16141615
16151616 if (tun_mode == SSH_TUNMODE_NO )
16161617 return 0 ;
16171618
16181619 debug ("Requesting tun unit %d in mode %d" , local_tun , tun_mode );
16191620
16201621 /* Open local tunnel device */
1621- if ((fd = tun_open (local_tun , tun_mode )) == -1 ) {
1622+ if ((fd = tun_open (local_tun , tun_mode , & ifname )) == -1 ) {
16221623 error ("Tunnel device open failed." );
1623- return -1 ;
1624+ return NULL ;
16241625 }
1626+ debug ("Tunnel forwarding using interface %s" , ifname );
16251627
16261628 c = channel_new (ssh , "tun" , SSH_CHANNEL_OPENING , fd , fd , -1 ,
16271629 CHAN_TCP_WINDOW_DEFAULT , CHAN_TCP_PACKET_DEFAULT , 0 , "tun" , 1 );
@@ -1642,7 +1644,7 @@ client_request_tun_fwd(struct ssh *ssh, int tun_mode,
16421644 packet_put_int (remote_tun );
16431645 packet_send ();
16441646
1645- return 0 ;
1647+ return ifname ;
16461648}
16471649
16481650/* XXXX move to generic input handler */
0 commit comments