[ovs-dev] [PATCH 05/10] windows: fix calls in netlink-socket
Guru Shetty
guru at ovn.org
Tue Mar 7 21:40:05 UTC 2017
On 5 February 2017 at 20:41, Alin Serdean <aserdean at cloudbasesolutions.com>
wrote:
> Add nl_sock_transact forward declaration, since it is used before
> being on implemented. This applies only on Windows.
>
> Move nl_sock_subscribe_packet__ function before it is used.
>
> It makes more sense to move it rather than adding a forward declaration
> since it is used by the two functions defined above it.
>
> Signed-off-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
>
Applied.
> ---
> lib/netlink-socket.c | 50 ++++++++++++++++++++++++++----
> --------------------
> 1 file changed, 26 insertions(+), 24 deletions(-)
>
> diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c
> index e45914c..f4c6fd9 100644
> --- a/lib/netlink-socket.c
> +++ b/lib/netlink-socket.c
> @@ -60,6 +60,8 @@ static void log_nlmsg(const char *function, int error,
> #ifdef _WIN32
> static int get_sock_pid_from_kernel(struct nl_sock *sock);
> static int set_sock_property(struct nl_sock *sock);
> +static int nl_sock_transact(struct nl_sock *sock, const struct ofpbuf
> *request,
> + struct ofpbuf **replyp);
> #endif
>
> /* Netlink sockets. */
> @@ -425,6 +427,30 @@ nl_sock_join_mcgroup(struct nl_sock *sock, unsigned
> int multicast_group)
>
> #ifdef _WIN32
> int
> +nl_sock_subscribe_packet__(struct nl_sock *sock, bool subscribe)
> +{
> + struct ofpbuf request;
> + uint64_t request_stub[128];
> + struct ovs_header *ovs_header;
> + struct nlmsghdr *nlmsg;
> + int error;
> +
> + ofpbuf_use_stub(&request, request_stub, sizeof request_stub);
> + nl_msg_put_genlmsghdr(&request, 0, OVS_WIN_NL_CTRL_FAMILY_ID, 0,
> + OVS_CTRL_CMD_PACKET_SUBSCRIBE_REQ,
> + OVS_WIN_CONTROL_VERSION);
> +
> + ovs_header = ofpbuf_put_uninit(&request, sizeof *ovs_header);
> + ovs_header->dp_ifindex = 0;
> + nl_msg_put_u8(&request, OVS_NL_ATTR_PACKET_SUBSCRIBE, subscribe ? 1 :
> 0);
> + nl_msg_put_u32(&request, OVS_NL_ATTR_PACKET_PID, sock->pid);
> +
> + error = nl_sock_send(sock, &request, true);
> + ofpbuf_uninit(&request);
> + return error;
> +}
> +
> +int
> nl_sock_subscribe_packets(struct nl_sock *sock)
> {
> int error;
> @@ -459,30 +485,6 @@ nl_sock_unsubscribe_packets(struct nl_sock *sock)
> sock->read_ioctl = OVS_IOCTL_READ;
> return 0;
> }
> -
> -int
> -nl_sock_subscribe_packet__(struct nl_sock *sock, bool subscribe)
> -{
> - struct ofpbuf request;
> - uint64_t request_stub[128];
> - struct ovs_header *ovs_header;
> - struct nlmsghdr *nlmsg;
> - int error;
> -
> - ofpbuf_use_stub(&request, request_stub, sizeof request_stub);
> - nl_msg_put_genlmsghdr(&request, 0, OVS_WIN_NL_CTRL_FAMILY_ID, 0,
> - OVS_CTRL_CMD_PACKET_SUBSCRIBE_REQ,
> - OVS_WIN_CONTROL_VERSION);
> -
> - ovs_header = ofpbuf_put_uninit(&request, sizeof *ovs_header);
> - ovs_header->dp_ifindex = 0;
> - nl_msg_put_u8(&request, OVS_NL_ATTR_PACKET_SUBSCRIBE, subscribe ? 1 :
> 0);
> - nl_msg_put_u32(&request, OVS_NL_ATTR_PACKET_PID, sock->pid);
> -
> - error = nl_sock_send(sock, &request, true);
> - ofpbuf_uninit(&request);
> - return error;
> -}
> #endif
>
> /* Tries to make 'sock' stop listening to 'multicast_group'. Returns 0 if
> --
> 2.10.2.windows.1
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
More information about the dev
mailing list