From: Philipp Tölke Date: Tue, 20 Jul 2010 19:53:49 +0000 (+0000) Subject: renamed files to fit into the convention X-Git-Tag: initial-import-from-subversion-38251~20890 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=622360c41aa24d27c07a2118d4fcb80d4d8fa25c;p=oweals%2Fgnunet.git renamed files to fit into the convention --- diff --git a/src/vpn/Makefile.am b/src/vpn/Makefile.am index a30ff7e6e..afb6a7ba9 100644 --- a/src/vpn/Makefile.am +++ b/src/vpn/Makefile.am @@ -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 \ diff --git a/src/vpn/gnunet-vpn-helper.c b/src/vpn/gnunet-vpn-helper.c index 0cb5937a4..92af307dd 100644 --- a/src/vpn/gnunet-vpn-helper.c +++ b/src/vpn/gnunet-vpn-helper.c @@ -41,7 +41,7 @@ #include #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 index 000000000..e3854495f --- /dev/null +++ b/src/vpn/gnunet-vpn-tun.c @@ -0,0 +1,51 @@ +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +/** + * 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 index 000000000..3ba61771a --- /dev/null +++ b/src/vpn/gnunet-vpn-tun.h @@ -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 index e3854495f..000000000 --- a/src/vpn/tun.c +++ /dev/null @@ -1,51 +0,0 @@ -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -/** - * 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 index 3ba61771a..000000000 --- a/src/vpn/tun.h +++ /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