summaryrefslogtreecommitdiff
path: root/accel-pppd
diff options
context:
space:
mode:
Diffstat (limited to 'accel-pppd')
-rw-r--r--accel-pppd/CMakeLists.txt13
-rw-r--r--accel-pppd/accel-ppp.conf6
-rw-r--r--accel-pppd/ctrl/pppoe/pppoe.c2
-rw-r--r--accel-pppd/ctrl/sstp/sstp.c12
-rw-r--r--accel-pppd/extra/logwtmp.c7
-rw-r--r--accel-pppd/libnetlink/iputils.c3
-rw-r--r--accel-pppd/session.c8
7 files changed, 44 insertions, 7 deletions
diff --git a/accel-pppd/CMakeLists.txt b/accel-pppd/CMakeLists.txt
index cd7186b..496fbdc 100644
--- a/accel-pppd/CMakeLists.txt
+++ b/accel-pppd/CMakeLists.txt
@@ -71,6 +71,19 @@ IF (HAVE_GOOD_IFARP)
ADD_DEFINITIONS(-DHAVE_GOOD_IFARP)
ENDIF (HAVE_GOOD_IFARP)
+INCLUDE (CheckCSourceCompiles)
+CHECK_C_SOURCE_COMPILES("
+#include <utmp.h>
+int main(void)
+{
+ logwtmp(\"\", \"\", \"\");
+ return 0;
+}" HAVE_LOGWTMP)
+
+IF (HAVE_LOGWTMP)
+ ADD_DEFINITIONS(-DHAVE_LOGWTMP)
+ENDIF (HAVE_LOGWTMP)
+
ADD_SUBDIRECTORY(triton)
ADD_SUBDIRECTORY(vlan-mon)
diff --git a/accel-pppd/accel-ppp.conf b/accel-pppd/accel-ppp.conf
index abfd1ac..99d35c7 100644
--- a/accel-pppd/accel-ppp.conf
+++ b/accel-pppd/accel-ppp.conf
@@ -6,6 +6,9 @@ log_file
connlimit
+radius
+#chap-secrets
+
pptp
l2tp
#sstp
@@ -17,9 +20,6 @@ auth_mschap_v1
auth_chap_md5
auth_pap
-radius
-#chap-secrets
-
ippool
pppd_compat
diff --git a/accel-pppd/ctrl/pppoe/pppoe.c b/accel-pppd/ctrl/pppoe/pppoe.c
index dd623ac..8678db8 100644
--- a/accel-pppd/ctrl/pppoe/pppoe.c
+++ b/accel-pppd/ctrl/pppoe/pppoe.c
@@ -1394,6 +1394,8 @@ static void pppoe_add_interface_re(const char *opt, void *cli)
re = pcre_compile2(pattern, 0, NULL, &pcre_err, &pcre_offset, NULL);
if (!re) {
+ if (cli)
+ cli_sendv(cli, "pppoe: %s at %i\r\n", pcre_err, pcre_offset);
log_error("pppoe: %s at %i\r\n", pcre_err, pcre_offset);
return;
}
diff --git a/accel-pppd/ctrl/sstp/sstp.c b/accel-pppd/ctrl/sstp/sstp.c
index 2e2c4d3..2a9ddae 100644
--- a/accel-pppd/ctrl/sstp/sstp.c
+++ b/accel-pppd/ctrl/sstp/sstp.c
@@ -187,6 +187,7 @@ static unsigned int stat_active;
static inline void sstp_queue(struct sstp_conn_t *conn, struct buffer_t *buf);
static int sstp_send(struct sstp_conn_t *conn, struct buffer_t *buf);
static inline void sstp_queue_deferred(struct sstp_conn_t *conn, struct buffer_t *buf);
+static int sstp_write(struct triton_md_handler_t *h);
static int sstp_read_deferred(struct sstp_conn_t *conn);
static int sstp_abort(struct sstp_conn_t *conn, int disconnect);
static void sstp_disconnect(struct sstp_conn_t *conn);
@@ -858,7 +859,7 @@ static int http_send_response(struct sstp_conn_t *conn, char *proto, char *statu
}
}
- return sstp_send(conn, buf);
+ return sstp_send(conn, buf) || sstp_write(&conn->hnd);
}
static int http_recv_request(struct sstp_conn_t *conn, uint8_t *data, int len)
@@ -937,7 +938,7 @@ static int http_handler(struct sstp_conn_t *conn, struct buffer_t *buf)
static const char *table[] = { "\n\r\n", "\r\r\n", NULL };
const char **pptr;
uint8_t *ptr, *end = NULL;
- int n;
+ int n, r;
if (conn->sstp_state != STATE_SERVER_CALL_DISCONNECTED)
return -1;
@@ -963,8 +964,11 @@ static int http_handler(struct sstp_conn_t *conn, struct buffer_t *buf)
} else
n = end - buf->head;
- if (http_recv_request(conn, buf->head, n) < 0)
+ r = http_recv_request(conn, buf->head, n);
+ if (r < 0)
return -1;
+ else if (r > 0)
+ return 1;
buf_pull(buf, n);
conn->sstp_state = STATE_SERVER_CONNECT_REQUEST_PENDING;
@@ -1950,6 +1954,8 @@ static int sstp_read(struct triton_md_handler_t *h)
n = conn->handler(conn, buf);
if (n < 0)
goto drop;
+ else if (n > 0)
+ return 1;
buf_expand_tail(buf, SSTP_MAX_PACKET_SIZE);
}
diff --git a/accel-pppd/extra/logwtmp.c b/accel-pppd/extra/logwtmp.c
index f95b62c..f66e640 100644
--- a/accel-pppd/extra/logwtmp.c
+++ b/accel-pppd/extra/logwtmp.c
@@ -14,6 +14,7 @@
#include "memdebug.h"
+#ifdef HAVE_LOGWTMP
static void ev_ses_started(struct ap_session *ses)
{
logwtmp(ses->ifname, ses->username ?: "", ses->ctrl->calling_station_id);
@@ -29,5 +30,11 @@ static void init(void)
triton_event_register_handler(EV_SES_STARTED, (triton_event_func)ev_ses_started);
triton_event_register_handler(EV_SES_FINISHED, (triton_event_func)ev_ses_finished);
}
+#else
+static void init(void)
+{
+ log_warn("logwtmp is not supported on your platfrom, check libc doc\n");
+}
+#endif
DEFINE_INIT(200, init);
diff --git a/accel-pppd/libnetlink/iputils.c b/accel-pppd/libnetlink/iputils.c
index 23325fc..4bf7fd0 100644
--- a/accel-pppd/libnetlink/iputils.c
+++ b/accel-pppd/libnetlink/iputils.c
@@ -213,7 +213,8 @@ int __export iplink_vlan_add(const char *ifname, int ifindex, int vid)
data = NLMSG_TAIL(&req.n);
addattr_l(&req.n, 4096, IFLA_INFO_DATA, NULL, 0);
- addattr_l(&req.n, 4096, IFLA_VLAN_ID, &vid, 2);
+ uint16_t vid_16b = (uint16_t)vid;
+ addattr_l(&req.n, 4096, IFLA_VLAN_ID, &vid_16b, 2);
data->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)data;
linkinfo->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)linkinfo;
diff --git a/accel-pppd/session.c b/accel-pppd/session.c
index c01417f..74b3947 100644
--- a/accel-pppd/session.c
+++ b/accel-pppd/session.c
@@ -30,6 +30,14 @@
#define SID_SOURCE_SEQ 0
#define SID_SOURCE_URANDOM 1
+#ifndef __WORDSIZE
+#if defined(__GLIBC__) || defined(__UCLIBC__)
+#include <bits/wordsize.h>
+#else
+#include <bits/reg.h>
+#endif
+#endif
+
static int conf_sid_ucase;
static int conf_single_session = -1;
static int conf_single_session_ignore_case;