mirror of
https://github.com/OpenVPN/openvpn.git
synced 2026-05-28 04:03:29 -04:00
Include utun device number in utun error messages
For lack of a better API (or knowledge about a better API) we try to open utun devices on macOS by trying utun0 to utun255 and use the first one that works. On my Mac I have already 4 devices that do nothing but are just there and another VPN connection resulting in a number of error messages. This explicitly shows in the log that we tried the devices instead of some unspecific error. This changes the log from: Opening utun (connect(AF_SYS_CONTROL)): Resource busy (errno=16) Opening utun (connect(AF_SYS_CONTROL)): Resource busy (errno=16) Opening utun (connect(AF_SYS_CONTROL)): Resource busy (errno=16) Opening utun (connect(AF_SYS_CONTROL)): Resource busy (errno=16) Opening utun (connect(AF_SYS_CONTROL)): Resource busy (errno=16) Opened utun device utun5 to Opening utun0 failed (connect(AF_SYS_CONTROL)): Resource busy (errno=16) Opening utun1 failed (connect(AF_SYS_CONTROL)): Resource busy (errno=16) Opening utun2 failed (connect(AF_SYS_CONTROL)): Resource busy (errno=16) Opening utun3 failed (connect(AF_SYS_CONTROL)): Resource busy (errno=16) Opening utun4 failed (connect(AF_SYS_CONTROL)): Resource busy (errno=16) Opened utun device utun5 Signed-off-by: Arne Schwabe <arne@rfc2549.org> Feature-ACK-by: "Jonathan K. Bullard" <jkbullard@gmail.com> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20200725235023.22441-1-arne@rfc2549.org> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg20590.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
parent
6d19775a46
commit
1d86fae874
1 changed files with 6 additions and 3 deletions
|
|
@ -2950,14 +2950,16 @@ utun_open_helper(struct ctl_info ctlInfo, int utunnum)
|
|||
|
||||
if (fd < 0)
|
||||
{
|
||||
msg(M_INFO | M_ERRNO, "Opening utun (socket(SYSPROTO_CONTROL))");
|
||||
msg(M_INFO | M_ERRNO, "Opening utun%d failed (socket(SYSPROTO_CONTROL))",
|
||||
utunnum);
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (ioctl(fd, CTLIOCGINFO, &ctlInfo) == -1)
|
||||
{
|
||||
close(fd);
|
||||
msg(M_INFO | M_ERRNO, "Opening utun (ioctl(CTLIOCGINFO))");
|
||||
msg(M_INFO | M_ERRNO, "Opening utun%d failed (ioctl(CTLIOCGINFO))",
|
||||
utunnum);
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
|
@ -2975,7 +2977,8 @@ utun_open_helper(struct ctl_info ctlInfo, int utunnum)
|
|||
|
||||
if (connect(fd, (struct sockaddr *)&sc, sizeof(sc)) < 0)
|
||||
{
|
||||
msg(M_INFO | M_ERRNO, "Opening utun (connect(AF_SYS_CONTROL))");
|
||||
msg(M_INFO | M_ERRNO, "Opening utun%d failed (connect(AF_SYS_CONTROL))",
|
||||
utunnum);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue