OSDN Git Service

1. Add a new option 'pppox <n>' to support PPPoX sockets. Note that using this
authorChia-chi Yeh <chiachi@android.com>
Thu, 7 May 2009 21:45:53 +0000 (05:45 +0800)
committerChia-chi Yeh <chiachi@android.com>
Thu, 7 May 2009 21:45:53 +0000 (05:45 +0800)
   will make all terminal-specific options unrecognized. (see tty.c)
2. Remove libssl and ipxcp.c from Android.mk. We do not need them.

pppd/Android.mk
pppd/main.c
pppd/pppox.c [new file with mode: 0644]

index 4155fe3..f54ab5a 100644 (file)
@@ -13,7 +13,6 @@ LOCAL_SRC_FILES:= \
        chap-new.c \
        ccp.c \
        ecp.c \
-       ipxcp.c \
        auth.c \
        options.c \
        sys-linux.c \
@@ -24,10 +23,11 @@ LOCAL_SRC_FILES:= \
        eap.c \
        chap-md5.c \
        pppcrypt.c \
-       openssl-hash.c
+       openssl-hash.c \
+       pppox.c
 
 LOCAL_SHARED_LIBRARIES := \
-       libcutils libcrypto libssl
+       libcutils libcrypto
 
 LOCAL_C_INCLUDES := \
        $(LOCAL_PATH)/include
index d37d781..162208f 100644 (file)
@@ -360,13 +360,20 @@ main(argc, argv)
      */
     tty_init();
 
+#ifdef ANDROID_CHANGES
+    {
+        extern void pppox_init();
+        pppox_init();
+    }
+#endif
+
     progname = *argv;
 
     /*
      * Parse, in order, the system options file, the user's options file,
      * and the command line arguments.
      */
-#ifdef ANDROID
+#ifdef ANDROID_CHANGES
     /* Android: only take options from commandline */
     if (!parse_args(argc-1, argv+1))
        exit(EXIT_OPTION_ERROR);
diff --git a/pppd/pppox.c b/pppd/pppox.c
new file mode 100644 (file)
index 0000000..9604fba
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2009 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 <unistd.h>
+#include "pppd.h"
+
+static int pppox_set(char **);
+static int pppox_connect();
+static void pppox_disconnect();
+
+static option_t pppox_options[] = {
+    {"pppox", o_special, pppox_set, "PPPoX socket", OPT_DEVNAM},
+    {NULL},
+};
+
+static struct channel pppox_channel = {
+    .options = pppox_options,
+    .process_extra_options = NULL,
+    .check_options = NULL,
+    .connect = pppox_connect,
+    .disconnect = pppox_disconnect,
+    .establish_ppp = generic_establish_ppp,
+    .disestablish_ppp = generic_disestablish_ppp,
+    .send_config = NULL,
+    .recv_config = NULL,
+    .cleanup = NULL,
+    .close = NULL,
+};
+
+static int pppox = -1;
+
+static int pppox_set(char **argv) {
+    if (!int_option(*argv, &pppox)) {
+        return 0;
+    }
+    info("Using PPPoX (socket = %d)", pppox);
+    the_channel = &pppox_channel;
+    return 1;
+}
+
+static int pppox_connect() {
+    return pppox;
+}
+
+static void pppox_disconnect() {
+    if (pppox != -1) {
+        close(pppox);
+        pppox = -1;
+    }
+}
+
+void pppox_init() {
+    add_options(pppox_options);
+}