From ea6ba478c7be6d76e4aa710b957fdd7d4c22dba0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Philipp=20T=C3=B6lke?= Date: Sun, 30 Jan 2011 20:53:27 +0000 Subject: [PATCH] get the ip-addresses from the command-line --- src/vpn/gnunet-daemon-vpn-helper.c | 5 ++++- src/vpn/gnunet-helper-vpn.c | 21 ++++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/vpn/gnunet-daemon-vpn-helper.c b/src/vpn/gnunet-daemon-vpn-helper.c index 468658c48..23df26297 100644 --- a/src/vpn/gnunet-daemon-vpn-helper.c +++ b/src/vpn/gnunet-daemon-vpn-helper.c @@ -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); diff --git a/src/vpn/gnunet-helper-vpn.c b/src/vpn/gnunet-helper-vpn.c index 00eb15c6a..53e86e303 100644 --- a/src/vpn/gnunet-helper-vpn.c +++ b/src/vpn/gnunet-helper-vpn.c @@ -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); } -- 2.25.1