[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r14323 - gnunet/src/vpn
From: |
gnunet |
Subject: |
[GNUnet-SVN] r14323 - gnunet/src/vpn |
Date: |
Wed, 2 Feb 2011 23:42:11 +0100 |
Author: toelke
Date: 2011-02-02 23:42:11 +0100 (Wed, 02 Feb 2011)
New Revision: 14323
Modified:
gnunet/src/vpn/gnunet-helper-vpn.c
Log:
create the tun-interfaces with a name choosen by the user
Modified: gnunet/src/vpn/gnunet-helper-vpn.c
===================================================================
--- gnunet/src/vpn/gnunet-helper-vpn.c 2011-02-02 22:20:48 UTC (rev 14322)
+++ gnunet/src/vpn/gnunet-helper-vpn.c 2011-02-02 22:42:11 UTC (rev 14323)
@@ -30,7 +30,6 @@
* have your name added to the list):
*
* - Philipp Tölke
- * - Christian Grothoff
*/
#include "platform.h"
#include <linux/if_tun.h>
@@ -96,7 +95,7 @@
memset (&ifr, 0, sizeof (ifr));
ifr.ifr_flags = IFF_TUN;
- if ('\0' == *dev)
+ if ('\0' != *dev)
strncpy (ifr.ifr_name, dev, IFNAMSIZ);
if (-1 == ioctl (fd, TUNSETIFF, (void *) &ifr))
@@ -532,24 +531,26 @@
char dev[IFNAMSIZ];
int fd_tun;
- memset (dev, 0, IFNAMSIZ);
- if (-1 == (fd_tun = init_tun (dev)))
+ if (6 != argc)
{
fprintf (stderr,
- "Fatal: could not initialize tun-interface\n");
+ "Fatal: must supply 5 arguments!\n");
return 1;
}
- if (5 != argc)
+ strncpy(dev, argv[1], IFNAMSIZ);
+ dev[IFNAMSIZ - 1] = '\0';
+
+ if (-1 == (fd_tun = init_tun (dev)))
{
fprintf (stderr,
- "Fatal: must supply 4 arguments!\n");
+ "Fatal: could not initialize tun-interface\n");
return 1;
}
{
- const char *address = argv[1];
- long prefix_len = atol(argv[2]);
+ const char *address = argv[2];
+ long prefix_len = atol(argv[3]);
if ( (prefix_len < 1) || (prefix_len > 127) )
{
@@ -561,8 +562,8 @@
}
{
- const char *address = argv[3];
- const char *mask = argv[4];
+ const char *address = argv[4];
+ const char *mask = argv[5];
set_address4 (dev, address, mask);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r14323 - gnunet/src/vpn,
gnunet <=