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

dnstap_collector.c: SOCK_NONBLOCK is not available on Mac/Darwin #284

Closed
ljliman opened this issue Jun 21, 2023 · 2 comments
Closed

dnstap_collector.c: SOCK_NONBLOCK is not available on Mac/Darwin #284

ljliman opened this issue Jun 21, 2023 · 2 comments

Comments

@ljliman
Copy link

ljliman commented Jun 21, 2023

Hi guys!

Thanks for keeping up the fantastic work.

While trying to compile NSD with dnstap support on a Mac I ran into:

% make
gcc -I/opt/pkg/include -I. -I/opt/pkg/include -L/opt/pkg/include -c dnstap/dnstap_collector.c
clang: warning: argument unused during compilation: '-L/opt/pkg/include' [-Wunused-command-line-argument]
dnstap/dnstap_collector.c:68:39: error: use of undeclared identifier 'SOCK_NONBLOCK'
if(socketpair(AF_UNIX, SOCK_DGRAM | SOCK_NONBLOCK, 0, sv) < 0) {
^
1 error generated.
make: *** [dnstap_collector.o] Error 1

... and alas, SOCK_NONBLOCK doesn't exist on the Macs. I see you have worked around it in other parts of the code. Would you please "do the same" in the dnstap corner?

This is with nsd-4.7.0 and MacOS Monterrey (12.6).

Cheers,
/LIman

@wcawijngaards
Copy link
Member

The -L compile argument with an include directory looks unnecessary to me, usually -L needs a library directory. But I guess otherwise harmless, as there is likely no libraries there.

The commit applies a similar fix that exists in other parts of the code. It ignores the extra argument if that option does not exist, and then attempts to set nonblocking with the fcntl function. Thanks for the fail details, I hope it works on the compile environment, but that seems likely.

@ljliman
Copy link
Author

ljliman commented Jun 22, 2023

Hi Wouter!

Thanks for a quick fix. It does indeed take me through compilation like a breeze. Next I'll test the functionality.

I'm a bit surprised that you didn't identify the "-L" as the obvious cut-and-paste error that it is though, but thanks for highlighting it.

Cheers,
/Liman

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