mirror of
https://github.com/openvswitch/ovs
synced 2025-09-04 16:25:17 +00:00
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>
This commit is contained in:
committed by
Gurucharan Shetty
parent
5517b83962
commit
74804b2108
@@ -60,6 +60,8 @@ static void log_nlmsg(const char *function, int error,
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static int get_sock_pid_from_kernel(struct nl_sock *sock);
|
static int get_sock_pid_from_kernel(struct nl_sock *sock);
|
||||||
static int set_sock_property(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
|
#endif
|
||||||
|
|
||||||
/* Netlink sockets. */
|
/* Netlink sockets. */
|
||||||
@@ -424,6 +426,30 @@ nl_sock_join_mcgroup(struct nl_sock *sock, unsigned int multicast_group)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#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
|
int
|
||||||
nl_sock_subscribe_packets(struct nl_sock *sock)
|
nl_sock_subscribe_packets(struct nl_sock *sock)
|
||||||
{
|
{
|
||||||
@@ -459,30 +485,6 @@ nl_sock_unsubscribe_packets(struct nl_sock *sock)
|
|||||||
sock->read_ioctl = OVS_IOCTL_READ;
|
sock->read_ioctl = OVS_IOCTL_READ;
|
||||||
return 0;
|
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
|
#endif
|
||||||
|
|
||||||
/* Tries to make 'sock' stop listening to 'multicast_group'. Returns 0 if
|
/* Tries to make 'sock' stop listening to 'multicast_group'. Returns 0 if
|
||||||
|
Reference in New Issue
Block a user