summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Protsenko <semen.protsenko@linaro.org>2018-07-26 22:05:12 -0700
committerandroid-build-merger <android-build-merger@google.com>2018-07-26 22:05:12 -0700
commit0634ee55dc6b60481a1d0a0740bcdd1ca81553f3 (patch)
treefba5513f6f6d10f4bb454be98c59c95b09ee7a37
parentb6a78583525ee3f0503f4a5d11141a4108e8d180 (diff)
parentc976b782201514779dd67013d6c57f2a219023c6 (diff)
downloadppp-0634ee55dc6b60481a1d0a0740bcdd1ca81553f3.tar.gz
pppd: Enable plugin support in pppd
am: c976b78220 Change-Id: I0a33e98e68ef8b66dde826709bb93680feb8f285
-rw-r--r--pppd/Android.mk4
-rw-r--r--pppd/pathnames.h16
2 files changed, 20 insertions, 0 deletions
diff --git a/pppd/Android.mk b/pppd/Android.mk
index 88cfe35..ba06198 100644
--- a/pppd/Android.mk
+++ b/pppd/Android.mk
@@ -41,6 +41,10 @@ LOCAL_CFLAGS := -DCHAPMS=1 -DMPPE=1 -DINET6=1 -DUSE_OPENSSL=1 -Wno-unused-parame
# Turn off warnings for now until this is fixed upstream. b/18632512
LOCAL_CFLAGS += -Wno-unused-variable
+# Enable plugin support
+LOCAL_CFLAGS += -DPLUGIN
+LOCAL_LDFLAGS := -ldl -rdynamic
+
LOCAL_MODULE:= pppd
include $(BUILD_EXECUTABLE)
diff --git a/pppd/pathnames.h b/pppd/pathnames.h
index a33f046..ea74736 100644
--- a/pppd/pathnames.h
+++ b/pppd/pathnames.h
@@ -56,10 +56,26 @@
#endif /* __STDC__ */
#ifdef PLUGIN
+#ifdef __ANDROID__
+
+/*
+ * In Android we can't load plugins from /system/lib{64}/pppd/, because
+ * Bionic loader only allows us to dlopen() libraries from /system/lib{64} root
+ * directory (as specified in ld.config.txt, see "default" linker namespace).
+ */
+#ifdef __LP64__
+#define _PATH_PLUGIN "/system/lib64"
+#else /* __LP64__ */
+#define _PATH_PLUGIN "/system/lib"
+#endif /* __LP64__ */
+
+#else /* __ANDROID__ */
+
#ifdef __STDC__
#define _PATH_PLUGIN DESTDIR "/lib/pppd/" VERSION
#else /* __STDC__ */
#define _PATH_PLUGIN "/usr/lib/pppd"
#endif /* __STDC__ */
+#endif /* __ANDROID__ */
#endif /* PLUGIN */