summaryrefslogtreecommitdiffstats
path: root/src/config.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-03-28 20:47:06 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-03-28 20:47:06 +0200
commit14a44b4016d3350c85c419e1e1b683c1574cd86e (patch)
tree3804218093a4ea3f56396efbc2c1e92b4a416dc3 /src/config.c
parentc8ea4868b37f53e138548b7adee756834ad7ea66 (diff)
downloadfastd-14a44b4016d3350c85c419e1e1b683c1574cd86e.tar
fastd-14a44b4016d3350c85c419e1e1b683c1574cd86e.zip
Add keygen function
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c
index af32975..6fd8def 100644
--- a/src/config.c
+++ b/src/config.c
@@ -146,6 +146,7 @@ void fastd_configure(fastd_context *ctx, fastd_config *conf, int argc, char *con
char *charptr;
char *endptr;
char *addrstr;
+ bool keygen = false;
while (i < argc) {
@@ -305,9 +306,20 @@ void fastd_configure(fastd_context *ctx, fastd_config *conf, int argc, char *con
continue;
}
+ IF_OPTION("--generate-key") {
+ keygen = true;
+ continue;
+ }
+
exit_error(ctx, "config error: unknown option `%s'", argv[i]);
}
+ if (keygen) {
+ ctx->conf = conf;
+ conf->protocol->generate_key(ctx);
+ exit(0);
+ }
+
conf->n_floating = 0;
conf->n_v4 = 0;
conf->n_v6 = 0;