nfqws,tpws: add support for systemd readiness notifications

This commit is contained in:
Ivan Trubach
2025-03-11 06:57:02 +03:00
parent 8b73e2ea8e
commit 756603338b
8 changed files with 104 additions and 0 deletions

View File

@@ -35,6 +35,10 @@
#include "win.h"
#endif
#ifdef USE_SYSTEMD
#include <systemd/sd-daemon.h>
#endif
#ifdef __linux__
#include <libnetfilter_queue/libnetfilter_queue.h>
#define NF_DROP 0
@@ -271,6 +275,15 @@ exiterr:
return false;
}
static void notify_ready(void)
{
#ifdef USE_SYSTEMD
int r = sd_notify(0, "READY=1");
if (r < 0)
DLOG_ERR("sd_notify: %s\n", strerror(-r));
#endif
}
static int nfq_main(void)
{
uint8_t buf[16384] __attribute__((aligned));
@@ -291,6 +304,8 @@ static int nfq_main(void)
if (!nfq_init(&h,&qh))
return 1;
notify_ready();
fd = nfq_fd(h);
do
{