gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r12294 - gnunet/src/vpn


From: gnunet
Subject: [GNUnet-SVN] r12294 - gnunet/src/vpn
Date: Tue, 20 Jul 2010 21:53:49 +0200

Author: toelke
Date: 2010-07-20 21:53:49 +0200 (Tue, 20 Jul 2010)
New Revision: 12294

Added:
   gnunet/src/vpn/gnunet-vpn-tun.c
   gnunet/src/vpn/gnunet-vpn-tun.h
Removed:
   gnunet/src/vpn/tun.c
   gnunet/src/vpn/tun.h
Modified:
   gnunet/src/vpn/Makefile.am
   gnunet/src/vpn/gnunet-vpn-helper.c
Log:
renamed files to fit into the convention

Modified: gnunet/src/vpn/Makefile.am
===================================================================
--- gnunet/src/vpn/Makefile.am  2010-07-20 19:53:46 UTC (rev 12293)
+++ gnunet/src/vpn/Makefile.am  2010-07-20 19:53:49 UTC (rev 12294)
@@ -25,7 +25,7 @@
 gnunet_vpn_helper_SOURCES = \
  gnunet-vpn-helper.c \
  gnunet-vpn-helper-p.h \
- tun.h tun.c
+ gnunet-vpn-tun.h gnunet-vpn-tun.c
 
 # debug.c  debug.h \
 # packet.h packet.c \

Modified: gnunet/src/vpn/gnunet-vpn-helper.c
===================================================================
--- gnunet/src/vpn/gnunet-vpn-helper.c  2010-07-20 19:53:46 UTC (rev 12293)
+++ gnunet/src/vpn/gnunet-vpn-helper.c  2010-07-20 19:53:49 UTC (rev 12294)
@@ -41,7 +41,7 @@
 #include <unistd.h>
 
 #include "gnunet-vpn-helper-p.h"
-#include "tun.h"
+#include "gnunet-vpn-tun.h"
 
 #ifndef _LINUX_IN6_H
 // This is in linux/include/net/ipv6.h.

Copied: gnunet/src/vpn/gnunet-vpn-tun.c (from rev 12293, gnunet/src/vpn/tun.c)
===================================================================
--- gnunet/src/vpn/gnunet-vpn-tun.c                             (rev 0)
+++ gnunet/src/vpn/gnunet-vpn-tun.c     2010-07-20 19:53:49 UTC (rev 12294)
@@ -0,0 +1,51 @@
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+
+#include <linux/if.h>
+#include <linux/if_tun.h>
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+
+/**
+ * Creates a tun-interface called dev;
+ * dev is asumed to point to a char[IFNAMSIZ]
+ * if *dev == 0, uses the name supplied by the kernel
+ * returns the fd to the tun or -1
+ */
+int init_tun(char *dev) {{{
+       if (!dev) {
+               errno = EINVAL;
+               return -1;
+       }
+
+       struct ifreq ifr;
+       int fd, err;
+
+       if( (fd = open("/dev/net/tun", O_RDWR)) < 0 ) {
+               fprintf(stderr, "opening /dev/net/tun: %m\n");
+               return -1;
+       }
+
+       memset(&ifr, 0, sizeof(ifr));
+
+       ifr.ifr_flags = IFF_TUN;
+
+       if (*dev)
+               strncpy(ifr.ifr_name, dev, IFNAMSIZ);
+
+       if ((err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0 ){
+               close(fd);
+               fprintf(stderr, "ioctl'ing /dev/net/tun: %m\n");
+               return err;
+       }
+
+       strcpy(dev, ifr.ifr_name);
+       return fd;
+}}}

Copied: gnunet/src/vpn/gnunet-vpn-tun.h (from rev 12293, gnunet/src/vpn/tun.h)
===================================================================
--- gnunet/src/vpn/gnunet-vpn-tun.h                             (rev 0)
+++ gnunet/src/vpn/gnunet-vpn-tun.h     2010-07-20 19:53:49 UTC (rev 12294)
@@ -0,0 +1,11 @@
+#ifndef _GNTUN_TUN_H_
+#define _GNTUN_TUN_H_
+
+/**
+ * Creates a tun-interface called dev;
+ * if *dev == 0, uses the name supplied by the kernel
+ * returns the fd to the tun or -1
+ */
+int init_tun(char *dev);
+
+#endif

Deleted: gnunet/src/vpn/tun.c
===================================================================
--- gnunet/src/vpn/tun.c        2010-07-20 19:53:46 UTC (rev 12293)
+++ gnunet/src/vpn/tun.c        2010-07-20 19:53:49 UTC (rev 12294)
@@ -1,51 +0,0 @@
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-
-#include <linux/if.h>
-#include <linux/if_tun.h>
-
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-
-/**
- * Creates a tun-interface called dev;
- * dev is asumed to point to a char[IFNAMSIZ]
- * if *dev == 0, uses the name supplied by the kernel
- * returns the fd to the tun or -1
- */
-int init_tun(char *dev) {{{
-       if (!dev) {
-               errno = EINVAL;
-               return -1;
-       }
-
-       struct ifreq ifr;
-       int fd, err;
-
-       if( (fd = open("/dev/net/tun", O_RDWR)) < 0 ) {
-               fprintf(stderr, "opening /dev/net/tun: %m\n");
-               return -1;
-       }
-
-       memset(&ifr, 0, sizeof(ifr));
-
-       ifr.ifr_flags = IFF_TUN;
-
-       if (*dev)
-               strncpy(ifr.ifr_name, dev, IFNAMSIZ);
-
-       if ((err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0 ){
-               close(fd);
-               fprintf(stderr, "ioctl'ing /dev/net/tun: %m\n");
-               return err;
-       }
-
-       strcpy(dev, ifr.ifr_name);
-       return fd;
-}}}

Deleted: gnunet/src/vpn/tun.h
===================================================================
--- gnunet/src/vpn/tun.h        2010-07-20 19:53:46 UTC (rev 12293)
+++ gnunet/src/vpn/tun.h        2010-07-20 19:53:49 UTC (rev 12294)
@@ -1,11 +0,0 @@
-#ifndef _GNTUN_TUN_H_
-#define _GNTUN_TUN_H_
-
-/**
- * Creates a tun-interface called dev;
- * if *dev == 0, uses the name supplied by the kernel
- * returns the fd to the tun or -1
- */
-int init_tun(char *dev);
-
-#endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]