diff options
author | Chia-chi Yeh <chiachi@android.com> | 2011-07-07 03:20:34 -0700 |
---|---|---|
committer | Chia-chi Yeh <chiachi@android.com> | 2011-07-07 03:42:05 -0700 |
commit | e9fc376dc7e9ee22358b872c3eb2808fa42160f0 (patch) | |
tree | 3834c809e43ab43c8dd7d21d84d7e9b5a111cfec /main.c | |
parent | f8a6a7636d53a5730c58ae041e4e09ae12e1657c (diff) | |
download | ipsec-tools-e9fc376dc7e9ee22358b872c3eb2808fa42160f0.tar.gz |
ipsec-tools: Support IPSec RSA sessions again.
This change supports command-line usage and android service at
the same time. It also removes the access to native keystore.
Change-Id: Ia3d931b0ba8f83624d668de97c9dfc10280bef3b
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 The Android Open Source Project + * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,20 +31,22 @@ #include "config.h" #include "gcmalloc.h" +#include "vmbuf.h" +#include "localconf.h" #include "session.h" #include "schedule.h" #include "plog.h" #ifdef ANDROID_CHANGES -static void android_get_arguments(int *argc, char ***argv) +static int get_control_and_arguments(int *argc, char ***argv) { static char *args[32]; int control; int i; if ((i = android_get_control_socket("racoon")) == -1) { - return; + return -1; } do_plog(LLV_DEBUG, "Waiting for control socket"); if (listen(i, 1) == -1 || (control = accept(i, NULL, 0)) == -1) { @@ -84,7 +86,7 @@ static void android_get_arguments(int *argc, char ***argv) *argc = i; *argv = args; - close(control); + return control; } #endif @@ -110,7 +112,15 @@ static void terminated() int main(int argc, char **argv) { +#ifdef ANDROID_CHANGES + int control = get_control_and_arguments(&argc, &argv); + if (control != -1) { + lcconf->chroot = "%p"; + } +#endif + do_plog(LLV_INFO, "ipsec-tools 0.8.0 (http://ipsec-tools.sf.net)\n"); + setup(argc, argv); signal(SIGHUP, terminate); signal(SIGINT, terminate); @@ -118,12 +128,6 @@ int main(int argc, char **argv) signal(SIGPIPE, SIG_IGN); atexit(terminated); -#ifdef ANDROID_CHANGES -/* setuid(AID_VPN); */ - android_get_arguments(&argc, &argv); -#endif - setup(argc, argv); - while (1) { struct timeval *tv = schedular(); int timeout = tv->tv_sec * 1000 + tv->tv_usec / 1000 + 1; |