{"id":28737319,"url":"https://github.com/corellium/node-nfqueue","last_synced_at":"2026-03-11T07:02:12.808Z","repository":{"id":296252719,"uuid":"992759585","full_name":"corellium/node-nfqueue","owner":"corellium","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-30T04:36:21.000Z","size":46,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-29T11:00:45.420Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/corellium.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-29T17:05:16.000Z","updated_at":"2025-05-30T04:20:50.000Z","dependencies_parsed_at":"2025-05-29T19:01:57.326Z","dependency_job_id":null,"html_url":"https://github.com/corellium/node-nfqueue","commit_stats":null,"previous_names":["corellium/node-nfqueue"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/corellium/node-nfqueue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corellium%2Fnode-nfqueue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corellium%2Fnode-nfqueue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corellium%2Fnode-nfqueue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corellium%2Fnode-nfqueue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/corellium","download_url":"https://codeload.github.com/corellium/node-nfqueue/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corellium%2Fnode-nfqueue/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30373509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T06:09:32.197Z","status":"ssl_error","status_checked_at":"2026-03-11T06:09:17.086Z","response_time":84,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-16T02:09:56.447Z","updated_at":"2026-03-11T07:02:12.794Z","avatar_url":"https://github.com/corellium.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"node-nfqueue\n============\n\nThis is a node.js binding to the linux netfilter NFQUEUE. It allows to filter packets thought a javascript program.\nThis is done asynchronously using libuv poll.\n\n## Example\n\nThis small example allow one packet every two, and display IP header informations using the pcap binding to decode the payload (payload is provided as a javascript Buffer object by the wrapper, and this is what pcap library handle too)\n```js\nvar nfq = require('nfqueue');\nvar IPv4 = require('pcap/decode/ipv4');\nvar counter = 0;\n\nnfq.createQueueHandler(1, function(nfpacket) {\n  console.log(\"-- packet received --\");\n  console.log(JSON.stringify(nfpacket.info, null, 2));\n\n  // Decode the raw payload using pcap library\n  var packet = new IPv4().decode(nfpacket.payload, 0);\n  // Protocol numbers, for example: 1 - ICMP, 6 - TCP, 17 - UDP\n  console.log(\n    \"src=\" + packet.saddr + \", dst=\" + packet.daddr\n    + \", proto=\" + packet.protocol\n  );\n\n  // Set packet verdict. Second parameter set the packet mark.\n  nfpacket.setVerdict((counter++ % 2) ? nfq.NF_DROP : nfq.NF_ACCEPT);\n\n  // Or modify packet and set updated payload\n  // nfpacket.setVerdict(nfq.NF_ACCEPT, null, nfpacket.payload);\n});\n```\nFor an icmp packet, and a nfqueuing in INPUT chain of filter table, it'll output something looking like :\n\n    packet received\n    {\n      \"len\": 84,\n      \"id\": 3,\n      \"nfmark\": 0,\n      \"indev\": 2,\n      \"physindev\": 0,\n      \"outdev\": 0,\n      \"physoutdev\": 0,\n      \"indev_name\": \"eth0\",\n      \"physintdev_name\": \"*\",\n      \"outdev_name\": \"*\",\n      \"physoutdev_name\": \"*\"\n    }\n    src=10.33.15.1, dst=10.0.2.15, proto=1\n\nBe careful, you must be root to open nfqueue handles. Here is an iptables command example to add a rule sending icmp to nfqueue #1 :\n\n    sudo iptables -I INPUT 1 -p icmp -j NFQUEUE --queue-num 1\n\n## Requirements\n  - Linux kernel \u003e= 2.6.30\n\n## Troubleshooting\n\n### Performance and ENOBUFS (No buffer space available)\n\nWith a large number of packets in the queue happens that the queue is destroyed due to a read error from the socket\n\n```sh\nrecvfrom(20, 0x7fffab1d5b70, 65535, 0, 0, 0) = -1 ENOBUFS (No buffer space available)\n```\nrecv() may return -1 and errno is set to ENOBUFS in case that your application is not fast enough to retrieve the packets from the kernel.\n\nBy default to avoid queue destroy we use socket option NETLINK_NO_ENOBUFS, it allows ignore packets instead destroy socket with error.\nhttps://patchwork.ozlabs.org/patch/24919/\n\nTo avoid packet loss you may increase default socket buffer size up to your need when create queue.\n```js\nnfq.createQueueHandler(1, 67108864, function() {});\n```\nDefault socket buffer size: 65535.\n\nTo improve your libnetfilter_queue application in terms of performance, you may consider the following tweaks:\n\n- increase the default socket buffer size.\nset nice value of your process to -20 (maximum priority).\n- set the CPU affinity of your process to a spare core that is not used to handle NIC interruptions.\n- use --queue-balance option in NFQUEUE target for multi-threaded apps (it requires Linux kernel \u003e= 2.6.31).\n\nhttp://www.netfilter.org/projects/libnetfilter_queue/doxygen/index.html\n\n## Author and license\n\nCopyright (C) 2014  Anthony Hinsinger\n\nThis program is free software; you can redistribute it and/or\nmodify it under the terms of the GNU General Public License\nas published by the Free Software Foundation; either version 2\nof the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software\nFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorellium%2Fnode-nfqueue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcorellium%2Fnode-nfqueue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorellium%2Fnode-nfqueue/lists"}