diff options
author | Alin Serdean <aserdean@cloudbasesolutions.com> | 2017-02-06 04:41:40 +0000 |
---|---|---|
committer | Gurucharan Shetty <guru@ovn.org> | 2017-03-07 13:37:15 -0800 |
commit | 74804b21081883764a09d7186ee3c60bcc43265f (patch) | |
tree | 56fa29d19f1ce697671bb0ebff42d59e77ba017a /lib | |
parent | 5517b83962aa3d4fedaa1e3bfaea2b979dda6953 (diff) | |
download | openvswitch-74804b21081883764a09d7186ee3c60bcc43265f.tar.gz |
windows: fix calls in netlink-socket
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@cloudbasesolutions.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/netlink-socket.c | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c index e45914c32..f4c6fd953 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 |