If we get a permission denied error on one DCO device, trying 255 more
times will not succeed, and just fill the log file with errors.
Also, remove the msg() call there because it was at debug level
(needed --verb 4 to be seen), didn't see the correct errno, and the
sitnl code already prints the error.
v2: use "else if"
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Antonio Quartulli <a@unstable.cc>
Message-Id: <
20220804082502.
1750074-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24799.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
{
openvpn_snprintf(dynamic_name, sizeof(dynamic_name),
"%s%d", dev, i);
- if (open_tun_dco(tt, ctx, dynamic_name) == 0)
+ int ret = open_tun_dco(tt, ctx, dynamic_name);
+ if (ret == 0)
{
dynamic_opened = true;
msg(M_INFO, "DCO device %s opened", dynamic_name);
break;
}
- msg(D_READ_WRITE | M_ERRNO, "Tried opening %s (failed)", dynamic_name);
+ /* "permission denied" won't succeed if we try 256 times */
+ else if (ret == -EPERM)
+ {
+ break;
+ }
}
if (!dynamic_opened)
{