Thread (23 messages) 23 messages, 4 authors, 2009-07-20

Re: [iproute2 patch]: Add 'ip tuntap' facility for managing tun/tap devices

From: David Woodhouse <dwmw2@infradead.org>
Date: 2009-07-20 23:44:59

On Sat, 2009-06-13 at 09:55 +0100, David Woodhouse wrote:
On Thu, 2009-05-28 at 09:12 +0100, David Woodhouse wrote:
quoted
On Wed, 2009-05-27 at 21:58 -0700, Stephen Hemminger wrote:
quoted
quoted
+#define TUNDEV "/dev/net/tun"
I know this is historical legacy, but how does this play with
network namespaces?

For /dev/net/tun itself, it doesn't need to. The namespaces come into
play when you issue the TUNSETIFF ioctl to create/attach a particular
named device, which uses the network namespace of the process which
opened /dev/net/tun.
 
quoted
quoted
+static int tap_add_ioctl(struct ifreq *ifr, uid_t uid, gid_t gid)
+{
+   int fd = open(TUNDEV, O_RDWR);
+   int ret = -1;
+
+#ifndef IFF_TUN_EXCL
+#define IFF_TUN_EXCL       0x8000
+#endif
This shouldn't be here.
It should be defined in include/linux/if_tun.h in kernel source
and then a kernel sanitized version of if_tun.h should be put
in iproute2 source for backwards compatibility.
I'm happy to do that; I was just taking my lead from the handling of
RTAX_RTTVAR, IP_DF, IPPROTO_SCTP, IPPPROTO_DCCP and IPPROTO_MH in
ip/*.c
quoted
 But why bother it doesn't seem to be defined or used by current
kernel??

It's in net-next and is harmless in older kernels. It just means you
can't accidentally 'create' a device which already existed.
quoted
Would prefer open() next to the test.
OK, moved.
quoted
quoted
+     while (argc > 0) {
+             if (strcmp(*argv, "mode") == 0) {
The argument parsing in ip commands uses matches() rather than
strcmp
quoted
to allow for partial completion.  
OK. I had copied that part from 'ip tunnel', which uses strcmp().

New patch...
Ping?
Ping?

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help