Hi,

the attached patch fixes the interface index for dhcpv6 answers on
OpenBSD. It is based on the patch from
https://marc.info/?l=openbsd-misc&m=144067760416819&w=2

Without the patch, every request will create a log entry with no route
to host:
Jan 20 11:05:50 infra1-DG dhcpd: send_packet6: No route to host
Jan 20 11:05:50 infra1-DG dhcpd: dhcpv6: send_packet6() sent -1 of 133 bytes

Comments, oks?


Marc
Index: patches/patch-common_socket_c
===================================================================
RCS file: patches/patch-common_socket_c
diff -N patches/patch-common_socket_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-common_socket_c	20 Jan 2017 09:39:19 -0000
@@ -0,0 +1,21 @@
+--- common/socket.c.orig	Thu Jan 19 15:55:02 2017
++++ common/socket.c	Thu Jan 19 15:58:34 2017
+@@ -793,9 +793,18 @@
+ 	memcpy(&dst, to, sizeof(dst));
+ 	m.msg_name = &dst;
+ 	m.msg_namelen = sizeof(dst);
++
++	/*
++	 * For OpenBSD, needing interface index.
++	 * The preprocessor test is added . . .
++	 */
++	#if defined(__OpenBSD__)
++		dst.sin6_scope_id = ifindex = if_nametoindex(interface->name);
++	#else  /* ! defined(__OpenBSD__) */
+ 	ifindex = if_nametoindex(interface->name);
+ 	if (no_global_v6_socket)
+ 		dst.sin6_scope_id = ifindex;
++	#endif /* ! defined(__OpenBSD__) */
+ 
+ 	/*
+ 	 * Set the data buffer we're sending. (Using this wacky 

Reply via email to