adapt portable to channels API changes
This commit is contained in:
parent
4ec0bb9f9a
commit
871f1e4374
|
@ -1634,7 +1634,7 @@ client_request_tun_fwd(struct ssh *ssh, int tun_mode,
|
|||
|
||||
#if defined(SSH_TUN_FILTER)
|
||||
if (options.tun_open == SSH_TUNMODE_POINTOPOINT)
|
||||
channel_register_filter(c->self, sys_tun_infilter,
|
||||
channel_register_filter(ssh, c->self, sys_tun_infilter,
|
||||
sys_tun_outfilter, NULL, NULL);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ sys_tun_open(int tun, int mode)
|
|||
#define OPENBSD_AF_INET6 24
|
||||
|
||||
int
|
||||
sys_tun_infilter(struct Channel *c, char *buf, int _len)
|
||||
sys_tun_infilter(struct ssh *ssh, struct Channel *c, char *buf, int _len)
|
||||
{
|
||||
int r;
|
||||
size_t len;
|
||||
|
@ -245,24 +245,22 @@ sys_tun_infilter(struct Channel *c, char *buf, int _len)
|
|||
POKE_U32(buf, af == AF_INET6 ? OPENBSD_AF_INET6 : OPENBSD_AF_INET);
|
||||
#endif
|
||||
|
||||
if ((r = sshbuf_put_string(&c->input, ptr, len)) != 0)
|
||||
if ((r = sshbuf_put_string(c->input, ptr, len)) != 0)
|
||||
fatal("%s: buffer error: %s", __func__, ssh_err(r));
|
||||
return (0);
|
||||
}
|
||||
|
||||
u_char *
|
||||
sys_tun_outfilter(struct Channel *c, u_char **data, u_int *dlen)
|
||||
sys_tun_outfilter(struct ssh *ssh, struct Channel *c,
|
||||
u_char **data, size_t *dlen)
|
||||
{
|
||||
u_char *buf;
|
||||
u_int32_t af;
|
||||
int r;
|
||||
size_t xxx_dlen;
|
||||
|
||||
/* XXX new API is incompatible with this signature. */
|
||||
if ((r = sshbuf_get_string(&c->output, data, &xxx_dlen)) != 0)
|
||||
if ((r = sshbuf_get_string(c->output, data, dlen)) != 0)
|
||||
fatal("%s: buffer error: %s", __func__, ssh_err(r));
|
||||
if (dlen != NULL)
|
||||
*dlen = xxx_dlen;
|
||||
if (*dlen < sizeof(af))
|
||||
return (NULL);
|
||||
buf = *data;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#define _PORT_TUN_H
|
||||
|
||||
struct Channel;
|
||||
struct ssh;
|
||||
|
||||
#if defined(SSH_TUN_LINUX) || defined(SSH_TUN_FREEBSD)
|
||||
# define CUSTOM_SYS_TUN_OPEN
|
||||
|
@ -26,8 +27,8 @@ int sys_tun_open(int, int);
|
|||
|
||||
#if defined(SSH_TUN_COMPAT_AF) || defined(SSH_TUN_PREPEND_AF)
|
||||
# define SSH_TUN_FILTER
|
||||
int sys_tun_infilter(struct Channel *, char *, int);
|
||||
u_char *sys_tun_outfilter(struct Channel *, u_char **, u_int *);
|
||||
int sys_tun_infilter(struct ssh *, struct Channel *, char *, int);
|
||||
u_char *sys_tun_outfilter(struct ssh *, struct Channel *, u_char **, size_t *);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -549,7 +549,7 @@ server_request_tun(struct ssh *ssh)
|
|||
c->datagram = 1;
|
||||
#if defined(SSH_TUN_FILTER)
|
||||
if (mode == SSH_TUNMODE_POINTOPOINT)
|
||||
channel_register_filter(c->self, sys_tun_infilter,
|
||||
channel_register_filter(ssh, c->self, sys_tun_infilter,
|
||||
sys_tun_outfilter, NULL, NULL);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue