get the ip-addresses from the command-line
authorPhilipp Tölke <toelke@in.tum.de>
Sun, 30 Jan 2011 20:53:27 +0000 (20:53 +0000)
committerPhilipp Tölke <toelke@in.tum.de>
Sun, 30 Jan 2011 20:53:27 +0000 (20:53 +0000)
src/vpn/gnunet-daemon-vpn-helper.c
src/vpn/gnunet-helper-vpn.c

index 468658c4873cf25acac6e52d4f3b9ee1b95a0f6d..23df262973ce3540df43656f1db2cf05ea08530c 100644 (file)
@@ -74,7 +74,10 @@ start_helper_and_schedule(void *cls,
 
     if (helper_in == NULL || helper_out == NULL) return;
 
-    helper_proc = GNUNET_OS_start_process(helper_in, helper_out, "gnunet-helper-vpn", "gnunet-helper-vpn", NULL);
+    helper_proc =
+      GNUNET_OS_start_process (helper_in, helper_out, "gnunet-helper-vpn",
+                              "gnunet-helper-vpn", "1234::1", "16", "10.10.10.1",
+                              "255.255.255.0");
 
     fh_from_helper = GNUNET_DISK_pipe_handle (helper_out, GNUNET_DISK_PIPE_END_READ);
     fh_to_helper = GNUNET_DISK_pipe_handle (helper_in, GNUNET_DISK_PIPE_END_WRITE);
index 00eb15c6a218c31fce65c307d477bd7b33548eff..53e86e303c760fc9e0c174390f5c1b4985802885 100644 (file)
@@ -480,17 +480,28 @@ main (int argc, char **argv)
       return 1;
     }
 
+  if (5 != argc)
+    {
+      fprintf(stderr, "Fatal: must supply 4 arguments!\n");
+      return 1;
+    }
+
   {
-    // TODO: get this out of argv
-    char address[] = "1234::1";
-    unsigned long prefix_len = 16;
+    char *address = argv[1];
+    long prefix_len = atol(argv[2]);
+
+    if (prefix_len < 1 || prefix_len > 127)
+      {
+       fprintf(stderr, "Fatal: prefix_len out of range\n");
+       return 1;
+      }
 
     set_address6 (dev, address, prefix_len);
   }
 
   {
-    char address[] = "10.10.10.1";
-    char mask[] = "255.255.255.252";
+    char *address = argv[3];
+    char *mask = argv[4];
 
     set_address4 (dev, address, mask);
   }