From d16b78813da8b69aafd13ca5086850a5d27a871e Mon Sep 17 00:00:00 2001 From: Aleksey Zhukov Date: Wed, 26 Dec 2012 01:34:39 +0400 Subject: Pass proper pointer to rad_packet_find_attr --- accel-pppd/radius/dm_coa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accel-pppd/radius/dm_coa.c b/accel-pppd/radius/dm_coa.c index b96f3e0..807a8b4 100644 --- a/accel-pppd/radius/dm_coa.c +++ b/accel-pppd/radius/dm_coa.c @@ -162,7 +162,7 @@ static void coa_request(struct radius_pd_t *rpd) if (ev.res) dm_coa_send_nak(serv.hnd.fd, rpd->dm_coa_req, &rpd->dm_coa_addr, 0); else { - class = rad_packet_find_attr(rpd->dm_coa_req, NULL, "Class"); + class = rad_packet_find_attr(rpd->dm_coa_req->pack, NULL, "Class"); if (class) { prev_class = rpd->attr_class; -- cgit v1.2.3 From 812813bf523901dd091bb071f22986e71cdcea6a Mon Sep 17 00:00:00 2001 From: Aleksey Zhukov Date: Wed, 26 Dec 2012 01:35:35 +0400 Subject: Do not segfault on RADIUS failures during interim --- accel-pppd/radius/acct.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/accel-pppd/radius/acct.c b/accel-pppd/radius/acct.c index 9a832a9..43e5549 100644 --- a/accel-pppd/radius/acct.c +++ b/accel-pppd/radius/acct.c @@ -202,6 +202,12 @@ static void rad_acct_interim_update(struct triton_timer_t *t) req_set_RA(rpd->acct_req, rpd->acct_req->serv->secret); __rad_req_send(rpd->acct_req); + /* The above call may set rpd->acct_req to NULL in the following chain of events: + 1. __rad_req_send fails (on rad_server_realloc) and calls ppp_terminate; + 2. As a result, an EV_PPP_FINISHING event is fired; + 3. ppp_finishing calls rad_acct_stop that cleans up the request. */ + if (!rpd->acct_req) + return; __sync_add_and_fetch(&rpd->acct_req->serv->stat_interim_sent, 1); -- cgit v1.2.3 From fcca57d11413da719eed8b48afb778b13285e4bf Mon Sep 17 00:00:00 2001 From: Aleksey Zhukov Date: Wed, 26 Dec 2012 01:36:46 +0400 Subject: Proper logging of LCP Magic-Numbers --- accel-pppd/ppp/lcp_opt_magic.c | 4 ++-- accel-pppd/ppp/ppp_lcp.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/accel-pppd/ppp/lcp_opt_magic.c b/accel-pppd/ppp/lcp_opt_magic.c index 3e694d2..bf39209 100644 --- a/accel-pppd/ppp/lcp_opt_magic.c +++ b/accel-pppd/ppp/lcp_opt_magic.c @@ -94,9 +94,9 @@ static void magic_print(void (*print)(const char *fmt,...),struct lcp_option_t * struct lcp_opt32_t *opt32 = (struct lcp_opt32_t *)ptr; if (ptr) - print("", ntohl(opt32->val)); + print("", ntohl(opt32->val)); else - print("", magic_opt->magic); + print("", magic_opt->magic); } static void magic_opt_init() diff --git a/accel-pppd/ppp/ppp_lcp.c b/accel-pppd/ppp/ppp_lcp.c index e1727de..7a071dd 100644 --- a/accel-pppd/ppp/ppp_lcp.c +++ b/accel-pppd/ppp/ppp_lcp.c @@ -606,7 +606,7 @@ static void lcp_recv_echo_repl(struct ppp_lcp_t *lcp, uint8_t *data, int size) magic = ntohl(*(uint32_t *)data); if (conf_ppp_verbose) - log_ppp_debug("recv [LCP EchoRep id=%x ]\n", lcp->fsm.recv_id, magic); + log_ppp_debug("recv [LCP EchoRep id=%x ]\n", lcp->fsm.recv_id, magic); if (magic == lcp->magic) { log_ppp_error("lcp: echo: loop-back detected\n"); @@ -630,7 +630,7 @@ static void send_echo_reply(struct ppp_lcp_t *lcp) *(uint32_t *)(hdr + 1) = htonl(lcp->magic); if (conf_ppp_verbose) - log_ppp_debug("send [LCP EchoRep id=%x ]\n", hdr->id, htonl(lcp->magic)); + log_ppp_debug("send [LCP EchoRep id=%x ]\n", hdr->id, lcp->magic); ppp_chan_send(lcp->ppp, hdr, ntohs(hdr->len) + 2); } @@ -683,7 +683,7 @@ static void send_echo_request(struct triton_timer_t *t) } if (conf_ppp_verbose) - log_ppp_debug("send [LCP EchoReq id=%x ]\n", msg.hdr.id, lcp->magic); + log_ppp_debug("send [LCP EchoReq id=%x ]\n", msg.hdr.id, lcp->magic); ppp_chan_send(lcp->ppp,&msg,ntohs(msg.hdr.len)+2); } @@ -851,7 +851,7 @@ static void lcp_recv(struct ppp_handler_t*h) break; case ECHOREQ: if (conf_ppp_verbose) - log_ppp_debug("recv [LCP EchoReq id=%x ]\n", hdr->id, ntohl(*(uint32_t*)(hdr + 1))); + log_ppp_debug("recv [LCP EchoReq id=%x ]\n", hdr->id, ntohl(*(uint32_t*)(hdr + 1))); send_echo_reply(lcp); break; case ECHOREP: -- cgit v1.2.3 From 4acfa46c321a344b9a6ce4128e72d1e02828d8a0 Mon Sep 17 00:00:00 2001 From: Kozlov Dmitry Date: Wed, 26 Dec 2012 02:00:16 +0400 Subject: Revert "Pass proper pointer to rad_packet_find_attr" This reverts commit d16b78813da8b69aafd13ca5086850a5d27a871e. --- accel-pppd/radius/dm_coa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accel-pppd/radius/dm_coa.c b/accel-pppd/radius/dm_coa.c index 807a8b4..b96f3e0 100644 --- a/accel-pppd/radius/dm_coa.c +++ b/accel-pppd/radius/dm_coa.c @@ -162,7 +162,7 @@ static void coa_request(struct radius_pd_t *rpd) if (ev.res) dm_coa_send_nak(serv.hnd.fd, rpd->dm_coa_req, &rpd->dm_coa_addr, 0); else { - class = rad_packet_find_attr(rpd->dm_coa_req->pack, NULL, "Class"); + class = rad_packet_find_attr(rpd->dm_coa_req, NULL, "Class"); if (class) { prev_class = rpd->attr_class; -- cgit v1.2.3 From c223aade3cd0c9ee651902f70da5497aae0f8014 Mon Sep 17 00:00:00 2001 From: Kozlov Dmitry Date: Wed, 26 Dec 2012 02:15:05 +0400 Subject: cmake: use CMAKE_FIND_ROOT_PATH and LIB_SUFFIX --- accel-pppd/CMakeLists.txt | 23 ++++++++++++++++++----- accel-pppd/auth/CMakeLists.txt | 2 +- accel-pppd/ctrl/l2tp/CMakeLists.txt | 2 +- accel-pppd/ctrl/pppoe/CMakeLists.txt | 6 +----- accel-pppd/ctrl/pptp/CMakeLists.txt | 2 +- accel-pppd/extra/CMakeLists.txt | 6 +++--- accel-pppd/extra/net-snmp/CMakeLists.txt | 2 +- accel-pppd/ipv6/CMakeLists.txt | 2 +- accel-pppd/logs/CMakeLists.txt | 8 ++++---- accel-pppd/radius/CMakeLists.txt | 2 +- accel-pppd/shaper/CMakeLists.txt | 2 +- accel-pppd/triton/CMakeLists.txt | 4 ++-- 12 files changed, 35 insertions(+), 26 deletions(-) diff --git a/accel-pppd/CMakeLists.txt b/accel-pppd/CMakeLists.txt index 0c1c949..2d1db49 100644 --- a/accel-pppd/CMakeLists.txt +++ b/accel-pppd/CMakeLists.txt @@ -15,6 +15,19 @@ ENDIF (EXISTS ${CMAKE_HOME_DIRECTORY}/.git AND NOT DEFINED IGNORE_GIT) ADD_DEFINITIONS(-DACCEL_PPP_VERSION="${ACCEL_PPP_VERSION}") +IF (NOT DEFINED LIB_SUFFIX) + EXECUTE_PROCESS( + COMMAND uname -m + COMMAND tr -d '\n' + OUTPUT_VARIABLE ARCH + ) + message(STATUS "'" ${ARCH} "'") + IF (ARCH STREQUAL x86_64) + SET(LIB_SUFFIX 64) + ENDIF (ARCH STREQUAL x86_64) +ENDIF (NOT DEFINED LIB_SUFFIX) + + INCLUDE_DIRECTORIES(include) IF (MEMDEBUG) @@ -93,7 +106,7 @@ TARGET_LINK_LIBRARIES(accel-pppd triton rt pthread ${crypto_lib} pcre) set_property(TARGET accel-pppd PROPERTY CMAKE_SKIP_BUILD_RPATH FALSE) set_property(TARGET accel-pppd PROPERTY CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) set_property(TARGET accel-pppd PROPERTY INSTALL_RPATH_USE_LINK_PATH FALSE) -set_property(TARGET accel-pppd PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib/accel-ppp) +set_property(TARGET accel-pppd PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib${LIB_SIFFIX}/accel-ppp) INSTALL(TARGETS accel-pppd RUNTIME DESTINATION sbin @@ -102,10 +115,10 @@ INSTALL(TARGETS accel-pppd INSTALL(FILES accel-ppp.conf.5 DESTINATION share/man/man5) IF (NOT DEFINED CPACK_TYPE) - INSTALL(FILES accel-ppp.conf DESTINATION /etc RENAME accel-ppp.conf.dist) + INSTALL(FILES accel-ppp.conf DESTINATION ${CMAKE_FIND_ROOT_PATH}/etc RENAME accel-ppp.conf.dist) - INSTALL(CODE "EXECUTE_PROCESS(COMMAND mkdir -p /var/log/accel-ppp)") - INSTALL(CODE "EXECUTE_PROCESS(COMMAND mkdir -p /var/run/accel-ppp)") - INSTALL(CODE "EXECUTE_PROCESS(COMMAND 'echo 0 > /var/run/accel-ppp/seq')") + INSTALL(CODE "EXECUTE_PROCESS(COMMAND mkdir -p ${CMAKE_FIND_ROOT_PATH}/var/log/accel-ppp)") + INSTALL(CODE "EXECUTE_PROCESS(COMMAND mkdir -p ${CMAKE_FIND_ROOT_PATH}/var/run/accel-ppp)") + INSTALL(CODE "EXECUTE_PROCESS(COMMAND 'echo 0 > ${CMAKE_FIND_ROOT_PATH}/var/run/accel-ppp/seq')") ENDIF (NOT DEFINED CPACK_TYPE) diff --git a/accel-pppd/auth/CMakeLists.txt b/accel-pppd/auth/CMakeLists.txt index 7af8fac..f93d9e3 100644 --- a/accel-pppd/auth/CMakeLists.txt +++ b/accel-pppd/auth/CMakeLists.txt @@ -8,6 +8,6 @@ TARGET_LINK_LIBRARIES(auth_mschap_v1 ${crypto_lib}) TARGET_LINK_LIBRARIES(auth_mschap_v2 ${crypto_lib}) INSTALL(TARGETS auth_pap auth_chap_md5 auth_mschap_v1 auth_mschap_v2 - LIBRARY DESTINATION lib/accel-ppp + LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp ) diff --git a/accel-pppd/ctrl/l2tp/CMakeLists.txt b/accel-pppd/ctrl/l2tp/CMakeLists.txt index b295289..66dd3fc 100644 --- a/accel-pppd/ctrl/l2tp/CMakeLists.txt +++ b/accel-pppd/ctrl/l2tp/CMakeLists.txt @@ -10,7 +10,7 @@ ADD_LIBRARY(l2tp SHARED ) #TARGET_LINK_LIBRARIES(l2tp nl nl-genl) -INSTALL(TARGETS l2tp LIBRARY DESTINATION lib/accel-ppp) +INSTALL(TARGETS l2tp LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp) FILE(GLOB dict "${CMAKE_CURRENT_SOURCE_DIR}/dict/*") INSTALL(FILES ${dict} DESTINATION share/accel-ppp/l2tp) diff --git a/accel-pppd/ctrl/pppoe/CMakeLists.txt b/accel-pppd/ctrl/pppoe/CMakeLists.txt index a38cfb2..fad9efd 100644 --- a/accel-pppd/ctrl/pppoe/CMakeLists.txt +++ b/accel-pppd/ctrl/pppoe/CMakeLists.txt @@ -13,9 +13,5 @@ ENDIF(RADIUS) ADD_LIBRARY(pppoe SHARED ${sources}) TARGET_LINK_LIBRARIES(pppoe ${crypto_lib}) -#set_property(TARGET pppoe PROPERTY CMAKE_SKIP_BUILD_RPATH FALSE) -#set_property(TARGET pppoe PROPERTY CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) -#set_property(TARGET pppoe PROPERTY INSTALL_RPATH_USE_LINK_PATH FALSE) -#set_property(TARGET pppoe PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib/accel-ppp) -INSTALL(TARGETS pppoe LIBRARY DESTINATION lib/accel-ppp) +INSTALL(TARGETS pppoe LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp) diff --git a/accel-pppd/ctrl/pptp/CMakeLists.txt b/accel-pppd/ctrl/pptp/CMakeLists.txt index 3199e7f..aa011d1 100644 --- a/accel-pppd/ctrl/pptp/CMakeLists.txt +++ b/accel-pppd/ctrl/pptp/CMakeLists.txt @@ -2,4 +2,4 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) ADD_LIBRARY(pptp SHARED pptp.c) -INSTALL(TARGETS pptp LIBRARY DESTINATION lib/accel-ppp ) +INSTALL(TARGETS pptp LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp ) diff --git a/accel-pppd/extra/CMakeLists.txt b/accel-pppd/extra/CMakeLists.txt index cbaef49..43ba367 100644 --- a/accel-pppd/extra/CMakeLists.txt +++ b/accel-pppd/extra/CMakeLists.txt @@ -1,6 +1,6 @@ ADD_LIBRARY(pppd_compat SHARED pppd_compat.c) TARGET_LINK_LIBRARIES(pppd_compat sigchld) -set_property(TARGET pppd_compat PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib/accel-ppp) +set_property(TARGET pppd_compat PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/accel-ppp) ADD_LIBRARY(ippool SHARED ippool.c) ADD_LIBRARY(ipv6pool SHARED ipv6pool.c) ADD_LIBRARY(sigchld SHARED sigchld.c) @@ -10,7 +10,7 @@ TARGET_LINK_LIBRARIES(logwtmp util) ADD_LIBRARY(connlimit SHARED connlimit.c) INSTALL(TARGETS pppd_compat ippool ipv6pool sigchld chap-secrets logwtmp connlimit - LIBRARY DESTINATION lib/accel-ppp + LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp ) IF (SHAPER) @@ -20,7 +20,7 @@ IF (SHAPER) SET_PROPERTY(TARGET shaper_tbf PROPERTY LINK_FLAGS "-L${LIBNL_PREFIX}/lib") ENDIF (LIBNL_PREFIX) TARGET_LINK_LIBRARIES(shaper_tbf nl m) - INSTALL(TARGETS shaper_tbf LIBRARY DESTINATION lib/accel-ppp) + INSTALL(TARGETS shaper_tbf LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp) ENDIF (SHAPER) diff --git a/accel-pppd/extra/net-snmp/CMakeLists.txt b/accel-pppd/extra/net-snmp/CMakeLists.txt index b61c0d0..7633f37 100644 --- a/accel-pppd/extra/net-snmp/CMakeLists.txt +++ b/accel-pppd/extra/net-snmp/CMakeLists.txt @@ -25,5 +25,5 @@ IF (NETSNMP_PREFIX) ENDIF (NETSNMP_PREFIX) INSTALL(TARGETS net-snmp - LIBRARY DESTINATION lib/accel-ppp + LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp ) diff --git a/accel-pppd/ipv6/CMakeLists.txt b/accel-pppd/ipv6/CMakeLists.txt index 9f8c3d1..e95eadb 100644 --- a/accel-pppd/ipv6/CMakeLists.txt +++ b/accel-pppd/ipv6/CMakeLists.txt @@ -2,6 +2,6 @@ ADD_LIBRARY(ipv6_dhcp SHARED dhcpv6.c dhcpv6_packet.c) ADD_LIBRARY(ipv6_nd SHARED nd.c) INSTALL(TARGETS ipv6_dhcp ipv6_nd - LIBRARY DESTINATION lib/accel-ppp + LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp ) diff --git a/accel-pppd/logs/CMakeLists.txt b/accel-pppd/logs/CMakeLists.txt index b10163f..b25cbe2 100644 --- a/accel-pppd/logs/CMakeLists.txt +++ b/accel-pppd/logs/CMakeLists.txt @@ -15,21 +15,21 @@ IF(LOG_FILE) ADD_LIBRARY(log_file SHARED log_file.c) TARGET_LINK_LIBRARIES(log_file rt) INSTALL(TARGETS log_file - LIBRARY DESTINATION lib/accel-ppp + LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp ) ENDIF(LOG_FILE) IF(LOG_TCP) ADD_LIBRARY(log_tcp SHARED log_tcp.c) INSTALL(TARGETS log_tcp - LIBRARY DESTINATION lib/accel-ppp + LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp ) ENDIF(LOG_TCP) IF(LOG_SYSLOG) ADD_LIBRARY(log_syslog SHARED log_syslog.c) INSTALL(TARGETS log_syslog - LIBRARY DESTINATION lib/accel-ppp + LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp ) ENDIF(LOG_SYSLOG) @@ -37,7 +37,7 @@ IF(LOG_PGSQL) ADD_LIBRARY(log_pgsql SHARED log_pgsql.c) TARGET_LINK_LIBRARIES(log_pgsql pq) INSTALL(TARGETS log_pgsql - LIBRARY DESTINATION lib/accel-ppp + LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp ) ENDIF(LOG_PGSQL) diff --git a/accel-pppd/radius/CMakeLists.txt b/accel-pppd/radius/CMakeLists.txt index 0c1789e..566f3f9 100644 --- a/accel-pppd/radius/CMakeLists.txt +++ b/accel-pppd/radius/CMakeLists.txt @@ -15,7 +15,7 @@ ADD_DEFINITIONS(-DDICTIONARY="${CMAKE_INSTALL_PREFIX}/share/accel-ppp/radius/dic ADD_LIBRARY(radius SHARED ${sources}) INSTALL(TARGETS radius - LIBRARY DESTINATION lib/accel-ppp + LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp ) FILE(GLOB dict "${CMAKE_CURRENT_SOURCE_DIR}/dict/*") INSTALL(FILES ${dict} DESTINATION share/accel-ppp/radius) diff --git a/accel-pppd/shaper/CMakeLists.txt b/accel-pppd/shaper/CMakeLists.txt index 3c1ac95..7f211fd 100644 --- a/accel-pppd/shaper/CMakeLists.txt +++ b/accel-pppd/shaper/CMakeLists.txt @@ -1,6 +1,6 @@ ADD_LIBRARY(shaper SHARED shaper.c limiter.c leaf_qdisc.c tc_core.c) INSTALL(TARGETS shaper - LIBRARY DESTINATION lib/accel-ppp + LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp ) diff --git a/accel-pppd/triton/CMakeLists.txt b/accel-pppd/triton/CMakeLists.txt index 105b62a..0dc7ba5 100644 --- a/accel-pppd/triton/CMakeLists.txt +++ b/accel-pppd/triton/CMakeLists.txt @@ -30,11 +30,11 @@ ENDIF (HAVE_TIMERFD) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) -ADD_DEFINITIONS(-DMODULE_PATH="${CMAKE_INSTALL_PREFIX}/lib/accel-ppp") +ADD_DEFINITIONS(-DMODULE_PATH="${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/accel-ppp") ADD_LIBRARY(triton SHARED ${sources_c}) TARGET_LINK_LIBRARIES(triton dl) INSTALL(TARGETS triton - LIBRARY DESTINATION lib/accel-ppp + LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp ) -- cgit v1.2.3