[PATCH] ocserv: fix ipv6 tun control on OpenBSD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This fixes ipv6 tunnel support on OpenBSD. OpenBSD network stack doesn't
enable the multicast flag on tun devices like FreeBSD - but this is
obligatory for ipv6.

Error message without this patch:
main: tun.c:260: tun0: Error setting IPv6: Invalid argument

Signed-off-by: Andrew Karpow <andy at ndyk.de>
---
 src/tun.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/src/tun.c b/src/tun.c
index c478690..a8d7740 100644
--- a/src/tun.c
+++ b/src/tun.c
@@ -566,6 +566,28 @@ int open_tun(main_server_st * s, struct proc_st *proc)
 		strlcpy(proc->tun_lease.name, devname(st.st_rdev, S_IFCHR), sizeof(proc->tun_lease.name));
 	}
 
+	/* enable multicast for tun interface (OpenBSD) */
+	{
+		struct tuninfo inf;
+		ret = ioctl(tunfd, TUNGIFINFO, &inf);
+		if (ret < 0) {
+			e = errno;
+			mslog(s, NULL, LOG_ERR, "%s: TUNGIFINFO: %s\n",
+					proc->tun_lease.name, strerror(e));
+			goto fail;
+		}
+
+		inf.flags |= IFF_MULTICAST;
+
+		ret = ioctl(tunfd, TUNSIFINFO, &inf);
+		if (ret < 0) {
+			e = errno;
+			mslog(s, NULL, LOG_ERR, "%s: TUNSIFINFO: %s\n",
+					proc->tun_lease.name, strerror(e));
+			goto fail;
+		}
+	}
+
 #ifdef TUNSIFHEAD
 	{
 		int i = 1;
-- 
2.8.3




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux