Compare commits

..

2 Commits

Author SHA1 Message Date
bol-van
1175b171ba nfqws: NETLINK_NO_ENOBUFS 2024-12-08 09:58:30 +03:00
bol-van
bea643c967 nfqws: more error checking fixing 2024-12-08 09:40:45 +03:00

View File

@ -217,10 +217,12 @@ static bool nfq_init(struct nfq_handle **h,struct nfq_q_handle **qh)
if (!rawsend_preinit(params.bind_fix4,params.bind_fix6)) if (!rawsend_preinit(params.bind_fix4,params.bind_fix6))
goto exiterr; goto exiterr;
// increase socket buffer size. on slow systems reloading hostlist can take a while. int yes=1, fd = nfq_fd(*h);
// if too many unhandled packets are received its possible to get "no buffer space available" error
if (!set_socket_buffers(nfq_fd(*h),Q_RCVBUF/2,Q_SNDBUF/2)) #if defined SOL_NETLINK && defined NETLINK_NO_ENOBUFS
goto exiterr; if (setsockopt(fd, SOL_NETLINK, NETLINK_NO_ENOBUFS, &yes, sizeof(yes)) == -1)
DLOG_PERROR("setsockopt(NETLINK_NO_ENOBUFS)");
#endif
return true; return true;
exiterr: exiterr:
@ -267,7 +269,7 @@ static int nfq_main(void)
errno=e; errno=e;
DLOG_PERROR("recv"); DLOG_PERROR("recv");
// do not fail on ENOBUFS // do not fail on ENOBUFS
} while(errno==ENOBUFS); } while(e==ENOBUFS);
nfq_deinit(&h,&qh); nfq_deinit(&h,&qh);