summaryrefslogtreecommitdiffstats
path: root/cmds/ip-up-vpn
diff options
context:
space:
mode:
authorChia-chi Yeh <chiachi@android.com>2011-07-02 16:41:59 -0700
committerChia-chi Yeh <chiachi@android.com>2011-07-02 16:41:59 -0700
commit6278d5ef052cec6afecae69328e084566bb157c6 (patch)
tree2f16590f5e1993cb287afd295c45417ce5caa092 /cmds/ip-up-vpn
parentd6315c0ebb6ebbc67f0c669e92f92be70b49ba2c (diff)
downloadframeworks_base-6278d5ef052cec6afecae69328e084566bb157c6.zip
frameworks_base-6278d5ef052cec6afecae69328e084566bb157c6.tar.gz
frameworks_base-6278d5ef052cec6afecae69328e084566bb157c6.tar.bz2
Promote ip-up-vpn into the framework.
pppd needs it, and racoon will also use it soon. Change-Id: I7fc40a709f7d44f75cd3683ab77d90cbc29cd765
Diffstat (limited to 'cmds/ip-up-vpn')
-rw-r--r--cmds/ip-up-vpn/Android.mk26
-rw-r--r--cmds/ip-up-vpn/ip-up-vpn.c35
2 files changed, 61 insertions, 0 deletions
diff --git a/cmds/ip-up-vpn/Android.mk b/cmds/ip-up-vpn/Android.mk
new file mode 100644
index 0000000..de81889
--- /dev/null
+++ b/cmds/ip-up-vpn/Android.mk
@@ -0,0 +1,26 @@
+#
+# 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.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := ip-up-vpn.c
+LOCAL_SHARED_LIBRARIES := libcutils
+LOCAL_MODULE := ip-up-vpn
+LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/ppp
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_EXECUTABLE)
diff --git a/cmds/ip-up-vpn/ip-up-vpn.c b/cmds/ip-up-vpn/ip-up-vpn.c
new file mode 100644
index 0000000..bbf6b14
--- /dev/null
+++ b/cmds/ip-up-vpn/ip-up-vpn.c
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <cutils/properties.h>
+
+int main(int argc, char **argv)
+{
+ if (argc > 1 && strlen(argv[1]) > 0) {
+ char dns[PROPERTY_VALUE_MAX];
+ char *dns1 = getenv("DNS1");
+ char *dns2 = getenv("DNS2");
+
+ snprintf(dns, sizeof(dns), "%s %s", dns1 ? dns1 : "", dns2 ? dns2 : "");
+ property_set("vpn.dns", dns);
+ property_set("vpn.via", argv[1]);
+ }
+ return 0;
+}