summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2017-09-12 18:01:35 +1000
committerDamien Miller <djm@mindrot.org>2017-09-12 18:01:35 +1000
commit871f1e4374420b07550041b329627c474abc3010 (patch)
tree8b01b89e95aa3faf6a2eb9be50fee5a25928a7f6
parent4ec0bb9f9ad7b4eb0af110fa8eddf8fa199e46bb (diff)
adapt portable to channels API changes
-rw-r--r--clientloop.c2
-rw-r--r--openbsd-compat/port-tun.c12
-rw-r--r--openbsd-compat/port-tun.h5
-rw-r--r--serverloop.c2
4 files changed, 10 insertions, 11 deletions
diff --git a/clientloop.c b/clientloop.c
index 829eae024..3b4840b12 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1634,7 +1634,7 @@ client_request_tun_fwd(struct ssh *ssh, int tun_mode,
1634 1634
1635#if defined(SSH_TUN_FILTER) 1635#if defined(SSH_TUN_FILTER)
1636 if (options.tun_open == SSH_TUNMODE_POINTOPOINT) 1636 if (options.tun_open == SSH_TUNMODE_POINTOPOINT)
1637 channel_register_filter(c->self, sys_tun_infilter, 1637 channel_register_filter(ssh, c->self, sys_tun_infilter,
1638 sys_tun_outfilter, NULL, NULL); 1638 sys_tun_outfilter, NULL, NULL);
1639#endif 1639#endif
1640 1640
diff --git a/openbsd-compat/port-tun.c b/openbsd-compat/port-tun.c
index a7a5d949a..7579c6084 100644
--- a/openbsd-compat/port-tun.c
+++ b/openbsd-compat/port-tun.c
@@ -207,7 +207,7 @@ sys_tun_open(int tun, int mode)
207#define OPENBSD_AF_INET6 24 207#define OPENBSD_AF_INET6 24
208 208
209int 209int
210sys_tun_infilter(struct Channel *c, char *buf, int _len) 210sys_tun_infilter(struct ssh *ssh, struct Channel *c, char *buf, int _len)
211{ 211{
212 int r; 212 int r;
213 size_t len; 213 size_t len;
@@ -245,24 +245,22 @@ sys_tun_infilter(struct Channel *c, char *buf, int _len)
245 POKE_U32(buf, af == AF_INET6 ? OPENBSD_AF_INET6 : OPENBSD_AF_INET); 245 POKE_U32(buf, af == AF_INET6 ? OPENBSD_AF_INET6 : OPENBSD_AF_INET);
246#endif 246#endif
247 247
248 if ((r = sshbuf_put_string(&c->input, ptr, len)) != 0) 248 if ((r = sshbuf_put_string(c->input, ptr, len)) != 0)
249 fatal("%s: buffer error: %s", __func__, ssh_err(r)); 249 fatal("%s: buffer error: %s", __func__, ssh_err(r));
250 return (0); 250 return (0);
251} 251}
252 252
253u_char * 253u_char *
254sys_tun_outfilter(struct Channel *c, u_char **data, u_int *dlen) 254sys_tun_outfilter(struct ssh *ssh, struct Channel *c,
255 u_char **data, size_t *dlen)
255{ 256{
256 u_char *buf; 257 u_char *buf;
257 u_int32_t af; 258 u_int32_t af;
258 int r; 259 int r;
259 size_t xxx_dlen;
260 260
261 /* XXX new API is incompatible with this signature. */ 261 /* XXX new API is incompatible with this signature. */
262 if ((r = sshbuf_get_string(&c->output, data, &xxx_dlen)) != 0) 262 if ((r = sshbuf_get_string(c->output, data, dlen)) != 0)
263 fatal("%s: buffer error: %s", __func__, ssh_err(r)); 263 fatal("%s: buffer error: %s", __func__, ssh_err(r));
264 if (dlen != NULL)
265 *dlen = xxx_dlen;
266 if (*dlen < sizeof(af)) 264 if (*dlen < sizeof(af))
267 return (NULL); 265 return (NULL);
268 buf = *data; 266 buf = *data;
diff --git a/openbsd-compat/port-tun.h b/openbsd-compat/port-tun.h
index c53df01fc..103514370 100644
--- a/openbsd-compat/port-tun.h
+++ b/openbsd-compat/port-tun.h
@@ -18,6 +18,7 @@
18#define _PORT_TUN_H 18#define _PORT_TUN_H
19 19
20struct Channel; 20struct Channel;
21struct ssh;
21 22
22#if defined(SSH_TUN_LINUX) || defined(SSH_TUN_FREEBSD) 23#if defined(SSH_TUN_LINUX) || defined(SSH_TUN_FREEBSD)
23# define CUSTOM_SYS_TUN_OPEN 24# define CUSTOM_SYS_TUN_OPEN
@@ -26,8 +27,8 @@ int sys_tun_open(int, int);
26 27
27#if defined(SSH_TUN_COMPAT_AF) || defined(SSH_TUN_PREPEND_AF) 28#if defined(SSH_TUN_COMPAT_AF) || defined(SSH_TUN_PREPEND_AF)
28# define SSH_TUN_FILTER 29# define SSH_TUN_FILTER
29int sys_tun_infilter(struct Channel *, char *, int); 30int sys_tun_infilter(struct ssh *, struct Channel *, char *, int);
30u_char *sys_tun_outfilter(struct Channel *, u_char **, u_int *); 31u_char *sys_tun_outfilter(struct ssh *, struct Channel *, u_char **, size_t *);
31#endif 32#endif
32 33
33#endif 34#endif
diff --git a/serverloop.c b/serverloop.c
index ae75fc2ec..24bbae322 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -549,7 +549,7 @@ server_request_tun(struct ssh *ssh)
549 c->datagram = 1; 549 c->datagram = 1;
550#if defined(SSH_TUN_FILTER) 550#if defined(SSH_TUN_FILTER)
551 if (mode == SSH_TUNMODE_POINTOPOINT) 551 if (mode == SSH_TUNMODE_POINTOPOINT)
552 channel_register_filter(c->self, sys_tun_infilter, 552 channel_register_filter(ssh, c->self, sys_tun_infilter,
553 sys_tun_outfilter, NULL, NULL); 553 sys_tun_outfilter, NULL, NULL);
554#endif 554#endif
555 555