Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933112AbXHVUnW (ORCPT ); Wed, 22 Aug 2007 16:43:22 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758283AbXHVUnP (ORCPT ); Wed, 22 Aug 2007 16:43:15 -0400 Received: from saraswathi.solana.com ([198.99.130.12]:50763 "EHLO saraswathi.solana.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750747AbXHVUnO (ORCPT ); Wed, 22 Aug 2007 16:43:14 -0400 Date: Wed, 22 Aug 2007 16:42:54 -0400 From: Jeff Dike To: Mike Mohr Cc: Rene Herman , linux-kernel@vger.kernel.org, Guido Guenther , Bodo Eggert <7eggert@gmx.de> Subject: Re: group ownership of tun devices -- nonfunctional? Message-ID: <20070822204254.GA13410@c2.user-mode-linux.org> References: <8Tpwf-3Nb-1@gated-at.bofh.it> <46C86B6C.8090209@home.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2845 Lines: 89 > I can create devices that are owned by my user account (tunctl -u > `whoami` -t tap0) and it works fine. However, if I use group > permissions with -g it stops working. In all cases, if I pass -g > , the interface is created correctly but it is unusable as a > non-root user. I can't reproduce this - it seems to work fine on -rc3-mm1: As root: ./tunctl -u user -g user -t tap1 ifconfig tap1 192.168.0.130 up route add -host 192.168.0.131 dev tap1 chmod 666 /dev/net/tun As a normal user: ./tunread # tunread source is below As root again: ping 192.168.0.131 tunread output: 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0x0 0xffffffff 0xffffff9b 0x51 0xffffffb9 0xffffffd9 0x8 0x6 0x0 0x1 0x8 0x0 0x6 0x4 0x0 0x1 0x0 0xffffffff 0xffffff9b 0x51 0xffffffb9 0xffffffd9 0xffffffc0 0xffffffa8 0x0 0xffffff82 0x0 0x0 0x0 0x0 0x0 0x0 0xffffffc0 0xffffffa8 0x0 0xffffff83 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0x0 0xffffffff 0xffffff9b 0x51 0xffffffb9 0xffffffd9 0x8 0x6 0x0 0x1 0x8 0x0 0x6 0x4 0x0 0x1 0x0 0xffffffff 0xffffff9b 0x51 0xffffffb9 0xffffffd9 0xffffffc0 0xffffffa8 0x0 0xffffff82 0x0 0x0 0x0 0x0 0x0 0x0 0xffffffc0 0xffffffa8 0x0 0xffffff83 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0x0 0xffffffff 0xffffff9b 0x51 0xffffffb9 0xffffffd9 0x8 0x6 0x0 0x1 0x8 0x0 0x6 0x4 0x0 0x1 0x0 0xffffffff 0xffffff9b 0x51 0xffffffb9 0xffffffd9 0xffffffc0 0xffffffa8 0x0 0xffffff82 Jeff -- Work email - jdike at linux dot intel dot com #include #include #include #include #include #include #include #define __KERNEL__ #include #include #include int main(int argc, char **argv) { char packet[1600]; struct ifreq ifr; int fd, err, i, n; if((fd = open("/dev/net/tun", O_RDWR)) < 0){ perror("Opening /dev/net/tun"); exit(1); } memset(&ifr, 0, sizeof(ifr)); /* Flags: IFF_TUN - TUN device (no Ethernet headers) * IFF_TAP - TAP device * * IFF_NO_PI - Do not provide packet information */ ifr.ifr_flags = IFF_TUN; strncpy(ifr.ifr_name, "tap1", IFNAMSIZ); if((err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0){ perror("TUNSETIFF"); exit(1); } while(1){ n = read(fd, packet, sizeof(packet)); if(n < 0){ perror("read"); exit(1); } else if(n == 0) break; for(i = 0; i < n; i++){ printf("0x%x ", packet[i]); if((i % 32) == 31) printf("\n"); } } } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/