Re: make ip-transparent option work on OpenBSD

"W.C.A. Wijngaards" <[email protected]>
Newsgroups gmane.network.dns.nsd.general
Message-ID <[email protected]>
Hi Florian,

Thanks for the patch! I have applied it to the source code.

Best regards, Wouter

On 01/11/17 14:41, Florian Obser wrote:
> OpenBSD supports SO_BINDANY socket option from BSD/OS since 2008.
> 
> The same diff was sent to OpenBSD in 2016 by Delan Azabani but I was
> not aware and basically came up with the same one.
> 
> ( https://marc.info/?l=openbsd-tech&m=147747266305927&w=2 )
> 
> As far as I know it had not been submitted to nsd.
> 
> Thanks,
> Florian
> 
> Index: server.c
> ===================================================================
> --- server.c	(revision 4787)
> +++ server.c	(working copy)
> @@ -561,7 +561,7 @@
>  {
>  	struct addrinfo* addr;
>  	size_t i;
> -#if defined(SO_REUSEPORT) || defined(SO_REUSEADDR) || (defined(INET6) && (defined(IPV6_V6ONLY) || defined(IPV6_USE_MIN_MTU) || defined(IPV6_MTU) || defined(IP_TRANSPARENT)) || defined(IP_FREEBIND))
> +#if defined(SO_REUSEPORT) || defined(SO_REUSEADDR) || (defined(INET6) && (defined(IPV6_V6ONLY) || defined(IPV6_USE_MIN_MTU) || defined(IPV6_MTU) || defined(IP_TRANSPARENT)) || defined(IP_FREEBIND) || defined(SO_BINDANY))
>  	int on = 1;
>  #endif
>  
> @@ -751,6 +751,12 @@
>  					strerror(errno));
>  			}
>  #endif /* IP_TRANSPARENT */
> +#ifdef SO_BINDANY
> +			if (setsockopt(nsd->udp[i].s, SOL_SOCKET, SO_BINDANY, &on, sizeof(on)) < 0) {
> +				log_msg(LOG_ERR, "setsockopt(...,SO_BINDANY, ...) failed for udp: %s",
> +					strerror(errno));
> +			}
> +#endif /* SO_BINDANY */
>  		}
>  
>  		if (bind(nsd->udp[i].s, (struct sockaddr *) addr->ai_addr, addr->ai_addrlen) != 0) {
> @@ -881,6 +887,12 @@
>  					strerror(errno));
>  			}
>  #endif /* IP_TRANSPARENT */
> +#ifdef SO_BINDANY
> +			if (setsockopt(nsd->tcp[i].s, SOL_SOCKET, SO_BINDANY, &on, sizeof(on)) < 0) {
> +				log_msg(LOG_ERR, "setsockopt(...,SO_BINDANY, ...) failed for tcp: %s",
> +					strerror(errno));
> +			}
> +#endif /* SO_BINDANY */
>  		}
>  
>  		if (bind(nsd->tcp[i].s, (struct sockaddr *) addr->ai_addr, addr->ai_addrlen) != 0) {
> 
>

_______________________________________________
nsd-users mailing list
[email protected]
https://open.nlnetlabs.nl/mailman/listinfo/nsd-users
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE7fqj8spObrBWga+On28cLX4EX40FAln62/IACgkQn28cLX4E
X40OtQ//S62KiEpVfR9k+3vzrG6dRGizTwANUUk/84UiEC3l+1EAOEAUXxkTXIZf
ltmKaPGt6MLrrRDS00+ljvNgegzTyarvZi7oEdBE4md1IcRED31tgX6ILRB7XqJk
CJN88XacBLdV6iUMMbrdhUvriIxagGfSmnJI8pmDnipzYhQ/Ejh0g58jZO3ZGDif
G8/Xlvbip5Ha7QJ2il0bPr0OyW7wZ1B5JnkG6F/cl89E8wiY7AQ1pHzK4+uxFO/N
3PJSxW2X9MiI8MG2HMTI1LwgHi9955iGbsFApNMrHUpzQVU2r3Ec4ccz/e09bA+1
l4Wu8PiRi86F5o5DQRJdtS/QHGXuvdZaAP8lA3lPLnxdhypzJH7ngMPE1KeyYMWR
N8QNHKr37fTeuu5s2uVyluTCo/D0xOl7fSV2w0CgSUa7NJGywJW+px0EFxFZ4WnG
4AwBn97Yi/yhpZvbBA5/AFPQY0xKaoO0FP4wPQwWPCSddkJvHkKgj415uIU7qeOj
17J2ip6LdKYbM2Gyr8Ev+Vgjye2EvCjjuo3GFGIYIgeCCFyMntJwu4XzV/4Biswf
Pnuo+xWL7M24EE84c2PTk30FwFS2dnTh6oL4Xm3hDuqWWXvWbFAeEz6AwMBlMsSp
5gSrOtWMn7TD2LKL99swSlhU6/AUCsCVv0TIF5ZvzTdbKtb2kRw=
=bbNJ
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.