diff options
author | Damien Miller <djm@mindrot.org> | 2017-09-12 18:01:35 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2017-09-12 18:01:35 +1000 |
commit | 871f1e4374420b07550041b329627c474abc3010 (patch) | |
tree | 8b01b89e95aa3faf6a2eb9be50fee5a25928a7f6 /openbsd-compat | |
parent | 4ec0bb9f9ad7b4eb0af110fa8eddf8fa199e46bb (diff) |
adapt portable to channels API changes
Diffstat (limited to 'openbsd-compat')
-rw-r--r-- | openbsd-compat/port-tun.c | 12 | ||||
-rw-r--r-- | openbsd-compat/port-tun.h | 5 |
2 files changed, 8 insertions, 9 deletions
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 | ||
209 | int | 209 | int |
210 | sys_tun_infilter(struct Channel *c, char *buf, int _len) | 210 | sys_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 | ||
253 | u_char * | 253 | u_char * |
254 | sys_tun_outfilter(struct Channel *c, u_char **data, u_int *dlen) | 254 | sys_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 | ||
20 | struct Channel; | 20 | struct Channel; |
21 | struct 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 |
29 | int sys_tun_infilter(struct Channel *, char *, int); | 30 | int sys_tun_infilter(struct ssh *, struct Channel *, char *, int); |
30 | u_char *sys_tun_outfilter(struct Channel *, u_char **, u_int *); | 31 | u_char *sys_tun_outfilter(struct ssh *, struct Channel *, u_char **, size_t *); |
31 | #endif | 32 | #endif |
32 | 33 | ||
33 | #endif | 34 | #endif |