Acked-by: Sairam Venugopal <vsai...@vmware.com>
On 2/5/17, 8:41 PM, "ovs-dev-boun...@openvswitch.org on behalf of Alin Serdean" <ovs-dev-boun...@openvswitch.org on behalf of aserd...@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 <aserd...@cloudbasesolutions.com> >--- > 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 >d...@openvswitch.org >https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=Z6vowHUOjP5ysP_g372c49Nqc1vEKqHKNBkR5Q5Z7uo&m=Rv_yI-lt1EoeaN4Xzp2r3ZeNVphsVz65WcblPQ_igvU&s=gm4S8Z7cdQx42sqD7mWNa2g9JBWKsiE-NV81-1k8i8s&e= > _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev