Re: [ovs-dev] [PATCH 05/10] windows: fix calls in netlink-socket

2017-03-07 Thread Guru Shetty
On 5 February 2017 at 20:41, Alin Serdean 
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 
>
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_stub, sizeof request_stub);
> +nl_msg_put_genlmsghdr(, 0, OVS_WIN_NL_CTRL_FAMILY_ID, 0,
> +  OVS_CTRL_CMD_PACKET_SUBSCRIBE_REQ,
> +  OVS_WIN_CONTROL_VERSION);
> +
> +ovs_header = ofpbuf_put_uninit(, sizeof *ovs_header);
> +ovs_header->dp_ifindex = 0;
> +nl_msg_put_u8(, OVS_NL_ATTR_PACKET_SUBSCRIBE, subscribe ? 1 :
> 0);
> +nl_msg_put_u32(, OVS_NL_ATTR_PACKET_PID, sock->pid);
> +
> +error = nl_sock_send(sock, , true);
> +ofpbuf_uninit();
> +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_stub, sizeof request_stub);
> -nl_msg_put_genlmsghdr(, 0, OVS_WIN_NL_CTRL_FAMILY_ID, 0,
> -  OVS_CTRL_CMD_PACKET_SUBSCRIBE_REQ,
> -  OVS_WIN_CONTROL_VERSION);
> -
> -ovs_header = ofpbuf_put_uninit(, sizeof *ovs_header);
> -ovs_header->dp_ifindex = 0;
> -nl_msg_put_u8(, OVS_NL_ATTR_PACKET_SUBSCRIBE, subscribe ? 1 :
> 0);
> -nl_msg_put_u32(, OVS_NL_ATTR_PACKET_PID, sock->pid);
> -
> -error = nl_sock_send(sock, , true);
> -ofpbuf_uninit();
> -return error;
> -}
>  #endif
>
>  /* Tries to make 'sock' stop listening to 'multicast_group'.  Returns 0 if
> --
> 2.10.2.windows.1
> ___
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH 05/10] windows: fix calls in netlink-socket

2017-03-07 Thread Sairam Venugopal
Acked-by: Sairam Venugopal 







On 2/5/17, 8:41 PM, "ovs-dev-boun...@openvswitch.org on behalf of Alin Serdean" 
 
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 
>---
> 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_stub, sizeof request_stub);
>+nl_msg_put_genlmsghdr(, 0, OVS_WIN_NL_CTRL_FAMILY_ID, 0,
>+  OVS_CTRL_CMD_PACKET_SUBSCRIBE_REQ,
>+  OVS_WIN_CONTROL_VERSION);
>+
>+ovs_header = ofpbuf_put_uninit(, sizeof *ovs_header);
>+ovs_header->dp_ifindex = 0;
>+nl_msg_put_u8(, OVS_NL_ATTR_PACKET_SUBSCRIBE, subscribe ? 1 : 0);
>+nl_msg_put_u32(, OVS_NL_ATTR_PACKET_PID, sock->pid);
>+
>+error = nl_sock_send(sock, , true);
>+ofpbuf_uninit();
>+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_stub, sizeof request_stub);
>-nl_msg_put_genlmsghdr(, 0, OVS_WIN_NL_CTRL_FAMILY_ID, 0,
>-  OVS_CTRL_CMD_PACKET_SUBSCRIBE_REQ,
>-  OVS_WIN_CONTROL_VERSION);
>-
>-ovs_header = ofpbuf_put_uninit(, sizeof *ovs_header);
>-ovs_header->dp_ifindex = 0;
>-nl_msg_put_u8(, OVS_NL_ATTR_PACKET_SUBSCRIBE, subscribe ? 1 : 0);
>-nl_msg_put_u32(, OVS_NL_ATTR_PACKET_PID, sock->pid);
>-
>-error = nl_sock_send(sock, , true);
>-ofpbuf_uninit();
>-return error;
>-}
> #endif
> 
> /* Tries to make 'sock' stop listening to 'multicast_group'.  Returns 0 if
>-- 
>2.10.2.windows.1
>___
>dev mailing list
>d...@openvswitch.org
>https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev=DwICAg=uilaK90D4TOVoH58JNXRgQ=Z6vowHUOjP5ysP_g372c49Nqc1vEKqHKNBkR5Q5Z7uo=Rv_yI-lt1EoeaN4Xzp2r3ZeNVphsVz65WcblPQ_igvU=gm4S8Z7cdQx42sqD7mWNa2g9JBWKsiE-NV81-1k8i8s=
> 
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev