Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'removes-getcmds' of git://github.com/kechagia/cjdns

  • Loading branch information...
commit d77cb0d58715514463398f7f9a67d23f29e4ebb5 2 parents 93c24e0 + c792c14
Caleb James DeLisle authored
Showing with 6 additions and 58 deletions.
  1. +5 −3 README.md
  2. +1 −55 cjdroute.c
View
8 README.md
@@ -438,13 +438,15 @@ The output of the last command will tell you the name of the new device.
If that name is not `"tun0"` then you will need to edit the cjdroute.conf file
and change the line which says: `"tunDevice": "tun0"` to whatever it is.
-4b-1: Get commands.
+4b-1: Setup the interface manually
----------------
-Get the commands to run in order to prepare your TUN device by running:
+Run those commands to prepare your TUN device:
- # ./cjdroute --getcmds < cjdroute.conf
+ # /sbin/ip addr add <your ipv6 address>/8 dev tun0
+ # /sbin/ip link set tun0 up
+Exchange tun0 with your device name, in case the previous step told you a different one.
These commands should be executed as root now every time the system restarts.
4b-2: Fire it up!
View
56 cjdroute.c
@@ -270,7 +270,7 @@ static void parsePrivateKey(Dict* config, struct Address* addr, uint8_t privateK
static int usage(char* appName)
{
- printf("Usage: %s [--help] [--genconf] [--getcmds] [--bench]\n"
+ printf("Usage: %s [--help] [--genconf] [--bench]\n"
"\n"
"To get the router up and running.\n"
"Step 1:\n"
@@ -292,55 +292,6 @@ static int usage(char* appName)
return 0;
}
-static int getcmds(Dict* config)
-{
-#ifdef __APPLE__
- printf("# The Apple implementation does not support persistent tunnels.\n"
- "# Therefor this is not necessary.\n"
- "# Just start the router and it will configure automatically.\n");
-
- return 0;
-
-#else
-
- uint8_t privateKey[32];
- struct Address addr;
- parsePrivateKey(config, &addr, privateKey);
-
- uint8_t myIp[40];
- Address_printIp(myIp, &addr);
-
- Dict* router = Dict_getDict(config, String_CONST("router"));
- Dict* iface = Dict_getDict(router, String_CONST("interface"));
- String* type = Dict_getString(iface, String_CONST("type"));
- String* tunDevice = Dict_getString(iface, String_CONST("tunDevice"));
- if (!String_equals(type, String_CONST("TUNInterface"))) {
- fprintf(stderr, "router.interface.type is not recognized.\n");
- return -1;
- }
- char *tunDev = (tunDevice) ? tunDevice->bytes : DEFAULT_TUN_DEV;
- if (strrchr(tunDev, '/') != NULL) {
- tunDev = strrchr(tunDev, '/') + 1;
- }
-
- printf("#!/bin/bash\n"
- "# This is for starting cjdroute as it's own user. see README.md\n"
- "# *MOST USERS DON'T NEED THIS*\n"
- "# To setup a persistent tunnel, run these commands every reboot.\n"
- "#\n"
- "# NOTE: tun devices are destroyed when a system is rebooted.\n"
- "# To create the tun device use this command.\n"
- "# replace \"cjdns\" with the name of the user which the router will run as.\n"
- "# /sbin/ip tuntap add dev %s mode tun user cjdns\n\n", tunDev);
-
- printf("/sbin/ip addr add %s/8 dev %s\n", myIp, tunDev);
- printf("/sbin/ip link set %s up\n", tunDev);
-
- return 0;
-
-#endif /* __APPLE__ */
-}
-
static void reconf(struct Context* ctx, Dict* mainConf)
{
Dict* adminConf = Dict_getDict(mainConf, String_CONST("admin"));
@@ -505,8 +456,6 @@ int main(int argc, char** argv)
return usage(argv[0]);
} else if (strcmp(argv[1], "--genconf") == 0) {
return genconf();
- } else if (strcmp(argv[1], "--getcmds") == 0) {
- // Performed after reading the configuration
} else if (strcmp(argv[1], "--pidfile") == 0) {
// Performed after reading the configuration
} else if (strcmp(argv[1], "--reconf") == 0) {
@@ -547,9 +496,6 @@ int main(int argc, char** argv)
return -1;
}
- if (argc == 2 && strcmp(argv[1], "--getcmds") == 0) {
- return getcmds(&config);
- }
if (argc == 2 && strcmp(argv[1], "--pidfile") == 0) {
pidfile(&config);
return 0;
Please sign in to comment.
Something went wrong with that request. Please try again.