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 $ */
2
2
/*
3
3
* Author: Tatu Ylonen <[email protected] >
4
4
* Copyright (c) 1995 Tatu Ylonen <[email protected] >, Espoo, Finland
@@ -1605,23 +1605,25 @@ client_request_agent(struct ssh *ssh, const char *request_type, int rchan)
1605
1605
return c ;
1606
1606
}
1607
1607
1608
- int
1608
+ char *
1609
1609
client_request_tun_fwd (struct ssh * ssh , int tun_mode ,
1610
1610
int local_tun , int remote_tun )
1611
1611
{
1612
1612
Channel * c ;
1613
1613
int fd ;
1614
+ char * ifname = NULL ;
1614
1615
1615
1616
if (tun_mode == SSH_TUNMODE_NO )
1616
1617
return 0 ;
1617
1618
1618
1619
debug ("Requesting tun unit %d in mode %d" , local_tun , tun_mode );
1619
1620
1620
1621
/* 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 ) {
1622
1623
error ("Tunnel device open failed." );
1623
- return -1 ;
1624
+ return NULL ;
1624
1625
}
1626
+ debug ("Tunnel forwarding using interface %s" , ifname );
1625
1627
1626
1628
c = channel_new (ssh , "tun" , SSH_CHANNEL_OPENING , fd , fd , -1 ,
1627
1629
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,
1642
1644
packet_put_int (remote_tun );
1643
1645
packet_send ();
1644
1646
1645
- return 0 ;
1647
+ return ifname ;
1646
1648
}
1647
1649
1648
1650
/* XXXX move to generic input handler */
0 commit comments