summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tun.c43
1 files changed, 0 insertions, 43 deletions
diff --git a/tun.c b/tun.c
index 88e1f0f..37560e2 100644
--- a/tun.c
+++ b/tun.c
@@ -1973,15 +1973,6 @@ read_tun (struct tuntap* tt, uint8_t *buf, int len)
*
*/
-static inline int
-netbsd_modify_read_write_return (int len)
-{
- if (len > 0)
- return len > sizeof (u_int32_t) ? len - sizeof (u_int32_t) : 0;
- else
- return len;
-}
-
void
open_tun (const char *dev, const char *dev_type, const char *dev_node, bool ipv6, struct tuntap *tt)
{
@@ -2083,46 +2074,12 @@ read_tun (struct tuntap* tt, uint8_t *buf, int len)
int
write_tun (struct tuntap* tt, uint8_t *buf, int len)
{
- if (tt->type == DEV_TYPE_TUN)
- {
- u_int32_t type;
- struct iovec iv[2];
- struct openvpn_iphdr *iph;
-
- iph = (struct openvpn_iphdr *) buf;
-
- if (tt->ipv6 && OPENVPN_IPH_GET_VER(iph->version_len) == 6)
- type = htonl (AF_INET6);
- else
- type = htonl (AF_INET);
-
- iv[0].iov_base = (char *)&type;
- iv[0].iov_len = sizeof (type);
- iv[1].iov_base = buf;
- iv[1].iov_len = len;
-
- return netbsd_modify_read_write_return (writev (tt->fd, iv, 2));
- }
- else
return write (tt->fd, buf, len);
}
int
read_tun (struct tuntap* tt, uint8_t *buf, int len)
{
- if (tt->type == DEV_TYPE_TUN)
- {
- u_int32_t type;
- struct iovec iv[2];
-
- iv[0].iov_base = (char *)&type;
- iv[0].iov_len = sizeof (type);
- iv[1].iov_base = buf;
- iv[1].iov_len = len;
-
- return netbsd_modify_read_write_return (readv (tt->fd, iv, 2));
- }
- else
return read (tt->fd, buf, len);
}
#endif /* NETBSD_MULTI_AF */