Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libnetfilter_queue/libnetfilter_queue.h no such file or directory #6

Closed
ArthurAttout opened this issue Mar 15, 2018 · 7 comments
Closed

Comments

@ArthurAttout
Copy link

(Tried on Ubuntu 16.04.3)

When running npm install nfqueue on a fresh npm init I get the following error


> nfqueue@0.3.1 install /home/ubuntu/Documents/NAT/node_modules/nfqueue
> node-gyp rebuild

make: Entering directory '/home/ubuntu/Documents/NAT/node_modules/nfqueue/build'
  CXX(target) Release/obj.target/nfqueue/src/node_nfqueue.o
../src/node_nfqueue.cpp:24:51: fatal error: libnetfilter_queue/libnetfilter_queue.h: No such file or directory
compilation terminated.
nfqueue.target.mk:92: recipe for target 'Release/obj.target/nfqueue/src/node_nfqueue.o' failed
make: *** [Release/obj.target/nfqueue/src/node_nfqueue.o] Error 1
make: Leaving directory '/home/ubuntu/Documents/NAT/node_modules/nfqueue/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:269:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.10.0-28-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/ubuntu/Documents/NAT/node_modules/nfqueue
gyp ERR! node -v v4.2.6
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
nat@1.0.0 /home/ubuntu/Documents/NAT
└── nan@2.9.2  extraneous

npm WARN nat@1.0.0 No description
npm WARN nat@1.0.0 No repository field.
npm ERR! Linux 4.10.0-28-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "nfqueue"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE

npm ERR! nfqueue@0.3.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the nfqueue@0.3.1 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the nfqueue package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs nfqueue
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls nfqueue
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/ubuntu/Documents/NAT/npm-debug.log

Is there any dependency that the lib is requiring ?

Thanks !

@dmblack
Copy link

dmblack commented Mar 15, 2018

Do you have libnetfilter installed?

I have the following;

libnetfilter-queue-dev				install
libnetfilter-queue1				install

@ArthurAttout
Copy link
Author

ArthurAttout commented Mar 21, 2018

Thanks, I was able to install the package.
Now, when trying to run the demo, I get another error

/home/ubuntu/Documents/NAT/node_modules/nfqueue/nfqueue.js:55
  this.bindings.open(num, buf);
                ^

TypeError: Unable to unbind queue
    at TypeError (native)
    at NFQueue.open (/home/ubuntu/Documents/NAT/node_modules/nfqueue/nfqueue.js:55:17)
    at Object.exports.createQueueHandler (/home/ubuntu/Documents/NAT/node_modules/nfqueue/nfqueue.js:72:7)
    at Object.<anonymous> (/home/ubuntu/Documents/NAT/node_modules/nfqueue/demo/demo.js:7:5)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
    at startup (node.js:136:18)

Do you have any idea what could be causing this ? Thanks !

@dmblack
Copy link

dmblack commented Mar 21, 2018

Your app may simply be running with insufficient privileges to bind /unbind the queue.

Without going into too much depth, out of scope of the project, I invoke my app with;

sudo `which node` start

Neither the package maintainer, nor i; can take any accountability for running your applications or other commands as sudo. And further managing this is outside scope of this project.

From brief research; you'll need to discover how to grant access to both libpcap and libnfqueue to a non-sudo user.

Obviously; properly managing your system permissions in production/release is very important.

@ArthurAttout
Copy link
Author

Thank you for your help, I really appreciate it ! However, I have one last problem I hope you could help me with. When running the project, if I ping the machine to test if the packet is received properly, I have the following error


/home/ubuntu/Documents/NAT/node_modules/nfqueue/nfqueue.js:63
    callback(new me.NFQueuePacket(info, payload));
    ^

TypeError: callback is not a function
    at /home/ubuntu/Documents/NAT/node_modules/nfqueue/nfqueue.js:63:5


Do you have any idea what could cause this ?

@ArthurAttout
Copy link
Author

ArthurAttout commented Mar 22, 2018

Ooooh, I have found where the error was. It seems that my version of node couldn't interpret the follwing instruction :

if (!buf) { buf = 65535; }

Because of that, my callback was always undefined, and it would crash when trying to execute it

@dmblack
Copy link

dmblack commented Mar 25, 2018

Ah. Yeah. There is an issue with the demo / example. I've been meaning to write a new, and submit a PR. Creating a queue handler requires three arguments, contrary to the two in the example;

Queue Number, Buffer Size, Callback.

As per;

exports.createQueueHandler = function(num, buf, callback) {

Edit:
I have since created an issue, and proposed a fix in the forms of a pull request.

@ArthurAttout
Copy link
Author

Since it seems to have been fixed, this issue may be closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants