version 1.305, 2017/09/19 04:24:22 |
version 1.306, 2017/10/23 05:08:00 |
|
|
return c; |
return c; |
} |
} |
|
|
int |
char * |
client_request_tun_fwd(struct ssh *ssh, int tun_mode, |
client_request_tun_fwd(struct ssh *ssh, int tun_mode, |
int local_tun, int remote_tun) |
int local_tun, int remote_tun) |
{ |
{ |
Channel *c; |
Channel *c; |
int fd; |
int fd; |
|
char *ifname = NULL; |
|
|
if (tun_mode == SSH_TUNMODE_NO) |
if (tun_mode == SSH_TUNMODE_NO) |
return 0; |
return 0; |
|
|
debug("Requesting tun unit %d in mode %d", local_tun, tun_mode); |
debug("Requesting tun unit %d in mode %d", local_tun, tun_mode); |
|
|
/* Open local tunnel device */ |
/* Open local tunnel device */ |
if ((fd = tun_open(local_tun, tun_mode)) == -1) { |
if ((fd = tun_open(local_tun, tun_mode, &ifname)) == -1) { |
error("Tunnel device open failed."); |
error("Tunnel device open failed."); |
return -1; |
return NULL; |
} |
} |
|
debug("Tunnel forwarding using interface %s", ifname); |
|
|
c = channel_new(ssh, "tun", SSH_CHANNEL_OPENING, fd, fd, -1, |
c = channel_new(ssh, "tun", SSH_CHANNEL_OPENING, fd, fd, -1, |
CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1); |
CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1); |
|
|
packet_put_int(remote_tun); |
packet_put_int(remote_tun); |
packet_send(); |
packet_send(); |
|
|
return 0; |
return ifname; |
} |
} |
|
|
/* XXXX move to generic input handler */ |
/* XXXX move to generic input handler */ |