[ovs-dev] [PATCH v2 4/5] Changes needed to netlink-socket for MSVC

Gurucharan Shetty shettyg at nicira.com
Tue Sep 9 20:28:24 UTC 2014


On Tue, Jul 29, 2014 at 8:23 AM, Alin Serdean
<aserdean at cloudbasesolutions.com> wrote:
> Add two functions set_sock_pid_in_kernel and portid_next. This will allow
> the channel identification for the kernel extension to send back messages.
>
> Replace send with WriteFile equivalent and ignore nl_sock_drain for the moment
> under MSVC.
>
> Replace sendmsg and recvmsg with ReadFile and WriteFile equivalents.
>
> On MSVC put in handle instead of fd(sock->fd becomes sock->handle).
>
> Creation of the netlink socket will be replaced by CreateFile equivalent.
>
> Add MAX_STACK_LENGTH for MSVC this will be our maximmum for on-stack copy buffer.
>
> Signed-off-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>



>  int
>  nl_sock_leave_mcgroup(struct nl_sock *sock, unsigned int multicast_group)
>  {
> +#ifdef _WIN32
> +    struct ofpbuf msg_buf;
> +    struct message_multicast
> +    {
> +        struct nlmsghdr;
> +        /* if true, join; if else, leave*/
> +        unsigned char join;
> +    };
> +
> +    struct message_multicast msg = { 0 };
> +    nl_msg_put_nlmsghdr(&msg, sizeof(struct message_multicast),
> +                        multicast_group, 0);
The above gives a warning:
"incompatible types - from "message_multicast *" to "ofpbuf *".
Is it intentional (I haven't followed the work closely, so I am not
sure)? If so, can we cast it?

>  /* Starts a Netlink "dump" operation, by sending 'request' to the kernel on a
> @@ -877,7 +1045,11 @@ nl_dump_done(struct nl_dump *dump)
>  void
>  nl_sock_wait(const struct nl_sock *sock, short int events)
>  {
> +#ifdef _WIN32
> +    poll_fd_wait(sock->handle, events);

poll_fd_wait() can only be used for sockets. So this will not give you
the desired behavior. Did you mean to use poll_wevent_wait() instead?
(In which case 'events' will be ignored. )



More information about the dev mailing list