kernel-netlink: Add a compile-time hook to simulate request message loss
This commit is contained in:
@@ -77,6 +77,16 @@ struct private_netlink_socket_t {
|
|||||||
u_int retries;
|
u_int retries;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* #definable hook to simulate request message loss
|
||||||
|
*/
|
||||||
|
#ifdef NETLINK_MSG_LOSS_HOOK
|
||||||
|
bool NETLINK_MSG_LOSS_HOOK(struct nlmsghdr *msg);
|
||||||
|
#define msg_loss_hook(msg) NETLINK_MSG_LOSS_HOOK(msg)
|
||||||
|
#else
|
||||||
|
#define msg_loss_hook(msg) FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request entry the answer for a waiting thread is collected in
|
* Request entry the answer for a waiting thread is collected in
|
||||||
*/
|
*/
|
||||||
@@ -109,6 +119,11 @@ static bool write_msg(private_netlink_socket_t *this, struct nlmsghdr *msg)
|
|||||||
};
|
};
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
if (msg_loss_hook(msg))
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
len = sendto(this->socket, msg, msg->nlmsg_len, 0,
|
len = sendto(this->socket, msg, msg->nlmsg_len, 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user