Skip to contentSkip to conversation

ipv6 netbsd support

Openvpn-devel [email protected]... 3 participants 4 messages Jan 29, 2004 – Feb 5, 2004

lore
Share & tools
lore
#0 lore raw

Hello,

is there an ipv6-netbsd support planed ?

Can you give me detailed information what must be changed so that I can try to write a patch?

thank you for your efforts
Uwe

#1 lore raw
Quoted 6 lines · [email protected]... said:

Hello,

is there an ipv6-netbsd support planed ?

Can you give me detailed information what must be changed so that I can try to write a patch?

Currently IPv6 over IPv4 tun support exists for Linux and OpenBSD. Take a look a tun.c -- that's where the patch would go.

James

#2 lore raw
In reply to [email protected]...

Hi,

Quoted 2 lines

is there an ipv6-netbsd support planed ? Can you give me detailed information what must be changed so that I can try to write a patch?

I thought I had made a netbsd patch ready, but I can't find it anylonger. But it should be quiet easy looking at the patches which were necessary to enable ipv6 tunnels via tun device on OpenBSD and FreeBSD. You should also have a look at the linux/ipv6 section in the openvpn code.

If you can give me access to a NetBSD system *including* root access and kernel sources extracted I should be able to patch and test openvpn within hours to support IPv6 via tun devices.

Thomas

syshead.h renamed from tmp/openvpn-1.5-beta7/syshead.h +8 -0
diff /tmp/openvpn-1.5-beta7/syshead.h openvpn-1.5-beta7/syshead.h
@@ -209,6 +209,14 @@
 #include <sys/uio.h>
 #endif
 
+#ifdef HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+
+#ifdef HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+
 #ifdef HAVE_NET_IF_TUN_H
 #include <net/if_tun.h>
 #endif
tun.c renamed from tmp/openvpn-1.5-beta7/tun.c +10 -2
diff /tmp/openvpn-1.5-beta7/tun.c openvpn-1.5-beta7/tun.c
@@ -708,7 +708,7 @@
 void
 open_tun (const char *dev, const char *dev_type, const char *dev_node, bool ipv6, int mtu, struct tuntap *tt)
 {
-  open_tun_generic (dev, dev_node, ipv6, false, true, tt);
+  open_tun_generic (dev, dev_node, ipv6, true, true, tt);
 }
 
 void
@@ -729,8 +729,16 @@
 int
 write_tun (struct tuntap* tt, uint8_t *buf, int len)
 {
-  u_int32_t type = htonl (AF_INET);
+  u_int32_t type;
   struct iovec iv[2];
+  struct ip *iph;
+
+  iph = (struct ip *)buf;
+
+  if(tt->ipv6 && iph->ip_v == 6)
+    type = htonl(AF_INET6);
+  else 
+    type = htonl(AF_INET);
 
   iv[0].iov_base = &type;
   iv[0].iov_len = sizeof (type);
syshead.h +8 -0
diff -ruN openvpn-1.5-beta7-orig/syshead.h openvpn-1.5-beta7/syshead.h
@@ -217,6 +217,14 @@
 
 #ifdef TARGET_FREEBSD
 
+#ifdef HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+
+#ifdef HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+
 #ifdef HAVE_NET_IF_TUN_H
 #include <net/if_tun.h>
 #endif
tun.c +38 -3

67 lines not on this page · raw message

#3 lore raw

Hi together,

Quoted 3 lines

If you can give me access to a NetBSD system *including* root access and kernel sources extracted I should be able to patch and test openvpn within hours to support IPv6 via tun devices.

one of my openvpn/ipv6 users did patch NetBSD tun device itself and maybe openvpn, too. I told him to send his patches to the upstream maintainers.

Thomas