diff options
author | 2017-10-23 05:08:00 +0000 | |
---|---|---|
committer | 2017-10-23 05:08:00 +0000 | |
commit | 39a288ec9abdad08cdca4429df9f9771a04419dd (patch) | |
tree | 7cdcf9ef4307992f96f7c1aa88e29de232013596 /usr.bin/ssh/misc.c | |
parent | remove mention of unused MACOBIOVERBOSE and NBUF options (diff) | |
download | wireguard-openbsd-39a288ec9abdad08cdca4429df9f9771a04419dd.tar.xz wireguard-openbsd-39a288ec9abdad08cdca4429df9f9771a04419dd.zip |
Expose devices allocated for tun/tap forwarding.
At the client, the device may be obtained from a new %T expansion
for LocalCommand.
At the server, the allocated devices will be listed in a
SSH_TUNNEL variable exposed to the environment of any user sessions
started after the tunnel forwarding was established.
ok markus
Diffstat (limited to 'usr.bin/ssh/misc.c')
-rw-r--r-- | usr.bin/ssh/misc.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.bin/ssh/misc.c b/usr.bin/ssh/misc.c index 33e0c3a5972..54efcfd5cd0 100644 --- a/usr.bin/ssh/misc.c +++ b/usr.bin/ssh/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.114 2017/10/21 23:06:24 millert Exp $ */ +/* $OpenBSD: misc.c,v 1.115 2017/10/23 05:08:00 djm Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * Copyright (c) 2005,2006 Damien Miller. All rights reserved. @@ -944,13 +944,16 @@ read_keyfile_line(FILE *f, const char *filename, char *buf, size_t bufsz, } int -tun_open(int tun, int mode) +tun_open(int tun, int mode, char **ifname) { struct ifreq ifr; char name[100]; int fd = -1, sock; const char *tunbase = "tun"; + if (ifname != NULL) + *ifname = NULL; + if (mode == SSH_TUNMODE_ETHERNET) tunbase = "tap"; @@ -997,6 +1000,9 @@ tun_open(int tun, int mode) } } + if (ifname != NULL) + *ifname = xstrdup(ifr.ifr_name); + close(sock); return fd; |