diff options
Diffstat (limited to 'accel-pptpd')
-rw-r--r-- | accel-pptpd/ctrl/CMakeLists.txt | 6 | ||||
-rw-r--r-- | accel-pptpd/ctrl/l2tp/CMakeLists.txt | 2 | ||||
-rw-r--r-- | accel-pptpd/ctrl/l2tp/netlink.c | 22 | ||||
-rw-r--r-- | accel-pptpd/extra/CMakeLists.txt | 8 | ||||
-rw-r--r-- | accel-pptpd/extra/shaper_tbf.c | 26 | ||||
-rw-r--r-- | accel-pptpd/ppp/ppp_ccp.c | 3 | ||||
-rw-r--r-- | accel-pptpd/ppp/ppp_lcp.c | 7 |
7 files changed, 45 insertions, 29 deletions
diff --git a/accel-pptpd/ctrl/CMakeLists.txt b/accel-pptpd/ctrl/CMakeLists.txt index 6b37bc4a..1ba3b2a6 100644 --- a/accel-pptpd/ctrl/CMakeLists.txt +++ b/accel-pptpd/ctrl/CMakeLists.txt @@ -1,3 +1,7 @@ ADD_SUBDIRECTORY(pptp) ADD_SUBDIRECTORY(pppoe) -ADD_SUBDIRECTORY(l2tp) + +IF (L2TP) + ADD_SUBDIRECTORY(l2tp) +ENDIF (L2TP) + diff --git a/accel-pptpd/ctrl/l2tp/CMakeLists.txt b/accel-pptpd/ctrl/l2tp/CMakeLists.txt index edff55dc..c9b483d3 100644 --- a/accel-pptpd/ctrl/l2tp/CMakeLists.txt +++ b/accel-pptpd/ctrl/l2tp/CMakeLists.txt @@ -8,6 +8,6 @@ ADD_LIBRARY(l2tp SHARED packet.c netlink.c ) -TARGET_LINK_LIBRARIES(l2tp nl) +TARGET_LINK_LIBRARIES(l2tp nl-genl) INSTALL(TARGETS l2tp LIBRARY DESTINATION usr/lib/accel-pptp) diff --git a/accel-pptpd/ctrl/l2tp/netlink.c b/accel-pptpd/ctrl/l2tp/netlink.c index 0cc5b34b..7c8c79a6 100644 --- a/accel-pptpd/ctrl/l2tp/netlink.c +++ b/accel-pptpd/ctrl/l2tp/netlink.c @@ -9,10 +9,10 @@ static int family; void l2tp_nl_delete_tunnel(int tid) { - struct nl_handle *nl_sock; + struct nl_sock *nl_sock; struct nl_msg *msg; - nl_sock = nl_handle_alloc(); + nl_sock = nl_socket_alloc(); msg = nlmsg_alloc(); genl_connect(nl_sock); @@ -25,15 +25,15 @@ void l2tp_nl_delete_tunnel(int tid) nlmsg_free(msg); nl_close(nl_sock); - nl_handle_destroy(nl_sock); + nl_socket_free(nl_sock); } void l2tp_nl_create_tunnel(int fd, int tid, int peer_tid) { - struct nl_handle *nl_sock; + struct nl_sock *nl_sock; struct nl_msg *msg; - nl_sock = nl_handle_alloc(); + nl_sock = nl_socket_alloc(); msg = nlmsg_alloc(); genl_connect(nl_sock); @@ -51,15 +51,15 @@ void l2tp_nl_create_tunnel(int fd, int tid, int peer_tid) nlmsg_free(msg); nl_close(nl_sock); - nl_handle_destroy(nl_sock); + nl_socket_free(nl_sock); } void l2tp_nl_create_session(int tid, int sid, int peer_sid) { - struct nl_handle *nl_sock; + struct nl_sock *nl_sock; struct nl_msg *msg; - nl_sock = nl_handle_alloc(); + nl_sock = nl_socket_alloc(); msg = nlmsg_alloc(); genl_connect(nl_sock); @@ -77,18 +77,18 @@ void l2tp_nl_create_session(int tid, int sid, int peer_sid) nlmsg_free(msg); nl_close(nl_sock); - nl_handle_destroy(nl_sock); + nl_socket_free(nl_sock); } static void __init init(void) { - struct nl_handle *nl_sock = nl_handle_alloc(); + struct nl_sock *nl_sock = nl_socket_alloc(); genl_connect(nl_sock); family = genl_ctrl_resolve(nl_sock, L2TP_GENL_NAME); nl_close(nl_sock); - nl_handle_destroy(nl_sock); + nl_socket_free(nl_sock); } diff --git a/accel-pptpd/extra/CMakeLists.txt b/accel-pptpd/extra/CMakeLists.txt index 600c8613..9d58b8ee 100644 --- a/accel-pptpd/extra/CMakeLists.txt +++ b/accel-pptpd/extra/CMakeLists.txt @@ -1,10 +1,14 @@ ADD_LIBRARY(pppd_compat SHARED pppd_compat.c) ADD_LIBRARY(ippool SHARED ippool.c) ADD_LIBRARY(sigchld SHARED sigchld.c) -ADD_LIBRARY(shaper_tbf SHARED shaper_tbf.c) -TARGET_LINK_LIBRARIES(shaper_tbf nl) INSTALL(TARGETS pppd_compat ippool sigchld LIBRARY DESTINATION usr/lib/accel-pptp ) +IF (SHAPER) + ADD_LIBRARY(shaper_tbf SHARED shaper_tbf.c) + TARGET_LINK_LIBRARIES(shaper_tbf nl-route) + INSTALL(TARGETS shaper_tbf LIBRARY DESTINATION usr/lib/accel-pptp) +ENDIF (SHAPER) + diff --git a/accel-pptpd/extra/shaper_tbf.c b/accel-pptpd/extra/shaper_tbf.c index 7ed68f5e..cd1a88a6 100644 --- a/accel-pptpd/extra/shaper_tbf.c +++ b/accel-pptpd/extra/shaper_tbf.c @@ -92,7 +92,7 @@ static void tc_calc_rtable(struct tc_ratespec *r, uint32_t *rtab, int cell_log, r->cell_log=cell_log; } -static int install_tbf(struct nl_handle *h, int ifindex, int speed) +static int install_tbf(struct nl_sock *h, int ifindex, int speed) { struct tc_tbf_qopt opt; struct nl_msg *msg; @@ -159,7 +159,7 @@ nla_put_failure: return -1; } -static int install_ingress(struct nl_handle *h, int ifindex) +static int install_ingress(struct nl_sock *h, int ifindex) { struct nl_msg *pmsg; @@ -200,7 +200,7 @@ nla_put_failure: return -1; } -static int install_filter(struct nl_handle *h, int ifindex, int speed) +static int install_filter(struct nl_sock *h, int ifindex, int speed) { double rate = speed*1000/8; double bucket = rate*conf_burst_factor; @@ -323,7 +323,7 @@ nla_put_failure: static int install_shaper(const char *ifname, int down_speed, int up_speed) { - struct nl_handle *h; + struct nl_sock *h; struct ifreq ifr; int err; @@ -335,9 +335,9 @@ static int install_shaper(const char *ifname, int down_speed, int up_speed) return -1; } - h = nl_handle_alloc(); + h = nl_socket_alloc(); if (!h) { - log_ppp_error("tbf: nl_handle_alloc failed\n"); + log_ppp_error("tbf: nl_socket_alloc failed\n"); return -1; } @@ -360,7 +360,7 @@ static int install_shaper(const char *ifname, int down_speed, int up_speed) nl_close(h); out: - nl_handle_destroy(h); + nl_socket_free(h); return 0; } @@ -395,7 +395,7 @@ static struct shaper_pd_t *find_pd(struct ppp_t *ppp, int create) static int remove_shaper(const char *ifname) { - struct nl_handle *h; + struct nl_sock *h; struct ifreq ifr; struct nl_msg *pmsg; int err; @@ -422,16 +422,16 @@ static int remove_shaper(const char *ifname) .tcm_parent = TC_H_INGRESS, }; - h = nl_handle_alloc(); + h = nl_socket_alloc(); if (!h) { - log_ppp_error("tbf: nl_handle_alloc failed\n"); + log_ppp_error("tbf: nl_socket_alloc failed\n"); return -1; } err = nl_connect(h, NETLINK_ROUTE); if (err < 0) { log_ppp_error("tbf: nl_connect: %s", strerror(errno)); - nl_handle_destroy(h); + nl_socket_free(h); return -1; } @@ -466,7 +466,7 @@ static int remove_shaper(const char *ifname) nlmsg_free(pmsg); nl_close(h); - nl_handle_destroy(h); + nl_socket_free(h); return 0; out_err: @@ -476,7 +476,7 @@ out_err: nlmsg_free(pmsg); nl_close(h); - nl_handle_destroy(h); + nl_socket_free(h); return -1; } diff --git a/accel-pptpd/ppp/ppp_ccp.c b/accel-pptpd/ppp/ppp_ccp.c index 4f30aa99..9f8419fd 100644 --- a/accel-pptpd/ppp/ppp_ccp.c +++ b/accel-pptpd/ppp/ppp_ccp.c @@ -607,7 +607,8 @@ static void ccp_recv(struct ppp_handler_t*h) if (ccp->fsm.fsm_state == FSM_Initial || ccp->fsm.fsm_state == FSM_Closed) { if (conf_ppp_verbose) log_ppp_warn("CCP: discaring packet\n"); - lcp_send_proto_rej(ccp->ppp, htons(PPP_CCP)); + if (ccp->fsm.fsm_state == FSM_Closed) + lcp_send_proto_rej(ccp->ppp, htons(PPP_CCP)); return; } diff --git a/accel-pptpd/ppp/ppp_lcp.c b/accel-pptpd/ppp/ppp_lcp.c index 0eae8fc9..e5063f3f 100644 --- a/accel-pptpd/ppp/ppp_lcp.c +++ b/accel-pptpd/ppp/ppp_lcp.c @@ -690,6 +690,13 @@ static void lcp_recv(struct ppp_handler_t*h) int r; char *term_msg; + if (lcp->fsm.fsm_state == FSM_Initial || lcp->fsm.fsm_state == FSM_Closed) { + /*if (conf_ppp_verbose) + log_ppp_warn("LCP: discaring packet\n"); + lcp_send_proto_rej(ccp->ppp, htons(PPP_CCP));*/ + return; + } + if (lcp->ppp->chan_buf_size < PPP_HEADERLEN + 2) { log_ppp_warn("LCP: short packet received\n"); return; |