[Vtun-Commit] CVS: The file 'vtun/linux/tap_dev.c' has been modified.
Status: Inactive
Brought to you by:
mtbishop
|
From: Bishop <mtb...@us...> - 2006-12-11 10:39:30
|
The following file was modified in vtun/linux:
Name Old version New version Comment
---- ----------- ----------- -------
tap_dev.c 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Post-merge cleanup. ugh.
The diff of the modified file(s):
--- tap_dev.c 22 Jan 2002 09:53:00 -0000 1.3
+++ tap_dev.c 11 Dec 2006 10:39:30 -0000 1.4
@@ -17,110 +17,12 @@
*/
=20
/*
- * tap_dev.c,v 1.2 2001/09/20 06:26:41 talby Exp
+ * $Id$
*/
=20
-#include "config.h"
-
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <syslog.h>
-#include <errno.h>
-
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <linux/if.h>
-
-#include "vtun.h"
-#include "lib.h"
-
/*=20
- * Allocate Ether TAP device, returns opened fd.=20
- * Stores dev name in the first arg(must be large enough).
+ This is an empty file. All functionality formerly here is moved
+ to the tun_dev.c file. This file exists to prevent the automangle
+ tools from moving a tap_dev.c from the generic directory - which
+ we can't use - in place of this missing file.
*/
-int tap_open_old(char *dev)
-{
- char tapname[14];
- int i, fd;
-
- if (*dev) {
- sprintf(tapname, "/dev/%s", dev);
- return open(tapname, O_RDWR);
- }
-
- for (i =3D 0; i < 255; i++) {
- sprintf(tapname, "/dev/tap%d", i);
- /* Open device */
- if ((fd =3D open(tapname, O_RDWR)) > 0) {
- sprintf(dev, "tap%d", i);
- return fd;
- }
- }
- return -1;
-}
-
-#ifdef HAVE_LINUX_IF_TUN_H /* New driver support */
-#include <linux/if_tun.h>
-
-/* pre 2.4.6 compatibility */
-#define OTUNSETNOCSUM (('T'<< 8) | 200)
-#define OTUNSETDEBUG (('T'<< 8) | 201)
-#define OTUNSETIFF (('T'<< 8) | 202)
-#define OTUNSETPERSIST (('T'<< 8) | 203)
-#define OTUNSETOWNER (('T'<< 8) | 204)
-
-int tap_open(char *dev)
-{
- struct ifreq ifr;
- int fd, err;
-
- if ((fd =3D open("/dev/net/tun", O_RDWR)) < 0)
- return tap_open_old(dev);
-
- memset(&ifr, 0, sizeof(ifr));
- ifr.ifr_flags =3D IFF_TAP | IFF_NO_PI;
- if (*dev)
- strncpy(ifr.ifr_name, dev, IFNAMSIZ);
-
- if (ioctl(fd, TUNSETIFF, (void *) &ifr) < 0) {
- if (errno =3D=3D EBADFD) {
- /* Try old ioctl */
- if (ioctl(fd, OTUNSETIFF, (void *) &ifr) < 0)
- goto failed;
- } else
- goto failed;
- }
-
- strcpy(dev, ifr.ifr_name);
- return fd;
-
- failed:
- close(fd);
- return -1;
-}
-#else
-int tap_open(char *dev)
-{
- return tap_open_old(dev);
-}
-#endif /* New driver support */
-
-int tap_close(int fd, char *dev)
-{
- return close(fd);
-}
-
-/* Write frames to TAP device */
-int tap_write(int fd, char *buf, int len)
-{
- return write(fd, buf, len);
-}
-
-/* Read frames from TAP device */
-int tap_read(int fd, char *buf, int len)
-{
- return read(fd, buf, len);
-}
|