Bugzilla – Attachment 3019 Details for
Bug 2735
Wrong address family handling for tun devices
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Modified re-re-revised diff to not use htonl()/ntohl() anymore
0001-Do-not-convert-address-family-with-ntohl-htonl-befor.patch (text/plain), 1.64 KB, created by
stepe
on 2017-07-28 05:13:14 AEST
(
hide
)
Description:
Modified re-re-revised diff to not use htonl()/ntohl() anymore
Filename:
MIME Type:
Creator:
stepe
Created:
2017-07-28 05:13:14 AEST
Size:
1.64 KB
patch
obsolete
>From cdc36f0ffa5b531aca130b01977e536645202fd9 Mon Sep 17 00:00:00 2001 >From: stepe <stepe@centaurus.uberspace.de> >Date: Thu, 27 Jul 2017 20:41:37 +0200 >Subject: [PATCH] Do not convert address family with ntohl()/htonl() before > reading/writing it to/from the ssh buffer since PEEK_U32()/POKE_U32() already > take care of the correct byte order. > >--- > openbsd-compat/port-tun.c | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > >diff --git a/openbsd-compat/port-tun.c b/openbsd-compat/port-tun.c >index 40dd8b5..a7a5d94 100644 >--- a/openbsd-compat/port-tun.c >+++ b/openbsd-compat/port-tun.c >@@ -234,16 +234,15 @@ sys_tun_infilter(struct Channel *c, char *buf, int _len) > /* Prepend address family to packet using OpenBSD constants */ > memcpy(rbuf + 4, buf, len); > len += 4; >- POKE_U32(rbuf, htonl(af)); >+ POKE_U32(rbuf, af); > ptr = rbuf; > #elif defined(SSH_TUN_COMPAT_AF) > /* Convert existing address family header to OpenBSD value */ > if (len <= 4) > return -1; >- af = ntohl(PEEK_U32(buf)); >+ af = PEEK_U32(buf); > /* Put it back */ >- POKE_U32(buf, htonl(af == AF_INET6 ? >- OPENBSD_AF_INET6 : OPENBSD_AF_INET)); >+ POKE_U32(buf, af == AF_INET6 ? OPENBSD_AF_INET6 : OPENBSD_AF_INET); > #endif > > if ((r = sshbuf_put_string(&c->input, ptr, len)) != 0) >@@ -274,8 +273,8 @@ sys_tun_outfilter(struct Channel *c, u_char **data, u_int *dlen) > buf = *data + sizeof(af); > #elif defined(SSH_TUN_COMPAT_AF) > /* translate address family */ >- af = (ntohl(PEEK_U32(buf)) == OPENBSD_AF_INET6) ? AF_INET6 : AF_INET; >- POKE_U32(buf, htonl(af)); >+ af = (PEEK_U32(buf) == OPENBSD_AF_INET6) ? AF_INET6 : AF_INET; >+ POKE_U32(buf, af); > #endif > return (buf); > } >-- >2.1.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 2735
:
3005
|
3006
|
3011
|
3016
|
3017
|
3019
|
3020