Thread (59 messages) 59 messages, 10 authors, 2017-01-20

Re: [PATCH v2] drivers/net:new PMD using tun/tap host interface

From: Yuanhan Liu <hidden>
Date: 2016-09-20 04:05:02

[ just got few more comments after some fiddling with the build issue ]

On Fri, Sep 16, 2016 at 11:22:13AM -0500, Keith Wiles wrote:
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/tap/Makefile b/drivers/net/tap/Makefile
new file mode 100644
index 0000000..442a2fe
--- /dev/null
+++ b/drivers/net/tap/Makefile
@@ -0,0 +1,60 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2014 John W. Linville <linville@redhat.com>
+#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+#   Copyright(c) 2014 6WIND S.A.
Just wondering, is it on purpose, or just yet another copy-paste error?
+#include <arpa/inet.h>
+#include <net/if.h>
+#ifdef __linux__
So, you meant to add other OS support, say BSD?
+#include <linux/if.h>
+#include <linux/if_tun.h>
+#include <linux/if_ether.h>
+#else
+#include <netinet/if_ether.h>
+#endif
+#include <fcntl.h>
+
+#include <poll.h>
+
+/* Linux based path to the TUN device */
+#define TUN_TAP_DEV_PATH        "/dev/net/tun"
However, you hardcoded a linux only path here. While checking the code
from qemu, I saw that the path is actually different from different UNIX
variants, even for FreeBSD and NetBSD.

    [yliu@yliu-dev ~/qemu]$ grep -E "/dev/.*(tap|tun)" net/tap*.c
    net/tap-bsd.c:            snprintf(dname, sizeof dname, "/dev/tun%d", i);
    net/tap-bsd.c:            snprintf(dname, sizeof dname, "/dev/tap%d", i);
    net/tap-bsd.c:#define PATH_NET_TAP "/dev/tap"
    net/tap-linux.c:#define PATH_NET_TUN "/dev/net/tun"
    net/tap-solaris.c:    TFR(tap_fd = open("/dev/tap", O_RDWR, 0));
    ...

	--yliu
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help