Otherwise we keep using the old netlink socket if we hit EINTR.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
extern int netlink_batch_send(struct netlink_ctx *ctx, struct list_head *err_list);
-extern void netlink_restart(struct mnl_socket *nf_sock);
+extern struct mnl_socket *netlink_restart(struct mnl_socket *nf_sock);
#define netlink_abi_error() \
__netlink_abi_error(__FILE__, __LINE__, strerror(errno));
extern void __noreturn __netlink_abi_error(const char *file, int line, const char *reason);
mnl_socket_close(nf_sock);
}
-void netlink_restart(struct mnl_socket *nf_sock)
+struct mnl_socket *netlink_restart(struct mnl_socket *nf_sock)
{
netlink_close_sock(nf_sock);
- nf_sock = netlink_open_sock();
+ return netlink_open_sock();
}
void __noreturn __netlink_abi_error(const char *file, int line,
.msgs = msgs,
.nft = nft,
};
- struct mnl_socket *nf_sock = nft->nf_sock;
struct nft_cache *cache = &nft->cache;
replay:
if (ret < 0) {
cache_release(cache);
if (errno == EINTR) {
- netlink_restart(nf_sock);
+ nft->nf_sock = netlink_restart(nft->nf_sock);
goto replay;
}
return -1;