Hi, Also there are some places openvpn_errno() is used and the result checked > against POSIX error codes: > in forward.c around line 2102: > > if (.... && ENETUNREACH == error_code && ...) > > where error_code = openvpn_errno() which may return WSAENETUNREACH on > Windows not ENETUNREACH-- even that depends on GetLastError() and > WSAGetLastError() to behave identically. >
Thanks, fixed. > Also does code like the below in socket.c do the right thing? > (around line 1451 in socket.c) > status = openvpn_errno(); > if (status == WSAEWOULDBLOCK) .... > but openvpn_errono() doesn't look for WSA errors (though it probably still > works?). > Yeah we compare GetLastError result here with WSA*, but in practice that works. Here we just call openvpn_errno(), we could add WSA* support but this will make code less readable for the benefit of being more "pure", not sure it is worth it. > - extended_msg, strerror(my_errno), sock ? sock->sd : >> -1, my_errno); >> + extended_msg, openvpn_strerror(my_errno, &gc), sock >> ? sock->sd : -1, my_errno); >> > > Here my_errno = openvpn_errno() -- don't we need the fallback to POSIX > errno in this case? Could this also get called when a socket error is > expected? > You are right. I slightly refactored that part to reuse crt error fallback code which we need in 3 different places. The rest looks good to me. > As you proposed, I removed WSA error printing from this patch, it could come in a follow-up. V2 is coming.
_______________________________________________ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel