From 59b3734643315791306e12960f861695b7886c2d Mon Sep 17 00:00:00 2001 From: bol-van Date: Sun, 22 Feb 2026 19:41:08 +0300 Subject: [PATCH] nfqws2: add comment --- nfq2/nfqws.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nfq2/nfqws.c b/nfq2/nfqws.c index e47d5e7..df14d7f 100644 --- a/nfq2/nfqws.c +++ b/nfq2/nfqws.c @@ -266,6 +266,10 @@ static int nfq_cb(struct nfq_q_handle *qh, struct nfgenmsg *nfmsg, struct nfq_da mark = nfq_get_nfmark(nfa); ilen = nfq_get_payload(nfa, &data); + // if_indextoname creates socket, calls ioctl, closes socket + // code below prevents socket() and close() syscalls on every packet + // this saves CPU 5-10 times + *ifr_out.ifr_name = 0; ifr_out.ifr_ifindex = nfq_get_outdev(nfa); if (ifr_out.ifr_ifindex && ioctl(cbdata->sock, SIOCGIFNAME, &ifr_out)<0)