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

NSD 4.3.0 does not start on FreeBSD #78

Closed
h-ume opened this issue Mar 19, 2020 · 5 comments
Closed

NSD 4.3.0 does not start on FreeBSD #78

h-ume opened this issue Mar 19, 2020 · 5 comments

Comments

@h-ume
Copy link

h-ume commented Mar 19, 2020

NSD 4.3.0 fails to start on FreeBSD with following error:

[2020-03-19 10:56:03.988] nsd[6411]: error: setsockopt(..., SO_SETFIB, 0, ...) failed: Bad address

The following change should fix this problem.

--- server.c.orig	2020-03-17 10:00:17 UTC
+++ server.c
@@ -1104,7 +1104,7 @@ set_setfib(struct nsd_socket *sock)
 {
 #if defined(SO_SETFIB)
 	if(setsockopt(sock->s, SOL_SOCKET, SO_SETFIB,
-	              (const void *)(uintptr_t)sock->fib, sizeof(sock->fib)) == -1)
+	              (const void *)&sock->fib, sizeof(sock->fib)) == -1)
 	{
 		log_msg(LOG_ERR, "setsockopt(..., %s, %d, ...) failed: %s",
 		                 "SO_SETFIB", sock->fib, strerror(errno));
@h-ume h-ume changed the title NSD 4.3.0 does not start NSD 4.3.0 does not start on FreeBSD Mar 19, 2020
@wcawijngaards
Copy link
Member

Thanks for the fix and the report!

@k0ekk0ek
Copy link
Contributor

My bad. Very sloppy. Thanks for the patch! Since that means you specified a specific routing table, would love to know how you're using it and if it works for you at some point (if you can spare the time of course). Thanks again.

@h-ume
Copy link
Author

h-ume commented Mar 19, 2020

I have two routing tables.
I'm using ip-address option.
But, I do not specify setfib option in nsd.conf.

@k0ekk0ek
Copy link
Contributor

Hmmm, then there's possibly another logic error in the code. The SO_SETFIB should only be enabled if setfib is specified in the configuration. I think it's when using the wildcard addresses then(?) In which case the fib member of the nsd_socket struct isn't initialized to -1... I'll have a look

@k0ekk0ek
Copy link
Contributor

Seems like my hunch was right. Addon fix in #79. Thanks again for the report.

uqs pushed a commit to freebsd/freebsd-ports that referenced this issue Mar 19, 2020
- see also: NLnetLabs/nsd#78

PR:		244904
Submitted by:	ume
Approved by:	Jaap Akkerhuis <jaap@NLnetLabs.nl> (maintainer)


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@528710 35697150-7ecd-e111-bb59-0022644237b5
uqs pushed a commit to freebsd/freebsd-ports that referenced this issue Mar 19, 2020
- see also: NLnetLabs/nsd#78

PR:		244904
Submitted by:	ume
Approved by:	Jaap Akkerhuis <jaap@NLnetLabs.nl> (maintainer)
Jehops pushed a commit to Jehops/freebsd-ports-legacy that referenced this issue Mar 19, 2020
- see also: NLnetLabs/nsd#78

PR:		244904
Submitted by:	ume
Approved by:	Jaap Akkerhuis <jaap@NLnetLabs.nl> (maintainer)


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@528710 35697150-7ecd-e111-bb59-0022644237b5
svmhdvn pushed a commit to svmhdvn/freebsd-ports that referenced this issue Jan 10, 2024
- see also: NLnetLabs/nsd#78

PR:		244904
Submitted by:	ume
Approved by:	Jaap Akkerhuis <jaap@NLnetLabs.nl> (maintainer)
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

3 participants