diff options
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: misc.c,v 1.114 2017/10/21 23:06:24 millert Exp $ */ | 1 | /* $OpenBSD: misc.c,v 1.115 2017/10/23 05:08:00 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | * Copyright (c) 2005,2006 Damien Miller. All rights reserved. | 4 | * Copyright (c) 2005,2006 Damien Miller. All rights reserved. |
@@ -964,16 +964,19 @@ read_keyfile_line(FILE *f, const char *filename, char *buf, size_t bufsz, | |||
964 | } | 964 | } |
965 | 965 | ||
966 | int | 966 | int |
967 | tun_open(int tun, int mode) | 967 | tun_open(int tun, int mode, char **ifname) |
968 | { | 968 | { |
969 | #if defined(CUSTOM_SYS_TUN_OPEN) | 969 | #if defined(CUSTOM_SYS_TUN_OPEN) |
970 | return (sys_tun_open(tun, mode)); | 970 | return (sys_tun_open(tun, mode, ifname)); |
971 | #elif defined(SSH_TUN_OPENBSD) | 971 | #elif defined(SSH_TUN_OPENBSD) |
972 | struct ifreq ifr; | 972 | struct ifreq ifr; |
973 | char name[100]; | 973 | char name[100]; |
974 | int fd = -1, sock; | 974 | int fd = -1, sock; |
975 | const char *tunbase = "tun"; | 975 | const char *tunbase = "tun"; |
976 | 976 | ||
977 | if (ifname != NULL) | ||
978 | *ifname = NULL; | ||
979 | |||
977 | if (mode == SSH_TUNMODE_ETHERNET) | 980 | if (mode == SSH_TUNMODE_ETHERNET) |
978 | tunbase = "tap"; | 981 | tunbase = "tap"; |
979 | 982 | ||
@@ -1020,6 +1023,9 @@ tun_open(int tun, int mode) | |||
1020 | } | 1023 | } |
1021 | } | 1024 | } |
1022 | 1025 | ||
1026 | if (ifname != NULL) | ||
1027 | *ifname = xstrdup(ifr.ifr_name); | ||
1028 | |||
1023 | close(sock); | 1029 | close(sock); |
1024 | return fd; | 1030 | return fd; |
1025 | 1031 | ||