[ovs-dev] [PATCH v2 3/3] stream-ssl: Add support for windows platform.

Ben Pfaff blp at nicira.com
Mon Feb 10 21:14:34 UTC 2014


On Mon, Feb 10, 2014 at 11:16:22AM -0800, Gurucharan Shetty wrote:
> This commit creates events and through poll_fd_wait_event()
> associates them with socket file descriptors to get woken up
> from poll_block().
> 
> Some other changes:
> 
> * Windows does not have sys/fcntl.h but has a fcntl.h
> On Linux, there is fctnl.h too.
> 
> * include <openssl/applink.c> to handle different C-Runtime linking
> of OVS and openssl libraries as suggested at
> https://www.openssl.org/support/faq.html#PROG2

The last sentence in that FAQ entry is: "An explicit reminder is due
that in this situation [mixing compiler options] it is as important to
add CRYPTO_malloc_init prior first call to OpenSSL."  We don't call
CRYPTO_malloc_init().  Should we?

> The above include will not be needed if we compile Open vSwitch with
> /MD compiler option.

Do we need to avoid the #include, with /MD?

> * WSAEventSelect() function that associates 'fd' with events, does not
> understand POLLIN, POLLOUT etc. Instead the macros it understands are FD_READ,
> FD_WRITE, FD_ACCEPT, FD_CONNECT, FD_CLOSE etc. So we need to make that
> transition.

Won't we need that kind of translation for every call to
poll_fd_wait_event() in the whole program?  If so then should we do
the translation inside poll_fd_wait_event() itself, so that we don't
have to modify code all over?

I see that one of the changes here is changing a setsockopt() call to
cater to Windows defining the data arg as "char *" instead of "void
*".  We have a fair number of setsockopt() calls in the tree, and so
it might be better to just add something like this (untested) to
socket-util.h:

    #ifdef _WIN32
    /* Windows defines the 'optval' argument as char * instead of void *. */
    #define setsockopt(sock, level, optname, optval, optlen) \
        rpl_setsockopt(sock, level, optname, optval, optlen)
    static inline int rpl_setsockopt(int sock, int level, int optname,
                                     const void *optval, socklen_t optlen)
    {
        return (setsockopt)(sock, level, optname, optval, optlen);
    }
    #endif

Thanks,

Ben.



More information about the dev mailing list