summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKozlov Dmitry <xeb@mail.ru>2012-08-11 14:40:27 +0400
committerKozlov Dmitry <xeb@mail.ru>2012-08-11 14:40:27 +0400
commite326838cd260599c6ab048e7b3e538d936e54218 (patch)
tree85a55dac735bf51dbc7ee7ea8d1403e5d664a92e
parent892f7b726b5b7fadc9d565b2e3d22566be346d60 (diff)
downloadaccel-ppp-e326838cd260599c6ab048e7b3e538d936e54218.tar.gz
accel-ppp-e326838cd260599c6ab048e7b3e538d936e54218.zip
ipoe: fixed packet output path
-rw-r--r--accel-pppd/CMakeLists.txt120
-rw-r--r--accel-pppd/radius/radius.c2
-rw-r--r--drivers/ipoe/ipoe.c34
3 files changed, 39 insertions, 117 deletions
diff --git a/accel-pppd/CMakeLists.txt b/accel-pppd/CMakeLists.txt
index 92d7cfba..91d5b36e 100644
--- a/accel-pppd/CMakeLists.txt
+++ b/accel-pppd/CMakeLists.txt
@@ -1,113 +1,9 @@
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fvisibility=hidden -fno-strict-aliasing -D_GNU_SOURCE -DPTHREAD_SPINLOCK -fPIC")
-
-IF (EXISTS ${CMAKE_HOME_DIRECTORY}/.git AND NOT DEFINED IGNORE_GIT)
- EXECUTE_PROCESS(
- COMMAND git log --no-color
- COMMAND head -n1
- COMMAND awk "{print $2}"
- WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}
- OUTPUT_VARIABLE ACCEL_PPP_VERSION
- )
- STRING(STRIP ${ACCEL_PPP_VERSION} ACCEL_PPP_VERSION)
-ELSE (EXISTS ${CMAKE_HOME_DIRECTORY}/.git AND NOT DEFINED IGNORE_GIT)
- SET (ACCEL_PPP_VERSION 1.7.0)
-ENDIF (EXISTS ${CMAKE_HOME_DIRECTORY}/.git AND NOT DEFINED IGNORE_GIT)
-
-ADD_DEFINITIONS(-DACCEL_PPP_VERSION="${ACCEL_PPP_VERSION}")
-
-INCLUDE_DIRECTORIES(include)
-
-IF (MEMDEBUG)
- ADD_DEFINITIONS(-DMEMDEBUG)
- IF (VALGRIND)
- ADD_DEFINITIONS(-DVALGRIND)
- ENDIF (VALGRIND)
-ENDIF (MEMDEBUG)
-
-IF (BACKUP)
- ADD_DEFINITIONS(-DUSE_BACKUP)
- ADD_SUBDIRECTORY(backup)
-ENDIF (BACKUP)
-
-IF (NOT DEFINED RADIUS)
- SET(RADIUS TRUE)
-ENDIF (NOT DEFINED RADIUS)
-
-IF (RADIUS)
- ADD_DEFINITIONS(-DRADIUS)
- ADD_SUBDIRECTORY(radius)
-ENDIF (RADIUS)
-
-ADD_SUBDIRECTORY(triton)
-ADD_SUBDIRECTORY(ctrl)
-ADD_SUBDIRECTORY(auth)
-ADD_SUBDIRECTORY(logs)
-ADD_SUBDIRECTORY(extra)
-ADD_SUBDIRECTORY(ipv6)
-ADD_SUBDIRECTORY(shaper)
-
-ADD_EXECUTABLE(accel-pppd
- session.c
- session_backup.c
- ifcfg.c
-
- backup/backup.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/ipv6cp_opt_intfid.c
- ppp/ppp_ipv6cp.c
- ppp/ppp_ccp.c
- ppp/ccp_mppe.c
-
- cli/std_cmd.c
- cli/show_sessions.c
- cli/telnet.c
- cli/tcp.c
- cli/cli.c
-
- libnetlink/libnetlink.c
- libnetlink/iplink.c
- libnetlink/genl.c
-
- pwdb.c
- ipdb.c
-
- iprange.c
-
- utils.c
-
- log.c
- main.c
- memdebug.c
-)
-
-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)
-
-INSTALL(TARGETS accel-pppd
- RUNTIME DESTINATION sbin
-)
-
-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(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')")
-ENDIF (NOT DEFINED CPACK_TYPE)
+ADD_SUBDIRECTORY(pptp)
+ADD_SUBDIRECTORY(pppoe)
+ADD_SUBDIRECTORY(l2tp)
+ADD_SUBDIRECTORY(ipoe)
+
+if (OPENVPN)
+ ADD_SUBDIRECTORY(openvpn)
+endif (OPENVPN)
diff --git a/accel-pppd/radius/radius.c b/accel-pppd/radius/radius.c
index f10b1567..b83f67d6 100644
--- a/accel-pppd/radius/radius.c
+++ b/accel-pppd/radius/radius.c
@@ -242,7 +242,7 @@ static void idle_timeout(struct triton_timer_t *t)
rad_read_stats(rpd, &stats);
if (stats.rx_packets == rpd->acct_rx_packets && stats.tx_packets == rpd->acct_tx_packets) {
- log_ppp_msg("radius: session timed out\n");
+ log_ppp_msg("radius: idle timed out\n");
ap_session_terminate(rpd->ses, TERM_IDLE_TIMEOUT, 0);
} else {
rpd->acct_rx_packets = stats.rx_packets;
diff --git a/drivers/ipoe/ipoe.c b/drivers/ipoe/ipoe.c
index b3968669..5bef0c8c 100644
--- a/drivers/ipoe/ipoe.c
+++ b/drivers/ipoe/ipoe.c
@@ -345,6 +345,7 @@ static netdev_tx_t ipoe_xmit(struct sk_buff *skb, struct net_device *dev)
unsigned char *arp_ptr;
__be32 tip;*/
int noff;
+ unsigned char *cb_ptr;
if (!ses->peer_addr)
goto drop;
@@ -402,6 +403,14 @@ static netdev_tx_t ipoe_xmit(struct sk_buff *skb, struct net_device *dev)
pskb_pull(skb, ETH_HLEN);
skb_reset_network_header(skb);
+ cb_ptr = skb->cb + sizeof(skb->cb) - 2;
+ *(__u16 *)cb_ptr = IPOE_MAGIC;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32)
+ skb->skb_iif = dev->ifindex;
+#else
+ skb->iif = dev->ifindex;
+#endif
+
ip_local_out(skb);
return NETDEV_TX_OK;
@@ -435,8 +444,14 @@ static netdev_tx_t ipoe_xmit(struct sk_buff *skb, struct net_device *dev)
}*/
if (ses->link_dev) {
+ cb_ptr = skb->cb + sizeof(skb->cb) - 2;
+ *(__u16 *)cb_ptr = IPOE_MAGIC;
skb->dev = ses->link_dev;
- //skb->skb_iif = dev->ifindex;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32)
+ skb->skb_iif = dev->ifindex;
+#else
+ skb->iif = dev->ifindex;
+#endif
dev_queue_xmit(skb);
return NETDEV_TX_OK;
@@ -721,7 +736,7 @@ static unsigned int ipt_in_hook(unsigned int hook, struct sk_buff *skb, const st
cb_ptr = skb1->cb + sizeof(skb1->cb) - 2;
*(__u16 *)cb_ptr = IPOE_MAGIC;
- skb1->tc_verd = SET_TC_NCLS(0);
+ //skb1->tc_verd = SET_TC_NCLS(0);
netif_rx(skb1);
@@ -739,7 +754,7 @@ out:
static unsigned int ipt_out_hook(unsigned int hook, struct sk_buff *skb, const struct net_device *in, const struct net_device *out, int (*okfn)(struct sk_buff *skb))
{
- int noff;
+ int noff, iif;
struct iphdr *iph;
struct ipoe_session *ses;
unsigned char *cb_ptr;
@@ -767,8 +782,19 @@ static unsigned int ipt_out_hook(unsigned int hook, struct sk_buff *skb, const s
ses = ipoe_lookup(iph->daddr);
if (!ses)
return NF_ACCEPT;
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32)
+ iif = skb->skb_iif;
+#else
+ iif = skb->iif;
+#endif
+
+ if (iif == ses->dev->ifindex) {
+ atomic_dec(&ses->refs);
+ return NF_ACCEPT;
+ }
- skb->dev = ses->dev;
+ skb->dev = ses->dev;
atomic_dec(&ses->refs);
return NF_ACCEPT;