summaryrefslogtreecommitdiff
path: root/accel-pptpd
diff options
context:
space:
mode:
Diffstat (limited to 'accel-pptpd')
-rw-r--r--accel-pptpd/CMakeLists.txt42
-rw-r--r--accel-pptpd/accel-pptpd.conf6
-rw-r--r--accel-pptpd/auth/CMakeLists.txt5
-rw-r--r--accel-pptpd/auth/auth_chap_md5.c (renamed from accel-pptpd/auth_chap_md5.c)0
-rw-r--r--accel-pptpd/auth/auth_mschap_v1.c (renamed from accel-pptpd/auth_mschap_v1.c)0
-rw-r--r--accel-pptpd/auth/auth_mschap_v2.c (renamed from accel-pptpd/auth_mschap_v2.c)0
-rw-r--r--accel-pptpd/auth/auth_pap.c (renamed from accel-pptpd/auth_pap.c)0
-rw-r--r--accel-pptpd/ctrl/CMakeLists.txt4
-rw-r--r--accel-pptpd/ctrl/pptp.c (renamed from accel-pptpd/pptp.c)3
-rw-r--r--accel-pptpd/ctrl/pptp_prot.h (renamed from accel-pptpd/pptp_prot.h)0
-rw-r--r--accel-pptpd/include/if_pppox.h (renamed from accel-pptpd/if_pppox.h)0
l---------accel-pptpd/include/ipdb.h1
l---------accel-pptpd/include/list.h1
l---------accel-pptpd/include/log.h1
l---------accel-pptpd/include/ppp.h1
l---------accel-pptpd/include/ppp_auth.h1
l---------accel-pptpd/include/ppp_fsm.h1
l---------accel-pptpd/include/ppp_lcp.h1
l---------accel-pptpd/include/pwdb.h1
l---------accel-pptpd/include/triton.h1
-rw-r--r--accel-pptpd/ipdb.c3
-rw-r--r--accel-pptpd/list.h252
-rw-r--r--accel-pptpd/log.c14
-rw-r--r--accel-pptpd/main.c2
-rw-r--r--accel-pptpd/ppp/CMakeLists.txt19
-rw-r--r--accel-pptpd/ppp/ipcp_opt_dns.c (renamed from accel-pptpd/ipcp_opt_dns.c)0
-rw-r--r--accel-pptpd/ppp/ipcp_opt_ipaddr.c (renamed from accel-pptpd/ipcp_opt_ipaddr.c)0
-rw-r--r--accel-pptpd/ppp/lcp_opt_accomp.c (renamed from accel-pptpd/lcp_opt_accomp.c)0
-rw-r--r--accel-pptpd/ppp/lcp_opt_magic.c (renamed from accel-pptpd/lcp_opt_magic.c)0
-rw-r--r--accel-pptpd/ppp/lcp_opt_mru.c (renamed from accel-pptpd/lcp_opt_mru.c)0
-rw-r--r--accel-pptpd/ppp/lcp_opt_pcomp.c (renamed from accel-pptpd/lcp_opt_pcomp.c)0
-rw-r--r--accel-pptpd/ppp/ppp.c (renamed from accel-pptpd/ppp.c)26
-rw-r--r--accel-pptpd/ppp/ppp.h (renamed from accel-pptpd/ppp.h)2
-rw-r--r--accel-pptpd/ppp/ppp_auth.c (renamed from accel-pptpd/ppp_auth.c)6
-rw-r--r--accel-pptpd/ppp/ppp_auth.h (renamed from accel-pptpd/ppp_auth.h)0
-rw-r--r--accel-pptpd/ppp/ppp_ccp.c (renamed from accel-pptpd/ppp_ccp.c)2
-rw-r--r--accel-pptpd/ppp/ppp_ccp.h (renamed from accel-pptpd/ppp_ccp.h)2
-rw-r--r--accel-pptpd/ppp/ppp_fsm.c (renamed from accel-pptpd/ppp_fsm.c)2
-rw-r--r--accel-pptpd/ppp/ppp_fsm.h (renamed from accel-pptpd/ppp_fsm.h)0
-rw-r--r--accel-pptpd/ppp/ppp_ipcp.c (renamed from accel-pptpd/ppp_ipcp.c)2
-rw-r--r--accel-pptpd/ppp/ppp_ipcp.h (renamed from accel-pptpd/ppp_ipcp.h)2
-rw-r--r--accel-pptpd/ppp/ppp_lcp.c (renamed from accel-pptpd/ppp_lcp.c)5
-rw-r--r--accel-pptpd/ppp/ppp_lcp.h (renamed from accel-pptpd/ppp_lcp.h)2
-rw-r--r--accel-pptpd/pptpd.h26
-rw-r--r--accel-pptpd/pwdb.c4
-rw-r--r--accel-pptpd/triton/loader.c40
-rw-r--r--accel-pptpd/triton/triton.c7
-rw-r--r--accel-pptpd/triton/triton.h2
-rw-r--r--accel-pptpd/triton/triton_p.h1
49 files changed, 144 insertions, 346 deletions
diff --git a/accel-pptpd/CMakeLists.txt b/accel-pptpd/CMakeLists.txt
index fc6ac0ed..64f351fa 100644
--- a/accel-pptpd/CMakeLists.txt
+++ b/accel-pptpd/CMakeLists.txt
@@ -3,35 +3,31 @@ cmake_minimum_required(VERSION 2.6)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fvisibility=hidden -D_GNU_SOURCE")
+INCLUDE_DIRECTORIES(include)
+
ADD_SUBDIRECTORY(triton)
+ADD_SUBDIRECTORY(ctrl)
+ADD_SUBDIRECTORY(auth)
ADD_EXECUTABLE(pptpd
- pptp.c
+ ppp/ppp.c
+ ppp/ppp_fsm.c
+ ppp/ppp_lcp.c
+ ppp/lcp_opt_mru.c
+ ppp/lcp_opt_magic.c
+ ppp/lcp_opt_pcomp.c
+ ppp/lcp_opt_accomp.c
+ ppp/ppp_auth.c
+ ppp/ppp_ipcp.c
+ ppp/ipcp_opt_ipaddr.c
+ ppp/ipcp_opt_dns.c
+ ppp/ppp_ccp.c
+
log.c
- ppp.c
- ppp_fsm.c
-
- ppp_lcp.c
- lcp_opt_mru.c
- lcp_opt_magic.c
- lcp_opt_pcomp.c
- lcp_opt_accomp.c
-
- ppp_auth.c
- auth_pap.c
- auth_chap_md5.c
- auth_mschap_v1.c
- auth_mschap_v2.c
-
- ppp_ipcp.c
- ipcp_opt_ipaddr.c
- ipcp_opt_dns.c
-
- ppp_ccp.c
-
pwdb.c
ipdb.c
main.c
)
-TARGET_LINK_LIBRARIES(pptpd pthread triton ssl rt)
+TARGET_LINK_LIBRARIES(pptpd triton rt pthread ssl)
+
diff --git a/accel-pptpd/accel-pptpd.conf b/accel-pptpd/accel-pptpd.conf
index 736f71af..fa2f128c 100644
--- a/accel-pptpd/accel-pptpd.conf
+++ b/accel-pptpd/accel-pptpd.conf
@@ -1,8 +1,6 @@
[modules]
-libpap.so
-libmschap-v1.so
-libmschap-v2.so
-
+./libpptp.so
+./libauth_mschap_v2.so
[core]
log-error=/dev/stderr
diff --git a/accel-pptpd/auth/CMakeLists.txt b/accel-pptpd/auth/CMakeLists.txt
new file mode 100644
index 00000000..f0e6465c
--- /dev/null
+++ b/accel-pptpd/auth/CMakeLists.txt
@@ -0,0 +1,5 @@
+ADD_LIBRARY(auth_pap SHARED auth_pap.c)
+ADD_LIBRARY(auth_chap_md5 SHARED auth_chap_md5.c)
+ADD_LIBRARY(auth_mschap_v1 SHARED auth_mschap_v1.c)
+ADD_LIBRARY(auth_mschap_v2 SHARED auth_mschap_v2.c)
+
diff --git a/accel-pptpd/auth_chap_md5.c b/accel-pptpd/auth/auth_chap_md5.c
index 5577794f..5577794f 100644
--- a/accel-pptpd/auth_chap_md5.c
+++ b/accel-pptpd/auth/auth_chap_md5.c
diff --git a/accel-pptpd/auth_mschap_v1.c b/accel-pptpd/auth/auth_mschap_v1.c
index 1cf5eb8b..1cf5eb8b 100644
--- a/accel-pptpd/auth_mschap_v1.c
+++ b/accel-pptpd/auth/auth_mschap_v1.c
diff --git a/accel-pptpd/auth_mschap_v2.c b/accel-pptpd/auth/auth_mschap_v2.c
index 502f3686..502f3686 100644
--- a/accel-pptpd/auth_mschap_v2.c
+++ b/accel-pptpd/auth/auth_mschap_v2.c
diff --git a/accel-pptpd/auth_pap.c b/accel-pptpd/auth/auth_pap.c
index 92ddef52..92ddef52 100644
--- a/accel-pptpd/auth_pap.c
+++ b/accel-pptpd/auth/auth_pap.c
diff --git a/accel-pptpd/ctrl/CMakeLists.txt b/accel-pptpd/ctrl/CMakeLists.txt
new file mode 100644
index 00000000..97f8e0d8
--- /dev/null
+++ b/accel-pptpd/ctrl/CMakeLists.txt
@@ -0,0 +1,4 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+
+ADD_LIBRARY(pptp SHARED pptp.c)
+
diff --git a/accel-pptpd/pptp.c b/accel-pptpd/ctrl/pptp.c
index 2d69a6ef..b503d85e 100644
--- a/accel-pptpd/pptp.c
+++ b/accel-pptpd/ctrl/pptp.c
@@ -14,8 +14,7 @@
#include "list.h"
#include "pptp_prot.h"
-#include "triton/triton.h"
-#include "pptpd.h"
+#include "triton.h"
#include "log.h"
#include "ppp.h"
diff --git a/accel-pptpd/pptp_prot.h b/accel-pptpd/ctrl/pptp_prot.h
index 7e3ebdd4..7e3ebdd4 100644
--- a/accel-pptpd/pptp_prot.h
+++ b/accel-pptpd/ctrl/pptp_prot.h
diff --git a/accel-pptpd/if_pppox.h b/accel-pptpd/include/if_pppox.h
index da327a1c..da327a1c 100644
--- a/accel-pptpd/if_pppox.h
+++ b/accel-pptpd/include/if_pppox.h
diff --git a/accel-pptpd/include/ipdb.h b/accel-pptpd/include/ipdb.h
new file mode 120000
index 00000000..77ab85b8
--- /dev/null
+++ b/accel-pptpd/include/ipdb.h
@@ -0,0 +1 @@
+../ipdb.h \ No newline at end of file
diff --git a/accel-pptpd/include/list.h b/accel-pptpd/include/list.h
new file mode 120000
index 00000000..4b6d9a91
--- /dev/null
+++ b/accel-pptpd/include/list.h
@@ -0,0 +1 @@
+../triton/list.h \ No newline at end of file
diff --git a/accel-pptpd/include/log.h b/accel-pptpd/include/log.h
new file mode 120000
index 00000000..49a04dd9
--- /dev/null
+++ b/accel-pptpd/include/log.h
@@ -0,0 +1 @@
+../log.h \ No newline at end of file
diff --git a/accel-pptpd/include/ppp.h b/accel-pptpd/include/ppp.h
new file mode 120000
index 00000000..ae3fa2ef
--- /dev/null
+++ b/accel-pptpd/include/ppp.h
@@ -0,0 +1 @@
+../ppp/ppp.h \ No newline at end of file
diff --git a/accel-pptpd/include/ppp_auth.h b/accel-pptpd/include/ppp_auth.h
new file mode 120000
index 00000000..527c8538
--- /dev/null
+++ b/accel-pptpd/include/ppp_auth.h
@@ -0,0 +1 @@
+../ppp/ppp_auth.h \ No newline at end of file
diff --git a/accel-pptpd/include/ppp_fsm.h b/accel-pptpd/include/ppp_fsm.h
new file mode 120000
index 00000000..5c6b7f47
--- /dev/null
+++ b/accel-pptpd/include/ppp_fsm.h
@@ -0,0 +1 @@
+../ppp/ppp_fsm.h \ No newline at end of file
diff --git a/accel-pptpd/include/ppp_lcp.h b/accel-pptpd/include/ppp_lcp.h
new file mode 120000
index 00000000..49027522
--- /dev/null
+++ b/accel-pptpd/include/ppp_lcp.h
@@ -0,0 +1 @@
+../ppp/ppp_lcp.h \ No newline at end of file
diff --git a/accel-pptpd/include/pwdb.h b/accel-pptpd/include/pwdb.h
new file mode 120000
index 00000000..360efe4d
--- /dev/null
+++ b/accel-pptpd/include/pwdb.h
@@ -0,0 +1 @@
+../pwdb.h \ No newline at end of file
diff --git a/accel-pptpd/include/triton.h b/accel-pptpd/include/triton.h
new file mode 120000
index 00000000..6f35a2fe
--- /dev/null
+++ b/accel-pptpd/include/triton.h
@@ -0,0 +1 @@
+../triton/triton.h \ No newline at end of file
diff --git a/accel-pptpd/ipdb.c b/accel-pptpd/ipdb.c
index fb139710..8ac86cb6 100644
--- a/accel-pptpd/ipdb.c
+++ b/accel-pptpd/ipdb.c
@@ -1,6 +1,7 @@
+#include "triton.h"
#include "ipdb.h"
-int ipdb_get(in_addr_t *addr, in_addr_t *peer_addr)
+int __export ipdb_get(in_addr_t *addr, in_addr_t *peer_addr)
{
*addr=inet_addr("192.168.200.100");
*peer_addr=inet_addr("192.168.200.200");
diff --git a/accel-pptpd/list.h b/accel-pptpd/list.h
deleted file mode 100644
index 49045b7e..00000000
--- a/accel-pptpd/list.h
+++ /dev/null
@@ -1,252 +0,0 @@
-#ifndef _LINUX_LIST_H
-#define _LINUX_LIST_H
-
-//#if defined(__KERNEL__) || defined(_LVM_H_INCLUDE)
-
-//#include <linux/prefetch.h>
-
-/*
- * Simple doubly linked list implementation.
- *
- * Some of the internal functions ("__xxx") are useful when
- * manipulating whole lists rather than single entries, as
- * sometimes we already know the next/prev entries and we can
- * generate better code by using them directly rather than
- * using the generic single-entry routines.
- */
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-void static inline prefetch(void* p){}
-
-typedef struct list_head {
- struct list_head *next, *prev;
-} list_t;
-
-#define LIST_HEAD_INIT(name) { &(name), &(name) }
-
-#define LIST_HEAD(name) \
- struct list_head name = LIST_HEAD_INIT(name)
-
-#define INIT_LIST_HEAD(ptr) do { \
- (ptr)->next = (ptr); (ptr)->prev = (ptr); \
-} while (0)
-
-/*
- * Insert a _new entry between two known consecutive entries.
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-static inline void __list_add(struct list_head *_new,
- struct list_head *prev,
- struct list_head *next)
-{
- next->prev = _new;
- _new->next = next;
- _new->prev = prev;
- prev->next = _new;
-}
-
-/**
- * list_add - add a _new entry
- * @_new: _new entry to be added
- * @head: list head to add it after
- *
- * Insert a _new entry after the specified head.
- * This is good for implementing stacks.
- */
-static inline void list_add(struct list_head *_new, struct list_head *head)
-{
- __list_add(_new, head, head->next);
-}
-
-/**
- * list_add_tail - add a _new entry
- * @_new: _new entry to be added
- * @head: list head to add it before
- *
- * Insert a _new entry before the specified head.
- * This is useful for implementing queues.
- */
-static inline void list_add_tail(struct list_head *_new, struct list_head *head)
-{
- __list_add(_new, head->prev, head);
-}
-
-/*
- * Delete a list entry by making the prev/next entries
- * point to each other.
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-static inline void __list_del(struct list_head *prev, struct list_head *next)
-{
- next->prev = prev;
- prev->next = next;
-}
-
-/**
- * list_del - deletes entry from list.
- * @entry: the element to delete from the list.
- * Note: list_empty on entry does not return true after this, the entry is in an undefined state.
- */
-static inline void list_del(struct list_head *entry)
-{
- __list_del(entry->prev, entry->next);
- entry->next = NULL;//(void *) 0;
- entry->prev = NULL;//(void *) 0;
-}
-
-/**
- * list_del_init - deletes entry from list and reinitialize it.
- * @entry: the element to delete from the list.
- */
-static inline void list_del_init(struct list_head *entry)
-{
- __list_del(entry->prev, entry->next);
- INIT_LIST_HEAD(entry);
-}
-
-/**
- * list_move - delete from one list and add as another's head
- * @list: the entry to move
- * @head: the head that will precede our entry
- */
-static inline void list_move(struct list_head *list, struct list_head *head)
-{
- __list_del(list->prev, list->next);
- list_add(list, head);
-}
-
-/**
- * list_move_tail - delete from one list and add as another's tail
- * @list: the entry to move
- * @head: the head that will follow our entry
- */
-static inline void list_move_tail(struct list_head *list,
- struct list_head *head)
-{
- __list_del(list->prev, list->next);
- list_add_tail(list, head);
-}
-
-/**
- * list_empty - tests whether a list is empty
- * @head: the list to test.
- */
-static inline int list_empty(struct list_head *head)
-{
- return head->next == head;
-}
-
-static inline void __list_splice(struct list_head *list,
- struct list_head *head)
-{
- struct list_head *first = list->next;
- struct list_head *last = list->prev;
- struct list_head *at = head->next;
-
- first->prev = head;
- head->next = first;
-
- last->next = at;
- at->prev = last;
-}
-
-/**
- * list_splice - join two lists
- * @list: the _new list to add.
- * @head: the place to add it in the first list.
- */
-static inline void list_splice(struct list_head *list, struct list_head *head)
-{
- if (!list_empty(list))
- __list_splice(list, head);
-}
-
-/**
- * list_splice_init - join two lists and reinitialise the emptied list.
- * @list: the _new list to add.
- * @head: the place to add it in the first list.
- *
- * The list at @list is reinitialised
- */
-static inline void list_splice_init(struct list_head *list,
- struct list_head *head)
-{
- if (!list_empty(list)) {
- __list_splice(list, head);
- INIT_LIST_HEAD(list);
- }
-}
-
-/**
- * list_entry - get the struct for this entry
- * @ptr: the &struct list_head pointer.
- * @type: the type of the struct this is embedded in.
- * @member: the name of the list_struct within the struct.
- */
-#define list_entry(ptr, type, member) \
- ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
-
-/**
- * list_for_each - iterate over a list
- * @pos: the &struct list_head to use as a loop counter.
- * @head: the head for your list.
- */
-#define list_for_each(pos, head) \
- for (pos = (head)->next, prefetch(pos->next); pos != (head); \
- pos = pos->next, prefetch(pos->next))
-
-/**
- * __list_for_each - iterate over a list
- * @pos: the &struct list_head to use as a loop counter.
- * @head: the head for your list.
- *
- * This variant differs from list_for_each() in that it's the
- * simplest possible list iteration code, no prefetching is done.
- * Use this for code that knows the list to be very short (empty
- * or 1 entry) most of the time.
- */
-#define __list_for_each(pos, head) \
- for (pos = (head)->next; pos != (head); pos = pos->next)
-
-/**
- * list_for_each_prev - iterate over a list backwards
- * @pos: the &struct list_head to use as a loop counter.
- * @head: the head for your list.
- */
-#define list_for_each_prev(pos, head) \
- for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \
- pos = pos->prev, prefetch(pos->prev))
-
-/**
- * list_for_each_safe - iterate over a list safe against removal of list entry
- * @pos: the &struct list_head to use as a loop counter.
- * @n: another &struct list_head to use as temporary storage
- * @head: the head for your list.
- */
-#define list_for_each_safe(pos, n, head) \
- for (pos = (head)->next, n = pos->next; pos != (head); \
- pos = n, n = pos->next)
-
-/**
- * list_for_each_entry - iterate over list of given type
- * @pos: the type * to use as a loop counter.
- * @head: the head for your list.
- * @member: the name of the list_struct within the struct.
- */
-#define list_for_each_entry(pos, head, member) \
- for (pos = list_entry((head)->next, typeof(*pos), member), \
- prefetch(pos->member.next); \
- &pos->member != (head); \
- pos = list_entry(pos->member.next, typeof(*pos), member), \
- prefetch(pos->member.next))
-
-//#endif /* __KERNEL__ || _LVM_H_INCLUDE */
-
-#endif
diff --git a/accel-pptpd/log.c b/accel-pptpd/log.c
index 992f24d5..a29ce846 100644
--- a/accel-pptpd/log.c
+++ b/accel-pptpd/log.c
@@ -20,6 +20,7 @@
#include <pthread.h>
#include <sys/time.h>
+#include "triton/triton.h"
#include "log.h"
#define RED_COLOR "\033[1;31m"
@@ -61,7 +62,7 @@ static void do_log(int level,const char *fmt,va_list ap)
msg_completed=fmt[strlen(fmt)-1]=='\n';
//if (msg_completed) pthread_mutex_unlock(&lock);
}
-void log_error(const char *fmt,...)
+void __export log_error(const char *fmt,...)
{
if (log_level>=1)
{
@@ -70,7 +71,7 @@ void log_error(const char *fmt,...)
do_log(LOG_ERROR,fmt,ap);
}
}
-void log_warn(const char *fmt,...)
+void __export log_warn(const char *fmt,...)
{
if (log_level>=2)
{
@@ -79,7 +80,7 @@ void log_warn(const char *fmt,...)
do_log(LOG_WARN,fmt,ap);
}
}
-void log_info(const char *fmt,...)
+void __export log_info(const char *fmt,...)
{
if (log_level>=3)
{
@@ -88,7 +89,7 @@ void log_info(const char *fmt,...)
do_log(LOG_INFO,fmt,ap);
}
}
-void log_debug(const char *fmt,...)
+void __export log_debug(const char *fmt,...)
{
if (log_level>=4)
{
@@ -98,7 +99,7 @@ void log_debug(const char *fmt,...)
}
}
-void log_msg(const char *fmt,...)
+void __export log_msg(const char *fmt,...)
{
va_list ap;
if (msg_completed) return;
@@ -108,9 +109,10 @@ void log_msg(const char *fmt,...)
if (msg_completed) pthread_mutex_unlock(&lock);
}
-void log_init(FILE *f,int level,int color)
+void __export log_init(FILE *f,int level,int color)
{
log_file=f;
log_level=level;
log_color=color;
}
+
diff --git a/accel-pptpd/main.c b/accel-pptpd/main.c
index 05036251..c60d35fb 100644
--- a/accel-pptpd/main.c
+++ b/accel-pptpd/main.c
@@ -69,7 +69,7 @@ static void __init __main(void)
if (!conf_file)
goto usage;
- if (triton_init(conf_file))
+ if (triton_init(conf_file, "modules"))
_exit(EXIT_FAILURE);
return;
diff --git a/accel-pptpd/ppp/CMakeLists.txt b/accel-pptpd/ppp/CMakeLists.txt
new file mode 100644
index 00000000..f4c0f04a
--- /dev/null
+++ b/accel-pptpd/ppp/CMakeLists.txt
@@ -0,0 +1,19 @@
+SET(target ppp)
+SET(sources_c
+ ppp.c
+ ppp_fsm.c
+ ppp_lcp.c
+ lcp_opt_mru.c
+ lcp_opt_magic.c
+ lcp_opt_pcomp.c
+ lcp_opt_accomp.c
+ ppp_auth.c
+ ppp_ipcp.c
+ ipcp_opt_ipaddr.c
+ ipcp_opt_dns.c
+ ppp_ccp.c
+)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+
+ADD_LIBRARY(${target} SHARED ${sources_c})
+
diff --git a/accel-pptpd/ipcp_opt_dns.c b/accel-pptpd/ppp/ipcp_opt_dns.c
index b7417989..b7417989 100644
--- a/accel-pptpd/ipcp_opt_dns.c
+++ b/accel-pptpd/ppp/ipcp_opt_dns.c
diff --git a/accel-pptpd/ipcp_opt_ipaddr.c b/accel-pptpd/ppp/ipcp_opt_ipaddr.c
index 2fa92519..2fa92519 100644
--- a/accel-pptpd/ipcp_opt_ipaddr.c
+++ b/accel-pptpd/ppp/ipcp_opt_ipaddr.c
diff --git a/accel-pptpd/lcp_opt_accomp.c b/accel-pptpd/ppp/lcp_opt_accomp.c
index c4c221ce..c4c221ce 100644
--- a/accel-pptpd/lcp_opt_accomp.c
+++ b/accel-pptpd/ppp/lcp_opt_accomp.c
diff --git a/accel-pptpd/lcp_opt_magic.c b/accel-pptpd/ppp/lcp_opt_magic.c
index dc94ac62..dc94ac62 100644
--- a/accel-pptpd/lcp_opt_magic.c
+++ b/accel-pptpd/ppp/lcp_opt_magic.c
diff --git a/accel-pptpd/lcp_opt_mru.c b/accel-pptpd/ppp/lcp_opt_mru.c
index e1c13b47..e1c13b47 100644
--- a/accel-pptpd/lcp_opt_mru.c
+++ b/accel-pptpd/ppp/lcp_opt_mru.c
diff --git a/accel-pptpd/lcp_opt_pcomp.c b/accel-pptpd/ppp/lcp_opt_pcomp.c
index 8700bf49..8700bf49 100644
--- a/accel-pptpd/lcp_opt_pcomp.c
+++ b/accel-pptpd/ppp/lcp_opt_pcomp.c
diff --git a/accel-pptpd/ppp.c b/accel-pptpd/ppp/ppp.c
index d1b38832..5c2eb910 100644
--- a/accel-pptpd/ppp.c
+++ b/accel-pptpd/ppp/ppp.c
@@ -11,7 +11,7 @@
#include <linux/ppp_defs.h>
#include <linux/if_ppp.h>
-#include "triton/triton.h"
+#include "triton.h"
#include "ppp.h"
#include "ppp_fsm.h"
@@ -45,7 +45,7 @@ static void free_ppp(struct ppp_t *ppp)
free(ppp->unit_buf);
}
-int establish_ppp(struct ppp_t *ppp)
+int __export establish_ppp(struct ppp_t *ppp)
{
/* Open an instance of /dev/ppp and connect the channel to it */
if (ioctl(ppp->fd, PPPIOCGCHAN, &ppp->chan_idx)==-1)
@@ -141,7 +141,7 @@ exit_close_chan:
return -1;
}
-void destablish_ppp(struct ppp_t *ppp)
+static void destablish_ppp(struct ppp_t *ppp)
{
triton_md_unregister_handler(&ppp->chan_hnd);
triton_md_unregister_handler(&ppp->unit_hnd);
@@ -170,7 +170,7 @@ void print_buf(uint8_t *buf,int size)
printf("\n");
}
-int ppp_chan_send(struct ppp_t *ppp, void *data, int size)
+int __export ppp_chan_send(struct ppp_t *ppp, void *data, int size)
{
int n;
@@ -183,7 +183,7 @@ int ppp_chan_send(struct ppp_t *ppp, void *data, int size)
return n;
}
-int ppp_unit_send(struct ppp_t *ppp, void *data, int size)
+int __export ppp_unit_send(struct ppp_t *ppp, void *data, int size)
{
int n;
@@ -280,7 +280,7 @@ cont:
}
}
-void ppp_layer_started(struct ppp_t *ppp, struct ppp_layer_data_t *d)
+void __export ppp_layer_started(struct ppp_t *ppp, struct ppp_layer_data_t *d)
{
struct layer_node_t *n=d->node;
@@ -303,7 +303,7 @@ void ppp_layer_started(struct ppp_t *ppp, struct ppp_layer_data_t *d)
}
}
-void ppp_layer_finished(struct ppp_t *ppp, struct ppp_layer_data_t *d)
+void __export ppp_layer_finished(struct ppp_t *ppp, struct ppp_layer_data_t *d)
{
struct layer_node_t *n=d->node;
@@ -322,7 +322,7 @@ void ppp_layer_finished(struct ppp_t *ppp, struct ppp_layer_data_t *d)
destablish_ppp(ppp);
}
-void ppp_terminate(struct ppp_t *ppp, int hard)
+void __export ppp_terminate(struct ppp_t *ppp, int hard)
{
struct layer_node_t *n;
struct ppp_layer_data_t *d;
@@ -348,15 +348,15 @@ void ppp_terminate(struct ppp_t *ppp, int hard)
destablish_ppp(ppp);
}
-void ppp_register_chan_handler(struct ppp_t *ppp,struct ppp_handler_t *h)
+void __export ppp_register_chan_handler(struct ppp_t *ppp,struct ppp_handler_t *h)
{
list_add_tail(&h->entry,&ppp->chan_handlers);
}
-void ppp_register_unit_handler(struct ppp_t *ppp,struct ppp_handler_t *h)
+void __export ppp_register_unit_handler(struct ppp_t *ppp,struct ppp_handler_t *h)
{
list_add_tail(&h->entry,&ppp->unit_handlers);
}
-void ppp_unregister_handler(struct ppp_t *ppp,struct ppp_handler_t *h)
+void __export ppp_unregister_handler(struct ppp_t *ppp,struct ppp_handler_t *h)
{
list_del(&h->entry);
}
@@ -370,7 +370,7 @@ static int get_layer_order(const char *name)
return -1;
}
-int ppp_register_layer(const char *name, struct ppp_layer_t *layer)
+int __export ppp_register_layer(const char *name, struct ppp_layer_t *layer)
{
int order;
struct layer_node_t *n,*n1;
@@ -406,7 +406,7 @@ insert:
return 0;
}
-void ppp_unregister_layer(struct ppp_layer_t *layer)
+void __export ppp_unregister_layer(struct ppp_layer_t *layer)
{
list_del(&layer->entry);
}
diff --git a/accel-pptpd/ppp.h b/accel-pptpd/ppp/ppp.h
index b3b1be89..d880fc2a 100644
--- a/accel-pptpd/ppp.h
+++ b/accel-pptpd/ppp/ppp.h
@@ -3,7 +3,7 @@
#include <sys/types.h>
-#include "triton/triton.h"
+#include "triton.h"
#include "list.h"
/*
diff --git a/accel-pptpd/ppp_auth.c b/accel-pptpd/ppp/ppp_auth.c
index 3208edac..32f63d5b 100644
--- a/accel-pptpd/ppp_auth.c
+++ b/accel-pptpd/ppp/ppp_auth.c
@@ -294,19 +294,19 @@ static void auth_layer_free(struct ppp_layer_data_t *ld)
free(ad);
}
-void auth_successed(struct ppp_t *ppp)
+void __export auth_successed(struct ppp_t *ppp)
{
struct auth_layer_data_t *ad=container_of(ppp_find_layer_data(ppp,&auth_layer),typeof(*ad),ld);
log_debug("auth_layer_started\n");
ppp_layer_started(ppp,&ad->ld);
}
-void auth_failed(struct ppp_t *ppp)
+void __export auth_failed(struct ppp_t *ppp)
{
ppp_terminate(ppp, 0);
}
-int ppp_auth_register_handler(struct ppp_auth_handler_t *h)
+int __export ppp_auth_register_handler(struct ppp_auth_handler_t *h)
{
list_add_tail(&h->entry,&auth_handlers);
return 0;
diff --git a/accel-pptpd/ppp_auth.h b/accel-pptpd/ppp/ppp_auth.h
index f1880d5d..f1880d5d 100644
--- a/accel-pptpd/ppp_auth.h
+++ b/accel-pptpd/ppp/ppp_auth.h
diff --git a/accel-pptpd/ppp_ccp.c b/accel-pptpd/ppp/ppp_ccp.c
index 924df7d2..fe10886e 100644
--- a/accel-pptpd/ppp_ccp.c
+++ b/accel-pptpd/ppp/ppp_ccp.c
@@ -4,7 +4,7 @@
#include <linux/if_ppp.h>
#include <arpa/inet.h>
-#include "triton/triton.h"
+#include "triton.h"
#include "log.h"
diff --git a/accel-pptpd/ppp_ccp.h b/accel-pptpd/ppp/ppp_ccp.h
index 6aca0ab1..3e459697 100644
--- a/accel-pptpd/ppp_ccp.h
+++ b/accel-pptpd/ppp/ppp_ccp.h
@@ -3,7 +3,7 @@
#include <stdint.h>
-#include "triton/triton.h"
+#include "triton.h"
#include "ppp_fsm.h"
/*
* Options.
diff --git a/accel-pptpd/ppp_fsm.c b/accel-pptpd/ppp/ppp_fsm.c
index c2d00dc6..85cf15a2 100644
--- a/accel-pptpd/ppp_fsm.c
+++ b/accel-pptpd/ppp/ppp_fsm.c
@@ -1,7 +1,7 @@
#include <arpa/inet.h>
#include <stdlib.h>
-#include "triton/triton.h"
+#include "triton.h"
#include "ppp.h"
#include "ppp_fsm.h"
diff --git a/accel-pptpd/ppp_fsm.h b/accel-pptpd/ppp/ppp_fsm.h
index bc958fe9..bc958fe9 100644
--- a/accel-pptpd/ppp_fsm.h
+++ b/accel-pptpd/ppp/ppp_fsm.h
diff --git a/accel-pptpd/ppp_ipcp.c b/accel-pptpd/ppp/ppp_ipcp.c
index 4acf6947..6ac145b2 100644
--- a/accel-pptpd/ppp_ipcp.c
+++ b/accel-pptpd/ppp/ppp_ipcp.c
@@ -4,7 +4,7 @@
#include <linux/if_ppp.h>
#include <arpa/inet.h>
-#include "triton/triton.h"
+#include "triton.h"
#include "log.h"
diff --git a/accel-pptpd/ppp_ipcp.h b/accel-pptpd/ppp/ppp_ipcp.h
index a2ce3b35..9e0c99ee 100644
--- a/accel-pptpd/ppp_ipcp.h
+++ b/accel-pptpd/ppp/ppp_ipcp.h
@@ -3,7 +3,7 @@
#include <stdint.h>
-#include "triton/triton.h"
+#include "triton.h"
#include "ppp_fsm.h"
/*
* Options.
diff --git a/accel-pptpd/ppp_lcp.c b/accel-pptpd/ppp/ppp_lcp.c
index 6c5fd189..afcfc102 100644
--- a/accel-pptpd/ppp_lcp.c
+++ b/accel-pptpd/ppp/ppp_lcp.c
@@ -4,7 +4,7 @@
#include <linux/if_ppp.h>
#include <arpa/inet.h>
-#include "triton/triton.h"
+#include "triton.h"
#include "log.h"
@@ -524,7 +524,8 @@ static void start_echo(struct ppp_lcp_t *lcp)
lcp->echo_timer.period = lcp->echo_interval * 1000;
lcp->echo_timer.expire = send_echo_request;
- triton_timer_add(lcp->ppp->ctrl->ctx, &lcp->echo_timer, 0);
+ if (lcp->echo_timer.period)
+ triton_timer_add(lcp->ppp->ctrl->ctx, &lcp->echo_timer, 0);
}
static void stop_echo(struct ppp_lcp_t *lcp)
{
diff --git a/accel-pptpd/ppp_lcp.h b/accel-pptpd/ppp/ppp_lcp.h
index 7110db20..46bc17b9 100644
--- a/accel-pptpd/ppp_lcp.h
+++ b/accel-pptpd/ppp/ppp_lcp.h
@@ -3,7 +3,7 @@
#include <stdint.h>
-#include "triton/triton.h"
+#include "triton.h"
#include "ppp_fsm.h"
/*
* Options.
diff --git a/accel-pptpd/pptpd.h b/accel-pptpd/pptpd.h
deleted file mode 100644
index d98978e5..00000000
--- a/accel-pptpd/pptpd.h
+++ /dev/null
@@ -1,26 +0,0 @@
-//
-// C++ Interface: pptpd
-//
-// Description:
-//
-//
-// Author: <xeb@mail.ru>, (C) 2009
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
-
-#ifndef PPTPD_H
-#define PPTPD_H
-
-struct ctrl_thread_t
-{
- pthread_t thr;
- pthread_mutex_t lock;
- int count;
- int pipe_fd[2];
-};
-
-int ctrl_init(struct ctrl_thread_t*);
-
-#endif
diff --git a/accel-pptpd/pwdb.c b/accel-pptpd/pwdb.c
index 4a03846e..37dd0c5f 100644
--- a/accel-pptpd/pwdb.c
+++ b/accel-pptpd/pwdb.c
@@ -1,12 +1,12 @@
#include "pwdb.h"
#include "ppp.h"
-int pwdb_check(struct ppp_t *ppp,const char *username,const char *password)
+__export int pwdb_check(struct ppp_t *ppp,const char *username,const char *password)
{
return 0;
}
-char *pwdb_get_passwd(struct ppp_t *ppp, const char *username)
+__export char *pwdb_get_passwd(struct ppp_t *ppp, const char *username)
{
return strdup("test");
}
diff --git a/accel-pptpd/triton/loader.c b/accel-pptpd/triton/loader.c
index a390f0a9..24d1cbcb 100644
--- a/accel-pptpd/triton/loader.c
+++ b/accel-pptpd/triton/loader.c
@@ -2,7 +2,45 @@
#include <string.h>
#include <unistd.h>
#include <stdio.h>
-#include <pthread.h>
+#include <errno.h>
+#include <dlfcn.h>
#include "triton_p.h"
+int load_modules(const char *name)
+{
+ struct conf_sect_t *sect;
+ struct conf_option_t *opt;
+
+ sect = conf_get_section(name);
+ if (!sect) {
+ fprintf(stderr, "loader: section '%s' not found\n", name);
+ return -1;
+ }
+
+ char *cwd = getcwd(NULL,0);
+
+ list_for_each_entry(opt, &sect->items, entry) {
+ if (!strcmp(opt->name,"path") && opt->val) {
+ if (chdir(opt->val)) {
+ fprintf(stderr,"loader: chdir '%s': %s\n", opt->val, strerror(errno));
+ goto out_err;
+ }
+ continue;
+ }
+ if (!dlopen(opt->name, RTLD_NOW | RTLD_GLOBAL)) {
+ fprintf(stderr,"loader: failed to load module '%s': %s\n",opt->name, dlerror());
+ goto out_err;
+ }
+ }
+
+ chdir(cwd);
+ free(cwd);
+ return 0;
+
+out_err:
+ chdir(cwd);
+ free(cwd);
+ return -1;
+}
+
diff --git a/accel-pptpd/triton/triton.c b/accel-pptpd/triton/triton.c
index 8c8d5a38..9aa7462b 100644
--- a/accel-pptpd/triton/triton.c
+++ b/accel-pptpd/triton/triton.c
@@ -188,7 +188,7 @@ void __export triton_unregister_ctx(struct triton_ctx_t *ud)
spin_unlock(&ctx_list_lock);
}
-int __export triton_init(const char *conf_file)
+int __export triton_init(const char *conf_file, const char *mod_sect)
{
ctx_pool = mempool_create(sizeof(struct _triton_ctx_t));
@@ -210,7 +210,10 @@ int __export triton_init(const char *conf_file)
if (timer_init())
return -1;
-
+
+ if (load_modules(mod_sect))
+ return -1;
+
return 0;
}
diff --git a/accel-pptpd/triton/triton.h b/accel-pptpd/triton/triton.h
index 2543a234..1009d67a 100644
--- a/accel-pptpd/triton/triton.h
+++ b/accel-pptpd/triton/triton.h
@@ -67,7 +67,7 @@ char *conf_get_opt(const char *sect, const char *name);
#define TRITON_ERR_NOMSG -6
#define TRITON_ERR_BUSY -5
-int triton_init(const char *conf_file);
+int triton_init(const char *conf_file, const char *mod_sect);
void triton_run(void);
void triton_terminate(void);
diff --git a/accel-pptpd/triton/triton_p.h b/accel-pptpd/triton/triton_p.h
index 24850bfd..0f7e7160 100644
--- a/accel-pptpd/triton/triton_p.h
+++ b/accel-pptpd/triton/triton_p.h
@@ -75,5 +75,6 @@ void triton_thread_wakeup(struct _triton_thread_t*);
int conf_load(const char *fname);
void triton_log_error(const char *fmt,...);
void triton_log_debug(const char *fmt,...);
+int load_modules(const char *name);
#endif