renamed files to fit into the convention
authorPhilipp Tölke <toelke@in.tum.de>
Tue, 20 Jul 2010 19:53:49 +0000 (19:53 +0000)
committerPhilipp Tölke <toelke@in.tum.de>
Tue, 20 Jul 2010 19:53:49 +0000 (19:53 +0000)
src/vpn/Makefile.am
src/vpn/gnunet-vpn-helper.c
src/vpn/gnunet-vpn-tun.c [new file with mode: 0644]
src/vpn/gnunet-vpn-tun.h [new file with mode: 0644]
src/vpn/tun.c [deleted file]
src/vpn/tun.h [deleted file]

index a30ff7e6e619849c57c66ef5e619dad2827ce34a..afb6a7ba96679ba53c74488a9c23f67175e3a55d 100644 (file)
@@ -25,7 +25,7 @@ bin_PROGRAMS = \
 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 \
index 0cb5937a4a996402c30f284eb47878c2dc1ae4e2..92af307dd380452df5f0d466eb876920c164827d 100644 (file)
@@ -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.
diff --git a/src/vpn/gnunet-vpn-tun.c b/src/vpn/gnunet-vpn-tun.c
new file mode 100644 (file)
index 0000000..e385449
--- /dev/null
@@ -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;
+}}}
diff --git a/src/vpn/gnunet-vpn-tun.h b/src/vpn/gnunet-vpn-tun.h
new file mode 100644 (file)
index 0000000..3ba6177
--- /dev/null
@@ -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
diff --git a/src/vpn/tun.c b/src/vpn/tun.c
deleted file mode 100644 (file)
index e385449..0000000
+++ /dev/null
@@ -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;
-}}}
diff --git a/src/vpn/tun.h b/src/vpn/tun.h
deleted file mode 100644 (file)
index 3ba6177..0000000
+++ /dev/null
@@ -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