[PATCH V2] ocserv: fix ipv6 tun control on OpenBSD
Andrew Karpow
andy at ndyk.de
Wed Jun 1 10:10:15 PDT 2016
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 | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/src/tun.c b/src/tun.c
index c478690..77a1330 100644
--- a/src/tun.c
+++ b/src/tun.c
@@ -566,6 +566,30 @@ 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));
}
+#if defined(__OpenBSD__)
+ /* 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;
+ }
+ }
+#endif
+
#ifdef TUNSIFHEAD
{
int i = 1;
--
2.8.3
More information about the openconnect-devel
mailing list