├── accel-pppd ├── include │ ├── log.h │ ├── cli.h │ ├── ipdb.h │ ├── ppp.h │ ├── pwdb.h │ ├── utils.h │ ├── cli_p.h │ ├── iprange.h │ ├── list.h │ ├── memdebug.h │ ├── backup.h │ ├── crypto.h │ ├── genl.h │ ├── ipset.h │ ├── luasupp.h │ ├── mempool.h │ ├── ppp_auth.h │ ├── ppp_fsm.h │ ├── ppp_lcp.h │ ├── radius.h │ ├── sigchld.h │ ├── triton.h │ ├── iputils.h │ ├── spinlock.h │ ├── libnetlink.h │ ├── linux_ppp.h │ ├── connlimit.h │ ├── ap_session_backup.h │ ├── vlan_mon.h │ ├── events.h │ └── ap_net.h ├── cli │ ├── CMakeLists.txt │ ├── cli_p.h │ └── cli.h ├── ctrl │ ├── ipoe │ │ ├── if_ipoe.h │ │ └── CMakeLists.txt │ ├── l2tp │ │ ├── dict │ │ │ ├── dictionary │ │ │ ├── dictionary.rfc3931 │ │ │ └── dictionary.rfc2661 │ │ ├── CMakeLists.txt │ │ ├── dict2c.py │ │ ├── l2tp_prot.h │ │ ├── attr_defs.h │ │ ├── netlink.c │ │ └── l2tp.h │ ├── CMakeLists.txt │ ├── pptp │ │ └── CMakeLists.txt │ ├── sstp │ │ └── CMakeLists.txt │ └── pppoe │ │ └── CMakeLists.txt ├── vlan-mon │ ├── if_vlan_mon.h │ └── CMakeLists.txt ├── lua │ ├── lua_lpack.c │ ├── CMakeLists.txt │ └── luasupp.h ├── backup │ ├── CMakeLists.txt │ └── backup.h ├── libnetlink │ ├── genl.h │ ├── ipset.h │ ├── iputils.h │ ├── genl.c │ └── ipset.c ├── shaper │ ├── CMakeLists.txt │ ├── tc_core.h │ └── shaper.h ├── ipv6 │ └── CMakeLists.txt ├── radius │ ├── dict │ │ ├── dictionary.rfc4849 │ │ ├── dictionary.rfc4372 │ │ ├── dictionary.rfc4072 │ │ ├── dictionary.rfc5176 │ │ ├── dictionary.rfc4818 │ │ ├── dictionary.rfc3162 │ │ ├── dictionary.rfc3580 │ │ ├── dictionary.rfc2867 │ │ ├── dictionary.alcatel │ │ ├── dictionary.rfc4675 │ │ ├── dictionary.rfc3576 │ │ ├── dictionary.rfc2869 │ │ ├── dictionary.rfc2868 │ │ ├── dictionary.rfc2866 │ │ ├── dictionary.rfc4679 │ │ ├── dictionary │ │ └── dictionary.microsoft │ ├── dict2c.py │ ├── CMakeLists.txt │ └── stat_accm.c ├── extra │ ├── net-snmp │ │ ├── statPPP.h │ │ ├── statIPOE.h │ │ ├── statL2TP.h │ │ ├── statPPTP.h │ │ ├── statPPPOE.h │ │ ├── exec_cli.h │ │ ├── shutdown.h │ │ ├── statCore.h │ │ ├── terminate.h │ │ ├── sessionTable_data_set.h │ │ ├── sessionTable_data_set.c │ │ ├── sessionTable_oids.h │ │ ├── CMakeLists.txt │ │ ├── sessionTable_enums.h │ │ ├── sessionTable_data_access.h │ │ ├── sessionTable_data_get.h │ │ ├── shutdown.c │ │ ├── sessionTable_interface.h │ │ ├── statPPTP.c │ │ ├── statIPOE.c │ │ ├── statL2TP.c │ │ ├── statPPPOE.c │ │ ├── statPPP.c │ │ └── exec_cli.c │ ├── sigchld.h │ ├── CMakeLists.txt │ ├── logwtmp.c │ ├── sigchld.c │ └── connlimit.c ├── auth │ └── CMakeLists.txt ├── utils.h ├── ppp │ ├── CMakeLists.txt │ ├── ppp_auth.h │ ├── ppp_ccp.h │ ├── ppp_fsm.h │ ├── ppp_ipv6cp.h │ ├── ppp_ipcp.h │ └── ppp.h ├── iprange.h ├── triton │ ├── timerfd.c │ ├── spinlock.h │ ├── mempool.h │ ├── options.c │ ├── CMakeLists.txt │ ├── log.c │ ├── timerfd.h │ ├── event.c │ ├── loader.c │ └── triton_p.h ├── pwdb.h ├── memdebug.h ├── logs │ └── CMakeLists.txt ├── pwdb.c ├── ipdb.h ├── log.h ├── utils.c ├── ipdb.c └── CMakeLists.txt ├── .gitignore ├── cmake ├── debian-kmod │ └── postinst ├── debian │ ├── conffiles │ ├── postinst │ └── debian.cmake └── cpack.cmake ├── rfc ├── TR-101.pdf ├── README └── README.Reference ├── drivers ├── ipoe │ ├── Makefile │ ├── CMakeLists.txt │ └── ipoe.h ├── pptp │ ├── Makefile │ ├── gre.h │ └── CMakeLists.txt └── vlan_mon │ ├── Makefile │ ├── CMakeLists.txt │ └── vlan_mon.h ├── config.h.in ├── contrib ├── debian │ ├── accel-ppp-default │ └── accel-ppp-init ├── gentoo │ └── net-dialup │ │ └── accel-ppp │ │ ├── files │ │ ├── accel-pppd-confd │ │ └── accel-pppd-init │ │ ├── accel-ppp-1.3.5.ebuild │ │ └── accel-ppp-9999.ebuild ├── accel-ppp.service └── centos │ └── centos.cmake ├── accel-cmd ├── CMakeLists.txt └── accel-cmd.1 ├── crypto ├── CMakeLists.txt ├── tomcrypt_argchk.h ├── crypto.h ├── tomcrypt.h └── crypto.c └── CMakeLists.txt /accel-pppd/include/log.h: -------------------------------------------------------------------------------- 1 | ../log.h -------------------------------------------------------------------------------- /accel-pppd/cli/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /accel-pppd/include/cli.h: -------------------------------------------------------------------------------- 1 | ../cli/cli.h -------------------------------------------------------------------------------- /accel-pppd/include/ipdb.h: -------------------------------------------------------------------------------- 1 | ../ipdb.h -------------------------------------------------------------------------------- /accel-pppd/include/ppp.h: -------------------------------------------------------------------------------- 1 | ../ppp/ppp.h -------------------------------------------------------------------------------- /accel-pppd/include/pwdb.h: -------------------------------------------------------------------------------- 1 | ../pwdb.h -------------------------------------------------------------------------------- /accel-pppd/include/utils.h: -------------------------------------------------------------------------------- 1 | ../utils.h -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | *.swp 3 | scripts 4 | -------------------------------------------------------------------------------- /accel-pppd/include/cli_p.h: -------------------------------------------------------------------------------- 1 | ../cli/cli_p.h -------------------------------------------------------------------------------- /accel-pppd/include/iprange.h: -------------------------------------------------------------------------------- 1 | ../iprange.h -------------------------------------------------------------------------------- /accel-pppd/include/list.h: -------------------------------------------------------------------------------- 1 | ../triton/list.h -------------------------------------------------------------------------------- /accel-pppd/include/memdebug.h: -------------------------------------------------------------------------------- 1 | ../memdebug.h -------------------------------------------------------------------------------- /accel-pppd/include/backup.h: -------------------------------------------------------------------------------- 1 | ../backup/backup.h -------------------------------------------------------------------------------- /accel-pppd/include/crypto.h: -------------------------------------------------------------------------------- 1 | ../../crypto/crypto.h -------------------------------------------------------------------------------- /accel-pppd/include/genl.h: -------------------------------------------------------------------------------- 1 | ../libnetlink/genl.h -------------------------------------------------------------------------------- /accel-pppd/include/ipset.h: -------------------------------------------------------------------------------- 1 | ../libnetlink/ipset.h -------------------------------------------------------------------------------- /accel-pppd/include/luasupp.h: -------------------------------------------------------------------------------- 1 | ../lua/luasupp.h -------------------------------------------------------------------------------- /accel-pppd/include/mempool.h: -------------------------------------------------------------------------------- 1 | ../triton/mempool.h -------------------------------------------------------------------------------- /accel-pppd/include/ppp_auth.h: -------------------------------------------------------------------------------- 1 | ../ppp/ppp_auth.h -------------------------------------------------------------------------------- /accel-pppd/include/ppp_fsm.h: -------------------------------------------------------------------------------- 1 | ../ppp/ppp_fsm.h -------------------------------------------------------------------------------- /accel-pppd/include/ppp_lcp.h: -------------------------------------------------------------------------------- 1 | ../ppp/ppp_lcp.h -------------------------------------------------------------------------------- /accel-pppd/include/radius.h: -------------------------------------------------------------------------------- 1 | ../radius/radius.h -------------------------------------------------------------------------------- /accel-pppd/include/sigchld.h: -------------------------------------------------------------------------------- 1 | ../extra/sigchld.h -------------------------------------------------------------------------------- /accel-pppd/include/triton.h: -------------------------------------------------------------------------------- 1 | ../triton/triton.h -------------------------------------------------------------------------------- /accel-pppd/include/iputils.h: -------------------------------------------------------------------------------- 1 | ../libnetlink/iputils.h -------------------------------------------------------------------------------- /accel-pppd/include/spinlock.h: -------------------------------------------------------------------------------- 1 | ../triton/spinlock.h -------------------------------------------------------------------------------- /accel-pppd/ctrl/ipoe/if_ipoe.h: -------------------------------------------------------------------------------- 1 | ../../../drivers/ipoe/ipoe.h -------------------------------------------------------------------------------- /accel-pppd/include/libnetlink.h: -------------------------------------------------------------------------------- 1 | ../libnetlink/libnetlink.h -------------------------------------------------------------------------------- /cmake/debian-kmod/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | depmod 4 | -------------------------------------------------------------------------------- /accel-pppd/vlan-mon/if_vlan_mon.h: -------------------------------------------------------------------------------- 1 | ../../drivers/vlan_mon/vlan_mon.h -------------------------------------------------------------------------------- /rfc/TR-101.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/themiron/accel-ppp-sf/HEAD/rfc/TR-101.pdf -------------------------------------------------------------------------------- /drivers/ipoe/Makefile: -------------------------------------------------------------------------------- 1 | obj-m += ipoe.o 2 | 3 | default: 4 | make -C $(KDIR) M=$(PWD) modules 5 | -------------------------------------------------------------------------------- /drivers/pptp/Makefile: -------------------------------------------------------------------------------- 1 | obj-m += pptp.o 2 | 3 | default: 4 | make -C $(KDIR) M=$(PWD) modules 5 | -------------------------------------------------------------------------------- /accel-pppd/ctrl/l2tp/dict/dictionary: -------------------------------------------------------------------------------- 1 | $INCLUDE dictionary.rfc2661 2 | $INCLUDE dictionary.rfc3931 3 | -------------------------------------------------------------------------------- /cmake/debian/conffiles: -------------------------------------------------------------------------------- 1 | /etc/init.d/accel-ppp 2 | /etc/accel-ppp.conf.dist 3 | /etc/default/accel-ppp 4 | -------------------------------------------------------------------------------- /drivers/vlan_mon/Makefile: -------------------------------------------------------------------------------- 1 | obj-m += vlan_mon.o 2 | 3 | default: 4 | make -C $(KDIR) M=$(PWD) modules 5 | -------------------------------------------------------------------------------- /accel-pppd/lua/lua_lpack.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/themiron/accel-ppp-sf/HEAD/accel-pppd/lua/lua_lpack.c -------------------------------------------------------------------------------- /config.h.in: -------------------------------------------------------------------------------- 1 | //#cmakedefine ACCEL_PPP_VERSION "${ACCEL_PPP_VERSION}" 2 | //#cmakedefine RADIUS 3 | #cmakedefine HAVE_IPSET 4 | #cmakedefine HAVE_SETNS 5 | -------------------------------------------------------------------------------- /accel-pppd/backup/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(backup_file SHARED backup_file.c) 2 | 3 | INSTALL(TARGETS backup_file LIBRARY DESTINATION lib/accel-ppp) 4 | 5 | -------------------------------------------------------------------------------- /accel-pppd/ctrl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY(pptp) 2 | ADD_SUBDIRECTORY(pppoe) 3 | ADD_SUBDIRECTORY(l2tp) 4 | ADD_SUBDIRECTORY(sstp) 5 | ADD_SUBDIRECTORY(ipoe) 6 | -------------------------------------------------------------------------------- /accel-pppd/libnetlink/genl.h: -------------------------------------------------------------------------------- 1 | #ifndef __GENL_H 2 | #define __GENL_H 3 | 4 | int genl_resolve_mcg(const char *family, const char *name, int *fam_id); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /accel-pppd/shaper/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(shaper SHARED shaper.c limiter.c leaf_qdisc.c tc_core.c) 2 | 3 | INSTALL(TARGETS shaper 4 | LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp 5 | ) 6 | 7 | -------------------------------------------------------------------------------- /accel-pppd/ctrl/pptp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | ADD_LIBRARY(pptp SHARED pptp.c) 4 | 5 | INSTALL(TARGETS pptp LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp ) 6 | -------------------------------------------------------------------------------- /cmake/debian/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | chmod +x /etc/init.d/accel-ppp 4 | 5 | mkdir /var/log/accel-ppp > /dev/null 2>&1 6 | mkdir /var/lib/accel-ppp > /dev/null 2>&1 7 | 8 | depmod 9 | 10 | exit 0 11 | -------------------------------------------------------------------------------- /contrib/debian/accel-ppp-default: -------------------------------------------------------------------------------- 1 | # Config file for /etc/init.d/accel-pppd 2 | 3 | # Any extra options you want to pass to aceel-pptpd 4 | # on start-up should be put here. 5 | ACCEL_PPPD_OPTS="-c /etc/accel-ppp.conf" 6 | -------------------------------------------------------------------------------- /accel-pppd/ipv6/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(ipv6_dhcp SHARED dhcpv6.c dhcpv6_packet.c) 2 | ADD_LIBRARY(ipv6_nd SHARED nd.c) 3 | 4 | INSTALL(TARGETS ipv6_dhcp ipv6_nd 5 | LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp 6 | ) 7 | 8 | -------------------------------------------------------------------------------- /accel-pppd/vlan-mon/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | ADD_LIBRARY(vlan-mon SHARED vlan_mon.c) 4 | 5 | INSTALL(TARGETS vlan-mon 6 | LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp 7 | ) 8 | 9 | -------------------------------------------------------------------------------- /contrib/gentoo/net-dialup/accel-ppp/files/accel-pppd-confd: -------------------------------------------------------------------------------- 1 | # Config file for /etc/init.d/accel-pptpd 2 | 3 | # Any extra options you want to pass to pptpd 4 | # on start-up should be put here. 5 | ACCEL_PPPD_OPTS="-d -c /etc/accel-ppp.conf" 6 | -------------------------------------------------------------------------------- /accel-pppd/ctrl/sstp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | ADD_LIBRARY(sstp SHARED sstp.c) 4 | 5 | TARGET_LINK_LIBRARIES(sstp util) 6 | 7 | INSTALL(TARGETS sstp LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp) 8 | -------------------------------------------------------------------------------- /accel-pppd/libnetlink/ipset.h: -------------------------------------------------------------------------------- 1 | #ifndef __IPSET_H 2 | #define __IPSET_H 3 | 4 | int ipset_add(const char *name, in_addr_t addr); 5 | int ipset_del(const char *name, in_addr_t addr); 6 | int ipset_flush(const char *name); 7 | 8 | #endif 9 | 10 | -------------------------------------------------------------------------------- /accel-pppd/radius/dict/dictionary.rfc4849: -------------------------------------------------------------------------------- 1 | # -*- text -*- 2 | # 3 | # Attributes and values defined in RFC 4849. 4 | # http://www.ietf.org/rfc/rfc4849.txt 5 | # 6 | # $Id: dictionary.rfc4849,v 1.2 2007/06/15 13:08:03 aland Exp $ 7 | # 8 | ATTRIBUTE NAS-Filter-Rule 92 string 9 | -------------------------------------------------------------------------------- /accel-pppd/radius/dict/dictionary.rfc4372: -------------------------------------------------------------------------------- 1 | # -*- text -*- 2 | # 3 | # Attributes and values defined in RFC 4372. 4 | # http://www.ietf.org/rfc/4372.txt 5 | # 6 | # $Id: dictionary.rfc4372,v 1.1 2007/04/07 14:47:34 aland Exp $ 7 | # 8 | ATTRIBUTE Chargeable-User-Identity 89 string 9 | -------------------------------------------------------------------------------- /accel-pppd/radius/dict/dictionary.rfc4072: -------------------------------------------------------------------------------- 1 | # -*- text -*- 2 | # 3 | # Attributes and values defined in RFC 4072 4 | # http://www.ietf.org/rfc/4072.txt 5 | # 6 | # $Id: dictionary.rfc4072,v 1.1 2007/11/14 09:00:25 aland Exp $ 7 | # 8 | 9 | ATTRIBUTE EAP-Key-Name 102 string 10 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/statPPP.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: this file originally auto-generated by mib2c using 3 | * : mib2c.int_watch.conf 13957 2005-12-20 15:33:08Z tanders $ 4 | */ 5 | #ifndef STATPPP_H 6 | #define STATPPP_H 7 | 8 | /* function declarations */ 9 | void init_statPPP(void); 10 | 11 | #endif /* STATPPP_H */ 12 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/statIPOE.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: this file originally auto-generated by mib2c using 3 | * : mib2c.int_watch.conf 13957 2005-12-20 15:33:08Z tanders $ 4 | */ 5 | #ifndef STATIPOE_H 6 | #define STATIPOE_H 7 | 8 | /* function declarations */ 9 | void init_statIPOE(void); 10 | 11 | #endif /* STATPPPOE_H */ 12 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/statL2TP.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: this file originally auto-generated by mib2c using 3 | * : mib2c.int_watch.conf 13957 2005-12-20 15:33:08Z tanders $ 4 | */ 5 | #ifndef STATL2TP_H 6 | #define STATL2TP_H 7 | 8 | /* function declarations */ 9 | void init_statL2TP(void); 10 | 11 | #endif /* STATL2TP_H */ 12 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/statPPTP.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: this file originally auto-generated by mib2c using 3 | * : mib2c.int_watch.conf 13957 2005-12-20 15:33:08Z tanders $ 4 | */ 5 | #ifndef STATPPTP_H 6 | #define STATPPTP_H 7 | 8 | /* function declarations */ 9 | void init_statPPTP(void); 10 | 11 | #endif /* STATPPTP_H */ 12 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/statPPPOE.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: this file originally auto-generated by mib2c using 3 | * : mib2c.int_watch.conf 13957 2005-12-20 15:33:08Z tanders $ 4 | */ 5 | #ifndef STATPPPOE_H 6 | #define STATPPPOE_H 7 | 8 | /* function declarations */ 9 | void init_statPPPOE(void); 10 | 11 | #endif /* STATPPPOE_H */ 12 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/exec_cli.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: this file originally auto-generated by mib2c using 3 | * : mib2c.scalar.conf 11805 2005-01-07 09:37:18Z dts12 $ 4 | */ 5 | #ifndef CLI_H 6 | #define CLI_H 7 | 8 | /* function declarations */ 9 | void init_cli(void); 10 | Netsnmp_Node_Handler handle_cli; 11 | 12 | #endif /* CLI_H */ 13 | -------------------------------------------------------------------------------- /accel-pppd/radius/dict/dictionary.rfc5176: -------------------------------------------------------------------------------- 1 | # -*- text -*- 2 | # 3 | # Attributes and values defined in RFC 5176. 4 | # http://www.ietf.org/rfc/rfc5176.txt 5 | # 6 | # $Id: dictionary.rfc5176,v 1.1 2008/03/08 16:17:44 aland Exp $ 7 | # 8 | VALUE Error-Cause Invalid-Attribute-Value 407 9 | VALUE Error-Cause Multiple-Session-Selection-Unsupported 508 10 | -------------------------------------------------------------------------------- /accel-cmd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -D_GNU_SOURCE") 2 | 3 | ADD_DEFINITIONS(-DACCEL_PPP_VERSION="${ACCEL_PPP_VERSION}") 4 | 5 | ADD_EXECUTABLE(accel-cmd 6 | accel_cmd.c 7 | ) 8 | 9 | INSTALL(TARGETS accel-cmd 10 | RUNTIME DESTINATION bin 11 | ) 12 | INSTALL(FILES accel-cmd.1 13 | DESTINATION share/man/man1 14 | ) 15 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/shutdown.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: this file originally auto-generated by mib2c using 3 | * : mib2c.scalar.conf 11805 2005-01-07 09:37:18Z dts12 $ 4 | */ 5 | #ifndef SHUTDOWN_H 6 | #define SHUTDOWN_H 7 | 8 | /* function declarations */ 9 | void init_shutdown(void); 10 | Netsnmp_Node_Handler handle_shutdown; 11 | 12 | #endif /* SHUTDOWN_H */ 13 | -------------------------------------------------------------------------------- /accel-pppd/auth/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(auth_pap SHARED auth_pap.c) 2 | ADD_LIBRARY(auth_chap_md5 SHARED auth_chap_md5.c) 3 | ADD_LIBRARY(auth_mschap_v1 SHARED auth_mschap_v1.c) 4 | ADD_LIBRARY(auth_mschap_v2 SHARED auth_mschap_v2.c) 5 | 6 | INSTALL(TARGETS auth_pap auth_chap_md5 auth_mschap_v1 auth_mschap_v2 7 | LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp 8 | ) 9 | 10 | -------------------------------------------------------------------------------- /accel-pppd/lua/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 2 | INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR}) 3 | 4 | SET(sources 5 | lua_lpack.c 6 | lua_bit.c 7 | session.c 8 | ) 9 | 10 | ADD_LIBRARY(luasupp SHARED ${sources}) 11 | TARGET_LINK_LIBRARIES(luasupp ${LUA_LIBRARIES}) 12 | 13 | INSTALL(TARGETS luasupp LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp) 14 | -------------------------------------------------------------------------------- /accel-pppd/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef __UTILS_H 2 | #define __UTILS_H 3 | 4 | #include 5 | 6 | void u_inet_ntoa(in_addr_t, char *str); 7 | int u_readlong(long int *dst, const char *src, long int min, long int max); 8 | int u_parse_ip4addr(const char *src, struct in_addr *addr, 9 | const char **err_msg); 10 | int u_randbuf(void *buf, size_t buf_len, int *err); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /contrib/accel-ppp.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Accel-PPP 3 | After=network.target 4 | 5 | [Service] 6 | ExecStart=/usr/sbin/accel-pppd -d -p /var/run/accel-pppd.pid -c /etc/accel-ppp.conf 7 | StandardOutput=null 8 | ExecReload=/bin/kill -SIGUSR1 $MAINPID 9 | PIDFile=/var/run/accel-pppd.pid 10 | Type=forking 11 | Restart=always 12 | 13 | [Install] 14 | WantedBy=multi-user.target 15 | Alias=accel-ppp.service 16 | 17 | -------------------------------------------------------------------------------- /accel-pppd/ppp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(target ppp) 2 | SET(sources_c 3 | ppp.c 4 | ppp_fsm.c 5 | ppp_lcp.c 6 | lcp_opt_mru.c 7 | lcp_opt_magic.c 8 | lcp_opt_pcomp.c 9 | lcp_opt_accomp.c 10 | ppp_auth.c 11 | ppp_ipcp.c 12 | ipcp_opt_ipaddr.c 13 | ipcp_opt_dns.c 14 | ipcp_opt_wins.c 15 | ppp_ccp.c 16 | ) 17 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 18 | 19 | ADD_LIBRARY(${target} SHARED ${sources_c}) 20 | 21 | -------------------------------------------------------------------------------- /accel-pppd/include/linux_ppp.h: -------------------------------------------------------------------------------- 1 | #ifndef __KERNEL_PPP_H 2 | #define __KERNEL_PPP_H 3 | 4 | #include 5 | 6 | #ifndef aligned_u64 7 | #define aligned_u64 __u64 __attribute__((aligned(8))) 8 | #endif 9 | 10 | #ifndef __aligned_u64 11 | #define __aligned_u64 __u64 __attribute__((aligned(8))) 12 | #endif 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #endif 19 | 20 | -------------------------------------------------------------------------------- /accel-pppd/iprange.h: -------------------------------------------------------------------------------- 1 | #ifndef __IPRANGE_H 2 | #define __IPRANGE_H 3 | 4 | #include 5 | 6 | 7 | #define IPRANGE_CONF_SECTION "client-ip-range" 8 | 9 | enum iprange_status { 10 | IPRANGE_DISABLED, 11 | IPRANGE_NO_RANGE, 12 | IPRANGE_ACTIVE, 13 | }; 14 | 15 | enum iprange_status iprange_check_activation(void); 16 | int iprange_client_check(in_addr_t ipaddr); 17 | int iprange_tunnel_check(in_addr_t ipaddr); 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /accel-pppd/radius/dict/dictionary.rfc4818: -------------------------------------------------------------------------------- 1 | # -*- text -*- 2 | ############################################################################## 3 | # 4 | # Attributes and values defined in RFC 4818. 5 | # http://www.ietf.org/rfc/rfc4818.txt 6 | # 7 | # $Id: dictionary.rfc4818,v 1.1 2007/05/16 10:06:36 aland Exp $ 8 | # 9 | ############################################################################## 10 | 11 | ATTRIBUTE Delegated-IPv6-Prefix 123 ipv6prefix 12 | -------------------------------------------------------------------------------- /accel-pppd/include/connlimit.h: -------------------------------------------------------------------------------- 1 | #ifndef __CONNLIMIT_H 2 | #define __CONNLIMIT_H 3 | 4 | static inline uint64_t cl_key_from_ipv4(uint32_t ip) 5 | { 6 | return ip; 7 | } 8 | 9 | static inline uint64_t cl_key_from_mac(uint8_t hw[6]) 10 | { 11 | union { 12 | uint8_t hw[6]; 13 | uint64_t key; 14 | } key = {{ 0 }}; 15 | 16 | memcpy(key.hw, hw, sizeof(key.hw)); 17 | 18 | return key.key; 19 | } 20 | 21 | int connlimit_check(uint64_t key); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/statCore.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: this file originally auto-generated by mib2c using 3 | * : mib2c.scalar.conf 11805 2005-01-07 09:37:18Z dts12 $ 4 | */ 5 | #ifndef STATCORE_H 6 | #define STATCORE_H 7 | 8 | /* function declarations */ 9 | void init_statCore(void); 10 | Netsnmp_Node_Handler handle_statCoreUpTime; 11 | Netsnmp_Node_Handler handle_statCoreCPU; 12 | Netsnmp_Node_Handler handle_statCoreMemRss; 13 | 14 | #endif /* STATCORE_H */ 15 | -------------------------------------------------------------------------------- /drivers/pptp/gre.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_GRE_H 2 | #define __LINUX_GRE_H 3 | 4 | #include 5 | 6 | #define GREPROTO_CISCO 0 7 | #define GREPROTO_PPTP 1 8 | #define GREPROTO_MAX 2 9 | 10 | struct gre_protocol { 11 | int (*handler)(struct sk_buff *skb); 12 | void (*err_handler)(struct sk_buff *skb, u32 info); 13 | }; 14 | 15 | int gre_add_protocol(struct gre_protocol *proto, u8 version); 16 | int gre_del_protocol(struct gre_protocol *proto, u8 version); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /accel-pppd/radius/dict/dictionary.rfc3162: -------------------------------------------------------------------------------- 1 | # -*- text -*- 2 | # 3 | # Attributes and values defined in RFC 3162. 4 | # http://www.ietf.org/rfc/rfc3162.txt 5 | # 6 | # $Id: dictionary.rfc3162,v 1.2 2005/08/08 22:23:39 aland Exp $ 7 | # 8 | ATTRIBUTE NAS-IPv6-Address 95 ipv6addr 9 | ATTRIBUTE Framed-Interface-Id 96 ifid 10 | ATTRIBUTE Framed-IPv6-Prefix 97 ipv6prefix 11 | ATTRIBUTE Login-IPv6-Host 98 ipv6addr 12 | ATTRIBUTE Framed-IPv6-Route 99 string 13 | ATTRIBUTE Framed-IPv6-Pool 100 string 14 | -------------------------------------------------------------------------------- /accel-pppd/triton/timerfd.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "timerfd.h" 6 | 7 | int timerfd_create (clockid_t __clock_id, int __flags) 8 | { 9 | return syscall(SYS_timerfd_create, __clock_id, __flags); 10 | } 11 | 12 | 13 | int timerfd_settime (int __ufd, int __flags, 14 | __const struct itimerspec *__utmr, 15 | struct itimerspec *__otmr) 16 | { 17 | return syscall(SYS_timerfd_settime, __ufd, __flags, __utmr, __otmr); 18 | } 19 | 20 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/terminate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: this file originally auto-generated by mib2c using 3 | * : mib2c.scalar.conf 11805 2005-01-07 09:37:18Z dts12 $ 4 | */ 5 | #ifndef TERMINATE_H 6 | #define TERMINATE_H 7 | 8 | /* function declarations */ 9 | void init_terminate(void); 10 | Netsnmp_Node_Handler handle_termBySID; 11 | Netsnmp_Node_Handler handle_termByIfName; 12 | Netsnmp_Node_Handler handle_termByIP; 13 | Netsnmp_Node_Handler handle_termByUsername; 14 | 15 | #endif /* TERMINATE_H */ 16 | -------------------------------------------------------------------------------- /accel-pppd/extra/sigchld.h: -------------------------------------------------------------------------------- 1 | #ifndef __SIGCHLD_H 2 | #define __SIGCHLD_H 3 | 4 | #include 5 | #include "list.h" 6 | 7 | struct sigchld_handler_t 8 | { 9 | struct list_head entry; 10 | pthread_mutex_t lock; 11 | pid_t pid; 12 | void (*handler)(struct sigchld_handler_t *, int status); 13 | }; 14 | 15 | void sigchld_register_handler(struct sigchld_handler_t *); 16 | int sigchld_unregister_handler(struct sigchld_handler_t *); 17 | void sigchld_lock(); 18 | void sigchld_unlock(); 19 | 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /accel-pppd/ctrl/l2tp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | ADD_DEFINITIONS(-DDICTIONARY="${CMAKE_INSTALL_PREFIX}/share/accel-ppp/l2tp/dictionary") 4 | 5 | ADD_LIBRARY(l2tp SHARED 6 | l2tp.c 7 | dict.c 8 | packet.c 9 | # netlink.c 10 | ) 11 | #TARGET_LINK_LIBRARIES(l2tp nl nl-genl) 12 | 13 | INSTALL(TARGETS l2tp LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp) 14 | 15 | FILE(GLOB dict "${CMAKE_CURRENT_SOURCE_DIR}/dict/*") 16 | INSTALL(FILES ${dict} DESTINATION share/accel-ppp/l2tp) 17 | 18 | -------------------------------------------------------------------------------- /accel-pppd/lua/luasupp.h: -------------------------------------------------------------------------------- 1 | #ifndef __LUASUPP_H 2 | #define __LUASUPP_H 3 | 4 | #include 5 | 6 | int luaopen_lpack(lua_State *L); 7 | int luaopen_bit(lua_State *L); 8 | 9 | #define LUA_AP_SESSION "ap_session" 10 | int luaopen_ap_session(lua_State *L); 11 | 12 | struct lua_session_module { 13 | const char *name; 14 | void (*init)(lua_State *L); 15 | int (*get_instance)(lua_State *L, struct ap_session *ses); 16 | }; 17 | 18 | void lua_session_module_register(const struct lua_session_module *mod); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /accel-pppd/cli/cli_p.h: -------------------------------------------------------------------------------- 1 | #ifndef __CLI_P_H 2 | #define __CLI_P_H 3 | 4 | #include 5 | 6 | #include "triton.h" 7 | 8 | struct cli_client_t 9 | { 10 | uint8_t *cmdline; 11 | int (*send)(struct cli_client_t *, const void *buf, int size); 12 | int (*sendv)(struct cli_client_t *, const char *fmt, va_list ap); 13 | void (*disconnect)(struct cli_client_t *); 14 | }; 15 | 16 | int cli_process_cmd(struct cli_client_t *cln); 17 | 18 | extern char *conf_cli_passwd; 19 | extern char *conf_cli_prompt; 20 | 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /accel-pppd/radius/dict/dictionary.rfc3580: -------------------------------------------------------------------------------- 1 | # -*- text -*- 2 | # 3 | # Attributes and values defined in RFC 3580. 4 | # http://www.ietf.org/rfc/rfc3580.txt 5 | # 6 | # $Id: dictionary.rfc3580,v 1.2 2005/08/08 22:23:39 aland Exp $ 7 | # 8 | VALUE Acct-Terminate-Cause Supplicant-Restart 19 9 | VALUE Acct-Terminate-Cause Reauthentication-Failure 20 10 | VALUE Acct-Terminate-Cause Port-Reinit 21 11 | VALUE Acct-Terminate-Cause Port-Disabled 22 12 | 13 | VALUE NAS-Port-Type Token-Ring 20 14 | VALUE NAS-Port-Type FDDI 21 15 | 16 | VALUE Tunnel-Type VLAN 13 17 | -------------------------------------------------------------------------------- /contrib/gentoo/net-dialup/accel-ppp/files/accel-pppd-init: -------------------------------------------------------------------------------- 1 | #!/sbin/runscript 2 | 3 | depend() { 4 | need net 5 | } 6 | 7 | start() { 8 | ebegin "Starting accel-pppd" 9 | start-stop-daemon --start --quiet --exec /usr/sbin/accel-pppd -- -p /var/run/accel-pppd.pid ${ACCEL_PPPD_OPTS} 10 | eend $? 11 | } 12 | 13 | stop() { 14 | ebegin "Stopping accel-pppd" 15 | start-stop-daemon --stop --quiet --pidfile /var/run/accel-pppd.pid 16 | result=$? 17 | start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/accel-pppd 18 | result=$(( $result + $? )) 19 | eend $result 20 | } 21 | -------------------------------------------------------------------------------- /accel-pppd/ctrl/pppoe/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | SET(sources 4 | pppoe.c 5 | mac_filter.c 6 | dpado.c 7 | cli.c 8 | disc.c 9 | ) 10 | 11 | IF (RADIUS) 12 | SET(sources ${sources} tr101.c) 13 | ENDIF(RADIUS) 14 | 15 | ADD_LIBRARY(pppoe SHARED ${sources}) 16 | TARGET_LINK_LIBRARIES(pppoe vlan-mon) 17 | set_property(TARGET pppoe PROPERTY CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) 18 | set_property(TARGET pppoe PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/accel-ppp) 19 | 20 | INSTALL(TARGETS pppoe LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp) 21 | -------------------------------------------------------------------------------- /accel-pppd/radius/dict/dictionary.rfc2867: -------------------------------------------------------------------------------- 1 | # -*- text -*- 2 | # 3 | # Attributes and values defined in RFC 2867. 4 | # http://www.ietf.org/rfc/rfc2867.txt 5 | # 6 | # $Id: dictionary.rfc2867,v 1.2 2005/08/08 22:23:38 aland Exp $ 7 | # 8 | ATTRIBUTE Acct-Tunnel-Connection 68 string 9 | ATTRIBUTE Acct-Tunnel-Packets-Lost 86 integer 10 | 11 | VALUE Acct-Status-Type Tunnel-Start 9 12 | VALUE Acct-Status-Type Tunnel-Stop 10 13 | VALUE Acct-Status-Type Tunnel-Reject 11 14 | VALUE Acct-Status-Type Tunnel-Link-Start 12 15 | VALUE Acct-Status-Type Tunnel-Link-Stop 13 16 | VALUE Acct-Status-Type Tunnel-Link-Reject 14 17 | -------------------------------------------------------------------------------- /accel-pppd/triton/spinlock.h: -------------------------------------------------------------------------------- 1 | #ifndef __TRITON_SPINLOCK_H 2 | #define __TRITON_SPINLOCK_H 3 | 4 | #if defined(GCC_SPINLOCK) 5 | 6 | typedef volatile int __attribute__((aligned)) spinlock_t; 7 | #define spin_lock(l) {while(__sync_lock_test_and_set(l,1));} 8 | #define spin_unlock(l) __sync_lock_release(l) 9 | #define SPINLOCK_INITIALIZER 0 10 | #define spinlock_init(l) {*(l)=0;} 11 | 12 | #else 13 | 14 | #include 15 | typedef pthread_spinlock_t spinlock_t; 16 | #define spin_lock(l) pthread_spin_lock(l) 17 | #define spin_unlock(l) pthread_spin_unlock(l) 18 | #define spinlock_init(l) pthread_spin_init(l, 0) 19 | #endif 20 | 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/sessionTable_data_set.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: this file originally auto-generated by mib2c using 3 | * version : 12077 $ of $ 4 | * 5 | * $Id:$ 6 | */ 7 | #ifndef SESSIONTABLE_DATA_SET_H 8 | #define SESSIONTABLE_DATA_SET_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | /* ********************************************************************* 15 | * SET function declarations 16 | */ 17 | 18 | /* ********************************************************************* 19 | * SET Table declarations 20 | */ 21 | 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | 27 | #endif /* SESSIONTABLE_DATA_SET_H */ 28 | -------------------------------------------------------------------------------- /accel-pppd/include/ap_session_backup.h: -------------------------------------------------------------------------------- 1 | #ifndef __AP_SESSION_BACKUP_H 2 | #define __AP_SESSION_BACKUP_H 3 | 4 | #define SES_TAG_USERNAME 1 5 | #define SES_TAG_SESSIONID 2 6 | #define SES_TAG_START_TIME 3 7 | #define SES_TAG_IPV4_ADDR 4 8 | #define SES_TAG_IPV4_PEER_ADDR 5 9 | #define SES_TAG_IPV6_INTFID 6 10 | #define SES_TAG_IPV6_PEER_INTFID 7 11 | #define SES_TAG_IPV6_ADDR 8 12 | #define SES_TAG_IFINDEX 9 13 | #define SES_TAG_IFNAME 10 14 | 15 | 16 | struct ses_tag_ipv6 17 | { 18 | struct in6_addr addr; 19 | uint8_t prefix_len; 20 | } __attribute__((packed)); 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/sessionTable_data_set.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: this file originally auto-generated by mib2c using 3 | * version : 12077 $ of $ 4 | * 5 | * $Id:$ 6 | * 7 | */ 8 | /* standard Net-SNMP includes */ 9 | #include 10 | #include 11 | #include 12 | 13 | /* include our parent header */ 14 | #include "sessionTable.h" 15 | 16 | 17 | /** @defgroup data_set data_set: Routines to set data 18 | * 19 | * These routines are used to set the value for individual objects. The 20 | * row context is passed, along with the new value. 21 | * 22 | * @{ 23 | */ 24 | /** @} */ 25 | -------------------------------------------------------------------------------- /crypto/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | IF (CRYPTO STREQUAL INTERNAL OR CRYPTO STREQUAL TOMCRYPT) 4 | 5 | SET(sources crypto.c) 6 | 7 | IF (CRYPTO STREQUAL INTERNAL) 8 | SET(sources 9 | ${sources} 10 | crypto.c 11 | md4.c 12 | md5.c 13 | sha1.c 14 | des.c 15 | ) 16 | ENDIF(CRYPTO STREQUAL INTERNAL) 17 | 18 | ADD_LIBRARY(internal-crypto SHARED ${sources}) 19 | IF (CRYPTO STREQUAL TOMCRYPT) 20 | TARGET_LINK_LIBRARIES(internal-crypto tomcrypt) 21 | ENDIF(CRYPTO STREQUAL TOMCRYPT) 22 | 23 | INSTALL(TARGETS internal-crypto LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp ) 24 | 25 | ENDIF(CRYPTO STREQUAL INTERNAL OR CRYPTO STREQUAL TOMCRYPT) 26 | -------------------------------------------------------------------------------- /accel-pppd/radius/dict2c.py: -------------------------------------------------------------------------------- 1 | import sys,re 2 | 3 | hdr = file(sys.argv[2],'w') 4 | 5 | def process(fname, hdr): 6 | for line in file(fname): 7 | if line[:-1].strip() == '': 8 | continue 9 | if line[0] == '#': 10 | continue 11 | f = re.compile('[$.a-zA-Z0-9\-]+').findall(line) 12 | if f[0] == 'ATTRIBUTE' or f[0] == 'VENDOR': 13 | hdr.write('#define {0} {1}\n'.format(f[1].replace('-','_').replace('.','_'), f[2])) 14 | elif f[0] == 'VALUE': 15 | hdr.write('#define {0}_{1} {2}\n'.format(f[1].replace('-','_').replace('.','_'), f[2].replace('-','_'),f[3])) 16 | elif f[0] == '$INCLUDE': 17 | process(f[1], hdr) 18 | 19 | if __name__ == '__main__': 20 | process(sys.argv[1], hdr) 21 | -------------------------------------------------------------------------------- /accel-pppd/ctrl/l2tp/dict2c.py: -------------------------------------------------------------------------------- 1 | import sys,re 2 | 3 | hdr = file(sys.argv[2],'w') 4 | 5 | def process(fname, hdr): 6 | for line in file(fname): 7 | if line[:-1].strip() == '': 8 | continue 9 | if line[0] == '#': 10 | continue 11 | f = re.compile('[$.a-zA-Z0-9\-]+').findall(line) 12 | if f[0] == 'ATTRIBUTE' or f[0] == 'VENDOR': 13 | hdr.write('#define {0} {1}\n'.format(f[1].replace('-','_').replace('.','_'), f[2])) 14 | elif f[0] == 'VALUE': 15 | hdr.write('#define {0}_{1} {2}\n'.format(f[1].replace('-','_').replace('.','_'), f[2].replace('-','_'),f[3])) 16 | elif f[0] == '$INCLUDE': 17 | process(f[1], hdr) 18 | 19 | if __name__ == '__main__': 20 | process(sys.argv[1], hdr) 21 | -------------------------------------------------------------------------------- /rfc/README: -------------------------------------------------------------------------------- 1 | In this directory are the various standards documents implemented in 2 | the pptp package. 3 | 4 | rfc791.txt Internet Protocol (IP). 5 | rfc793.txt Transmission Control Protocol (TCP). 6 | rfc1661.txt The Point-to-Point Protocol (PPP). 7 | rfc1662.txt PPP in HDLC-like Framing. (serial encoding). 8 | rfc1701.txt Generic Routing Encapsulation (GRE). 9 | rfc1702.txt Generic Routing Encapsulation over IPv4 networks. 10 | rfc1990.txt The PPP Multilink Protocol (MP). 11 | ms-chap.txt Microsoft PPP CHAP extensions. 12 | pptp-draft.txt July 1997 draft of the PPTP standard. 13 | 14 | rfc1990 is currently unimplemented in pptp 15 | CSA, 12/12/97 16 | -------------------------------------------------------------------------------- /accel-pppd/include/vlan_mon.h: -------------------------------------------------------------------------------- 1 | #ifndef __VLAN_MON_H 2 | #define __VLAN_MON_H 3 | 4 | typedef void (*vlan_mon_notify)(int ifindex, int vid, int vlan_ifindex); 5 | 6 | void vlan_mon_register_proto(uint16_t proto, vlan_mon_notify cb); 7 | 8 | int vlan_mon_add(int ifindex, uint16_t proto, long *mask, int len); 9 | int vlan_mon_add_vid(int ifindex, uint16_t proto, uint16_t vid); 10 | int vlan_mon_del_vid(int ifindex, uint16_t proto, uint16_t vid); 11 | int vlan_mon_del(int ifindex, uint16_t proto); 12 | int vlan_mon_check_busy(int ifindex, uint16_t vid); 13 | 14 | int make_vlan_name(const char *pattern, const char *parent, int svid, int cvid, char *name); 15 | int parse_vlan_mon(const char *opt, long *mask); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /rfc/README.Reference: -------------------------------------------------------------------------------- 1 | In this directory are the various standards documents implemented in 2 | the pptp package. 3 | 4 | rfc791.txt Internet Protocol (IP). 5 | rfc793.txt Transmission Control Protocol (TCP). 6 | rfc1661.txt The Point-to-Point Protocol (PPP). 7 | rfc1662.txt PPP in HDLC-like Framing. (serial encoding). 8 | rfc1701.txt Generic Routing Encapsulation (GRE). 9 | rfc1702.txt Generic Routing Encapsulation over IPv4 networks. 10 | rfc1990.txt The PPP Multilink Protocol (MP). 11 | ms-chap.txt Microsoft PPP CHAP extensions. 12 | pptp-draft.txt July 1997 draft of the PPTP standard. 13 | 14 | rfc1990 is currently unimplemented in pptp 15 | CSA, 12/12/97 16 | -------------------------------------------------------------------------------- /accel-pppd/triton/mempool.h: -------------------------------------------------------------------------------- 1 | #ifndef __TRITON_MEMPOOL_H 2 | #define __TRITON_MEMPOOL_H 3 | 4 | #include 5 | 6 | struct mempool_stat_t 7 | { 8 | uint32_t allocated; 9 | uint32_t available; 10 | }; 11 | 12 | typedef void * mempool_t; 13 | mempool_t *mempool_create(int size); 14 | mempool_t *mempool_create2(int size); 15 | struct mempool_stat_t mempool_get_stat(void); 16 | 17 | #ifdef MEMDEBUG 18 | void *md_mempool_alloc(mempool_t*, const char *fname, int line); 19 | #define mempool_alloc(pool) md_mempool_alloc(pool, __FILE__, __LINE__) 20 | #define mempool_free(ptr) md_free(ptr, __FILE__, __LINE__) 21 | #else 22 | void *mempool_alloc(mempool_t*); 23 | void mempool_free(void*); 24 | #endif 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /accel-pppd/extra/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(sigchld SHARED sigchld.c) 2 | ADD_LIBRARY(pppd_compat SHARED pppd_compat.c) 3 | TARGET_LINK_LIBRARIES(pppd_compat sigchld) 4 | set_property(TARGET pppd_compat PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/accel-ppp) 5 | ADD_LIBRARY(ippool SHARED ippool.c) 6 | ADD_LIBRARY(ipv6pool SHARED ipv6pool.c) 7 | ADD_LIBRARY(chap-secrets SHARED chap-secrets.c) 8 | ADD_LIBRARY(logwtmp SHARED logwtmp.c) 9 | TARGET_LINK_LIBRARIES(logwtmp util) 10 | ADD_LIBRARY(connlimit SHARED connlimit.c) 11 | 12 | INSTALL(TARGETS pppd_compat ippool ipv6pool sigchld chap-secrets logwtmp connlimit 13 | LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp 14 | ) 15 | 16 | IF (NETSNMP) 17 | ADD_SUBDIRECTORY(net-snmp) 18 | ENDIF (NETSNMP) 19 | -------------------------------------------------------------------------------- /drivers/ipoe/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (NOT DEFINED KDIR) 2 | set(KDIR "/usr/src/linux") 3 | endif (NOT DEFINED KDIR) 4 | 5 | ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/driver/ipoe.ko 6 | COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/driver 7 | COMMAND mkdir ${CMAKE_CURRENT_BINARY_DIR}/driver 8 | COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/* ${CMAKE_CURRENT_BINARY_DIR}/driver 9 | COMMAND make -C ${KDIR} M=${CMAKE_CURRENT_BINARY_DIR}/driver modules 10 | DEPENDS ipoe.c ipoe.h 11 | ) 12 | 13 | ADD_CUSTOM_TARGET(ipoe_drv ALL 14 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/driver/ipoe.ko 15 | ) 16 | 17 | IF (NOT DEFINED CPACK_TYPE) 18 | INSTALL(CODE "EXECUTE_PROCESS(COMMAND make -C ${KDIR} M=${CMAKE_CURRENT_BINARY_DIR}/drivers/ipoe modules_install)") 19 | ENDIF() 20 | -------------------------------------------------------------------------------- /drivers/pptp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (NOT DEFINED KDIR) 2 | set(KDIR "/usr/src/linux") 3 | endif (NOT DEFINED KDIR) 4 | 5 | ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/driver/pptp.ko 6 | COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/driver 7 | COMMAND mkdir ${CMAKE_CURRENT_BINARY_DIR}/driver 8 | COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/* ${CMAKE_CURRENT_BINARY_DIR}/driver 9 | COMMAND make -C ${KDIR} M=${CMAKE_CURRENT_BINARY_DIR}/driver modules 10 | DEPENDS pptp.c 11 | ) 12 | 13 | ADD_CUSTOM_TARGET(pptp_drv ALL 14 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/driver/pptp.ko 15 | ) 16 | 17 | IF (NOT DEFINED CPACK_TYPE) 18 | INSTALL(CODE "EXECUTE_PROCESS(COMMAND make -C ${KDIR} M=${CMAKE_CURRENT_BINARY_DIR}/driver modules_install)") 19 | ENDIF (NOT DEFINED CPACK_TYPE) 20 | -------------------------------------------------------------------------------- /accel-pppd/ctrl/ipoe/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | SET(sources 4 | ipoe.c 5 | dhcpv4.c 6 | dhcpv4_options.c 7 | ipoe_netlink.c 8 | # backup.c 9 | arp.c 10 | ) 11 | 12 | IF (LUA) 13 | INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR}) 14 | ADD_DEFINITIONS(-DUSE_LUA) 15 | SET(sources ${sources} lua.c) 16 | ENDIF (LUA) 17 | 18 | ADD_LIBRARY(ipoe SHARED ${sources}) 19 | 20 | IF (LUA) 21 | TARGET_LINK_LIBRARIES(ipoe luasupp) 22 | ENDIF(LUA) 23 | 24 | TARGET_LINK_LIBRARIES(ipoe vlan-mon) 25 | 26 | set_property(TARGET ipoe PROPERTY CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) 27 | set_property(TARGET ipoe PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/accel-ppp) 28 | 29 | INSTALL(TARGETS ipoe LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp) 30 | -------------------------------------------------------------------------------- /drivers/vlan_mon/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (NOT DEFINED KDIR) 2 | set(KDIR "/usr/src/linux") 3 | endif (NOT DEFINED KDIR) 4 | 5 | ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/driver/vlan_mon.ko 6 | COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/driver 7 | COMMAND mkdir ${CMAKE_CURRENT_BINARY_DIR}/driver 8 | COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/* ${CMAKE_CURRENT_BINARY_DIR}/driver 9 | COMMAND make -C ${KDIR} M=${CMAKE_CURRENT_BINARY_DIR}/driver modules 10 | DEPENDS vlan_mon.c vlan_mon.h 11 | ) 12 | 13 | ADD_CUSTOM_TARGET(vlan_mon_drv ALL 14 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/driver/vlan_mon.ko 15 | ) 16 | 17 | if (NOT DEFINED CPACK_TYPE) 18 | INSTALL(CODE "EXECUTE_PROCESS(COMMAND make -C ${KDIR} M=${CMAKE_CURRENT_BINARY_DIR}/drivers/vlan_mon modules_install)") 19 | endif () 20 | -------------------------------------------------------------------------------- /accel-pppd/radius/dict/dictionary.alcatel: -------------------------------------------------------------------------------- 1 | VENDOR Alcatel-IPD 6527 2 | 3 | BEGIN-VENDOR Alcatel-IPD 4 | 5 | ATTRIBUTE Alc-Primary-Dns 9 ipaddr 6 | ATTRIBUTE Alc-Secondary-Dns 10 ipaddr 7 | ATTRIBUTE Alc-Subsc-ID-Str 11 string 8 | ATTRIBUTE Alc-Subsc-Prof-Str 12 string 9 | ATTRIBUTE Alc-SLA-Prof-Str 13 string 10 | ATTRIBUTE Alc-Force-Renew 14 string 11 | ATTRIBUTE Alc-Create-Host 15 string 12 | ATTRIBUTE Alc-ANCP-Str 16 string 13 | ATTRIBUTE Alc-Retail-Serv-Id 17 integer 14 | ATTRIBUTE Alc-Default-Router 18 ipaddr 15 | 16 | 17 | END-VENDOR Alcatel-IPD 18 | -------------------------------------------------------------------------------- /accel-pppd/extra/logwtmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "ppp.h" 10 | #include "events.h" 11 | #include "triton.h" 12 | #include "log.h" 13 | 14 | #include "memdebug.h" 15 | 16 | 17 | static void ev_ses_started(struct ap_session *ses) 18 | { 19 | logwtmp(ses->ifname, ses->username ?: "", ses->ctrl->calling_station_id); 20 | } 21 | 22 | static void ev_ses_finished(struct ap_session *ses) 23 | { 24 | logwtmp(ses->ifname, "", ""); 25 | } 26 | 27 | static void init(void) 28 | { 29 | triton_event_register_handler(EV_SES_STARTED, (triton_event_func)ev_ses_started); 30 | triton_event_register_handler(EV_SES_FINISHED, (triton_event_func)ev_ses_finished); 31 | } 32 | 33 | DEFINE_INIT(200, init); 34 | -------------------------------------------------------------------------------- /accel-pppd/radius/dict/dictionary.rfc4675: -------------------------------------------------------------------------------- 1 | # -*- text -*- 2 | # 3 | # Attributes and values defined in RFC 4675. 4 | # http://www.ietf.org/rfc/4675.txt 5 | # 6 | # $Id: dictionary.rfc4675,v 1.1 2007/04/07 14:54:14 aland Exp $ 7 | # 8 | 9 | # 10 | # High byte = '1' (0x31) means the frames are tagged. 11 | # High byte = '2' (0x32) means the frames are untagged. 12 | # 13 | # Next 12 bits MUST be zero. 14 | # 15 | # Lower 12 bits is the IEEE-802.1Q VLAN VID. 16 | # 17 | ATTRIBUTE Egress-VLANID 56 integer 18 | ATTRIBUTE Ingress-Filters 57 integer 19 | 20 | # 21 | # First byte == '1' (0x31) means that the frames are tagged. 22 | # First byte == '2' (0x32) means that the frames are untagged. 23 | # 24 | ATTRIBUTE Egress-VLAN-Name 58 string 25 | ATTRIBUTE User-Priority-Table 59 octets # 8 26 | 27 | VALUE Ingress-Filters Enabled 1 28 | VALUE Ingress-Filters Disabled 2 29 | -------------------------------------------------------------------------------- /accel-pppd/pwdb.h: -------------------------------------------------------------------------------- 1 | #ifndef PWDB_H 2 | #define PWDB_H 3 | 4 | #include 5 | #include "list.h" 6 | 7 | struct ap_session; 8 | 9 | #define CHAP_MD5 5 10 | #define MSCHAP_V1 0x80 11 | #define MSCHAP_V2 0x81 12 | 13 | #define PWDB_SUCCESS 0 14 | #define PWDB_DENIED 1 15 | #define PWDB_WAIT 2 16 | #define PWDB_NO_IMPL 3 17 | 18 | typedef void (*pwdb_callback)(void *arg, int res); 19 | 20 | struct pwdb_t { 21 | struct list_head entry; 22 | int (*check)(struct pwdb_t *, struct ap_session *, pwdb_callback cb, void *cb_arg, const char *username, int type, va_list args); 23 | char* (*get_passwd)(struct pwdb_t *, struct ap_session *, const char *username); 24 | }; 25 | 26 | int pwdb_check(struct ap_session *, pwdb_callback cb, void *cb_arg, const char *username, int type, ...); 27 | char *pwdb_get_passwd(struct ap_session *, const char *username); 28 | 29 | void pwdb_register(struct pwdb_t *); 30 | void pwdb_unregister(struct pwdb_t *); 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /drivers/vlan_mon/vlan_mon.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_VLAN_MON_H 2 | #define __LINUX_VLAN_MON_H 3 | 4 | #include 5 | 6 | enum { 7 | VLAN_MON_CMD_NOOP, 8 | VLAN_MON_CMD_ADD, 9 | VLAN_MON_CMD_ADD_VID, 10 | VLAN_MON_CMD_DEL, 11 | VLAN_MON_NOTIFY, 12 | VLAN_MON_CMD_CHECK_BUSY, 13 | VLAN_MON_CMD_DEL_VID, 14 | __VLAN_MON_CMD_MAX, 15 | }; 16 | 17 | #define VLAN_MON_CMD_MAX (__VLAN_MON_CMD_MAX - 1) 18 | 19 | enum { 20 | VLAN_MON_ATTR_NONE, /* u32 */ 21 | VLAN_MON_ATTR_VLAN_MASK, /* u32 */ 22 | VLAN_MON_ATTR_PROTO, /* u32 */ 23 | VLAN_MON_ATTR_IFINDEX, /* u32 */ 24 | VLAN_MON_ATTR_VID, /* u32 */ 25 | VLAN_MON_ATTR_VLAN_IFINDEX, /* u32 */ 26 | __VLAN_MON_ATTR_MAX, 27 | }; 28 | 29 | #define VLAN_MON_ATTR_MAX (__VLAN_MON_ATTR_MAX - 1) 30 | 31 | /* 32 | * NETLINK_GENERIC related info 33 | */ 34 | #define VLAN_MON_GENL_NAME "vlan-mon" 35 | #define VLAN_MON_GENL_MCG "notify" 36 | #define VLAN_MON_GENL_VERSION 0x01 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /accel-pppd/radius/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(sources 2 | stat_accm.c 3 | dict.c 4 | req.c 5 | packet.c 6 | auth.c 7 | acct.c 8 | serv.c 9 | dm_coa.c 10 | radius.c 11 | ) 12 | 13 | IF (BACKUP) 14 | SET(sources ${sources} backup.c) 15 | ENDIF (BACKUP) 16 | 17 | IF (LUA) 18 | INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR}) 19 | SET(sources ${sources} lua.c) 20 | ENDIF () 21 | 22 | ADD_DEFINITIONS(-DDICTIONARY="${CMAKE_INSTALL_PREFIX}/share/accel-ppp/radius/dictionary") 23 | 24 | ADD_LIBRARY(radius SHARED ${sources}) 25 | set_property(TARGET radius PROPERTY CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) 26 | set_property(TARGET radius PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/accel-ppp) 27 | 28 | IF (LUA) 29 | TARGET_LINK_LIBRARIES(radius luasupp) 30 | ENDIF () 31 | 32 | INSTALL(TARGETS radius 33 | LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp 34 | ) 35 | FILE(GLOB dict "${CMAKE_CURRENT_SOURCE_DIR}/dict/*") 36 | INSTALL(FILES ${dict} DESTINATION share/accel-ppp/radius) 37 | -------------------------------------------------------------------------------- /accel-pppd/triton/options.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "triton_p.h" 5 | #include "conf_file.h" 6 | 7 | #include "memdebug.h" 8 | 9 | static struct conf_file_sect_t *sect=NULL; 10 | 11 | static const char* find_option(const char *name) 12 | { 13 | struct option_t *opt; 14 | 15 | if (!sect) 16 | { 17 | sect=conf_file_get_section("options"); 18 | if (!sect) return 0; 19 | } 20 | 21 | list_for_each_entry(opt,§->items,entry) 22 | { 23 | if (strcmp(opt->name,name)==0) 24 | return opt->val; 25 | } 26 | 27 | return NULL; 28 | } 29 | int triton_get_int_option(const char *str) 30 | { 31 | const char *val=find_option(str); 32 | if (!val) return 0; 33 | 34 | return atoi(val); 35 | } 36 | const char* triton_get_str_option(const char *str) 37 | { 38 | const char *val=find_option(str); 39 | 40 | return val; 41 | } 42 | double triton_get_double_option(const char *str) 43 | { 44 | const char *val=find_option(str); 45 | if (!val) return 0; 46 | 47 | return atof(val); 48 | } 49 | -------------------------------------------------------------------------------- /accel-pppd/triton/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(sources_c 2 | md.c 3 | timer.c 4 | triton.c 5 | conf_file.c 6 | loader.c 7 | log.c 8 | mempool.c 9 | event.c 10 | ) 11 | 12 | INCLUDE(CheckFunctionExists) 13 | CHECK_FUNCTION_EXISTS(timerfd_create HAVE_TIMERFD) 14 | 15 | IF (HAVE_TIMERFD) 16 | ADD_DEFINITIONS(-DHAVE_TIMERFD) 17 | ELSE (HAVE_TIMERFD) 18 | INCLUDE (CheckCSourceCompiles) 19 | CHECK_C_SOURCE_COMPILES(" 20 | #include 21 | int main() 22 | { 23 | syscall(SYS_timerfd_create); 24 | }" HAVE_SYSCALL) 25 | IF (NOT HAVE_SYSCALL) 26 | MESSAGE(FATAL_ERROR "Your system is too old and is not supported by accel-ppp, sorry...") 27 | ENDIF (NOT HAVE_SYSCALL) 28 | SET(sources_c ${sources_c} timerfd.c) 29 | ENDIF (HAVE_TIMERFD) 30 | 31 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 32 | 33 | ADD_DEFINITIONS(-DMODULE_PATH="${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/accel-ppp") 34 | 35 | ADD_LIBRARY(triton SHARED ${sources_c}) 36 | TARGET_LINK_LIBRARIES(triton dl) 37 | 38 | INSTALL(TARGETS triton 39 | LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp 40 | ) 41 | -------------------------------------------------------------------------------- /accel-pppd/ppp/ppp_auth.h: -------------------------------------------------------------------------------- 1 | #ifndef PPP_AUTH_H 2 | #define PPP_AUTH_H 3 | 4 | #include "list.h" 5 | 6 | struct ppp_auth_handler_t; 7 | 8 | struct auth_data_t 9 | { 10 | struct list_head entry; 11 | int proto; 12 | int state; 13 | struct ppp_auth_handler_t *h; 14 | }; 15 | 16 | struct ppp_auth_handler_t 17 | { 18 | struct list_head entry; 19 | const char *name; 20 | struct auth_data_t* (*init)(struct ppp_t*); 21 | int (*send_conf_req)(struct ppp_t*, struct auth_data_t*, uint8_t*); 22 | int (*recv_conf_req)(struct ppp_t*, struct auth_data_t*, uint8_t*); 23 | int (*start)(struct ppp_t*, struct auth_data_t*); 24 | int (*finish)(struct ppp_t*, struct auth_data_t*); 25 | void (*free)(struct ppp_t*,struct auth_data_t*); 26 | int (*check)(uint8_t *); 27 | int (*restart)(struct ppp_t*,struct auth_data_t*); 28 | }; 29 | 30 | int ppp_auth_register_handler(struct ppp_auth_handler_t*); 31 | 32 | int ppp_auth_succeeded(struct ppp_t *ppp, char *username); 33 | void ppp_auth_failed(struct ppp_t *ppp, char *username); 34 | int ppp_auth_restart(struct ppp_t *ppp); 35 | 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /accel-pppd/shaper/tc_core.h: -------------------------------------------------------------------------------- 1 | #ifndef _TC_CORE_H_ 2 | #define _TC_CORE_H_ 1 3 | 4 | #include 5 | #include 6 | 7 | #define TIME_UNITS_PER_SEC 1000000 8 | 9 | #ifndef UINT16_MAX 10 | #define UINT16_MAX 65535 11 | #endif 12 | 13 | enum link_layer { 14 | LINKLAYER_UNSPEC, 15 | LINKLAYER_ETHERNET, 16 | LINKLAYER_ATM, 17 | }; 18 | 19 | 20 | int tc_core_time2big(unsigned time); 21 | unsigned tc_core_time2tick(unsigned time); 22 | unsigned tc_core_tick2time(unsigned tick); 23 | unsigned tc_core_time2ktime(unsigned time); 24 | unsigned tc_core_ktime2time(unsigned ktime); 25 | unsigned tc_calc_xmittime(unsigned rate, unsigned size); 26 | unsigned tc_calc_xmitsize(unsigned rate, unsigned ticks); 27 | int tc_calc_rtable(struct tc_ratespec *r, __u32 *rtab, 28 | int cell_log, unsigned mtu, enum link_layer link_layer); 29 | int tc_calc_size_table(struct tc_sizespec *s, __u16 **stab); 30 | 31 | int tc_setup_estimator(unsigned A, unsigned time_const, struct tc_estimator *est); 32 | 33 | int tc_core_init(void); 34 | 35 | extern struct rtnl_handle g_rth; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /accel-pppd/ctrl/l2tp/dict/dictionary.rfc3931: -------------------------------------------------------------------------------- 1 | ATTRIBUTE Message-Digest 59 octets H=0 2 | ATTRIBUTE Ctrl-Message-Auth-Nonce 73 octets H=0 3 | ATTRIBUTE Router-ID 60 int32 H=0 4 | ATTRIBUTE Assigned-Connection-ID 61 int32 5 | ATTRIBUTE Pseudowire-Capabilities 62 octets 6 | ATTRIBUTE Prefered-Language 72 octets 7 | ATTRIBUTE Local-Session-ID 63 int32 8 | ATTRIBUTE Remote-Session-ID 64 int32 9 | ATTRIBUTE Assigned-Cookie 65 octets 10 | ATTRIBUTE Remote-End-ID 66 octets 11 | ATTRIBUTE Pseudowire-Type 68 int16 12 | ATTRIBUTE L2-Specific-Sublayer 69 int16 13 | ATTRIBUTE Data-Sequencing 70 int16 14 | ATTRIBUTE TX-Connect-Speed 74 int64 15 | ATTRIBUTE RX-Connect-Speed 75 int64 16 | ATTRIBUTE Circuit-Status 71 int16 17 | 18 | VALUE Message-Type Explicit-Ack 20 19 | -------------------------------------------------------------------------------- /accel-pppd/radius/dict/dictionary.rfc3576: -------------------------------------------------------------------------------- 1 | # -*- text -*- 2 | # 3 | # Attributes and values defined in RFC 3576. 4 | # http://www.ietf.org/rfc/rfc3576.txt 5 | # 6 | # $Id: dictionary.rfc3576,v 1.2 2005/08/08 22:23:39 aland Exp $ 7 | # 8 | ATTRIBUTE Error-Cause 101 integer 9 | 10 | # Service Types 11 | 12 | VALUE Service-Type Authorize-Only 17 13 | 14 | # Error causes 15 | 16 | VALUE Error-Cause Residual-Context-Removed 201 17 | VALUE Error-Cause Invalid-EAP-Packet 202 18 | VALUE Error-Cause Unsupported-Attribute 401 19 | VALUE Error-Cause Missing-Attribute 402 20 | VALUE Error-Cause NAS-Identification-Mismatch 403 21 | VALUE Error-Cause Invalid-Request 404 22 | VALUE Error-Cause Unsupported-Service 405 23 | VALUE Error-Cause Unsupported-Extension 406 24 | VALUE Error-Cause Administratively-Prohibited 501 25 | VALUE Error-Cause Proxy-Request-Not-Routable 502 26 | VALUE Error-Cause Session-Context-Not-Found 503 27 | VALUE Error-Cause Session-Context-Not-Removable 504 28 | VALUE Error-Cause Proxy-Processing-Error 505 29 | VALUE Error-Cause Resources-Unavailable 506 30 | VALUE Error-Cause Request-Initiated 507 31 | -------------------------------------------------------------------------------- /crypto/tomcrypt_argchk.h: -------------------------------------------------------------------------------- 1 | /* Defines the LTC_ARGCHK macro used within the library */ 2 | /* ARGTYPE is defined in mycrypt_cfg.h */ 3 | #if ARGTYPE == 0 4 | 5 | #include 6 | 7 | /* this is the default LibTomCrypt macro */ 8 | void crypt_argchk(char *v, char *s, int d); 9 | #define LTC_ARGCHK(x) if (!(x)) { crypt_argchk(#x, __FILE__, __LINE__); } 10 | #define LTC_ARGCHKVD(x) LTC_ARGCHK(x) 11 | 12 | #elif ARGTYPE == 1 13 | 14 | /* fatal type of error */ 15 | #define LTC_ARGCHK(x) assert((x)) 16 | #define LTC_ARGCHKVD(x) LTC_ARGCHK(x) 17 | 18 | #elif ARGTYPE == 2 19 | 20 | #define LTC_ARGCHK(x) if (!(x)) { fprintf(stderr, "\nwarning: ARGCHK failed at %s:%d\n", __FILE__, __LINE__); } 21 | #define LTC_ARGCHKVD(x) LTC_ARGCHK(x) 22 | 23 | #elif ARGTYPE == 3 24 | 25 | #define LTC_ARGCHK(x) 26 | #define LTC_ARGCHKVD(x) LTC_ARGCHK(x) 27 | 28 | #elif ARGTYPE == 4 29 | 30 | #define LTC_ARGCHK(x) if (!(x)) return CRYPT_INVALID_ARG; 31 | #define LTC_ARGCHKVD(x) if (!(x)) return; 32 | 33 | #endif 34 | 35 | 36 | /* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_argchk.h,v $ */ 37 | /* $Revision: 1.5 $ */ 38 | /* $Date: 2006/08/27 20:50:21 $ */ 39 | -------------------------------------------------------------------------------- /accel-pppd/ctrl/l2tp/l2tp_prot.h: -------------------------------------------------------------------------------- 1 | #ifndef __L2TP_PROT_H 2 | #define __L2TP_PROT_H 3 | 4 | #include 5 | 6 | #define L2TP_PORT 1701 7 | 8 | struct l2tp_hdr_t 9 | { 10 | uint8_t P:1; 11 | uint8_t O:1; 12 | uint8_t reserved2:1; 13 | uint8_t S:1; 14 | uint8_t reserved1:2; 15 | uint8_t L:1; 16 | uint8_t T:1; 17 | uint8_t ver:4; 18 | uint8_t reserved3:4; 19 | uint16_t length; 20 | union { 21 | struct { 22 | uint16_t tid; 23 | uint16_t sid; 24 | }; 25 | uint32_t cid; 26 | }; 27 | uint16_t Ns; 28 | uint16_t Nr; 29 | } __attribute__((packed)); 30 | 31 | /*#define L2TP_T(hdr) (hdr->flags >> 15) 32 | #define L2TP_L(hdr) ((hdr->flags >> 14) & 1) 33 | #define L2TP_S(hdr) ((hdr->flags >> 10) & 1) 34 | #define L2TP_O(hdr) ((hdr->flags >> 8) & 1) 35 | #define L2TP_VER(hdr) (hdr->flags & 0xf)*/ 36 | 37 | struct l2tp_avp_t 38 | { 39 | uint16_t length:10; 40 | uint16_t reserved:4; 41 | uint16_t H:1; 42 | uint16_t M:1; 43 | uint16_t vendor; 44 | uint16_t type; 45 | uint8_t val[0]; 46 | } __attribute__((packed)); 47 | 48 | struct l2tp_avp_result_code 49 | { 50 | uint16_t result_code; 51 | uint16_t error_code; 52 | char error_msg[0]; 53 | } __attribute__((packed)); 54 | 55 | #endif 56 | 57 | -------------------------------------------------------------------------------- /drivers/ipoe/ipoe.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_IPOE_H 2 | #define __LINUX_IPOE_H 3 | 4 | #include 5 | 6 | enum { 7 | IPOE_CMD_NOOP, 8 | IPOE_CMD_CREATE, 9 | IPOE_CMD_DELETE, 10 | IPOE_CMD_MODIFY, 11 | IPOE_CMD_GET, 12 | IPOE_CMD_ADD_IF, 13 | IPOE_CMD_DEL_IF, 14 | IPOE_REP_PKT, 15 | IPOE_CMD_ADD_EXCLUDE, 16 | IPOE_CMD_DEL_EXCLUDE, 17 | IPOE_CMD_ADD_NET, 18 | IPOE_CMD_DEL_NET, 19 | __IPOE_CMD_MAX, 20 | }; 21 | 22 | #define IPOE_CMD_MAX (__IPOE_CMD_MAX - 1) 23 | 24 | enum { 25 | IPOE_ATTR_NONE, /* no data */ 26 | IPOE_ATTR_ADDR, /* u32 */ 27 | IPOE_ATTR_PEER_ADDR, /* u32 */ 28 | IPOE_ATTR_GW_ADDR, /* u32 */ 29 | IPOE_ATTR_HWADDR, /* u32 */ 30 | IPOE_ATTR_MASK, /* u32 */ 31 | IPOE_ATTR_IFINDEX, /* u32 */ 32 | IPOE_ATTR_LINK_IFINDEX, /* u32 */ 33 | IPOE_ATTR_ETH_HDR, /* u32 */ 34 | IPOE_ATTR_IP_HDR, /* u32 */ 35 | IPOE_ATTR_MODE, /* u8 */ 36 | IPOE_ATTR_ARP_HDR, /* u8 */ 37 | __IPOE_ATTR_MAX, 38 | }; 39 | 40 | #define IPOE_ATTR_MAX (__IPOE_ATTR_MAX - 1) 41 | 42 | /* 43 | * NETLINK_GENERIC related info 44 | */ 45 | #define IPOE_GENL_NAME "IPoE" 46 | #define IPOE_GENL_MCG_PKT "Packet" 47 | #define IPOE_GENL_VERSION 0x02 48 | 49 | #endif 50 | 51 | -------------------------------------------------------------------------------- /contrib/centos/centos.cmake: -------------------------------------------------------------------------------- 1 | SET(CPACK_PACKAGING_INSTALL_PREFIX "/usr") 2 | SET(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}) 3 | 4 | if (BUILD_DRIVER_ONLY) 5 | if (BUILD_IPOE_DRIVER) 6 | SET(CPACK_PACKAGING_INSTALL_PREFIX "/") 7 | SET(CPACK_PACKAGE_NAME "accel-ppp-ipoe-kmod") 8 | SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "accel-ppp IPoE kernel module") 9 | SET(CPACK_RPM_PACKAGE_REQUIRES "") 10 | INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/drivers/ipoe/driver/ipoe.ko DESTINATION lib/modules/${CENTOS_KDIR}/extra) 11 | endif (BUILD_IPOE_DRIVER) 12 | 13 | if (BUILD_VLAN_MON_DRIVER) 14 | SET(CPACK_PACKAGING_INSTALL_PREFIX "/") 15 | SET(CPACK_PACKAGE_NAME "accel-ppp-vlan_mon-kmod") 16 | SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "accel-ppp vlan monitoring kernel module") 17 | SET(CPACK_RPM_PACKAGE_REQUIRES "") 18 | INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/drivers/vlan_mon/driver/vlan_mon.ko DESTINATION lib/modules/${CENTOS_KDIR}/extra) 19 | endif (BUILD_VLAN_MON_DRIVER) 20 | else (BUILD_DRIVER_ONLY) 21 | INSTALL(FILES ${CMAKE_HOME_DIRECTORY}/contrib/accel-ppp.service DESTINATION /usr/lib/systemd/system) 22 | INSTALL(FILES ${CMAKE_HOME_DIRECTORY}/accel-pppd/accel-ppp.conf DESTINATION /etc RENAME accel-ppp.conf.dist) 23 | endif (BUILD_DRIVER_ONLY) 24 | 25 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/sessionTable_oids.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: this file originally auto-generated by mib2c using 3 | * : generic-table-oids.m2c 17548 2009-04-23 16:35:18Z hardaker $ 4 | * 5 | * $Id:$ 6 | */ 7 | #ifndef SESSIONTABLE_OIDS_H 8 | #define SESSIONTABLE_OIDS_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | 15 | /* column number definitions for table sessionTable */ 16 | #define SESSIONTABLE_OID 1,3,6,1,4,1,8072,100,2,1 17 | 18 | 19 | #define COLUMN_SESSID 1 20 | 21 | #define COLUMN_SESIFNAME 2 22 | 23 | #define COLUMN_SESUSERNAME 3 24 | 25 | #define COLUMN_SESIP 4 26 | 27 | #define COLUMN_SESTYPE 5 28 | 29 | #define COLUMN_SESSTATE 6 30 | 31 | #define COLUMN_SESUPTIME 7 32 | 33 | #define COLUMN_SESCALLINGSID 8 34 | 35 | #define COLUMN_SESCALLEDSID 9 36 | 37 | #define COLUMN_SESRXBYTES 10 38 | 39 | #define COLUMN_SESRXPKTS 11 40 | 41 | #define COLUMN_SESTXBYTES 12 42 | 43 | #define COLUMN_SESTXPKTS 13 44 | 45 | 46 | #define SESSIONTABLE_MIN_COL COLUMN_SESSID 47 | #define SESSIONTABLE_MAX_COL COLUMN_SESTXPKTS 48 | 49 | 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif /* SESSIONTABLE_OIDS_H */ 56 | -------------------------------------------------------------------------------- /accel-pppd/radius/dict/dictionary.rfc2869: -------------------------------------------------------------------------------- 1 | # -*- text -*- 2 | # 3 | # Attributes and values defined in RFC 2869. 4 | # http://www.ietf.org/rfc/rfc2869.txt 5 | # 6 | # $Id: dictionary.rfc2869,v 1.2 2005/08/08 22:23:39 aland Exp $ 7 | # 8 | ATTRIBUTE Acct-Input-Gigawords 52 integer 9 | ATTRIBUTE Acct-Output-Gigawords 53 integer 10 | 11 | ATTRIBUTE Event-Timestamp 55 date 12 | 13 | ATTRIBUTE ARAP-Password 70 octets # 16 octets of data 14 | ATTRIBUTE ARAP-Features 71 octets # 14 octets of data 15 | ATTRIBUTE ARAP-Zone-Access 72 integer 16 | ATTRIBUTE ARAP-Security 73 integer 17 | ATTRIBUTE ARAP-Security-Data 74 string 18 | ATTRIBUTE Password-Retry 75 integer 19 | ATTRIBUTE Prompt 76 integer 20 | ATTRIBUTE Connect-Info 77 string 21 | ATTRIBUTE Configuration-Token 78 string 22 | ATTRIBUTE EAP-Message 79 octets 23 | ATTRIBUTE Message-Authenticator 80 octets 24 | 25 | ATTRIBUTE ARAP-Challenge-Response 84 octets # 8 octets of data 26 | ATTRIBUTE Acct-Interim-Interval 85 integer 27 | # 86: RFC 2867 28 | ATTRIBUTE NAS-Port-Id 87 string 29 | ATTRIBUTE Framed-Pool 88 string 30 | 31 | # ARAP Zone Access 32 | 33 | VALUE ARAP-Zone-Access Default-Zone 1 34 | VALUE ARAP-Zone-Access Zone-Filter-Inclusive 2 35 | VALUE ARAP-Zone-Access Zone-Filter-Exclusive 4 36 | 37 | # Prompt 38 | VALUE Prompt No-Echo 0 39 | VALUE Prompt Echo 1 40 | -------------------------------------------------------------------------------- /accel-pppd/memdebug.h: -------------------------------------------------------------------------------- 1 | #ifndef __MEMDEBUG_H 2 | #define __MEMDEBUG_H 3 | 4 | #ifdef MEMDEBUG 5 | 6 | #include 7 | 8 | #define _malloc(size) md_malloc(size, __FILE__, __LINE__) 9 | #define _realloc(ptr, size) md_realloc(ptr, size, __FILE__, __LINE__) 10 | #define _free(ptr) md_free(ptr, __FILE__, __LINE__) 11 | #define _strdup(str) md_strdup(str, __FILE__, __LINE__) 12 | #define _strndup(str, size) md_strndup(str, size, __FILE__, __LINE__) 13 | #define _asprintf(strp, fmt, ...) md_asprintf(__FILE__, __LINE__, strp, fmt, ##__VA_ARGS__) 14 | 15 | void *md_malloc(size_t size, const char *fname, int line); 16 | void *md_realloc(void *ptr, size_t size, const char *fname, int line); 17 | void md_free(void *ptr, const char *fname, int line); 18 | char* md_strdup(const char *ptr, const char *fname, int line); 19 | char* md_strndup(const char *ptr, size_t size, const char *fname, int line); 20 | int md_asprintf(const char *fname, int line, char **strp, const char *fmt, ...) __attribute__((format(gnu_printf, 4, 5))); 21 | void md_check(void *ptr); 22 | 23 | #else 24 | #define _malloc(size) malloc(size) 25 | #define _realloc(ptr, size) realloc(ptr, size) 26 | #define _free(ptr) free(ptr) 27 | #define _strdup(str) strdup(str) 28 | #define _strndup(str, size) strndup(str, size) 29 | #define _asprintf(strp, fmt, ...) asprintf(strp, fmt, ##__VA_ARGS__) 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /accel-pppd/logs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | IF(NOT DEFINED LOG_FILE) 2 | SET(LOG_FILE TRUE) 3 | ENDIF(NOT DEFINED LOG_FILE) 4 | 5 | IF(NOT DEFINED LOG_TCP) 6 | SET(LOG_TCP TRUE) 7 | ENDIF(NOT DEFINED LOG_TCP) 8 | 9 | IF(NOT DEFINED LOG_SYSLOG) 10 | SET(LOG_SYSLOG TRUE) 11 | ENDIF(NOT DEFINED LOG_SYSLOG) 12 | 13 | 14 | IF(LOG_FILE) 15 | ADD_LIBRARY(log_file SHARED log_file.c) 16 | TARGET_LINK_LIBRARIES(log_file rt) 17 | INSTALL(TARGETS log_file 18 | LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp 19 | ) 20 | ENDIF(LOG_FILE) 21 | 22 | IF(LOG_TCP) 23 | ADD_LIBRARY(log_tcp SHARED log_tcp.c) 24 | INSTALL(TARGETS log_tcp 25 | LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp 26 | ) 27 | ENDIF(LOG_TCP) 28 | 29 | IF(LOG_SYSLOG) 30 | ADD_LIBRARY(log_syslog SHARED log_syslog.c) 31 | INSTALL(TARGETS log_syslog 32 | LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp 33 | ) 34 | ENDIF(LOG_SYSLOG) 35 | 36 | IF(LOG_PGSQL) 37 | find_library(PGSQL_LIBRARY pq 38 | HINTS ${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib 39 | PATHS ${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib 40 | ) 41 | IF(NOT PGSQL_LIBRARY) 42 | message(FATAL_ERROR "${Esc}[31mRequired libpq not found.\n Install libpq-dev and run cmake again${Esc}[m") 43 | ENDIF(NOT PGSQL_LIBRARY) 44 | 45 | ADD_LIBRARY(log_pgsql SHARED log_pgsql.c) 46 | TARGET_LINK_LIBRARIES(log_pgsql ${PGSQL_LIBRARY}) 47 | INSTALL(TARGETS log_pgsql 48 | LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp 49 | ) 50 | ENDIF(LOG_PGSQL) 51 | 52 | -------------------------------------------------------------------------------- /accel-pppd/cli/cli.h: -------------------------------------------------------------------------------- 1 | #ifndef __CLI_H 2 | #define __CLI_H 3 | 4 | #include 5 | #include 6 | 7 | #define CLI_CMD_OK 0 8 | #define CLI_CMD_FAILED -1 9 | #define CLI_CMD_EXIT -2 10 | #define CLI_CMD_SYNTAX 1 11 | #define CLI_CMD_INVAL 2 12 | 13 | struct cli_simple_cmd_t 14 | { 15 | struct list_head entry; 16 | int hdr_len; 17 | const char **hdr; 18 | int (*exec)(const char *cmd, char * const *fields, int fields_cnt, void *client); 19 | void (*help)(char * const *fields, int field_cnt, void *client); 20 | }; 21 | 22 | struct cli_regexp_cmd_t 23 | { 24 | struct list_head entry; 25 | pcre *re; 26 | const char *pattern; 27 | int options; 28 | int (*exec)(const char *cmd, void *client); 29 | pcre *h_re; 30 | const char *h_pattern; 31 | int h_options; 32 | int (*help)(const char *cmd, void *client); 33 | }; 34 | 35 | struct ap_session; 36 | 37 | void cli_register_simple_cmd(struct cli_simple_cmd_t *cmd); 38 | void cli_register_simple_cmd2( 39 | int (*exec)(const char *cmd, char * const *fields, int fields_cnt, void *client), 40 | void (*help)(char * const *fields, int fields_cnt, void *client), 41 | int hdr_len, 42 | ... 43 | ); 44 | void cli_register_regexp_cmd(struct cli_regexp_cmd_t *cmd); 45 | void cli_show_ses_register(const char *name, const char *desc, void (*print)(struct ap_session *ses, char *buf)); 46 | 47 | int cli_send(void *client, const char *data); 48 | int cli_sendv(void *client, const char *fmt, ...) __attribute__((format(gnu_printf, 2, 3))); 49 | 50 | #endif 51 | 52 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(sources 2 | agent.c 3 | sessionTable.c 4 | sessionTable_data_access.c 5 | sessionTable_data_get.c 6 | sessionTable_data_set.c 7 | sessionTable_interface.c 8 | statCore.c 9 | statL2TP.c 10 | statPPP.c 11 | statPPPOE.c 12 | statPPTP.c 13 | statIPOE.c 14 | terminate.c 15 | shutdown.c 16 | exec_cli.c 17 | ) 18 | 19 | find_library(SNMP_LIBRARY netsnmp 20 | HINTS ${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib 21 | PATHS ${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib 22 | ) 23 | 24 | find_library(SNMPAGENT_LIBRARY netsnmpagent 25 | HINTS ${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib 26 | PATHS ${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib 27 | ) 28 | 29 | find_library(SNMPHELPERS_LIBRARY netsnmphelpers 30 | HINTS ${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib 31 | PATHS ${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib 32 | ) 33 | 34 | find_library(SNMPMIBS_LIBRARY netsnmpmibs 35 | HINTS ${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib 36 | PATHS ${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib 37 | ) 38 | 39 | IF(NOT SNMP_LIBRARY) 40 | message(FATAL_ERROR "${Esc}[31mRequired snmp libraries not found.\n Install libsnmp-dev and run cmake again${Esc}[m") 41 | ENDIF(NOT SNMP_LIBRARY) 42 | 43 | 44 | ADD_LIBRARY(net-snmp SHARED ${sources}) 45 | TARGET_LINK_LIBRARIES(net-snmp ${SNMP_LIBRARY} ${SNMPAGENT_LIBRARY} ${SNMPHELPERS_LIBRARY} ${SNMPMIBS_LIBRARY}) 46 | 47 | INSTALL(TARGETS net-snmp 48 | LIBRARY DESTINATION lib${LIB_SUFFIX}/accel-ppp 49 | ) 50 | -------------------------------------------------------------------------------- /accel-pppd/libnetlink/iputils.h: -------------------------------------------------------------------------------- 1 | #ifndef __IPLINK_H 2 | #define __IPLINK_H 3 | 4 | #include 5 | 6 | typedef int (*iplink_list_func)(int index, int flags, const char *name, int iflink, int vid, void *arg); 7 | 8 | int iplink_list(iplink_list_func func, void *arg); 9 | int iplink_get_stats(int ifindex, struct rtnl_link_stats *stats); 10 | int iplink_set_mtu(int ifindex, int mtu); 11 | 12 | int iplink_vlan_add(const char *ifname, int ifindex, int vid); 13 | int iplink_vlan_del(int ifindex); 14 | int iplink_vlan_get_vid(int ifindex, int *iflink); 15 | 16 | int ipaddr_add(int ifindex, in_addr_t addr, int mask); 17 | int ipaddr_add_peer(int ifindex, in_addr_t addr, in_addr_t peer_addr); 18 | int ipaddr_del(int ifindex, in_addr_t addr, int mask); 19 | int ipaddr_del_peer(int ifindex, in_addr_t addr, in_addr_t peer); 20 | 21 | int iproute_add(int ifindex, in_addr_t src, in_addr_t dst, in_addr_t gw, int proto, int mask); 22 | int iproute_del(int ifindex, in_addr_t dst, int proto, int mask); 23 | in_addr_t iproute_get(in_addr_t dst, in_addr_t *gw); 24 | 25 | int ip6route_add(int ifindex, struct in6_addr *dst, int prefix_len, int proto); 26 | int ip6route_del(int ifindex, struct in6_addr *dst, int prefix_len); 27 | int ip6addr_add(int ifindex, struct in6_addr *addr, int prefix_len); 28 | int ip6addr_add_peer(int ifindex, struct in6_addr *addr, struct in6_addr *peer_addr); 29 | int ip6addr_del(int ifindex, struct in6_addr *addr, int prefix_len); 30 | 31 | int iprule_add(uint32_t addr, int table); 32 | int iprule_del(uint32_t addr, int table); 33 | #endif 34 | -------------------------------------------------------------------------------- /accel-pppd/pwdb.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "triton.h" 5 | 6 | #include "pwdb.h" 7 | #include "ap_session.h" 8 | #include "log.h" 9 | 10 | #include "memdebug.h" 11 | 12 | static LIST_HEAD(pwdb_handlers); 13 | 14 | int __export pwdb_check(struct ap_session *ses, pwdb_callback cb, void *cb_arg, const char *username, int type, ...) 15 | { 16 | struct pwdb_t *pwdb; 17 | int r, res = PWDB_NO_IMPL; 18 | va_list args; 19 | 20 | if (ap_check_username(username)) { 21 | log_ppp_info1("%s: second session denied\n", username); 22 | return PWDB_DENIED; 23 | } 24 | 25 | va_start(args, type); 26 | 27 | list_for_each_entry(pwdb, &pwdb_handlers, entry) { 28 | if (!pwdb->check) 29 | continue; 30 | r = pwdb->check(pwdb, ses, cb, cb_arg, username, type, args); 31 | if (r == PWDB_NO_IMPL) 32 | continue; 33 | res = r; 34 | if (r == PWDB_SUCCESS || r == PWDB_WAIT) 35 | break; 36 | } 37 | 38 | va_end(args); 39 | 40 | return res; 41 | } 42 | 43 | __export char *pwdb_get_passwd(struct ap_session *ses, const char *username) 44 | { 45 | struct pwdb_t *pwdb; 46 | char *r = NULL; 47 | 48 | list_for_each_entry(pwdb, &pwdb_handlers, entry) { 49 | if (!pwdb->get_passwd) 50 | continue; 51 | r = pwdb->get_passwd(pwdb, ses, username); 52 | if (r) 53 | break; 54 | } 55 | 56 | return r; 57 | } 58 | 59 | void __export pwdb_register(struct pwdb_t *pwdb) 60 | { 61 | list_add_tail(&pwdb->entry, &pwdb_handlers); 62 | } 63 | 64 | void __export pwdb_unregister(struct pwdb_t *pwdb) 65 | { 66 | list_del(&pwdb->entry); 67 | } 68 | 69 | -------------------------------------------------------------------------------- /accel-pppd/shaper/shaper.h: -------------------------------------------------------------------------------- 1 | #ifndef __SHAPER_H 2 | #define __SHAPER_H 3 | 4 | #define LIM_POLICE 0 5 | #define LIM_TBF 1 6 | #define LIM_HTB 2 7 | 8 | #define LEAF_QDISC_SFQ 1 9 | #define LEAF_QDISC_FQ_CODEL 2 10 | 11 | struct rtnl_handle; 12 | struct nlmsghdr; 13 | 14 | struct qdisc_opt { 15 | char *kind; 16 | int handle; 17 | int parent; 18 | double latency; 19 | int rate; 20 | int buffer; 21 | int quantum; 22 | int defcls; 23 | int (*qdisc)(struct qdisc_opt *opt, struct nlmsghdr *n); 24 | }; 25 | 26 | extern int conf_up_limiter; 27 | extern int conf_down_limiter; 28 | 29 | extern double conf_down_burst_factor; 30 | extern double conf_up_burst_factor; 31 | extern double conf_latency; 32 | extern int conf_mpu; 33 | extern int conf_mtu; 34 | extern int conf_quantum; 35 | extern int conf_moderate_quantum; 36 | extern int conf_r2q; 37 | extern int conf_cburst; 38 | extern int conf_ifb_ifindex; 39 | extern int conf_fwmark; 40 | extern int conf_leaf_qdisc; 41 | extern int conf_lq_arg1; 42 | extern int conf_lq_arg2; 43 | extern int conf_lq_arg3; 44 | extern int conf_lq_arg4; 45 | extern int conf_lq_arg5; 46 | extern int conf_lq_arg6; 47 | 48 | int install_limiter(struct ap_session *ses, int down_speed, int down_burst, int up_speed, int up_burst, int idx); 49 | int remove_limiter(struct ap_session *ses, int idx); 50 | int install_leaf_qdisc(struct rtnl_handle *rth, int ifindex, int parent, int handle); 51 | int init_ifb(const char *); 52 | 53 | void leaf_qdisc_parse(const char *); 54 | 55 | int tc_qdisc_modify(struct rtnl_handle *rth, int ifindex, int cmd, unsigned flags, struct qdisc_opt *opt); 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /accel-pppd/include/events.h: -------------------------------------------------------------------------------- 1 | #ifndef __EVENTS_H 2 | #define __EVENTS_H 3 | 4 | #include 5 | #include 6 | 7 | #define EV_SES_STARTING 1 8 | #define EV_SES_STARTED 2 9 | #define EV_SES_FINISHING 3 10 | #define EV_SES_FINISHED 4 11 | #define EV_SES_AUTHORIZED 5 12 | #define EV_CTRL_STARTING 6 13 | #define EV_CTRL_STARTED 7 14 | #define EV_CTRL_FINISHED 8 15 | #define EV_SES_PRE_UP 9 16 | #define EV_SES_ACCT_START 10 17 | #define EV_CONFIG_RELOAD 11 18 | #define EV_SES_AUTH_FAILED 12 19 | #define EV_SES_PRE_FINISHED 13 20 | #define EV_SES_POST_STARTED 14 21 | #define EV_IP_CHANGED 100 22 | #define EV_SHAPER 101 23 | #define EV_MPPE_KEYS 102 24 | #define EV_DNS 103 25 | #define EV_WINS 104 26 | #define EV_FORCE_INTERIM_UPDATE 105 27 | #define EV_RADIUS_ACCESS_ACCEPT 200 28 | #define EV_RADIUS_COA 201 29 | 30 | struct ap_session; 31 | struct ppp_t; 32 | struct rad_packet_t; 33 | struct ev_radius_t 34 | { 35 | struct ap_session *ses; 36 | struct rad_packet_t *request; 37 | struct rad_packet_t *reply; 38 | int res; 39 | }; 40 | 41 | struct ev_mppe_keys_t 42 | { 43 | struct ppp_t *ppp; 44 | uint8_t *recv_key; 45 | uint8_t *send_key; 46 | int policy; 47 | int type; 48 | }; 49 | 50 | struct ev_shaper_t 51 | { 52 | struct ap_session *ses; 53 | const char *val; 54 | }; 55 | 56 | struct ev_dns_t 57 | { 58 | struct ap_session *ses; 59 | in_addr_t dns1; 60 | in_addr_t dns2; 61 | }; 62 | 63 | struct ev_wins_t 64 | { 65 | struct ap_session *ses; 66 | in_addr_t wins1; 67 | in_addr_t wins2; 68 | }; 69 | #endif 70 | -------------------------------------------------------------------------------- /accel-pppd/triton/log.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "triton_p.h" 6 | 7 | #include "memdebug.h" 8 | 9 | static FILE *f_error; 10 | static FILE *f_debug; 11 | static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; 12 | 13 | int log_init(void) 14 | { 15 | char *log_error = conf_get_opt("core","log-error"); 16 | char *log_debug = conf_get_opt("core","log-debug"); 17 | 18 | if (log_error) { 19 | f_error = fopen(log_error, "a"); 20 | if (!f_error) { 21 | perror("log:log_error:open"); 22 | return -1; 23 | } 24 | } 25 | if (log_debug) { 26 | f_debug = fopen(log_debug, "a"); 27 | if (!f_debug) { 28 | perror("log:log_debug:open"); 29 | return -1; 30 | } 31 | } 32 | 33 | return 0; 34 | } 35 | 36 | static void do_log(FILE *f, const char *fmt, va_list ap) 37 | { 38 | struct timeval tv; 39 | struct tm tm; 40 | char date[64]; 41 | 42 | gettimeofday(&tv, NULL); 43 | localtime_r(&tv.tv_sec, &tm); 44 | strftime(date, sizeof(date), "%F %H:%M:%S", &tm); 45 | 46 | pthread_mutex_lock(&lock); 47 | fprintf(f, "[%s.%i]", date, (int)tv.tv_usec / 1000); 48 | vfprintf(f, fmt,ap); 49 | fprintf(f, "\n"); 50 | pthread_mutex_unlock(&lock); 51 | 52 | fflush(f); 53 | } 54 | void triton_log_error(const char *fmt,...) 55 | { 56 | va_list ap; 57 | 58 | if (!f_error) 59 | return; 60 | 61 | va_start(ap, fmt); 62 | do_log(f_error, fmt, ap); 63 | va_end(ap); 64 | } 65 | 66 | void triton_log_debug(const char *fmt,...) 67 | { 68 | va_list ap; 69 | 70 | if (!f_debug) 71 | return; 72 | 73 | va_start(ap, fmt); 74 | do_log(f_debug, fmt, ap); 75 | va_end(ap); 76 | } 77 | 78 | -------------------------------------------------------------------------------- /accel-pppd/include/ap_net.h: -------------------------------------------------------------------------------- 1 | #ifndef __AP_NET_H 2 | #define __AP_NET_H 3 | 4 | struct rtnl_handle; 5 | 6 | struct ap_net { 7 | struct list_head entry; 8 | int refs; 9 | char *name; 10 | int (*socket)(int domain, int type, int proto); 11 | int (*connect)(int sock, const struct sockaddr *, socklen_t len); 12 | int (*bind)(int sock, const struct sockaddr *, socklen_t len); 13 | int (*listen)(int sock, int backlog); 14 | ssize_t (*read)(int sock, void *buf, size_t len); 15 | ssize_t (*recvfrom)(int sock, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen); 16 | ssize_t (*write)(int sock, const void *buf, size_t len); 17 | ssize_t (*sendto)(int sock, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen); 18 | int (*set_nonblocking)(int sock, int f); 19 | int (*setsockopt)(int sockfd, int level, int optname, const void *optval, socklen_t optlen); 20 | int (*sock_ioctl)(unsigned long request, void *arg); 21 | int (*sock6_ioctl)(unsigned long request, void *arg); 22 | int (*ppp_open)(); 23 | int (*ppp_ioctl)(int fd, unsigned long request, void *arg); 24 | void (*enter_ns)(); 25 | void (*exit_ns)(); 26 | struct rtnl_handle *(*rtnl_get)(); 27 | void (*rtnl_put)(struct rtnl_handle *); 28 | int (*rtnl_open)(struct rtnl_handle *h, int proto); 29 | int (*move_link)(struct ap_net *net, int ifindex); 30 | void (*release)(struct ap_net *net); 31 | }; 32 | 33 | extern __thread struct ap_net *net; 34 | extern struct ap_net *def_net; 35 | 36 | int ap_net_register(struct ap_net *net); 37 | struct ap_net *ap_net_find(const char *name); 38 | struct ap_net *ap_net_open_ns(const char *name); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /contrib/debian/accel-ppp-init: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # /etc/init.d/accel-pppd: set up the accel-ppp server 3 | ### BEGIN INIT INFO 4 | # Provides: accel-ppp 5 | # Required-Start: $remote_fs $syslog $network $time 6 | # Required-Stop: $remote_fs $syslog $network 7 | # Default-Start: 2 3 4 5 8 | # Default-Stop: 0 1 6 9 | ### END INIT INFO 10 | 11 | set -e 12 | 13 | PATH=/bin:/usr/bin:/sbin:/usr/sbin 14 | 15 | . /lib/lsb/init-functions 16 | 17 | if test -f /etc/default/accel-ppp; then 18 | . /etc/default/accel-ppp 19 | fi 20 | 21 | if [ -z "$ACCEL_PPPD_OPTS" ]; then 22 | ACCEL_PPPD_OPTS="-c /etc/accel-ppp.conf" 23 | fi 24 | 25 | case "$1" in 26 | start) 27 | log_daemon_msg "Starting PPtP/L2TP/PPPoE server" "accel-pppd" 28 | if start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/accel-pppd -- -d -p /var/run/accel-pppd.pid $ACCEL_PPPD_OPTS; then 29 | log_end_msg 0 30 | else 31 | log_end_msg 1 32 | fi 33 | ;; 34 | restart) 35 | log_daemon_msg "Restarting PPtP/L2TP/PPPoE server" "accel-pppd" 36 | start-stop-daemon --stop --quiet --oknodo --retry 180 --pidfile /var/run/accel-pppd.pid 37 | if start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/accel-pppd -- -d -p /var/run/accel-pppd.pid $ACCEL_PPPD_OPTS; then 38 | log_end_msg 0 39 | else 40 | log_end_msg 1 41 | fi 42 | ;; 43 | 44 | stop) 45 | log_daemon_msg "Stopping PPtP/L2TP/PPPoE server" "accel-pppd" 46 | start-stop-daemon --stop --quiet --oknodo --retry 180 --pidfile /var/run/accel-pppd.pid 47 | log_end_msg 0 48 | ;; 49 | 50 | status) 51 | status_of_proc /usr/sbin/accel-pppd "accel-pppd" 52 | ;; 53 | *) 54 | log_success_msg "Usage: /etc/init.d/accel-ppp {start|stop|status|restart}" 55 | exit 1 56 | ;; 57 | esac 58 | 59 | exit 0 60 | -------------------------------------------------------------------------------- /accel-pppd/ipdb.h: -------------------------------------------------------------------------------- 1 | #ifndef IPDB_H 2 | #define IPDB_H 3 | 4 | #include "ppp.h" 5 | #include "list.h" 6 | 7 | struct ipv4db_item_t 8 | { 9 | struct ipdb_t *owner; 10 | in_addr_t addr; 11 | in_addr_t peer_addr; 12 | int mask; 13 | }; 14 | 15 | struct ipv6db_addr_t 16 | { 17 | struct list_head entry; 18 | struct in6_addr addr; 19 | int prefix_len; 20 | int flag_onlink:1; 21 | int flag_auto:1; 22 | int installed:1; 23 | }; 24 | 25 | struct ipv6db_item_t 26 | { 27 | struct ipdb_t *owner; 28 | uint64_t intf_id; 29 | uint64_t peer_intf_id; 30 | struct list_head addr_list; 31 | }; 32 | 33 | struct ipv6db_prefix_t 34 | { 35 | struct ipdb_t *owner; 36 | struct list_head prefix_list; 37 | }; 38 | 39 | 40 | struct ipdb_t 41 | { 42 | struct list_head entry; 43 | 44 | struct ipv4db_item_t *(*get_ipv4)(struct ap_session *ses); 45 | void (*put_ipv4)(struct ap_session *ses, struct ipv4db_item_t *); 46 | 47 | struct ipv6db_item_t *(*get_ipv6)(struct ap_session *ses); 48 | void (*put_ipv6)(struct ap_session *ses, struct ipv6db_item_t *); 49 | 50 | struct ipv6db_prefix_t *(*get_ipv6_prefix)(struct ap_session *ses); 51 | void (*put_ipv6_prefix)(struct ap_session *ses, struct ipv6db_prefix_t *); 52 | }; 53 | 54 | struct ipv4db_item_t *ipdb_get_ipv4(struct ap_session *ses); 55 | void ipdb_put_ipv4(struct ap_session *ses, struct ipv4db_item_t *); 56 | 57 | struct ipv6db_item_t *ipdb_get_ipv6(struct ap_session *ses); 58 | void ipdb_put_ipv6(struct ap_session *ses, struct ipv6db_item_t *); 59 | 60 | struct ipv6db_prefix_t *ipdb_get_ipv6_prefix(struct ap_session *ses); 61 | void ipdb_put_ipv6_prefix(struct ap_session *ses, struct ipv6db_prefix_t *it); 62 | 63 | void ipdb_register(struct ipdb_t *); 64 | 65 | void build_ip6_addr(struct ipv6db_addr_t *a, uint64_t intf_id, struct in6_addr *addr); 66 | 67 | #endif 68 | 69 | -------------------------------------------------------------------------------- /accel-pppd/radius/dict/dictionary.rfc2868: -------------------------------------------------------------------------------- 1 | # -*- text -*- 2 | # 3 | # Attributes and values defined in RFC 2868. 4 | # http://www.ietf.org/rfc/rfc2868.txt 5 | # 6 | # $Id: dictionary.rfc2868,v 1.4 2007/02/13 13:28:17 aland Exp $ 7 | # 8 | ATTRIBUTE Tunnel-Type 64 integer has_tag 9 | ATTRIBUTE Tunnel-Medium-Type 65 integer has_tag 10 | ATTRIBUTE Tunnel-Client-Endpoint 66 string has_tag 11 | ATTRIBUTE Tunnel-Server-Endpoint 67 string has_tag 12 | 13 | ATTRIBUTE Tunnel-Password 69 string has_tag,encrypt=2 14 | 15 | ATTRIBUTE Tunnel-Private-Group-Id 81 string has_tag 16 | ATTRIBUTE Tunnel-Assignment-Id 82 string has_tag 17 | ATTRIBUTE Tunnel-Preference 83 integer has_tag 18 | 19 | ATTRIBUTE Tunnel-Client-Auth-Id 90 string has_tag 20 | ATTRIBUTE Tunnel-Server-Auth-Id 91 string has_tag 21 | 22 | # Tunnel Type 23 | 24 | VALUE Tunnel-Type PPTP 1 25 | VALUE Tunnel-Type L2F 2 26 | VALUE Tunnel-Type L2TP 3 27 | VALUE Tunnel-Type ATMP 4 28 | VALUE Tunnel-Type VTP 5 29 | VALUE Tunnel-Type AH 6 30 | VALUE Tunnel-Type IP 7 31 | VALUE Tunnel-Type MIN-IP 8 32 | VALUE Tunnel-Type ESP 9 33 | VALUE Tunnel-Type GRE 10 34 | VALUE Tunnel-Type DVS 11 35 | VALUE Tunnel-Type IP-in-IP 12 36 | 37 | # Tunnel Medium Type 38 | 39 | VALUE Tunnel-Medium-Type IP 1 40 | VALUE Tunnel-Medium-Type IPv4 1 41 | VALUE Tunnel-Medium-Type IPv6 2 42 | VALUE Tunnel-Medium-Type NSAP 3 43 | VALUE Tunnel-Medium-Type HDLC 4 44 | VALUE Tunnel-Medium-Type BBN-1822 5 45 | VALUE Tunnel-Medium-Type IEEE-802 6 46 | VALUE Tunnel-Medium-Type E.163 7 47 | VALUE Tunnel-Medium-Type E.164 8 48 | VALUE Tunnel-Medium-Type F.69 9 49 | VALUE Tunnel-Medium-Type X.121 10 50 | VALUE Tunnel-Medium-Type IPX 11 51 | VALUE Tunnel-Medium-Type Appletalk 12 52 | VALUE Tunnel-Medium-Type DecNet-IV 13 53 | VALUE Tunnel-Medium-Type Banyan-Vines 14 54 | VALUE Tunnel-Medium-Type E.164-NSAP 15 55 | -------------------------------------------------------------------------------- /crypto/crypto.h: -------------------------------------------------------------------------------- 1 | #ifndef __CRYPTO_H 2 | #define __CRYPTO_H 3 | 4 | #ifdef CRYPTO_OPENSSL 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined (LIBRESSL_VERSION_NUMBER) 13 | #define EVP_MD_CTX_new EVP_MD_CTX_create 14 | #define EVP_MD_CTX_free EVP_MD_CTX_destroy 15 | #endif 16 | #else 17 | 18 | #ifdef CRYPTO_TOMCRYPT 19 | #include 20 | #else 21 | #include "tomcrypt.h" 22 | #endif 23 | 24 | typedef hash_state MD4_CTX; 25 | #define MD4_DIGEST_LENGTH 16 26 | #define MD4_Init(c) md4_init(c) 27 | #define MD4_Update(c, data, len) md4_process(c, (const unsigned char *)(data), (unsigned long)(len)) 28 | #define MD4_Final(md, c) md4_done(c, (unsigned char*)(md)) 29 | 30 | typedef hash_state MD5_CTX; 31 | #define MD5_DIGEST_LENGTH 16 32 | #define MD5_Init(c) md5_init(c) 33 | #define MD5_Update(c, data, len) md5_process(c, (const unsigned char *)(data), (unsigned long)(len)) 34 | #define MD5_Final(md, c) md5_done(c, (unsigned char*)(md)) 35 | 36 | typedef hash_state SHA_CTX; 37 | #define SHA_DIGEST_LENGTH 20 38 | #define SHA1_Init(c) sha1_init(c) 39 | #define SHA1_Update(c, data, len) sha1_process(c, (const unsigned char *)(data), (unsigned long)(len)) 40 | #define SHA1_Final(md, c) sha1_done(c, (unsigned char*)(md)) 41 | 42 | typedef unsigned char DES_cblock[8]; 43 | typedef unsigned char const_DES_cblock[8]; 44 | #define DES_key_schedule symmetric_key 45 | #define DES_ENCRYPT 1 46 | #define DES_DECRYPT 0 47 | #define DES_set_key(key, schedule) des_setup((const unsigned char *)key, 8, 0, schedule) 48 | 49 | int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule); 50 | int DES_random_key(DES_cblock *ret); 51 | void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, DES_key_schedule *ks, int enc); 52 | 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /accel-pppd/log.h: -------------------------------------------------------------------------------- 1 | #ifndef __LOG_H 2 | #define __LOG_H 3 | 4 | #include 5 | #include 6 | #include "list.h" 7 | 8 | #define LOG_MAX_SIZE 4096 9 | #define LOG_CHUNK_SIZE 128 10 | 11 | struct ap_session; 12 | struct triton_context_t; 13 | 14 | struct log_msg_t 15 | { 16 | struct list_head entry; 17 | void *lpd; 18 | void *tpd; 19 | struct timeval timestamp; 20 | int level; 21 | struct log_chunk_t *hdr; 22 | struct list_head *chunks; 23 | }; 24 | 25 | struct log_chunk_t 26 | { 27 | struct list_head entry; 28 | int len; 29 | char msg[0]; 30 | }; 31 | 32 | struct log_target_t 33 | { 34 | struct list_head entry; 35 | 36 | void (*log)(struct log_target_t *, struct log_msg_t *, struct ap_session *ses); 37 | void (*reopen)(void); 38 | }; 39 | 40 | void log_free_msg(struct log_msg_t *msg); 41 | 42 | void log_emerg(const char *fmt, ...) __attribute__((format(gnu_printf, 1, 2))); 43 | 44 | void log_error(const char *fmt, ...) __attribute__((format(gnu_printf, 1, 2))); 45 | void log_warn(const char *fmt, ...) __attribute__((format(gnu_printf, 1, 2))); 46 | void log_info1(const char *fmt, ...) __attribute__((format(gnu_printf, 1, 2))); 47 | void log_info2(const char *fmt, ...) __attribute__((format(gnu_printf, 1, 2))); 48 | void log_debug(const char *fmt, ...) __attribute__((format(gnu_printf, 1, 2))); 49 | void log_msg(const char *fmt, ...) __attribute__((format(gnu_printf, 1, 2))); 50 | 51 | void log_ppp_error(const char *fmt, ...) __attribute__((format(gnu_printf, 1, 2))); 52 | void log_ppp_warn(const char *fmt, ...) __attribute__((format(gnu_printf, 1, 2))); 53 | void log_ppp_info1(const char *fmt, ...) __attribute__((format(gnu_printf, 1, 2))); 54 | void log_ppp_info2(const char *fmt, ...) __attribute__((format(gnu_printf, 1, 2))); 55 | void log_ppp_debug(const char *fmt, ...) __attribute__((format(gnu_printf, 1, 2))); 56 | void log_ppp_msg(const char *fmt, ...) __attribute__((format(gnu_printf, 1, 2))); 57 | 58 | void log_switch(struct triton_context_t *ctx, void *arg); 59 | 60 | void log_register_target(struct log_target_t *t); 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /accel-pppd/utils.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "triton.h" 9 | #include "utils.h" 10 | 11 | #include "memdebug.h" 12 | 13 | extern int urandom_fd; 14 | 15 | void __export u_inet_ntoa(in_addr_t addr, char *str) 16 | { 17 | addr = ntohl(addr); 18 | sprintf(str, "%i.%i.%i.%i", (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff); 19 | } 20 | 21 | int __export u_readlong(long int *dst, const char *src, 22 | long int min, long int max) 23 | { 24 | char *src_stop = NULL; 25 | long int rv; 26 | 27 | if (dst == NULL || src == NULL || src[0] == '\0') 28 | return -1; 29 | 30 | errno = 0; 31 | rv = strtol(src, &src_stop, 0); 32 | if (errno != 0 || *src_stop != '\0' || rv < min || rv > max) { 33 | return -1; 34 | } else { 35 | *dst = rv; 36 | return 0; 37 | } 38 | } 39 | 40 | int __export u_parse_ip4addr(const char *src, struct in_addr *addr, 41 | const char **err_msg) 42 | { 43 | struct addrinfo hint = { 44 | .ai_flags = AI_NUMERICHOST, 45 | .ai_family = AF_INET, 46 | .ai_socktype = 0, 47 | .ai_protocol = 0, 48 | }; 49 | struct addrinfo *ainfo; 50 | int err; 51 | 52 | err = getaddrinfo(src, NULL, &hint, &ainfo); 53 | if (err) { 54 | *err_msg = gai_strerror(err); 55 | return err; 56 | } 57 | 58 | *addr = ((struct sockaddr_in *)ainfo->ai_addr)->sin_addr; 59 | 60 | freeaddrinfo(ainfo); 61 | 62 | return 0; 63 | } 64 | 65 | int __export u_randbuf(void *buf, size_t buf_len, int *err) 66 | { 67 | uint8_t *u8buf = buf; 68 | ssize_t rd_len; 69 | 70 | while (buf_len) { 71 | rd_len = read(urandom_fd, u8buf, buf_len); 72 | if (rd_len < 0) { 73 | if (errno == EINTR) 74 | rd_len = 0; 75 | else { 76 | if (err) 77 | *err = errno; 78 | return -1; 79 | } 80 | } else if (rd_len == 0) { 81 | if (err) 82 | *err = 0; 83 | return -1; 84 | } 85 | u8buf += rd_len; 86 | buf_len -= rd_len; 87 | } 88 | 89 | return 0; 90 | } 91 | -------------------------------------------------------------------------------- /cmake/cpack.cmake: -------------------------------------------------------------------------------- 1 | INCLUDE(InstallRequiredSystemLibraries) 2 | 3 | SET(CPACK_PACKAGE_VERSION_MAJOR "1") 4 | SET(CPACK_PACKAGE_VERSION_MINOR "11") 5 | SET(CPACK_PACKAGE_VERSION_PATCH "99") 6 | 7 | SET(CPACK_PACKAGE_NAME "accel-ppp") 8 | SET(CPACK_PACKAGE_CONTACT "Dmitry Kozlov ") 9 | SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "PPtP/L2TP/PPPoE server for Linux") 10 | 11 | SET(CPACK_PACKAGE_VENDOR "Dmitry Kozlov") 12 | SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README") 13 | SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING") 14 | 15 | IF(CPACK_TYPE STREQUAL Debian5) 16 | SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.7), libssl0.9.8 (>= 0.9.8), libpcre3 (>= 7.6)") 17 | INCLUDE(${CMAKE_HOME_DIRECTORY}/cmake/debian/debian.cmake) 18 | ENDIF(CPACK_TYPE STREQUAL Debian5) 19 | 20 | IF(CPACK_TYPE STREQUAL Debian6) 21 | SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.11.2), libssl0.9.8 (>= 0.9.8), libpcre3 (>= 8.02)") 22 | INCLUDE(${CMAKE_HOME_DIRECTORY}/cmake/debian/debian.cmake) 23 | ENDIF(CPACK_TYPE STREQUAL Debian6) 24 | 25 | IF(CPACK_TYPE STREQUAL Debian7) 26 | SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.13), libssl1.0.0 (>= 1.0.0), libpcre3 (>= 8.30)") 27 | INCLUDE(${CMAKE_HOME_DIRECTORY}/cmake/debian/debian.cmake) 28 | ENDIF(CPACK_TYPE STREQUAL Debian7) 29 | 30 | IF(CPACK_TYPE STREQUAL Debian8) 31 | SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.19), libssl1.0.0 (>= 1.0.1k), libpcre3 (>= 8.35)") 32 | INCLUDE(${CMAKE_HOME_DIRECTORY}/cmake/debian/debian.cmake) 33 | ENDIF(CPACK_TYPE STREQUAL Debian8) 34 | 35 | IF(CPACK_TYPE STREQUAL Debian9) 36 | SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.24), libssl1.0.2 (>= 1.0.2l), libpcre3 (>= 8.39)") 37 | INCLUDE(${CMAKE_HOME_DIRECTORY}/cmake/debian/debian.cmake) 38 | ENDIF(CPACK_TYPE STREQUAL Debian9) 39 | 40 | IF(CPACK_TYPE STREQUAL Centos7) 41 | SET(CPACK_RPM_PACKAGE_LICENSE "GPL") 42 | SET(CPACK_RPM_PACKAGE_URL "http://accel-ppp.org") 43 | SET(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/sbin") 44 | SET(CPACK_RPM_PACKAGE_REQUIRES "glibc >= 2.17, openssl-libs >= 1.0.2k, pcre >= 8.32") 45 | INCLUDE(${CMAKE_HOME_DIRECTORY}/cmake/centos/centos.cmake) 46 | ENDIF() 47 | 48 | INCLUDE(CPack) 49 | -------------------------------------------------------------------------------- /accel-pppd/triton/timerfd.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2008 Free Software Foundation, Inc. 2 | This file is part of the GNU C Library. 3 | 4 | The GNU C Library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | The GNU C Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with the GNU C Library; if not, write to the Free 16 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 17 | 02111-1307 USA. */ 18 | 19 | #ifndef _SYS_TIMERFD_H 20 | #define _SYS_TIMERFD_H 1 21 | 22 | #include 23 | 24 | 25 | /* Bits to be set in the FLAGS parameter of `timerfd_create'. */ 26 | enum 27 | { 28 | TFD_CLOEXEC = 02000000, 29 | #define TFD_CLOEXEC TFD_CLOEXEC 30 | TFD_NONBLOCK = 04000 31 | #define TFD_NONBLOCK TFD_NONBLOCK 32 | }; 33 | 34 | 35 | /* Bits to be set in the FLAGS parameter of `timerfd_settime'. */ 36 | enum 37 | { 38 | TFD_TIMER_ABSTIME = 1 << 0 39 | #define TFD_TIMER_ABSTIME TFD_TIMER_ABSTIME 40 | }; 41 | 42 | 43 | __BEGIN_DECLS 44 | 45 | /* Return file descriptor for new interval timer source. */ 46 | extern int timerfd_create (clockid_t __clock_id, int __flags) __THROW; 47 | 48 | /* Set next expiration time of interval timer source UFD to UTMR. If 49 | FLAGS has the TFD_TIMER_ABSTIME flag set the timeout value is 50 | absolute. Optionally return the old expiration time in OTMR. */ 51 | extern int timerfd_settime (int __ufd, int __flags, 52 | __const struct itimerspec *__utmr, 53 | struct itimerspec *__otmr) __THROW; 54 | 55 | /* Return the next expiration time of UFD. */ 56 | extern int timerfd_gettime (int __ufd, struct itimerspec *__otmr) __THROW; 57 | 58 | __END_DECLS 59 | 60 | #endif /* sys/timerfd.h */ 61 | -------------------------------------------------------------------------------- /accel-pppd/radius/dict/dictionary.rfc2866: -------------------------------------------------------------------------------- 1 | # -*- text -*- 2 | # 3 | # Attributes and values defined in RFC 2866. 4 | # http://www.ietf.org/rfc/rfc2866.txt 5 | # 6 | # $Id: dictionary.rfc2866,v 1.2 2005/08/08 22:23:38 aland Exp $ 7 | # 8 | ATTRIBUTE Acct-Status-Type 40 integer 9 | ATTRIBUTE Acct-Delay-Time 41 integer 10 | ATTRIBUTE Acct-Input-Octets 42 integer 11 | ATTRIBUTE Acct-Output-Octets 43 integer 12 | ATTRIBUTE Acct-Session-Id 44 string 13 | ATTRIBUTE Acct-Authentic 45 integer 14 | ATTRIBUTE Acct-Session-Time 46 integer 15 | ATTRIBUTE Acct-Input-Packets 47 integer 16 | ATTRIBUTE Acct-Output-Packets 48 integer 17 | ATTRIBUTE Acct-Terminate-Cause 49 integer 18 | ATTRIBUTE Acct-Multi-Session-Id 50 string 19 | ATTRIBUTE Acct-Link-Count 51 integer 20 | 21 | # Accounting Status Types 22 | 23 | VALUE Acct-Status-Type Start 1 24 | VALUE Acct-Status-Type Stop 2 25 | VALUE Acct-Status-Type Alive 3 # dup 26 | VALUE Acct-Status-Type Interim-Update 3 27 | VALUE Acct-Status-Type Accounting-On 7 28 | VALUE Acct-Status-Type Accounting-Off 8 29 | VALUE Acct-Status-Type Failed 15 30 | 31 | # Authentication Types 32 | 33 | VALUE Acct-Authentic RADIUS 1 34 | VALUE Acct-Authentic Local 2 35 | VALUE Acct-Authentic Remote 3 36 | VALUE Acct-Authentic Diameter 4 37 | 38 | # Acct Terminate Causes 39 | 40 | VALUE Acct-Terminate-Cause User-Request 1 41 | VALUE Acct-Terminate-Cause Lost-Carrier 2 42 | VALUE Acct-Terminate-Cause Lost-Service 3 43 | VALUE Acct-Terminate-Cause Idle-Timeout 4 44 | VALUE Acct-Terminate-Cause Session-Timeout 5 45 | VALUE Acct-Terminate-Cause Admin-Reset 6 46 | VALUE Acct-Terminate-Cause Admin-Reboot 7 47 | VALUE Acct-Terminate-Cause Port-Error 8 48 | VALUE Acct-Terminate-Cause NAS-Error 9 49 | VALUE Acct-Terminate-Cause NAS-Request 10 50 | VALUE Acct-Terminate-Cause NAS-Reboot 11 51 | VALUE Acct-Terminate-Cause Port-Unneeded 12 52 | VALUE Acct-Terminate-Cause Port-Preempted 13 53 | VALUE Acct-Terminate-Cause Port-Suspended 14 54 | VALUE Acct-Terminate-Cause Service-Unavailable 15 55 | VALUE Acct-Terminate-Cause Callback 16 56 | VALUE Acct-Terminate-Cause User-Error 17 57 | VALUE Acct-Terminate-Cause Host-Request 18 58 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/sessionTable_enums.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: this file originally auto-generated by mib2c using 3 | * : generic-table-enums.m2c 12526 2005-07-15 22:41:16Z rstory $ 4 | * 5 | * $Id:$ 6 | */ 7 | #ifndef SESSIONTABLE_ENUMS_H 8 | #define SESSIONTABLE_ENUMS_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | /* 15 | * NOTES on enums 16 | * ============== 17 | * 18 | * Value Mapping 19 | * ------------- 20 | * If the values for your data type don't exactly match the 21 | * possible values defined by the mib, you should map them 22 | * below. For example, a boolean flag (1/0) is usually represented 23 | * as a TruthValue in a MIB, which maps to the values (1/2). 24 | * 25 | */ 26 | /************************************************************************* 27 | ************************************************************************* 28 | * 29 | * enum definitions for table sessionTable 30 | * 31 | ************************************************************************* 32 | *************************************************************************/ 33 | 34 | /************************************************************* 35 | * constants for enums for the MIB node 36 | * sesType (INTEGER / ASN_INTEGER) 37 | * 38 | * since a Textual Convention may be referenced more than once in a 39 | * MIB, protect againt redefinitions of the enum values. 40 | */ 41 | #ifndef SESTYPE_ENUMS 42 | #define SESTYPE_ENUMS 43 | 44 | #define SESTYPE_PPTP 1 45 | #define SESTYPE_L2TP 2 46 | #define SESTYPE_PPPOE 3 47 | #define SESTYPE_IPOE 4 48 | 49 | #endif /* SESTYPE_ENUMS */ 50 | 51 | 52 | /************************************************************* 53 | * constants for enums for the MIB node 54 | * sesState (INTEGER / ASN_INTEGER) 55 | * 56 | * since a Textual Convention may be referenced more than once in a 57 | * MIB, protect againt redefinitions of the enum values. 58 | */ 59 | #ifndef SESSTATE_ENUMS 60 | #define SESSTATE_ENUMS 61 | 62 | #define SESSTATE_STARTING 1 63 | #define SESSTATE_ACTIVE 2 64 | #define SESSTATE_FINISHING 3 65 | 66 | #endif /* SESSTATE_ENUMS */ 67 | 68 | 69 | 70 | 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | 75 | #endif /* SESSIONTABLE_ENUMS_H */ 76 | -------------------------------------------------------------------------------- /accel-pppd/radius/dict/dictionary.rfc4679: -------------------------------------------------------------------------------- 1 | # -*- text -*- 2 | # 3 | # Attributes and values defined in RFC 4679. 4 | # http://www.ietf.org/rfc/4679.txt 5 | # 6 | # $Id: dictionary.rfc4679,v 1.1 2007/04/08 14:18:01 aland Exp $ 7 | # 8 | 9 | VENDOR ADSL-Forum 3561 10 | 11 | BEGIN-VENDOR ADSL-Forum 12 | 13 | # 14 | # The first two attributes are prefixed with "ADSL-" because of 15 | # conflicting names in dictionary.redback. 16 | # 17 | ATTRIBUTE ADSL-Agent-Circuit-Id 1 string 18 | ATTRIBUTE ADSL-Agent-Remote-Id 2 string 19 | ATTRIBUTE Actual-Data-Rate-Upstream 129 integer 20 | ATTRIBUTE Actual-Data-Rate-Downstream 130 integer 21 | ATTRIBUTE Minimum-Data-Rate-Upstream 131 integer 22 | ATTRIBUTE Minimum-Data-Rate-Downstream 132 integer 23 | ATTRIBUTE Attainable-Data-Rate-Upstream 133 integer 24 | ATTRIBUTE Attainable-Data-Rate-Downstream 134 integer 25 | ATTRIBUTE Maximum-Data-Rate-Upstream 135 integer 26 | ATTRIBUTE Maximum-Data-Rate-Downstream 136 integer 27 | ATTRIBUTE Minimum-Data-Rate-Upstream-Low-Power 137 integer 28 | ATTRIBUTE Minimum-Data-Rate-Downstream-Low-Power 138 integer 29 | ATTRIBUTE Maximum-Interleaving-Delay-Upstream 139 integer 30 | ATTRIBUTE Actual-Interleaving-Delay-Upstream 140 integer 31 | ATTRIBUTE Maximum-Interleaving-Delay-Downstream 141 integer 32 | ATTRIBUTE Actual-Interleaving-Delay-Downstream 142 integer 33 | 34 | # 35 | # This next attribute has a weird encoding. 36 | # 37 | # Octet[0] - 0x01 AAL5 38 | # Octet[0] - 0x02 Ethernet 39 | 40 | # Octet[1] - 0x00 Not Available 41 | # Octet[1] - 0x01 Untagged Ethernet 42 | # Octet[1] - 0x02 Single-Tagged Ethernet 43 | 44 | # Octet[2] - 0x00 Not available 45 | # Octet[2] - 0x01 PPPoA LLC 46 | # Octet[2] - 0x02 PPPoA Null 47 | # Octet[2] - 0x03 IPoA LLC 48 | # Octet[2] - 0x04 IPoA NULL 49 | # Octet[2] - 0x05 Ethernet over AAL5 LLC with FCS 50 | # Octet[2] - 0x06 Ethernet over AAL5 LLC without FCS 51 | # Octet[2] - 0x07 Ethernet over AAL5 Null with FCS 52 | # Octet[2] - 0x08 Ethernet over AAL5 Null without FCS 53 | # 54 | ATTRIBUTE Access-Loop-Encapsulation 144 octets # 3 55 | 56 | # 57 | # If this attribute exists, it means that IFW has been performed 58 | # for the subscribers session. 59 | # 60 | ATTRIBUTE IWF-Session 254 octets # 0 61 | 62 | END-VENDOR ADSL-Forum 63 | -------------------------------------------------------------------------------- /accel-pppd/ipdb.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "triton.h" 4 | #include "ipdb.h" 5 | 6 | #include "memdebug.h" 7 | 8 | static LIST_HEAD(ipdb_handlers); 9 | 10 | struct ipv4db_item_t __export *ipdb_get_ipv4(struct ap_session *ses) 11 | { 12 | struct ipdb_t *ipdb; 13 | struct ipv4db_item_t *it; 14 | 15 | list_for_each_entry(ipdb, &ipdb_handlers, entry) { 16 | if (!ipdb->get_ipv4) 17 | continue; 18 | it = ipdb->get_ipv4(ses); 19 | if (it) 20 | return it; 21 | } 22 | 23 | return NULL; 24 | } 25 | 26 | void __export ipdb_put_ipv4(struct ap_session *ses, struct ipv4db_item_t *it) 27 | { 28 | if (it->owner->put_ipv4) 29 | it->owner->put_ipv4(ses, it); 30 | } 31 | 32 | struct ipv6db_item_t __export *ipdb_get_ipv6(struct ap_session *ses) 33 | { 34 | struct ipdb_t *ipdb; 35 | struct ipv6db_item_t *it; 36 | 37 | list_for_each_entry(ipdb, &ipdb_handlers, entry) { 38 | if (!ipdb->get_ipv6) 39 | continue; 40 | it = ipdb->get_ipv6(ses); 41 | if (it) 42 | return it; 43 | } 44 | 45 | return NULL; 46 | } 47 | 48 | void __export ipdb_put_ipv6(struct ap_session *ses, struct ipv6db_item_t *it) 49 | { 50 | if (it->owner->put_ipv6) 51 | it->owner->put_ipv6(ses, it); 52 | } 53 | 54 | struct ipv6db_prefix_t __export *ipdb_get_ipv6_prefix(struct ap_session *ses) 55 | { 56 | struct ipdb_t *ipdb; 57 | struct ipv6db_prefix_t *it; 58 | 59 | list_for_each_entry(ipdb, &ipdb_handlers, entry) { 60 | if (!ipdb->get_ipv6_prefix) 61 | continue; 62 | it = ipdb->get_ipv6_prefix(ses); 63 | if (it) 64 | return it; 65 | } 66 | 67 | return NULL; 68 | } 69 | 70 | void __export ipdb_put_ipv6_prefix(struct ap_session *ses, struct ipv6db_prefix_t *it) 71 | { 72 | if (it->owner->put_ipv6_prefix) 73 | it->owner->put_ipv6_prefix(ses, it); 74 | } 75 | 76 | void __export build_ip6_addr(struct ipv6db_addr_t *a, uint64_t intf_id, struct in6_addr *addr) 77 | { 78 | memcpy(addr, &a->addr, sizeof(*addr)); 79 | 80 | if (a->prefix_len == 128) 81 | return; 82 | 83 | if (a->prefix_len <= 64) 84 | *(uint64_t *)(addr->s6_addr + 8) = intf_id; 85 | else 86 | *(uint64_t *)(addr->s6_addr + 8) |= intf_id & htobe64((1 << (128 - a->prefix_len)) - 1); 87 | 88 | } 89 | 90 | void __export ipdb_register(struct ipdb_t *ipdb) 91 | { 92 | list_add_tail(&ipdb->entry, &ipdb_handlers); 93 | } 94 | -------------------------------------------------------------------------------- /accel-pppd/triton/event.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "triton_p.h" 6 | 7 | #include "memdebug.h" 8 | 9 | static int max_events = 1024; 10 | static struct _triton_event_t **events; 11 | 12 | struct event_handler_t 13 | { 14 | struct list_head entry; 15 | triton_event_func func; 16 | }; 17 | 18 | int event_init(void) 19 | { 20 | events = malloc(max_events * sizeof(void *)); 21 | if (!events) { 22 | fprintf(stderr,"event:cann't allocate memory\n"); 23 | return -1; 24 | } 25 | 26 | memset(events, 0, max_events * sizeof(void *)); 27 | 28 | return 0; 29 | } 30 | 31 | int __export triton_event_register_handler(int ev_id, triton_event_func func) 32 | { 33 | struct _triton_event_t *ev; 34 | struct event_handler_t *h; 35 | 36 | if (ev_id >= max_events) 37 | return -1; 38 | 39 | ev = events[ev_id]; 40 | if (!ev) { 41 | ev = malloc(sizeof(*ev)); 42 | if (!ev) { 43 | triton_log_error("event: out of memory"); 44 | return -1; 45 | } 46 | INIT_LIST_HEAD(&ev->handlers); 47 | events[ev_id] = ev; 48 | } 49 | 50 | h = malloc(sizeof(*h)); 51 | if (!h) { 52 | triton_log_error("event: out of memory"); 53 | return -1; 54 | } 55 | 56 | h->func = func; 57 | list_add_tail(&h->entry, &ev->handlers); 58 | 59 | return 0; 60 | } 61 | 62 | /*int triton_event_unregister_handler(int ev_id, triton_event_func func) 63 | { 64 | struct _triton_event_t *ev; 65 | struct event_handler_t *h; 66 | 67 | if (ev_id >= max_events) 68 | return -1; 69 | 70 | ev = events[ev_id]; 71 | if (!ev) { 72 | return -1; 73 | } 74 | 75 | list_for_each_entry(h, &ev->handlers, entry) { 76 | if (h->func == func) { 77 | if (ev->in_progress) 78 | h->func = NULL; 79 | else { 80 | list_del(&h->entry); 81 | _free(h); 82 | } 83 | return 0; 84 | } 85 | } 86 | 87 | return -1; 88 | }*/ 89 | 90 | void __export triton_event_fire(int ev_id, void *arg) 91 | { 92 | struct _triton_event_t *ev; 93 | struct event_handler_t *h; 94 | 95 | if (ev_id >= max_events) 96 | return; 97 | 98 | ev = events[ev_id]; 99 | if (!ev) 100 | return; 101 | 102 | list_for_each_entry(h, &ev->handlers, entry) 103 | h->func(arg); 104 | } 105 | 106 | -------------------------------------------------------------------------------- /contrib/gentoo/net-dialup/accel-ppp/accel-ppp-1.3.5.ebuild: -------------------------------------------------------------------------------- 1 | # Copyright 1999-2006 Gentoo Foundation 2 | # Distributed under the terms of the GNU General Public License v2 3 | 4 | EAPI=2 5 | 6 | inherit eutils linux-mod cmake-utils 7 | 8 | DESCRIPTION="PPtP/L2TP/PPPoE Server for Linux" 9 | SRC_URI="http://sourceforge.net/projects/accel-ppp/files/accel-ppp/${P}.tar.bz2" 10 | HOMEPAGE="http://accel-ppp.sourceforge.net/" 11 | 12 | SLOT="0" 13 | LICENSE="GPL" 14 | KEYWORDS="~amd64 ~x86" 15 | IUSE="postgres debug shaper pptp_driver radius" 16 | 17 | DEPEND=">=sys-libs/glibc-2.8 18 | dev-libs/openssl 19 | dev-libs/libaio 20 | shaper? ( =dev-libs/libnl-2* ) 21 | postgres? ( dev-db/postgresql-base )" 22 | 23 | RDEPEND="$DEPEND 24 | pptp_driver? ( virtual/modutils )" 25 | 26 | BUILD_TARGETS="default" 27 | BUILD_PARAMS="KDIR=${KERNEL_DIR}" 28 | CONFIG_CHECK="PPP PPPOE" 29 | MODULESD_PPTP_ALIASES=("net-pf-24 pptp") 30 | PREFIX="/" 31 | MODULE_NAMES="pptp(extra:${S}/driver/)" 32 | 33 | src_prepare() { 34 | sed -i -e "/mkdir/d" "${S}/accel-pppd/CMakeLists.txt" 35 | sed -i -e "/echo/d" "${S}/accel-pppd/CMakeLists.txt" 36 | sed -i -e "/INSTALL/d" "${S}/driver/CMakeLists.txt" 37 | } 38 | 39 | src_configure() { 40 | if use debug; then 41 | mycmakeargs+=( "-DCMAKE_BUILD_TYPE=Debug" ) 42 | fi 43 | 44 | if use postgres; then 45 | mycmakeargs+=( "-DLOG_PGSQL=TRUE" ) 46 | fi 47 | 48 | if use shaper; then 49 | mycmakeargs+=( "-DSHAPER=TRUE" ) 50 | fi 51 | 52 | if ! use radius; then 53 | mycmakeargs+=( "-DRADIUS=FALSE" ) 54 | fi 55 | 56 | mycmakeargs+=( "-DCMAKE_INSTALL_PREFIX=/usr" ) 57 | 58 | cmake-utils_src_configure 59 | } 60 | 61 | src_compile() { 62 | cmake-utils_src_compile 63 | 64 | if use pptp_driver; then 65 | cd ${S}/driver 66 | #convert_to_m Makefile 67 | linux-mod_src_compile || die "failed to build driver" 68 | fi 69 | } 70 | 71 | src_install() { 72 | cmake-utils_src_install 73 | 74 | if use pptp_driver; then 75 | cd ${S}/driver 76 | linux-mod_src_install 77 | fi 78 | 79 | exeinto /etc/init.d 80 | newexe "${S}/contrib/gentoo/net-dialup/accel-ppp/files/accel-pppd-init" accel-pppd 81 | 82 | insinto /etc/conf.d 83 | newins "${S}/contrib/gentoo/net-dialup/accel-ppp/files/accel-pppd-confd" accel-pppd 84 | 85 | dodir /var/log/accel-ppp 86 | dodir /var/run/accel-ppp 87 | dodir /var/run/radattr 88 | } 89 | -------------------------------------------------------------------------------- /contrib/gentoo/net-dialup/accel-ppp/accel-ppp-9999.ebuild: -------------------------------------------------------------------------------- 1 | # Copyright 1999-2006 Gentoo Foundation 2 | # Distributed under the terms of the GNU General Public License v2 3 | 4 | EAPI=2 5 | 6 | inherit eutils git linux-mod cmake-utils 7 | 8 | EGIT_REPO_URI="git://accel-ppp.git.sourceforge.net/gitroot/accel-ppp/accel-ppp" 9 | 10 | DESCRIPTION="PPtP/L2TP/PPPoE Server for Linux" 11 | SRC_URI="" 12 | HOMEPAGE="http://accel-ppp.sourceforge.net/" 13 | 14 | SLOT="0" 15 | LICENSE="GPL" 16 | KEYWORDS="~amd64 ~x86" 17 | IUSE="postgres debug shaper pptp_driver radius" 18 | 19 | DEPEND=">=sys-libs/glibc-2.8 20 | dev-libs/openssl 21 | dev-libs/libaio 22 | shaper? ( =dev-libs/libnl-2* ) 23 | postgres? ( dev-db/postgresql-base )" 24 | 25 | RDEPEND="$DEPEND 26 | pptp_driver? ( virtual/modutils )" 27 | 28 | BUILD_TARGETS="default" 29 | BUILD_PARAMS="KDIR=${KERNEL_DIR}" 30 | CONFIG_CHECK="PPP PPPOE" 31 | MODULESD_PPTP_ALIASES=("net-pf-24 pptp") 32 | PREFIX="/" 33 | MODULE_NAMES="pptp(extra:${S}/driver/)" 34 | 35 | src_unpack () { 36 | git_src_unpack 37 | } 38 | 39 | src_prepare() { 40 | sed -i -e "/mkdir/d" "${S}/accel-pppd/CMakeLists.txt" 41 | sed -i -e "/echo/d" "${S}/accel-pppd/CMakeLists.txt" 42 | sed -i -e "/INSTALL/d" "${S}/driver/CMakeLists.txt" 43 | } 44 | 45 | src_configure() { 46 | if use debug; then 47 | mycmakeargs+=( "-DCMAKE_BUILD_TYPE=Debug" ) 48 | fi 49 | 50 | if use postgres; then 51 | mycmakeargs+=( "-DLOG_PGSQL=TRUE" ) 52 | fi 53 | 54 | if use shaper; then 55 | mycmakeargs+=( "-DSHAPER=TRUE" ) 56 | fi 57 | 58 | if ! use radius; then 59 | mycmakeargs+=( "-DRADIUS=FALSE" ) 60 | fi 61 | 62 | mycmakeargs+=( "-DCMAKE_INSTALL_PREFIX=/usr" ) 63 | 64 | cmake-utils_src_configure 65 | } 66 | 67 | src_compile() { 68 | cmake-utils_src_compile 69 | 70 | if use pptp_driver; then 71 | cd ${S}/driver 72 | #convert_to_m Makefile 73 | linux-mod_src_compile || die "failed to build driver" 74 | fi 75 | } 76 | 77 | src_install() { 78 | cmake-utils_src_install 79 | 80 | if use pptp_driver; then 81 | cd ${S}/driver 82 | linux-mod_src_install 83 | fi 84 | 85 | exeinto /etc/init.d 86 | newexe "${S}/contrib/gentoo/net-dialup/accel-ppp/files/accel-pppd-init" accel-pppd 87 | 88 | insinto /etc/conf.d 89 | newins "${S}/contrib/gentoo/net-dialup/accel-ppp/files/accel-pppd-confd" accel-pppd 90 | 91 | dodir /var/log/accel-ppp 92 | dodir /var/run/accel-ppp 93 | dodir /var/run/radattr 94 | } 95 | -------------------------------------------------------------------------------- /accel-pppd/triton/loader.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "triton_p.h" 10 | 11 | #include "memdebug.h" 12 | 13 | struct module_t 14 | { 15 | struct list_head entry; 16 | char *name; 17 | void *handle; 18 | }; 19 | 20 | static LIST_HEAD(modules); 21 | 22 | int load_modules(const char *name) 23 | { 24 | struct conf_sect_t *sect; 25 | struct conf_option_t *opt; 26 | char *fname; 27 | char *path = MODULE_PATH; 28 | char *ptr1, *ptr2; 29 | struct module_t *m; 30 | void *h; 31 | 32 | sect = conf_get_section(name); 33 | if (!sect) { 34 | fprintf(stderr, "loader: section '%s' not found\n", name); 35 | return -1; 36 | } 37 | 38 | fname = _malloc(PATH_MAX); 39 | 40 | list_for_each_entry(opt, §->items, entry) { 41 | if (!strcmp(opt->name,"path") && opt->val) { 42 | path = opt->val; 43 | continue; 44 | } 45 | 46 | strcpy(fname, path); 47 | strcat(fname, "/"); 48 | strcat(fname, opt->name); 49 | if (access(fname, F_OK)) { 50 | strcpy(fname, path); 51 | strcat(fname, "/lib"); 52 | strcat(fname, opt->name); 53 | strcat(fname, ".so"); 54 | if (access(fname, F_OK)) { 55 | strcpy(fname, opt->name); 56 | if (access(opt->name, F_OK)) { 57 | triton_log_error("loader: '%s' not found", opt->name); 58 | continue; 59 | } 60 | } 61 | } 62 | 63 | h = dlopen(fname, RTLD_LAZY | RTLD_GLOBAL); 64 | if (!h) { 65 | triton_log_error("loader: failed to load '%s': %s", opt->name, dlerror()); 66 | _free(fname); 67 | return -1; 68 | } 69 | 70 | ptr1 = fname; 71 | while (1) { 72 | ptr2 = strchr(ptr1, '/'); 73 | if (!ptr2) 74 | break; 75 | ptr1 = ptr2 + 1; 76 | } 77 | 78 | if (!strncmp(ptr1, "lib", 3)) 79 | ptr1 += 3; 80 | 81 | ptr2 = strstr(ptr1, ".so\x0"); 82 | if (ptr2) 83 | *ptr2 = 0; 84 | 85 | m = _malloc(sizeof(*m)); 86 | m->name = _strdup(ptr1); 87 | m->handle = h; 88 | list_add_tail(&m->entry, &modules); 89 | } 90 | 91 | _free(fname); 92 | 93 | return 0; 94 | } 95 | 96 | int __export triton_module_loaded(const char *name) 97 | { 98 | struct module_t *m; 99 | 100 | list_for_each_entry(m, &modules, entry) { 101 | if (strcmp(m->name, name)) 102 | continue; 103 | return 1; 104 | } 105 | 106 | return 0; 107 | } 108 | 109 | -------------------------------------------------------------------------------- /accel-pppd/ctrl/l2tp/attr_defs.h: -------------------------------------------------------------------------------- 1 | #ifndef __ATTR_DEFS_H 2 | #define __ATTR_DEFS_H 3 | 4 | #define Message_Type 0 5 | #define Random_Vector 36 6 | #define Result_Code 1 7 | #define Protocol_Version 2 8 | #define Framing_Capabilities 3 9 | #define Bearer_Capabilities 4 10 | #define Tie_Breaker 5 11 | #define Firmware_Revision 6 12 | #define Host_Name 7 13 | #define Vendor_Name 8 14 | #define Assigned_Tunnel_ID 9 15 | #define Recv_Window_Size 10 16 | #define Challenge 11 17 | #define Challenge_Response 13 18 | #define Cause_Code 12 19 | #define Assigned_Session_ID 14 20 | #define Call_Serial_Number 15 21 | #define Minimum_BPS 16 22 | #define Maximum_BPS 17 23 | #define Bearer_Type 18 24 | #define Framing_Type 19 25 | #define Called_Number 21 26 | #define Calling_Number 22 27 | #define Sub_Address 23 28 | #define TX_Speed 24 29 | #define RX_Speed 38 30 | #define Physical_Channel_ID 25 31 | #define Private_Group_ID 37 32 | #define Sequencing_Required 39 33 | #define Init_Recv_LCP 26 34 | #define Last_Sent_LCP 27 35 | #define Last_Recv_LCP 28 36 | #define Proxy_Authen_Type 29 37 | #define Proxy_Authen_Name 30 38 | #define Proxy_Authen_Challenge 31 39 | #define Proxy_Authen_ID 32 40 | #define Proxy_Authen_Response 33 41 | #define Call_Errors 34 42 | #define ACCM 35 43 | #define Message_Type_Start_Ctrl_Conn_Request 1 44 | #define Message_Type_Start_Ctrl_Conn_Reply 2 45 | #define Message_Type_Start_Ctrl_Conn_Connected 3 46 | #define Message_Type_Stop_Ctrl_Conn_Notify 4 47 | #define Message_Type_Hello 6 48 | #define Message_Type_Outgoing_Call_Request 7 49 | #define Message_Type_Outgoing_Call_Reply 8 50 | #define Message_Type_Outgoing_Call_Connected 9 51 | #define Message_Type_Incoming_Call_Request 10 52 | #define Message_Type_Incoming_Call_Reply 11 53 | #define Message_Type_Incoming_Call_Connected 12 54 | #define Message_Type_Call_Disconnect_Notify 14 55 | #define Message_Type_WAN_Error_Notify 15 56 | #define Message_Type_Set_Link_Info 16 57 | #define Message_Digest 59 58 | #define Ctrl_Message_Auth_Nonce 73 59 | #define Router_ID 60 60 | #define Assigned_Connection_ID 61 61 | #define Pseudowire_Capabilities 62 62 | #define Prefered_Language 72 63 | #define Local_Session_ID 63 64 | #define Remote_Session_ID 64 65 | #define Assigned_Cookie 65 66 | #define Remote_End_ID 66 67 | #define Pseudowire_Type 68 68 | #define L2_Specific_Sublayer 69 69 | #define Data_Sequencing 70 70 | #define TX_Connect_Speed 74 71 | #define RX_Connect_Speed 75 72 | #define Circuit_Status 71 73 | #define Message_Type_Explicit_Ack 20 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /accel-pppd/backup/backup.h: -------------------------------------------------------------------------------- 1 | #ifndef __BACKUP_H 2 | #define __BACKUP_H 3 | 4 | #include 5 | #include "list.h" 6 | 7 | #define MODID_COMMON 1 8 | #define MODID_RADIUS 2 9 | #define MODID_PPPOE 3 10 | #define MODID_IPOE 4 11 | #define MODID_PPTP 5 12 | #define MODID_L2TP 6 13 | #define MODID_IPPOOL 7 14 | 15 | 16 | struct ap_session; 17 | struct backup_storage; 18 | struct backup_data; 19 | 20 | struct backup_tag 21 | { 22 | struct list_head entry; 23 | uint16_t internal:1; 24 | uint16_t id:15; 25 | uint16_t size; 26 | uint8_t *data; 27 | }; 28 | 29 | struct backup_mod 30 | { 31 | struct backup_data *data; 32 | struct list_head entry; 33 | int id; 34 | struct list_head tag_list; 35 | }; 36 | 37 | struct backup_data 38 | { 39 | struct ap_session *ses; 40 | struct backup_storage *storage; 41 | struct list_head mod_list; 42 | int internal:1; 43 | }; 44 | 45 | struct backup_module 46 | { 47 | struct list_head entry; 48 | int id; 49 | 50 | int (*save)(struct ap_session *, struct backup_mod *); 51 | int (*restore)(struct ap_session *, struct backup_mod *); 52 | 53 | struct ap_session *(*ctrl_restore)(struct backup_mod *); 54 | void (*ctrl_start)(struct ap_session *ses); 55 | void (*restore_complete)(void); 56 | }; 57 | 58 | struct backup_storage 59 | { 60 | struct list_head entry; 61 | 62 | /*int (*check_integrity)(void); 63 | int (*restore)(int internal);*/ 64 | 65 | void (*restore)(int internal); 66 | 67 | struct backup_data *(*create)(struct ap_session *); 68 | int (*commit)(struct backup_data *); 69 | void (*free)(struct backup_data *); 70 | 71 | struct backup_mod *(*alloc_mod)(struct backup_data *); 72 | void (*free_mod)(struct backup_mod *); 73 | 74 | void (*add_fd)(struct backup_data *, int fd); 75 | 76 | struct backup_tag *(*alloc_tag)(struct backup_data *, int size); 77 | void (*free_tag)(struct backup_data *, struct backup_tag *); 78 | }; 79 | 80 | void backup_register_module(struct backup_module *); 81 | void backup_register_storage(struct backup_storage *); 82 | 83 | int backup_save_session(struct ap_session *ses); 84 | void backup_restore_session(struct backup_data *d); 85 | 86 | struct backup_mod *backup_find_mod(struct backup_data *d, uint8_t mod_id); 87 | struct backup_tag *backup_find_tag(struct backup_data *d, uint8_t mod_id, uint8_t tag_id, int internal); 88 | struct backup_tag *backup_add_tag(struct backup_mod *m, uint8_t id, int internal, const void *data, size_t size); 89 | void backup_add_fd(struct backup_mod *m, int fd); 90 | 91 | void backup_restore(int internal); 92 | void backup_restore_fd(); 93 | 94 | #endif 95 | 96 | -------------------------------------------------------------------------------- /accel-pppd/ppp/ppp_ccp.h: -------------------------------------------------------------------------------- 1 | #ifndef PPP_CCP_H 2 | #define PPP_CCP_H 3 | 4 | #include 5 | 6 | #include "triton.h" 7 | #include "ppp_fsm.h" 8 | /* 9 | * Options. 10 | */ 11 | 12 | #define CI_MPPE 18 /* MPPE */ 13 | 14 | struct ccp_hdr_t 15 | { 16 | uint16_t proto; 17 | uint8_t code; 18 | uint8_t id; 19 | uint16_t len; 20 | } __attribute__((packed)); 21 | struct ccp_opt_hdr_t 22 | { 23 | uint8_t id; 24 | uint8_t len; 25 | } __attribute__((packed)); 26 | struct ccp_opt8_t 27 | { 28 | struct ccp_opt_hdr_t hdr; 29 | uint8_t val; 30 | } __attribute__((packed)); 31 | struct ccp_opt16_t 32 | { 33 | struct ccp_opt_hdr_t hdr; 34 | uint16_t val; 35 | } __attribute__((packed)); 36 | struct ccp_opt32_t 37 | { 38 | struct ccp_opt_hdr_t hdr; 39 | uint32_t val; 40 | } __attribute__((packed)); 41 | 42 | #define CCP_OPT_NONE 0 43 | #define CCP_OPT_ACK 1 44 | #define CCP_OPT_NAK -1 45 | #define CCP_OPT_REJ -2 46 | #define CCP_OPT_FAIL -3 47 | 48 | struct ppp_ccp_t; 49 | struct ccp_option_handler_t; 50 | 51 | struct ccp_option_t 52 | { 53 | struct list_head entry; 54 | int id; 55 | int len; 56 | int state; 57 | struct ccp_option_handler_t *h; 58 | }; 59 | 60 | struct ccp_option_handler_t 61 | { 62 | struct list_head entry; 63 | struct ccp_option_t* (*init)(struct ppp_ccp_t*); 64 | int (*send_conf_req)(struct ppp_ccp_t*,struct ccp_option_t*,uint8_t*); 65 | int (*send_conf_rej)(struct ppp_ccp_t*,struct ccp_option_t*,uint8_t*); 66 | int (*send_conf_nak)(struct ppp_ccp_t*,struct ccp_option_t*,uint8_t*); 67 | int (*recv_conf_req)(struct ppp_ccp_t*,struct ccp_option_t*,uint8_t*); 68 | int (*recv_conf_rej)(struct ppp_ccp_t*,struct ccp_option_t*,uint8_t*); 69 | int (*recv_conf_nak)(struct ppp_ccp_t*,struct ccp_option_t*,uint8_t*); 70 | int (*recv_conf_ack)(struct ppp_ccp_t*,struct ccp_option_t*,uint8_t*); 71 | void (*free)(struct ppp_ccp_t*,struct ccp_option_t*); 72 | void (*print)(void (*print)(const char *fmt,...), struct ccp_option_t*,uint8_t*); 73 | }; 74 | 75 | struct ppp_ccp_t 76 | { 77 | struct ppp_layer_data_t ld; 78 | struct ppp_handler_t hnd; 79 | struct ppp_fsm_t fsm; 80 | struct ppp_t *ppp; 81 | struct list_head options; 82 | 83 | struct list_head ropt_list; // last received ConfReq 84 | int ropt_len; 85 | 86 | int conf_req_len; 87 | int starting:1; 88 | int started:1; 89 | }; 90 | 91 | int ccp_option_register(struct ccp_option_handler_t *h); 92 | struct ccp_option_t *ccp_find_option(struct ppp_t *ppp, struct ccp_option_handler_t *h); 93 | 94 | struct ppp_ccp_t *ccp_find_layer_data(struct ppp_t *ppp); 95 | int ccp_ipcp_started(struct ppp_t *ppp); 96 | 97 | #endif 98 | 99 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/sessionTable_data_access.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: this file originally auto-generated by mib2c using 3 | * version : 14170 $ of $ 4 | * 5 | * $Id:$ 6 | */ 7 | #ifndef SESSIONTABLE_DATA_ACCESS_H 8 | #define SESSIONTABLE_DATA_ACCESS_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | 15 | /* ********************************************************************* 16 | * function declarations 17 | */ 18 | 19 | /* ********************************************************************* 20 | * Table declarations 21 | */ 22 | /********************************************************************** 23 | ********************************************************************** 24 | *** 25 | *** Table sessionTable 26 | *** 27 | ********************************************************************** 28 | **********************************************************************/ 29 | /* 30 | * ACCEL-PPP-MIB::sessionTable is subid 1 of accelPPPSessions. 31 | * Its status is Current. 32 | * OID: .1.3.6.1.4.1.8072.100.2.1, length: 10 33 | */ 34 | 35 | 36 | int sessionTable_init_data(sessionTable_registration * sessionTable_reg); 37 | 38 | 39 | /* 40 | * TODO:180:o: Review sessionTable cache timeout. 41 | * The number of seconds before the cache times out 42 | */ 43 | #define SESSIONTABLE_CACHE_TIMEOUT 60 44 | 45 | void sessionTable_container_init(netsnmp_container **container_ptr_ptr, 46 | netsnmp_cache *cache); 47 | void sessionTable_container_shutdown(netsnmp_container *container_ptr); 48 | 49 | int sessionTable_container_load(netsnmp_container *container); 50 | void sessionTable_container_free(netsnmp_container *container); 51 | 52 | int sessionTable_cache_load(netsnmp_container *container); 53 | void sessionTable_cache_free(netsnmp_container *container); 54 | 55 | /* 56 | *************************************************** 57 | *** START EXAMPLE CODE *** 58 | ***---------------------------------------------***/ 59 | /* ********************************************************************* 60 | * Since we have no idea how you really access your data, we'll go with 61 | * a worst case example: a flat text file. 62 | */ 63 | #define MAX_LINE_SIZE 256 64 | /* 65 | ***---------------------------------------------*** 66 | *** END EXAMPLE CODE *** 67 | ***************************************************/ 68 | int sessionTable_row_prep( sessionTable_rowreq_ctx *rowreq_ctx); 69 | 70 | 71 | 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | 76 | #endif /* SESSIONTABLE_DATA_ACCESS_H */ 77 | -------------------------------------------------------------------------------- /accel-pppd/ppp/ppp_fsm.h: -------------------------------------------------------------------------------- 1 | #ifndef PPP_FSM_H 2 | #define PPP_FSM_H 3 | 4 | typedef enum {FSM_Initial=0,FSM_Starting,FSM_Closed,FSM_Stopped,FSM_Closing,FSM_Stopping,FSM_Req_Sent,FSM_Ack_Rcvd,FSM_Ack_Sent,FSM_Opened} FSM_STATE; 5 | /* 6 | * CP (LCP, IPCP, etc.) codes. 7 | */ 8 | #define CONFREQ 1 /* Configuration Request */ 9 | #define CONFACK 2 /* Configuration Ack */ 10 | #define CONFNAK 3 /* Configuration Nak */ 11 | #define CONFREJ 4 /* Configuration Reject */ 12 | #define TERMREQ 5 /* Termination Request */ 13 | #define TERMACK 6 /* Termination Ack */ 14 | #define CODEREJ 7 /* Code Reject */ 15 | #define PROTOREJ 8 /* Code Reject */ 16 | #define ECHOREQ 9 /* Echo Request */ 17 | #define ECHOREP 10 /* Echo Reply */ 18 | #define DISCARDREQ 11 /* Discard Request */ 19 | #define IDENT 12 /* Identification */ 20 | 21 | struct ppp_t; 22 | 23 | struct ppp_fsm_t 24 | { 25 | struct ppp_t *ppp; 26 | FSM_STATE fsm_state; 27 | uint16_t proto; 28 | 29 | struct triton_timer_t restart_timer; 30 | int restart_counter; 31 | int max_terminate; 32 | int max_configure; 33 | int max_failure; 34 | int conf_failure; 35 | 36 | int id; 37 | int recv_id; 38 | 39 | //fsm handling 40 | void (*layer_up)(struct ppp_fsm_t*); 41 | void (*layer_down)(struct ppp_fsm_t*); 42 | void (*layer_started)(struct ppp_fsm_t*); 43 | void (*layer_finished)(struct ppp_fsm_t*); 44 | int (*send_conf_req)(struct ppp_fsm_t*); 45 | void (*send_conf_ack)(struct ppp_fsm_t*); 46 | void (*send_conf_nak)(struct ppp_fsm_t*); 47 | void (*send_conf_rej)(struct ppp_fsm_t*); 48 | void (*send_code_rej)(struct ppp_fsm_t*); 49 | void (*send_term_req)(struct ppp_fsm_t*); 50 | void (*send_term_ack)(struct ppp_fsm_t*); 51 | }; 52 | 53 | void ppp_fsm_init(struct ppp_fsm_t*); 54 | void ppp_fsm_free(struct ppp_fsm_t*); 55 | 56 | int ppp_fsm_lower_up(struct ppp_fsm_t*); 57 | void ppp_fsm_lower_down(struct ppp_fsm_t*); 58 | int ppp_fsm_open(struct ppp_fsm_t*); 59 | void ppp_fsm_close(struct ppp_fsm_t*); 60 | void ppp_fsm_close2(struct ppp_fsm_t *layer); 61 | void ppp_fsm_timeout0(struct ppp_fsm_t *layer); 62 | void ppp_fsm_timeout1(struct ppp_fsm_t *layer); 63 | void ppp_fsm_recv_conf_req_ack(struct ppp_fsm_t *layer); 64 | void ppp_fsm_recv_conf_req_nak(struct ppp_fsm_t *layer); 65 | void ppp_fsm_recv_conf_req_rej(struct ppp_fsm_t *layer); 66 | void ppp_fsm_recv_conf_ack(struct ppp_fsm_t *layer); 67 | void ppp_fsm_recv_conf_rej(struct ppp_fsm_t *layer); 68 | void ppp_fsm_recv_term_req(struct ppp_fsm_t *layer); 69 | void ppp_fsm_recv_term_ack(struct ppp_fsm_t *layer); 70 | void ppp_fsm_recv_unk(struct ppp_fsm_t *layer); 71 | void ppp_fsm_recv_code_rej_bad(struct ppp_fsm_t *layer); 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /accel-pppd/radius/stat_accm.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "radius_p.h" 5 | #include "mempool.h" 6 | #include "memdebug.h" 7 | 8 | struct item_t 9 | { 10 | struct list_head entry; 11 | unsigned int val; 12 | time_t ts; 13 | }; 14 | 15 | struct stat_accm_t 16 | { 17 | pthread_mutex_t lock; 18 | struct list_head items; 19 | unsigned int items_cnt; 20 | unsigned int time; 21 | unsigned long total; 22 | }; 23 | 24 | static mempool_t item_pool; 25 | 26 | struct stat_accm_t *stat_accm_create(unsigned int time) 27 | { 28 | struct stat_accm_t *s = _malloc(sizeof(*s)); 29 | 30 | memset(s, 0, sizeof(*s)); 31 | pthread_mutex_init(&s->lock, NULL); 32 | INIT_LIST_HEAD(&s->items); 33 | s->time = time; 34 | 35 | return s; 36 | } 37 | 38 | void stat_accm_free(struct stat_accm_t *s) 39 | { 40 | struct item_t *it; 41 | 42 | while (!list_empty(&s->items)) { 43 | it = list_entry(s->items.next, typeof(*it), entry); 44 | list_del(&it->entry); 45 | mempool_free(it); 46 | } 47 | 48 | _free(s); 49 | } 50 | 51 | static void stat_accm_clean(struct stat_accm_t *s) 52 | { 53 | struct item_t *it; 54 | struct timespec ts; 55 | 56 | clock_gettime(CLOCK_MONOTONIC, &ts); 57 | 58 | while (!list_empty(&s->items)) { 59 | it = list_entry(s->items.next, typeof(*it), entry); 60 | if (ts.tv_sec - it->ts > s->time) { 61 | list_del(&it->entry); 62 | --s->items_cnt; 63 | s->total -= it->val; 64 | mempool_free(it); 65 | } else 66 | break; 67 | } 68 | } 69 | 70 | void stat_accm_add(struct stat_accm_t *s, unsigned int val) 71 | { 72 | struct item_t *it; 73 | struct timespec ts; 74 | 75 | clock_gettime(CLOCK_MONOTONIC, &ts); 76 | 77 | pthread_mutex_lock(&s->lock); 78 | 79 | stat_accm_clean(s); 80 | 81 | it = mempool_alloc(item_pool); 82 | it->ts = ts.tv_sec; 83 | it->val = val; 84 | list_add_tail(&it->entry, &s->items); 85 | ++s->items_cnt; 86 | s->total += val; 87 | 88 | pthread_mutex_unlock(&s->lock); 89 | } 90 | 91 | unsigned long stat_accm_get_cnt(struct stat_accm_t *s) 92 | { 93 | pthread_mutex_lock(&s->lock); 94 | stat_accm_clean(s); 95 | pthread_mutex_unlock(&s->lock); 96 | 97 | return s->items_cnt; 98 | } 99 | 100 | unsigned long stat_accm_get_avg(struct stat_accm_t *s) 101 | { 102 | unsigned long val; 103 | pthread_mutex_lock(&s->lock); 104 | stat_accm_clean(s); 105 | val = s->items_cnt ? s->total/s->items_cnt : 0; 106 | pthread_mutex_unlock(&s->lock); 107 | 108 | return val; 109 | } 110 | 111 | static void init(void) 112 | { 113 | item_pool = mempool_create(sizeof(struct item_t)); 114 | } 115 | 116 | DEFINE_INIT(50, init); 117 | -------------------------------------------------------------------------------- /accel-pppd/ctrl/l2tp/netlink.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "l2tp_kernel.h" 6 | #include "triton.h" 7 | 8 | static int family; 9 | 10 | void l2tp_nl_delete_tunnel(int tid) 11 | { 12 | struct nl_sock *nl_sock; 13 | struct nl_msg *msg; 14 | 15 | nl_sock = nl_socket_alloc(); 16 | msg = nlmsg_alloc(); 17 | 18 | genl_connect(nl_sock); 19 | 20 | genlmsg_put(msg, NL_AUTO_PID, NL_AUTO_SEQ, family, 0, NLM_F_REQUEST, L2TP_CMD_TUNNEL_DELETE, L2TP_GENL_VERSION); 21 | nla_put_u32(msg, L2TP_ATTR_CONN_ID, tid); 22 | 23 | nl_send_auto_complete(nl_sock, msg); 24 | nl_recvmsgs_default(nl_sock); 25 | 26 | nlmsg_free(msg); 27 | nl_close(nl_sock); 28 | nl_socket_free(nl_sock); 29 | } 30 | 31 | void l2tp_nl_create_tunnel(int fd, int tid, int peer_tid) 32 | { 33 | struct nl_sock *nl_sock; 34 | struct nl_msg *msg; 35 | 36 | nl_sock = nl_socket_alloc(); 37 | msg = nlmsg_alloc(); 38 | 39 | genl_connect(nl_sock); 40 | 41 | genlmsg_put(msg, NL_AUTO_PID, NL_AUTO_SEQ, family, 0, NLM_F_REQUEST, L2TP_CMD_TUNNEL_CREATE, L2TP_GENL_VERSION); 42 | nla_put_u16(msg, L2TP_ATTR_ENCAP_TYPE, L2TP_ENCAPTYPE_UDP); 43 | nla_put_u8(msg, L2TP_ATTR_PROTO_VERSION, 2); 44 | nla_put_u32(msg, L2TP_ATTR_CONN_ID, tid); 45 | nla_put_u32(msg, L2TP_ATTR_PEER_CONN_ID, peer_tid); 46 | nla_put_u32(msg, L2TP_ATTR_FD, fd); 47 | //nla_put_u32(msg, L2TP_ATTR_DEBUG, 0xffffffff); 48 | 49 | nl_send_auto_complete(nl_sock, msg); 50 | nl_recvmsgs_default(nl_sock); 51 | 52 | nlmsg_free(msg); 53 | nl_close(nl_sock); 54 | nl_socket_free(nl_sock); 55 | } 56 | 57 | void l2tp_nl_create_session(int tid, int sid, int peer_sid) 58 | { 59 | struct nl_sock *nl_sock; 60 | struct nl_msg *msg; 61 | 62 | nl_sock = nl_socket_alloc(); 63 | msg = nlmsg_alloc(); 64 | 65 | genl_connect(nl_sock); 66 | 67 | genlmsg_put(msg, NL_AUTO_PID, NL_AUTO_SEQ, family, 0, NLM_F_REQUEST, L2TP_CMD_SESSION_CREATE, L2TP_GENL_VERSION); 68 | nla_put_u32(msg, L2TP_ATTR_CONN_ID, tid); 69 | nla_put_u32(msg, L2TP_ATTR_SESSION_ID, sid); 70 | nla_put_u32(msg, L2TP_ATTR_PEER_SESSION_ID, peer_sid); 71 | nla_put_u16(msg, L2TP_ATTR_PW_TYPE, L2TP_PWTYPE_PPP); 72 | nla_put_u8(msg, L2TP_ATTR_LNS_MODE, 1); 73 | //nla_put_u32(msg, L2TP_ATTR_DEBUG, 0xffffffff); 74 | 75 | nl_send_auto_complete(nl_sock, msg); 76 | nl_recvmsgs_default(nl_sock); 77 | 78 | nlmsg_free(msg); 79 | nl_close(nl_sock); 80 | nl_socket_free(nl_sock); 81 | } 82 | 83 | static void init(void) 84 | { 85 | struct nl_sock *nl_sock = nl_socket_alloc(); 86 | 87 | genl_connect(nl_sock); 88 | 89 | family = genl_ctrl_resolve(nl_sock, L2TP_GENL_NAME); 90 | 91 | nl_close(nl_sock); 92 | nl_socket_free(nl_sock); 93 | } 94 | 95 | DEFINE_INIT(21, init); 96 | -------------------------------------------------------------------------------- /accel-pppd/radius/dict/dictionary: -------------------------------------------------------------------------------- 1 | # -*- text -*- 2 | # 3 | # Version $Id: dictionary,v 1.155 2008/04/20 14:47:55 aland Exp $ 4 | # 5 | # DO NOT EDIT THE FILES IN THIS DIRECTORY 6 | # 7 | # The files in this directory are maintained and updated by 8 | # the FreeRADIUS project. Newer releases of software may update 9 | # or change these files. 10 | # 11 | # Use the main dictionary file (usually /etc/raddb/dictionary) 12 | # for local system attributes and $INCLUDEs. 13 | # 14 | # 15 | # 16 | # This file contains dictionary translations for parsing 17 | # requests and generating responses. All transactions are 18 | # composed of Attribute/Value Pairs. The value of each attribute 19 | # is specified as one of 4 data types. Valid data types are: 20 | # 21 | # text - printable, generally UTF-8 encoded (subset of 'string') 22 | # string - 0-253 octets 23 | # ipaddr - 4 octets in network byte order 24 | # integer - 32 bit value in big endian order (high byte first) 25 | # date - 32 bit value in big endian order - seconds since 26 | # 00:00:00 GMT, Jan. 1, 1970 27 | # ifid - 8 octets in network byte order 28 | # ipv6addr - 16 octets in network byte order 29 | # ipv6prefix - 18 octets in network byte order 30 | # ether - 6 octets of hh:hh:hh:hh:hh:hh 31 | # where 'h' is hex digits, upper or lowercase. 32 | # 33 | # FreeRADIUS includes extended data types which are not defined 34 | # in the RFC's. These data types are: 35 | # 36 | # abinary - Ascend's binary filter format. 37 | # octets - raw octets, printed and input as hex strings. 38 | # e.g.: 0x123456789abcdef 39 | # 40 | # 41 | # Enumerated values are stored in the user file with dictionary 42 | # VALUE translations for easy administration. 43 | # 44 | # Example: 45 | # 46 | # ATTRIBUTE VALUE 47 | # --------------- ----- 48 | # Framed-Protocol = PPP 49 | # 7 = 1 (integer encoding) 50 | # 51 | 52 | # 53 | # Include compatibility dictionary for older users file. Move 54 | # this directive to the end of this file if you want to see the 55 | # old names in the logfiles, INSTEAD OF the new names. 56 | # 57 | # 58 | # Include the RFC dictionaries next. 59 | # 60 | # For a complete list of the standard attributes and values, 61 | # see: 62 | # http://www.iana.org/assignments/radius-types 63 | # 64 | $INCLUDE dictionary.rfc2865 65 | $INCLUDE dictionary.rfc2866 66 | $INCLUDE dictionary.rfc2867 67 | $INCLUDE dictionary.rfc2868 68 | $INCLUDE dictionary.rfc2869 69 | $INCLUDE dictionary.rfc3162 70 | $INCLUDE dictionary.rfc3576 71 | $INCLUDE dictionary.rfc3580 72 | $INCLUDE dictionary.rfc4072 73 | $INCLUDE dictionary.rfc4372 74 | $INCLUDE dictionary.rfc4679 75 | $INCLUDE dictionary.rfc4818 76 | $INCLUDE dictionary.rfc5176 77 | 78 | $INCLUDE dictionary.microsoft 79 | $INCLUDE dictionary.cisco 80 | $INCLUDE dictionary.alcatel 81 | $INCLUDE dictionary.dhcp 82 | -------------------------------------------------------------------------------- /accel-pppd/radius/dict/dictionary.microsoft: -------------------------------------------------------------------------------- 1 | # -*- text -*- 2 | # 3 | # Microsoft's VSA's, from RFC 2548 4 | # 5 | # $Id: dictionary.microsoft,v 1.8 2005/08/08 22:23:37 aland Exp $ 6 | # 7 | 8 | VENDOR Microsoft 311 9 | 10 | BEGIN-VENDOR Microsoft 11 | ATTRIBUTE MS-CHAP-Response 1 octets 12 | ATTRIBUTE MS-CHAP-Error 2 string 13 | ATTRIBUTE MS-CHAP-CPW-1 3 octets 14 | ATTRIBUTE MS-CHAP-CPW-2 4 octets 15 | ATTRIBUTE MS-CHAP-LM-Enc-PW 5 octets 16 | ATTRIBUTE MS-CHAP-NT-Enc-PW 6 octets 17 | ATTRIBUTE MS-MPPE-Encryption-Policy 7 integer 18 | # This is referred to as both singular and plural in the RFC. 19 | # Plural seems to make more sense. 20 | ATTRIBUTE MS-MPPE-Encryption-Type 8 integer 21 | ATTRIBUTE MS-MPPE-Encryption-Types 8 integer 22 | ATTRIBUTE MS-RAS-Vendor 9 integer # content is Vendor-ID 23 | ATTRIBUTE MS-CHAP-Domain 10 string 24 | ATTRIBUTE MS-CHAP-Challenge 11 octets 25 | ATTRIBUTE MS-CHAP-MPPE-Keys 12 octets encrypt=1 26 | ATTRIBUTE MS-BAP-Usage 13 integer 27 | ATTRIBUTE MS-Link-Utilization-Threshold 14 integer # values are 1-100 28 | ATTRIBUTE MS-Link-Drop-Time-Limit 15 integer 29 | ATTRIBUTE MS-MPPE-Send-Key 16 octets encrypt=2 30 | ATTRIBUTE MS-MPPE-Recv-Key 17 octets encrypt=2 31 | ATTRIBUTE MS-RAS-Version 18 string 32 | ATTRIBUTE MS-Old-ARAP-Password 19 octets 33 | ATTRIBUTE MS-New-ARAP-Password 20 octets 34 | ATTRIBUTE MS-ARAP-PW-Change-Reason 21 integer 35 | 36 | ATTRIBUTE MS-Filter 22 octets 37 | ATTRIBUTE MS-Acct-Auth-Type 23 integer 38 | ATTRIBUTE MS-Acct-EAP-Type 24 integer 39 | 40 | ATTRIBUTE MS-CHAP2-Response 25 octets 41 | ATTRIBUTE MS-CHAP2-Success 26 octets 42 | ATTRIBUTE MS-CHAP2-CPW 27 octets 43 | 44 | ATTRIBUTE MS-Primary-DNS-Server 28 ipaddr 45 | ATTRIBUTE MS-Secondary-DNS-Server 29 ipaddr 46 | ATTRIBUTE MS-Primary-NBNS-Server 30 ipaddr 47 | ATTRIBUTE MS-Secondary-NBNS-Server 31 ipaddr 48 | 49 | #ATTRIBUTE MS-ARAP-Challenge 33 octets 50 | 51 | # 52 | # Integer Translations 53 | # 54 | 55 | # MS-BAP-Usage Values 56 | 57 | VALUE MS-BAP-Usage Not-Allowed 0 58 | VALUE MS-BAP-Usage Allowed 1 59 | VALUE MS-BAP-Usage Required 2 60 | 61 | # MS-ARAP-Password-Change-Reason Values 62 | 63 | VALUE MS-ARAP-PW-Change-Reason Just-Change-Password 1 64 | VALUE MS-ARAP-PW-Change-Reason Expired-Password 2 65 | VALUE MS-ARAP-PW-Change-Reason Admin-Requires-Password-Change 3 66 | VALUE MS-ARAP-PW-Change-Reason Password-Too-Short 4 67 | 68 | # MS-Acct-Auth-Type Values 69 | 70 | VALUE MS-Acct-Auth-Type PAP 1 71 | VALUE MS-Acct-Auth-Type CHAP 2 72 | VALUE MS-Acct-Auth-Type MS-CHAP-1 3 73 | VALUE MS-Acct-Auth-Type MS-CHAP-2 4 74 | VALUE MS-Acct-Auth-Type EAP 5 75 | 76 | # MS-Acct-EAP-Type Values 77 | 78 | VALUE MS-Acct-EAP-Type MD5 4 79 | VALUE MS-Acct-EAP-Type OTP 5 80 | VALUE MS-Acct-EAP-Type Generic-Token-Card 6 81 | VALUE MS-Acct-EAP-Type TLS 13 82 | 83 | END-VENDOR Microsoft 84 | -------------------------------------------------------------------------------- /accel-pppd/ppp/ppp_ipv6cp.h: -------------------------------------------------------------------------------- 1 | #ifndef PPP_IPV6CP_H 2 | #define PPP_IPV6CP_H 3 | 4 | #include 5 | 6 | #include "triton.h" 7 | #include "ppp_fsm.h" 8 | /* 9 | * Options. 10 | */ 11 | #define CI_INTFID 1 12 | 13 | struct ipv6cp_hdr_t 14 | { 15 | uint16_t proto; 16 | uint8_t code; 17 | uint8_t id; 18 | uint16_t len; 19 | } __attribute__((packed)); 20 | 21 | struct ipv6cp_opt_hdr_t 22 | { 23 | uint8_t id; 24 | uint8_t len; 25 | } __attribute__((packed)); 26 | 27 | struct ipv6cp_opt8_t 28 | { 29 | struct ipv6cp_opt_hdr_t hdr; 30 | uint8_t val; 31 | } __attribute__((packed)); 32 | 33 | struct ipv6cp_opt16_t 34 | { 35 | struct ipv6cp_opt_hdr_t hdr; 36 | uint16_t val; 37 | } __attribute__((packed)); 38 | 39 | struct ipv6cp_opt32_t 40 | { 41 | struct ipv6cp_opt_hdr_t hdr; 42 | uint32_t val; 43 | } __attribute__((packed)); 44 | 45 | struct ipv6cp_opt64_t 46 | { 47 | struct ipv6cp_opt_hdr_t hdr; 48 | uint64_t val; 49 | } __attribute__((packed)); 50 | 51 | 52 | #define IPV6CP_OPT_NONE 0 53 | #define IPV6CP_OPT_ACK 1 54 | #define IPV6CP_OPT_NAK -1 55 | #define IPV6CP_OPT_REJ -2 56 | #define IPV6CP_OPT_CLOSE -3 57 | #define IPV6CP_OPT_TERMACK -4 58 | #define IPV6CP_OPT_FAIL -5 59 | 60 | struct ppp_ipv6cp_t; 61 | struct ipv6cp_option_handler_t; 62 | 63 | struct ipv6cp_option_t 64 | { 65 | struct list_head entry; 66 | int id; 67 | int len; 68 | int state; 69 | int print:1; 70 | struct ipv6cp_option_handler_t *h; 71 | }; 72 | 73 | struct ipv6cp_option_handler_t 74 | { 75 | struct list_head entry; 76 | struct ipv6cp_option_t* (*init)(struct ppp_ipv6cp_t*); 77 | int (*send_conf_req)(struct ppp_ipv6cp_t*,struct ipv6cp_option_t*,uint8_t*); 78 | int (*send_conf_rej)(struct ppp_ipv6cp_t*,struct ipv6cp_option_t*,uint8_t*); 79 | int (*send_conf_nak)(struct ppp_ipv6cp_t*,struct ipv6cp_option_t*,uint8_t*); 80 | int (*recv_conf_req)(struct ppp_ipv6cp_t*,struct ipv6cp_option_t*,uint8_t*); 81 | int (*recv_conf_rej)(struct ppp_ipv6cp_t*,struct ipv6cp_option_t*,uint8_t*); 82 | int (*recv_conf_nak)(struct ppp_ipv6cp_t*,struct ipv6cp_option_t*,uint8_t*); 83 | int (*recv_conf_ack)(struct ppp_ipv6cp_t*,struct ipv6cp_option_t*,uint8_t*); 84 | void (*free)(struct ppp_ipv6cp_t*,struct ipv6cp_option_t*); 85 | void (*print)(void (*print)(const char *fmt,...), struct ipv6cp_option_t*,uint8_t*); 86 | }; 87 | 88 | struct ppp_ipv6cp_t 89 | { 90 | struct ppp_layer_data_t ld; 91 | struct ppp_handler_t hnd; 92 | struct ppp_fsm_t fsm; 93 | struct ppp_t *ppp; 94 | struct list_head options; 95 | 96 | struct triton_timer_t timeout; 97 | 98 | struct list_head ropt_list; // last received ConfReq 99 | int ropt_len; 100 | 101 | int conf_req_len; 102 | int starting:1; 103 | int started:1; 104 | int delay_ack:1; 105 | }; 106 | 107 | int ipv6cp_option_register(struct ipv6cp_option_handler_t *h); 108 | 109 | #endif 110 | 111 | -------------------------------------------------------------------------------- /crypto/tomcrypt.h: -------------------------------------------------------------------------------- 1 | #ifndef TOMCRYPT_H_ 2 | #define TOMCRYPT_H_ 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | /* use configuration data */ 12 | #include "tomcrypt_custom.h" 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | /* version */ 19 | #define CRYPT 0x0117 20 | #define SCRYPT "1.17" 21 | 22 | /* max size of either a cipher/hash block or symmetric key [largest of the two] */ 23 | #define MAXBLOCKSIZE 128 24 | 25 | /* descriptor table size */ 26 | #define TAB_SIZE 32 27 | 28 | /* error codes [will be expanded in future releases] */ 29 | enum { 30 | CRYPT_OK=0, /* Result OK */ 31 | CRYPT_ERROR, /* Generic Error */ 32 | CRYPT_NOP, /* Not a failure but no operation was performed */ 33 | 34 | CRYPT_INVALID_KEYSIZE, /* Invalid key size given */ 35 | CRYPT_INVALID_ROUNDS, /* Invalid number of rounds */ 36 | CRYPT_FAIL_TESTVECTOR, /* Algorithm failed test vectors */ 37 | 38 | CRYPT_BUFFER_OVERFLOW, /* Not enough space for output */ 39 | CRYPT_INVALID_PACKET, /* Invalid input packet given */ 40 | 41 | CRYPT_INVALID_PRNGSIZE, /* Invalid number of bits for a PRNG */ 42 | CRYPT_ERROR_READPRNG, /* Could not read enough from PRNG */ 43 | 44 | CRYPT_INVALID_CIPHER, /* Invalid cipher specified */ 45 | CRYPT_INVALID_HASH, /* Invalid hash specified */ 46 | CRYPT_INVALID_PRNG, /* Invalid PRNG specified */ 47 | 48 | CRYPT_MEM, /* Out of memory */ 49 | 50 | CRYPT_PK_TYPE_MISMATCH, /* Not equivalent types of PK keys */ 51 | CRYPT_PK_NOT_PRIVATE, /* Requires a private PK key */ 52 | 53 | CRYPT_INVALID_ARG, /* Generic invalid argument */ 54 | CRYPT_FILE_NOTFOUND, /* File Not Found */ 55 | 56 | CRYPT_PK_INVALID_TYPE, /* Invalid type of PK key */ 57 | CRYPT_PK_INVALID_SYSTEM,/* Invalid PK system specified */ 58 | CRYPT_PK_DUP, /* Duplicate key already in key ring */ 59 | CRYPT_PK_NOT_FOUND, /* Key not found in keyring */ 60 | CRYPT_PK_INVALID_SIZE, /* Invalid size input for PK parameters */ 61 | 62 | CRYPT_INVALID_PRIME_SIZE,/* Invalid size of prime requested */ 63 | CRYPT_PK_INVALID_PADDING /* Invalid padding on input */ 64 | }; 65 | 66 | #include "tomcrypt_cfg.h" 67 | #include "tomcrypt_macros.h" 68 | #include "tomcrypt_cipher.h" 69 | #include "tomcrypt_hash.h" 70 | //#include 71 | //#include 72 | //#include 73 | //#include 74 | //#include 75 | #include "tomcrypt_argchk.h" 76 | //#include 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | 82 | #endif /* TOMCRYPT_H_ */ 83 | 84 | 85 | /* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt.h,v $ */ 86 | /* $Revision: 1.21 $ */ 87 | /* $Date: 2006/12/16 19:34:05 $ */ 88 | -------------------------------------------------------------------------------- /accel-pppd/triton/triton_p.h: -------------------------------------------------------------------------------- 1 | #ifndef TRITON_P_H 2 | #define TRITON_P_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "triton.h" 9 | #include "list.h" 10 | #include "spinlock.h" 11 | #include "mempool.h" 12 | 13 | #define CTX_PRIO_MAX 4 14 | 15 | struct _triton_thread_t 16 | { 17 | struct list_head entry; 18 | struct list_head entry2; 19 | pthread_t thread; 20 | int terminate; 21 | struct _triton_context_t *ctx; 22 | pthread_mutex_t sleep_lock; 23 | struct list_head wakeup_list[CTX_PRIO_MAX]; 24 | }; 25 | 26 | struct _triton_context_t 27 | { 28 | struct list_head entry; 29 | struct list_head entry2; 30 | 31 | spinlock_t lock; 32 | struct _triton_thread_t *thread; 33 | 34 | struct list_head handlers; 35 | struct list_head timers; 36 | struct list_head pending_handlers; 37 | struct list_head pending_timers; 38 | struct list_head pending_calls; 39 | 40 | int init; 41 | int queued; 42 | int wakeup; 43 | int need_close; 44 | int need_free; 45 | int pending; 46 | int priority; 47 | int refs; 48 | 49 | ucontext_t *uc; 50 | 51 | struct triton_context_t *ud; 52 | void *bf_arg; 53 | }; 54 | 55 | struct _triton_md_handler_t 56 | { 57 | struct list_head entry; 58 | struct list_head entry2; 59 | struct _triton_context_t *ctx; 60 | struct epoll_event epoll_event; 61 | uint32_t trig_epoll_events; 62 | int pending; 63 | int trig_level:1; 64 | int armed:1; 65 | int mod:1; 66 | struct triton_md_handler_t *ud; 67 | }; 68 | 69 | struct _triton_timer_t 70 | { 71 | struct list_head entry; 72 | struct list_head entry2; 73 | struct epoll_event epoll_event; 74 | struct _triton_context_t *ctx; 75 | int fd; 76 | int pending:1; 77 | struct triton_timer_t *ud; 78 | }; 79 | 80 | struct _triton_event_t 81 | { 82 | struct list_head handlers; 83 | }; 84 | 85 | struct _triton_ctx_call_t 86 | { 87 | struct list_head entry; 88 | 89 | void *arg; 90 | void (*func)(void *); 91 | }; 92 | 93 | struct _triton_init_t 94 | { 95 | struct list_head entry; 96 | 97 | int order; 98 | void (*func)(void); 99 | }; 100 | 101 | int log_init(void); 102 | int md_init(); 103 | int timer_init(); 104 | int event_init(); 105 | 106 | void md_run(); 107 | void md_terminate(); 108 | void md_rearm(struct _triton_md_handler_t *h); 109 | void timer_run(); 110 | void timer_terminate(); 111 | extern struct triton_context_t default_ctx; 112 | int triton_queue_ctx(struct _triton_context_t*); 113 | void triton_thread_wakeup(struct _triton_thread_t*); 114 | int conf_load(const char *fname); 115 | int conf_reload(const char *fname); 116 | void triton_log_error(const char *fmt, ...) __attribute__((format(gnu_printf, 1, 2))); 117 | void triton_log_debug(const char *fmt, ...) __attribute__((format(gnu_printf, 1, 2))); 118 | int load_modules(const char *name); 119 | void triton_context_release(struct _triton_context_t *ctx); 120 | 121 | #endif 122 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/sessionTable_data_get.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: this file originally auto-generated by mib2c using 3 | * version : 12088 $ of $ 4 | * 5 | * $Id:$ 6 | * 7 | * @file sessionTable_data_get.h 8 | * 9 | * @addtogroup get 10 | * 11 | * Prototypes for get functions 12 | * 13 | * @{ 14 | */ 15 | #ifndef SESSIONTABLE_DATA_GET_H 16 | #define SESSIONTABLE_DATA_GET_H 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | #ifndef U64 23 | typedef struct counter64 U64; 24 | #endif 25 | 26 | /* ********************************************************************* 27 | * GET function declarations 28 | */ 29 | 30 | /* ********************************************************************* 31 | * GET Table declarations 32 | */ 33 | /********************************************************************** 34 | ********************************************************************** 35 | *** 36 | *** Table sessionTable 37 | *** 38 | ********************************************************************** 39 | **********************************************************************/ 40 | /* 41 | * ACCEL-PPP-MIB::sessionTable is subid 1 of accelPPPSessions. 42 | * Its status is Current. 43 | * OID: .1.3.6.1.4.1.8072.100.2.1, length: 10 44 | */ 45 | /* 46 | * indexes 47 | */ 48 | 49 | int sesIfName_get( sessionTable_rowreq_ctx *rowreq_ctx, char **sesIfName_val_ptr_ptr, size_t *sesIfName_val_ptr_len_ptr ); 50 | int sesUsername_get( sessionTable_rowreq_ctx *rowreq_ctx, char **sesUsername_val_ptr_ptr, size_t *sesUsername_val_ptr_len_ptr ); 51 | int sesIP_get( sessionTable_rowreq_ctx *rowreq_ctx, char **sesIP_val_ptr_ptr, size_t *sesIP_val_ptr_len_ptr ); 52 | int sesType_get( sessionTable_rowreq_ctx *rowreq_ctx, u_long * sesType_val_ptr ); 53 | int sesState_get( sessionTable_rowreq_ctx *rowreq_ctx, u_long * sesState_val_ptr ); 54 | int sesUptime_get( sessionTable_rowreq_ctx *rowreq_ctx, u_long * sesUptime_val_ptr ); 55 | int sesCallingSID_get( sessionTable_rowreq_ctx *rowreq_ctx, char **sesCallingSID_val_ptr_ptr, size_t *sesCallingSID_val_ptr_len_ptr ); 56 | int sesCalledSID_get( sessionTable_rowreq_ctx *rowreq_ctx, char **sesCalledSID_val_ptr_ptr, size_t *sesCalledSID_val_ptr_len_ptr ); 57 | int sesRxBytes_get( sessionTable_rowreq_ctx *rowreq_ctx, U64 * sesRxBytes_val_ptr ); 58 | int sesRxPkts_get( sessionTable_rowreq_ctx *rowreq_ctx, u_long * sesRxPkts_val_ptr ); 59 | int sesTxBytes_get( sessionTable_rowreq_ctx *rowreq_ctx, U64 * sesTxBytes_val_ptr ); 60 | int sesTxPkts_get( sessionTable_rowreq_ctx *rowreq_ctx, u_long * sesTxPkts_val_ptr ); 61 | 62 | 63 | int sessionTable_indexes_set_tbl_idx(sessionTable_mib_index *tbl_idx, char *sesSID_val_ptr, size_t sesSID_val_ptr_len); 64 | int sessionTable_indexes_set(sessionTable_rowreq_ctx *rowreq_ctx, char *sesSID_val_ptr, size_t sesSID_val_ptr_len); 65 | 66 | 67 | 68 | 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | 73 | #endif /* SESSIONTABLE_DATA_GET_H */ 74 | /** @} */ 75 | -------------------------------------------------------------------------------- /accel-pppd/ppp/ppp_ipcp.h: -------------------------------------------------------------------------------- 1 | #ifndef PPP_IPCP_H 2 | #define PPP_IPCP_H 3 | 4 | #include 5 | 6 | #include "triton.h" 7 | #include "ppp_fsm.h" 8 | /* 9 | * Options. 10 | */ 11 | #define CI_COMP 2 /* IP-Compress-Protocol */ 12 | #define CI_ADDR 3 /* IP-Address */ 13 | #define CI_DNS1 129 /* Primary-DNS-Address */ 14 | #define CI_DNS2 131 /* Secondary-DNS-Address */ 15 | #define CI_WINS1 130 /* Primary-NBNS-Address */ 16 | #define CI_WINS2 132 /* Secondary-NBNS-Address */ 17 | 18 | struct ipcp_hdr_t 19 | { 20 | uint16_t proto; 21 | uint8_t code; 22 | uint8_t id; 23 | uint16_t len; 24 | } __attribute__((packed)); 25 | struct ipcp_opt_hdr_t 26 | { 27 | uint8_t id; 28 | uint8_t len; 29 | } __attribute__((packed)); 30 | struct ipcp_opt8_t 31 | { 32 | struct ipcp_opt_hdr_t hdr; 33 | uint8_t val; 34 | } __attribute__((packed)); 35 | struct ipcp_opt16_t 36 | { 37 | struct ipcp_opt_hdr_t hdr; 38 | uint16_t val; 39 | } __attribute__((packed)); 40 | struct ipcp_opt32_t 41 | { 42 | struct ipcp_opt_hdr_t hdr; 43 | uint32_t val; 44 | } __attribute__((packed)); 45 | 46 | #define IPCP_OPT_NONE 0 47 | #define IPCP_OPT_ACK 1 48 | #define IPCP_OPT_NAK -1 49 | #define IPCP_OPT_REJ -2 50 | #define IPCP_OPT_CLOSE -3 51 | #define IPCP_OPT_TERMACK -4 52 | #define IPCP_OPT_FAIL -5 53 | 54 | struct ppp_ipcp_t; 55 | struct ipcp_option_handler_t; 56 | 57 | struct ipcp_option_t 58 | { 59 | struct list_head entry; 60 | int id; 61 | int len; 62 | int state; 63 | int print:1; 64 | struct ipcp_option_handler_t *h; 65 | }; 66 | 67 | struct ipcp_option_handler_t 68 | { 69 | struct list_head entry; 70 | struct ipcp_option_t* (*init)(struct ppp_ipcp_t*); 71 | int (*send_conf_req)(struct ppp_ipcp_t*,struct ipcp_option_t*,uint8_t*); 72 | int (*send_conf_rej)(struct ppp_ipcp_t*,struct ipcp_option_t*,uint8_t*); 73 | int (*send_conf_nak)(struct ppp_ipcp_t*,struct ipcp_option_t*,uint8_t*); 74 | int (*recv_conf_req)(struct ppp_ipcp_t*,struct ipcp_option_t*,uint8_t*); 75 | int (*recv_conf_rej)(struct ppp_ipcp_t*,struct ipcp_option_t*,uint8_t*); 76 | int (*recv_conf_nak)(struct ppp_ipcp_t*,struct ipcp_option_t*,uint8_t*); 77 | int (*recv_conf_ack)(struct ppp_ipcp_t*,struct ipcp_option_t*,uint8_t*); 78 | void (*free)(struct ppp_ipcp_t*,struct ipcp_option_t*); 79 | void (*print)(void (*print)(const char *fmt,...), struct ipcp_option_t*,uint8_t*); 80 | }; 81 | 82 | struct ppp_ipcp_t 83 | { 84 | struct ppp_layer_data_t ld; 85 | struct ppp_handler_t hnd; 86 | struct ppp_fsm_t fsm; 87 | struct ppp_t *ppp; 88 | struct list_head options; 89 | 90 | struct triton_timer_t timeout; 91 | 92 | struct list_head ropt_list; // last received ConfReq 93 | int ropt_len; 94 | 95 | int conf_req_len; 96 | int starting:1; 97 | int started:1; 98 | int delay_ack:1; 99 | }; 100 | 101 | int ipcp_option_register(struct ipcp_option_handler_t *h); 102 | struct ipcp_option_t *ipcp_find_option(struct ppp_t *ppp, struct ipcp_option_handler_t *h); 103 | 104 | #endif 105 | 106 | -------------------------------------------------------------------------------- /accel-pppd/libnetlink/genl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "triton.h" 16 | #include "log.h" 17 | 18 | #include "libnetlink.h" 19 | 20 | #define GENL_MAX_FAM_GRPS 128 21 | 22 | int __export genl_resolve_mcg(const char *family, const char *name, int *fam_id) 23 | { 24 | struct rtnl_handle rth; 25 | struct nlmsghdr *nlh; 26 | struct genlmsghdr *ghdr; 27 | struct rtattr *tb[CTRL_ATTR_MAX + 1]; 28 | struct rtattr *tb2[GENL_MAX_FAM_GRPS + 1]; 29 | struct rtattr *tb3[CTRL_ATTR_MCAST_GRP_MAX + 1]; 30 | struct rtattr *attrs; 31 | int i, len, ret = -1; 32 | struct { 33 | struct nlmsghdr n; 34 | char buf[4096]; 35 | } req; 36 | 37 | if (rtnl_open_byproto(&rth, 0, NETLINK_GENERIC)) { 38 | log_error("genl: cannot open rtnetlink\n"); 39 | return -1; 40 | } 41 | 42 | nlh = &req.n; 43 | nlh->nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN); 44 | nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK; 45 | nlh->nlmsg_type = GENL_ID_CTRL; 46 | 47 | ghdr = NLMSG_DATA(&req.n); 48 | ghdr->cmd = CTRL_CMD_GETFAMILY; 49 | 50 | addattr_l(nlh, 128, CTRL_ATTR_FAMILY_NAME, family, strlen(family) + 1); 51 | 52 | if (rtnl_talk(&rth, nlh, 0, 0, nlh, NULL, NULL, 0) < 0 ) { 53 | log_error("genl: error talking to kernel\n"); 54 | goto out; 55 | } 56 | 57 | if (nlh->nlmsg_type != GENL_ID_CTRL) { 58 | log_error("genl: not a controller message %d\n", nlh->nlmsg_type); 59 | goto out; 60 | } 61 | 62 | ghdr = NLMSG_DATA(nlh); 63 | 64 | if (ghdr->cmd != CTRL_CMD_NEWFAMILY) { 65 | log_error("genl: unknown controller command %d\n", ghdr->cmd); 66 | goto out; 67 | } 68 | 69 | len = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN); 70 | 71 | if (len < 0) { 72 | log_error("genl: wrong controller message len %d\n", len); 73 | goto out; 74 | } 75 | 76 | attrs = (struct rtattr *)((char *)ghdr + GENL_HDRLEN); 77 | parse_rtattr(tb, CTRL_ATTR_MAX, attrs, len); 78 | 79 | if (!tb[CTRL_ATTR_FAMILY_ID]) { 80 | log_error("genl: missing CTRL_FAMILY_ID attribute\n"); 81 | goto out; 82 | } 83 | 84 | if (!tb[CTRL_ATTR_MCAST_GROUPS]) 85 | goto out; 86 | 87 | if (fam_id) 88 | *fam_id = *(uint16_t *)(RTA_DATA(tb[CTRL_ATTR_FAMILY_ID])); 89 | 90 | parse_rtattr_nested(tb2, GENL_MAX_FAM_GRPS, tb[CTRL_ATTR_MCAST_GROUPS]); 91 | 92 | for (i = 1; i < GENL_MAX_FAM_GRPS; i++) { 93 | if (tb2[i]) { 94 | parse_rtattr_nested(tb3, CTRL_ATTR_MCAST_GRP_MAX, tb2[i]); 95 | if (!tb3[CTRL_ATTR_MCAST_GRP_ID] || !tb3[CTRL_ATTR_MCAST_GRP_NAME]) 96 | continue; 97 | if (strcmp(RTA_DATA(tb3[CTRL_ATTR_MCAST_GRP_NAME]), name)) 98 | continue; 99 | ret = *(uint32_t *)(RTA_DATA(tb3[CTRL_ATTR_MCAST_GRP_ID])); 100 | break; 101 | } 102 | } 103 | 104 | out: 105 | 106 | rtnl_close(&rth); 107 | return ret; 108 | } 109 | -------------------------------------------------------------------------------- /accel-pppd/extra/sigchld.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "triton.h" 8 | #include "spinlock.h" 9 | #include "log.h" 10 | 11 | #include "sigchld.h" 12 | 13 | #include "memdebug.h" 14 | 15 | static LIST_HEAD(handlers); 16 | static int lock_refs; 17 | static pthread_mutex_t handlers_lock = PTHREAD_MUTEX_INITIALIZER; 18 | static pthread_cond_t refs_cond = PTHREAD_COND_INITIALIZER; 19 | static pthread_t sigchld_thr; 20 | 21 | static void* sigchld_thread(void *arg) 22 | { 23 | sigset_t set; 24 | struct sigchld_handler_t *h, *h0; 25 | pid_t pid; 26 | int status, sig; 27 | 28 | sigfillset(&set); 29 | sigdelset(&set, SIGKILL); 30 | sigdelset(&set, SIGSTOP); 31 | pthread_sigmask(SIG_BLOCK, &set, NULL); 32 | 33 | sigemptyset(&set); 34 | sigaddset(&set, SIGCHLD); 35 | sigaddset(&set, SIGQUIT); 36 | 37 | while (1) { 38 | pid = waitpid(-1, &status, 0); 39 | if (pid < 0) { 40 | if (errno == EINTR) 41 | continue; 42 | if (errno == ECHILD) { 43 | sigwait(&set, &sig); 44 | if (sig == SIGQUIT) 45 | break; 46 | continue; 47 | } 48 | log_error("sigchld: waitpid: %s\n", strerror(errno)); 49 | continue; 50 | } 51 | 52 | pthread_mutex_lock(&handlers_lock); 53 | while (lock_refs) 54 | pthread_cond_wait(&refs_cond, &handlers_lock); 55 | 56 | h0 = NULL; 57 | list_for_each_entry(h, &handlers, entry) { 58 | if (h->pid == pid) { 59 | h0 = h; 60 | list_del(&h0->entry); 61 | pthread_mutex_lock(&h0->lock); 62 | break; 63 | } 64 | } 65 | pthread_mutex_unlock(&handlers_lock); 66 | if (h0) { 67 | h0->handler(h0, WEXITSTATUS(status)); 68 | h0->pid = 0; 69 | pthread_mutex_unlock(&h0->lock); 70 | } 71 | } 72 | 73 | return NULL; 74 | } 75 | 76 | void __export sigchld_register_handler(struct sigchld_handler_t *h) 77 | { 78 | pthread_mutex_init(&h->lock, NULL); 79 | 80 | pthread_mutex_lock(&handlers_lock); 81 | list_add_tail(&h->entry, &handlers); 82 | pthread_mutex_unlock(&handlers_lock); 83 | } 84 | 85 | int __export sigchld_unregister_handler(struct sigchld_handler_t *h) 86 | { 87 | int r = 0; 88 | 89 | pthread_mutex_lock(&handlers_lock); 90 | pthread_mutex_lock(&h->lock); 91 | if (h->pid) { 92 | list_del(&h->entry); 93 | h->pid = 0; 94 | r = 1; 95 | } 96 | pthread_mutex_unlock(&h->lock); 97 | pthread_mutex_unlock(&handlers_lock); 98 | 99 | return r; 100 | } 101 | 102 | void __export sigchld_lock() 103 | { 104 | pthread_mutex_lock(&handlers_lock); 105 | ++lock_refs; 106 | pthread_mutex_unlock(&handlers_lock); 107 | } 108 | 109 | void __export sigchld_unlock() 110 | { 111 | pthread_mutex_lock(&handlers_lock); 112 | if (--lock_refs == 0) 113 | pthread_cond_signal(&refs_cond); 114 | pthread_mutex_unlock(&handlers_lock); 115 | } 116 | 117 | static void __init init(void) 118 | { 119 | if (pthread_create(&sigchld_thr, NULL, sigchld_thread, NULL)) 120 | log_emerg("sigchld: pthread_create: %s\n", strerror(errno)); 121 | } 122 | 123 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/shutdown.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: this file originally auto-generated by mib2c using 3 | * : mib2c.scalar.conf 11805 2005-01-07 09:37:18Z dts12 $ 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include "shutdown.h" 10 | 11 | /** Initializes the shutdown module */ 12 | void 13 | init_shutdown(void) 14 | { 15 | static oid shutdown_oid[] = { 1,3,6,1,4,1,8072,100,3,2 }; 16 | 17 | DEBUGMSGTL(("shutdown", "Initializing\n")); 18 | 19 | netsnmp_register_scalar( 20 | netsnmp_create_handler_registration("shutdown", handle_shutdown, 21 | shutdown_oid, OID_LENGTH(shutdown_oid), 22 | HANDLER_CAN_RWRITE 23 | )); 24 | } 25 | 26 | int 27 | handle_shutdown(netsnmp_mib_handler *handler, 28 | netsnmp_handler_registration *reginfo, 29 | netsnmp_agent_request_info *reqinfo, 30 | netsnmp_request_info *requests) 31 | { 32 | int ret; 33 | /* We are never called for a GETNEXT if it's registered as a 34 | "instance", as it's "magically" handled for us. */ 35 | 36 | /* a instance handler also only hands us one request at a time, so 37 | we don't need to loop over a list of requests; we'll only get one. */ 38 | 39 | switch(reqinfo->mode) { 40 | 41 | case MODE_GET: 42 | netsnmp_set_request_error(reqinfo, requests, SNMP_NOSUCHINSTANCE ); 43 | break; 44 | 45 | /* 46 | * SET REQUEST 47 | * 48 | * multiple states in the transaction. See: 49 | * http://www.net-snmp.org/tutorial-5/toolkit/mib_module/set-actions.jpg 50 | */ 51 | case MODE_SET_RESERVE1: 52 | /* or you could use netsnmp_check_vb_type_and_size instead */ 53 | ret = netsnmp_check_vb_type(requests->requestvb, ASN_INTEGER); 54 | if ( ret != SNMP_ERR_NOERROR ) { 55 | netsnmp_set_request_error(reqinfo, requests, ret ); 56 | } 57 | break; 58 | 59 | case MODE_SET_RESERVE2: 60 | /* XXX malloc "undo" storage buffer */ 61 | break; 62 | 63 | case MODE_SET_FREE: 64 | /* XXX: free resources allocated in RESERVE1 and/or 65 | RESERVE2. Something failed somewhere, and the states 66 | below won't be called. */ 67 | break; 68 | 69 | case MODE_SET_ACTION: 70 | /* XXX: perform the value change here */ 71 | break; 72 | 73 | case MODE_SET_COMMIT: 74 | /* XXX: delete temporary storage */ 75 | break; 76 | 77 | case MODE_SET_UNDO: 78 | /* XXX: UNDO and return to previous value for the object */ 79 | break; 80 | 81 | default: 82 | /* we should never get here, so this is a really bad error */ 83 | snmp_log(LOG_ERR, "unknown mode (%d) in handle_shutdown\n", reqinfo->mode ); 84 | return SNMP_ERR_GENERR; 85 | } 86 | 87 | return SNMP_ERR_NOERROR; 88 | } 89 | -------------------------------------------------------------------------------- /accel-pppd/ctrl/l2tp/l2tp.h: -------------------------------------------------------------------------------- 1 | #ifndef __L2TP_H 2 | #define __L2TP_H 3 | 4 | #include 5 | 6 | #include "list.h" 7 | #include "l2tp_prot.h" 8 | 9 | #define ATTR_TYPE_NONE 0 10 | #define ATTR_TYPE_INT16 1 11 | #define ATTR_TYPE_INT32 2 12 | #define ATTR_TYPE_INT64 3 13 | #define ATTR_TYPE_OCTETS 4 14 | #define ATTR_TYPE_STRING 5 15 | 16 | #define L2TP_MAX_PACKET_SIZE 65536 17 | 18 | #define L2TP_V2_PROTOCOL_VERSION ( 1 << 8 | 0 ) 19 | 20 | #define L2TP_DATASEQ_ALLOW -1 21 | #define L2TP_DATASEQ_DENY 0 22 | #define L2TP_DATASEQ_PREFER 1 23 | #define L2TP_DATASEQ_REQUIRE 2 24 | 25 | typedef union 26 | { 27 | uint32_t uint32; 28 | int32_t int32; 29 | uint16_t uint16; 30 | int16_t int16; 31 | uint64_t uint64; 32 | uint8_t *octets; 33 | char *string; 34 | } l2tp_value_t; 35 | 36 | struct l2tp_dict_attr_t 37 | { 38 | struct list_head entry; 39 | const char *name; 40 | int id; 41 | int type; 42 | int M; 43 | int H; 44 | struct list_head values; 45 | }; 46 | 47 | struct l2tp_dict_value_t 48 | { 49 | struct list_head entry; 50 | const char *name; 51 | l2tp_value_t val; 52 | }; 53 | 54 | struct l2tp_attr_t 55 | { 56 | struct list_head entry; 57 | struct l2tp_dict_attr_t *attr; 58 | int M:1; 59 | int H:1; 60 | int length; 61 | l2tp_value_t val; 62 | }; 63 | 64 | struct l2tp_packet_t 65 | { 66 | struct list_head entry; 67 | struct list_head sess_entry; 68 | struct sockaddr_in addr; 69 | struct l2tp_hdr_t hdr; 70 | struct list_head attrs; 71 | struct l2tp_attr_t *last_RV; 72 | const char *secret; 73 | size_t secret_len; 74 | int hide_avps; 75 | }; 76 | 77 | extern int conf_verbose; 78 | extern int conf_avp_permissive; 79 | 80 | static inline int l2tp_packet_is_ZLB(const struct l2tp_packet_t *pack) 81 | { 82 | return list_empty(&pack->attrs); 83 | } 84 | 85 | struct l2tp_dict_attr_t *l2tp_dict_find_attr_by_name(const char *name); 86 | struct l2tp_dict_attr_t *l2tp_dict_find_attr_by_id(int id); 87 | const struct l2tp_dict_value_t *l2tp_dict_find_value(const struct l2tp_dict_attr_t *attr, 88 | l2tp_value_t val); 89 | 90 | int l2tp_recv(int fd, struct l2tp_packet_t **, struct in_pktinfo *, 91 | const char *secret, size_t secret_len); 92 | void l2tp_packet_free(struct l2tp_packet_t *); 93 | void l2tp_packet_print(const struct l2tp_packet_t *, 94 | void (*print)(const char *fmt, ...)); 95 | struct l2tp_packet_t *l2tp_packet_alloc(int ver, int msg_type, 96 | const struct sockaddr_in *addr, int H, 97 | const char *secret, size_t secret_len); 98 | int l2tp_packet_send(int sock, struct l2tp_packet_t *); 99 | int l2tp_packet_add_int16(struct l2tp_packet_t *pack, int id, int16_t val, int M); 100 | int l2tp_packet_add_int32(struct l2tp_packet_t *pack, int id, int32_t val, int M); 101 | int l2tp_packet_add_int64(struct l2tp_packet_t *pack, int id, int64_t val, int M); 102 | int l2tp_packet_add_string(struct l2tp_packet_t *pack, int id, const char *val, int M); 103 | int l2tp_packet_add_octets(struct l2tp_packet_t *pack, int id, const uint8_t *val, int size, int M); 104 | 105 | void l2tp_nl_create_tunnel(int fd, int tid, int peer_tid); 106 | void l2tp_nl_create_session(int tid, int sid, int peer_sid); 107 | void l2tp_nl_delete_tunnel(int tid); 108 | 109 | #endif 110 | -------------------------------------------------------------------------------- /cmake/debian/debian.cmake: -------------------------------------------------------------------------------- 1 | SET(CPACK_PACKAGING_INSTALL_PREFIX "/usr") 2 | SET(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}) 3 | 4 | if (NOT DEFINED MODULES_KDIR) 5 | execute_process( 6 | COMMAND uname -r 7 | COMMAND tr -d '\n' 8 | OUTPUT_VARIABLE MODULES_KDIR 9 | ) 10 | endif() 11 | 12 | if (BUILD_PPTP_DRIVER) 13 | if (BUILD_DRIVER_ONLY) 14 | SET(CPACK_PACKAGE_VERSION_MAJOR "0") 15 | SET(CPACK_PACKAGE_VERSION_MINOR "8") 16 | SET(CPACK_PACKAGE_VERSION_PATCH "5") 17 | SET(CPACK_PACKAGING_INSTALL_PREFIX "/") 18 | SET(CPACK_PACKAGE_NAME "accel-pptp-kmod") 19 | SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "accel-pptp kernel module") 20 | SET(CPACK_DEBIAN_PACKAGE_DEPENDS "") 21 | SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian-kmod/postinst") 22 | endif () 23 | #INSTALL(DIRECTORY lib/modules/${DEBIAN_KDIR}/extra) 24 | INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/driver/driver/pptp.ko DESTINATION /lib/modules/${MODULES_KDIR}/extra) 25 | #SET(CPACK_DEBIAN_PACKAGE_DEPENDS "linux-image (= ${LINUX_IMAGE})") 26 | endif (BUILD_PPTP_DRIVER) 27 | 28 | if (BUILD_IPOE_DRIVER) 29 | if (BUILD_DRIVER_ONLY) 30 | SET(CPACK_PACKAGING_INSTALL_PREFIX "/") 31 | SET(CPACK_PACKAGE_NAME "accel-ppp-ipoe-kmod") 32 | SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "accel-ppp IPoE kernel module") 33 | SET(CPACK_DEBIAN_PACKAGE_DEPENDS "") 34 | SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian-kmod/postinst") 35 | endif () 36 | INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/drivers/ipoe/driver/ipoe.ko DESTINATION /lib/modules/${MODULES_KDIR}/extra) 37 | endif (BUILD_IPOE_DRIVER) 38 | 39 | if (BUILD_VLAN_MON_DRIVER) 40 | if (BUILD_DRIVER_ONLY) 41 | SET(CPACK_PACKAGING_INSTALL_PREFIX "/") 42 | SET(CPACK_PACKAGE_NAME "accel-ppp-vlan_mon-kmod") 43 | SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "accel-ppp vlan monitoring kernel module") 44 | SET(CPACK_DEBIAN_PACKAGE_DEPENDS "") 45 | SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian-kmod/postinst") 46 | endif () 47 | INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/drivers/vlan_mon/driver/vlan_mon.ko DESTINATION /lib/modules/${MODULES_KDIR}/extra) 48 | endif (BUILD_VLAN_MON_DRIVER) 49 | 50 | if (NOT BUILD_DRIVER_ONLY) 51 | SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/postinst;${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/conffiles") 52 | 53 | if (CPACK_TYPE STREQUAL Debian6) 54 | INSTALL(FILES ${CMAKE_HOME_DIRECTORY}/accel-pppd/accel-ppp.conf DESTINATION ${CMAKE_BINARY_DIR}/_CPack_Packages/Linux/DEB/${CPACK_PACKAGE_FILE_NAME}/etc RENAME accel-ppp.conf.dist) 55 | INSTALL(FILES ${CMAKE_HOME_DIRECTORY}/contrib/debian/accel-ppp-init DESTINATION ${CMAKE_BINARY_DIR}/_CPack_Packages/Linux/DEB/${CPACK_PACKAGE_FILE_NAME}/etc/init.d RENAME accel-ppp) 56 | INSTALL(FILES ${CMAKE_HOME_DIRECTORY}/contrib/debian/accel-ppp-default DESTINATION ${CMAKE_BINARY_DIR}/_CPack_Packages/Linux/DEB/${CPACK_PACKAGE_FILE_NAME}/etc/default RENAME accel-ppp) 57 | else (CPACK_TYPE STREQUAL Debian6) 58 | INSTALL(FILES ${CMAKE_HOME_DIRECTORY}/accel-pppd/accel-ppp.conf DESTINATION /etc RENAME accel-ppp.conf.dist) 59 | INSTALL(FILES ${CMAKE_HOME_DIRECTORY}/contrib/debian/accel-ppp-init DESTINATION /etc/init.d RENAME accel-ppp) 60 | INSTALL(FILES ${CMAKE_HOME_DIRECTORY}/contrib/debian/accel-ppp-default DESTINATION /etc/default RENAME accel-ppp) 61 | endif (CPACK_TYPE STREQUAL Debian6) 62 | endif () 63 | -------------------------------------------------------------------------------- /accel-pppd/ctrl/l2tp/dict/dictionary.rfc2661: -------------------------------------------------------------------------------- 1 | ATTRIBUTE Message-Type 0 int16 H=0 2 | ATTRIBUTE Random-Vector 36 octets M=1 H=0 3 | ATTRIBUTE Result-Code 1 octets M=1 H=0 4 | ATTRIBUTE Protocol-Version 2 int16 M=1 H=0 5 | ATTRIBUTE Framing-Capabilities 3 int32 M=1 6 | ATTRIBUTE Bearer-Capabilities 4 int32 M=1 7 | ATTRIBUTE Tie-Breaker 5 int64 M=0 H=0 8 | ATTRIBUTE Firmware-Revision 6 int16 M=0 9 | ATTRIBUTE Host-Name 7 string M=1 H=0 10 | ATTRIBUTE Vendor-Name 8 string M=0 11 | ATTRIBUTE Assigned-Tunnel-ID 9 int16 M=1 12 | ATTRIBUTE Recv-Window-Size 10 int16 M=1 H=0 13 | ATTRIBUTE Challenge 11 octets M=1 14 | ATTRIBUTE Challenge-Response 13 octets M=1 15 | ATTRIBUTE Cause-Code 12 octets M=1 H=0 16 | ATTRIBUTE Assigned-Session-ID 14 int16 M=1 17 | ATTRIBUTE Call-Serial-Number 15 int32 M=1 18 | ATTRIBUTE Minimum-BPS 16 int32 M=1 19 | ATTRIBUTE Maximum-BPS 17 int32 M=1 20 | ATTRIBUTE Bearer-Type 18 int32 M=1 21 | ATTRIBUTE Framing-Type 19 int32 M=1 22 | ATTRIBUTE Called-Number 21 string M=1 23 | ATTRIBUTE Calling-Number 22 string M=1 24 | ATTRIBUTE Sub-Address 23 string M=1 25 | ATTRIBUTE TX-Speed 24 int32 M=1 26 | ATTRIBUTE RX-Speed 38 int32 M=0 27 | ATTRIBUTE Physical-Channel-ID 25 int32 M=0 28 | ATTRIBUTE Private-Group-ID 37 octets M=0 29 | ATTRIBUTE Sequencing-Required 39 none M=1 H=0 30 | ATTRIBUTE Init-Recv-LCP 26 octets M=0 31 | ATTRIBUTE Last-Sent-LCP 27 octets M=0 32 | ATTRIBUTE Last-Recv-LCP 28 octets M=0 33 | ATTRIBUTE Proxy-Authen-Type 29 int16 M=0 34 | ATTRIBUTE Proxy-Authen-Name 30 string M=0 35 | ATTRIBUTE Proxy-Authen-Challenge 31 octets M=0 36 | ATTRIBUTE Proxy-Authen-ID 32 int16 M=0 37 | ATTRIBUTE Proxy-Authen-Response 33 octets M=0 38 | ATTRIBUTE Call-Errors 34 octets M=1 39 | ATTRIBUTE ACCM 35 octets M=1 40 | 41 | VALUE Message-Type Start-Ctrl-Conn-Request 1 42 | VALUE Message-Type Start-Ctrl-Conn-Reply 2 43 | VALUE Message-Type Start-Ctrl-Conn-Connected 3 44 | VALUE Message-Type Stop-Ctrl-Conn-Notify 4 45 | VALUE Message-Type Hello 6 46 | VALUE Message-Type Outgoing-Call-Request 7 47 | VALUE Message-Type Outgoing-Call-Reply 8 48 | VALUE Message-Type Outgoing-Call-Connected 9 49 | VALUE Message-Type Incoming-Call-Request 10 50 | VALUE Message-Type Incoming-Call-Reply 11 51 | VALUE Message-Type Incoming-Call-Connected 12 52 | VALUE Message-Type Call-Disconnect-Notify 14 53 | VALUE Message-Type WAN-Error-Notify 15 54 | VALUE Message-Type Set-Link-Info 16 55 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/sessionTable_interface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: this file originally auto-generated by mib2c using 3 | * version : 15899 $ of $ 4 | * 5 | * $Id:$ 6 | */ 7 | /** @ingroup interface: Routines to interface to Net-SNMP 8 | * 9 | * \warning This code should not be modified, called directly, 10 | * or used to interpret functionality. It is subject to 11 | * change at any time. 12 | * 13 | * @{ 14 | */ 15 | /* 16 | * ********************************************************************* 17 | * ********************************************************************* 18 | * ********************************************************************* 19 | * *** *** 20 | * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE *** 21 | * *** *** 22 | * *** *** 23 | * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. *** 24 | * *** *** 25 | * *** *** 26 | * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND *** 27 | * *** *** 28 | * *** *** 29 | * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. *** 30 | * *** *** 31 | * *** *** 32 | * ********************************************************************* 33 | * ********************************************************************* 34 | * ********************************************************************* 35 | */ 36 | #ifndef SESSIONTABLE_INTERFACE_H 37 | #define SESSIONTABLE_INTERFACE_H 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | 44 | #include "sessionTable.h" 45 | 46 | 47 | /* ******************************************************************** 48 | * Table declarations 49 | */ 50 | 51 | /* PUBLIC interface initialization routine */ 52 | void _sessionTable_initialize_interface(sessionTable_registration * user_ctx, 53 | u_long flags); 54 | void _sessionTable_shutdown_interface(sessionTable_registration * user_ctx); 55 | 56 | sessionTable_registration * 57 | sessionTable_registration_get( void ); 58 | 59 | sessionTable_registration * 60 | sessionTable_registration_set( sessionTable_registration * newreg ); 61 | 62 | netsnmp_container *sessionTable_container_get( void ); 63 | int sessionTable_container_size( void ); 64 | 65 | sessionTable_rowreq_ctx * sessionTable_allocate_rowreq_ctx(sessionTable_data *, void *); 66 | void sessionTable_release_rowreq_ctx(sessionTable_rowreq_ctx *rowreq_ctx); 67 | 68 | int sessionTable_index_to_oid(netsnmp_index *oid_idx, 69 | sessionTable_mib_index *mib_idx); 70 | int sessionTable_index_from_oid(netsnmp_index *oid_idx, 71 | sessionTable_mib_index *mib_idx); 72 | 73 | /* 74 | * access to certain internals. use with caution! 75 | */ 76 | void sessionTable_valid_columns_set(netsnmp_column_info *vc); 77 | 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | 83 | #endif /* SESSIONTABLE_INTERFACE_H */ 84 | /** @} */ 85 | -------------------------------------------------------------------------------- /accel-cmd/accel-cmd.1: -------------------------------------------------------------------------------- 1 | .TH ACCEL-CMD 1 "January 2013" 2 | .SH NAME 3 | accel-cmd \- send commands to accel-ppp 4 | .SH SYNOPSIS 5 | .B accel-cmd 6 | .RB [ -n "] [" -4 "] [" -6 "] [" -f " \fIFAMILY\fR] [" -H " \fIHOST\fR]" 7 | .RB [ -p " \fIPORT\fR] [" -i " \fITIMEOUT\fR]" 8 | .RI "[--] [" COMMAND "]" 9 | .SH DESCRIPTION 10 | .BR accel-cmd " is a client for accel-ppp's " cli " module. It sends" 11 | .IR COMMAND "s to accel-ppp's tcp interface and displays the result on" 12 | .RI "standard output. If no " COMMAND " is supplied, then" 13 | .BR accel-cmd " reads and sends data from its standard input." 14 | .P 15 | The "help" 16 | .IR COMMAND " can be used to get information about available " COMMAND "s and " 17 | their syntax. 18 | .SH OPTIONS 19 | .TP 20 | .BR \-f " \fIFAMILY\fR, " \-\-family "=\fIFAMILY\fR" 21 | .RI "Connect to " HOST " using the given protocol family. Supported families" 22 | .RB "are " inet " (IPv4), " inet6 " (IPv6) and " unspec " (automatic)." 23 | .TP 24 | .B \-4 25 | .RB "Shorcut for " "--family=inet" . 26 | .TP 27 | .B \-6 28 | .RB "Shorcut for " "--family=inet6" . 29 | .TP 30 | .BR \-H " \fIHOST\fR, " \-\-host "=\fIHOST\fR" 31 | .RB "Set the host name or IP address to connect to. Defaults to " localhost . 32 | .TP 33 | .BR \-p " \fIPORT\fR, " \-\-port "=\fIPORT\fR" 34 | Set the service name or port number on which connection should be done. 35 | .RB "Defaults to " 2001 . 36 | .TP 37 | .BR \-n ", " \-\-numeric 38 | .RI "Inhibit name resolution of " HOST " and " PORT ". In this case," 39 | .IR HOST " must be an IP address and " PORT " a numeric port number." 40 | .TP 41 | .BR \-t " \fITIMEOUT\fR, " \-\-timeout "=\fITIMEOUT\fR" 42 | .RB "Set an inactivity timeout." 43 | .IR TIMEOUT " must be an integer and may be immediately followed by a time" 44 | .RB "unit. Supported units are " s " (seconds), " ms " (milliseconds) and " us 45 | .RB "(microseconds). The default unit is " s "." 46 | .RI "If this option is not supplied, or if " TIMEOUT " is zero, then no" 47 | timeout is set. 48 | .TP 49 | .BR \-P " \fIPASSWORD\fR, " \-\-password "=\fIPASSWORD\fR" 50 | .RB "Set password for accessing HOST." 51 | .RB "If this option is not supplied, or if " PASSWORD " is zero, and no" 52 | .RB "password is given as first line of \fICOMMAND\fR, then no" 53 | password is set. 54 | .TP 55 | .BR \-v ", " \-\-verbose 56 | Verbose output. 57 | .TP 58 | .BR \-V ", " \-\-version 59 | Display version number and exit. 60 | .TP 61 | .BR \-h ", " \-\-help 62 | Display help message and exit. 63 | .SH EXAMPLES 64 | .TP 65 | Get information about available commands: 66 | $ accel-cmd help 67 | .TP 68 | Send the "show sessions" command to accel-ppp on localhost and display \ 69 | the result on standard output: 70 | $ accel-cmd show sessions 71 | .TP 72 | Execute commands stored in file "cmds": 73 | $ accel-cmd < cmds 74 | .TP 75 | Same as above, but send commands to another host and timeout after \ 76 | 1.5 seconds of inactivity: 77 | $ accel-cmd --timeout 1500ms --host accelppp.example.com < cmds 78 | .SH EXIT STATUS 79 | .TP 80 | 0 81 | success, 82 | .TP 83 | 1 84 | invalid command line option, 85 | .TP 86 | 2 87 | invalid parameter given to a command line option, 88 | .TP 89 | 3 90 | connection to accel-ppp failed, 91 | .TP 92 | 4 93 | timeout expired, 94 | .TP 95 | 5 96 | \fICOMMAND\fR too big (standard input may be used instead \ 97 | for sending big amounts of data), 98 | .TP 99 | 100 (or above) 100 | internal error. 101 | -------------------------------------------------------------------------------- /accel-pppd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") 2 | ADD_DEFINITIONS(-DPTHREAD_SPINLOCK) 3 | 4 | INCLUDE_DIRECTORIES(include) 5 | 6 | IF (MEMDEBUG) 7 | ADD_DEFINITIONS(-DMEMDEBUG) 8 | IF (VALGRIND) 9 | ADD_DEFINITIONS(-DVALGRIND) 10 | ENDIF (VALGRIND) 11 | ENDIF (MEMDEBUG) 12 | 13 | IF (SESSIONID_LEN) 14 | ADD_DEFINITIONS(-DAP_SESSIONID_LEN=${SESSIONID_LEN}) 15 | ELSE (SESSIONID_LEN) 16 | ADD_DEFINITIONS(-DAP_SESSIONID_LEN=16) 17 | ENDIF (SESSIONID_LEN) 18 | 19 | #IF (BACKUP) 20 | # ADD_DEFINITIONS(-DUSE_BACKUP) 21 | # ADD_SUBDIRECTORY(backup) 22 | #ENDIF (BACKUP) 23 | 24 | IF (NOT DEFINED RADIUS) 25 | SET(RADIUS TRUE) 26 | ENDIF (NOT DEFINED RADIUS) 27 | 28 | IF (LUA) 29 | IF (LUA STREQUAL "TRUE") 30 | include(FindLua51) 31 | ELSE () 32 | find_package("Lua" ${LUA}) 33 | ENDIF () 34 | IF (NOT DEFINED LUA_VERSION_STRING) 35 | MESSAGE(FATAL_ERROR "lua not found") 36 | ENDIF () 37 | ADD_SUBDIRECTORY(lua) 38 | ENDIF (LUA) 39 | 40 | IF (RADIUS) 41 | ADD_DEFINITIONS(-DRADIUS) 42 | ADD_SUBDIRECTORY(radius) 43 | ENDIF (RADIUS) 44 | 45 | ADD_SUBDIRECTORY(triton) 46 | ADD_SUBDIRECTORY(vlan-mon) 47 | ADD_SUBDIRECTORY(ctrl) 48 | ADD_SUBDIRECTORY(auth) 49 | ADD_SUBDIRECTORY(logs) 50 | ADD_SUBDIRECTORY(extra) 51 | ADD_SUBDIRECTORY(ipv6) 52 | 53 | IF (NOT DEFINED SHAPER) 54 | SET(SHAPER TRUE) 55 | ENDIF (NOT DEFINED SHAPER) 56 | 57 | IF (SHAPER) 58 | ADD_SUBDIRECTORY(shaper) 59 | ENDIF (SHAPER) 60 | 61 | INCLUDE(CheckIncludeFile) 62 | CHECK_INCLUDE_FILE("linux/netfilter/ipset/ip_set.h" HAVE_IPSET) 63 | 64 | INCLUDE(CheckFunctionExists) 65 | CHECK_FUNCTION_EXISTS(setns HAVE_SETNS) 66 | 67 | ADD_EXECUTABLE(accel-pppd 68 | memdebug.c 69 | session.c 70 | session_backup.c 71 | ifcfg.c 72 | net.c 73 | 74 | backup/backup.c 75 | 76 | ppp/ppp.c 77 | ppp/ppp_fsm.c 78 | ppp/ppp_lcp.c 79 | ppp/lcp_opt_mru.c 80 | ppp/lcp_opt_magic.c 81 | ppp/lcp_opt_pcomp.c 82 | ppp/lcp_opt_accomp.c 83 | ppp/ppp_auth.c 84 | ppp/ppp_ipcp.c 85 | ppp/ipcp_opt_ipaddr.c 86 | ppp/ipcp_opt_dns.c 87 | ppp/ipcp_opt_wins.c 88 | ppp/ipv6cp_opt_intfid.c 89 | ppp/ppp_ipv6cp.c 90 | ppp/ppp_ccp.c 91 | ppp/ccp_mppe.c 92 | 93 | cli/std_cmd.c 94 | cli/show_sessions.c 95 | cli/telnet.c 96 | cli/tcp.c 97 | cli/cli.c 98 | 99 | libnetlink/libnetlink.c 100 | libnetlink/iputils.c 101 | libnetlink/genl.c 102 | libnetlink/ipset.c 103 | 104 | pwdb.c 105 | ipdb.c 106 | 107 | iprange.c 108 | 109 | utils.c 110 | rbtree.c 111 | 112 | log.c 113 | main.c 114 | ) 115 | 116 | TARGET_LINK_LIBRARIES(accel-pppd triton rt pthread ${crypto_lib} pcre) 117 | set_property(TARGET accel-pppd PROPERTY CMAKE_SKIP_BUILD_RPATH FALSE) 118 | set_property(TARGET accel-pppd PROPERTY CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) 119 | set_property(TARGET accel-pppd PROPERTY INSTALL_RPATH_USE_LINK_PATH FALSE) 120 | set_property(TARGET accel-pppd PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/accel-ppp) 121 | 122 | INSTALL(TARGETS accel-pppd 123 | RUNTIME DESTINATION sbin 124 | ) 125 | 126 | INSTALL(FILES accel-ppp.conf.5 DESTINATION share/man/man5) 127 | 128 | IF (NOT DEFINED CPACK_TYPE) 129 | INSTALL(FILES accel-ppp.conf DESTINATION ${CMAKE_FIND_ROOT_PATH}/etc RENAME accel-ppp.conf.dist) 130 | 131 | INSTALL(CODE "EXECUTE_PROCESS(COMMAND mkdir -p ${CMAKE_FIND_ROOT_PATH}/var/log/accel-ppp)") 132 | INSTALL(CODE "EXECUTE_PROCESS(COMMAND mkdir -p ${CMAKE_FIND_ROOT_PATH}/var/lib/accel-ppp)") 133 | ENDIF (NOT DEFINED CPACK_TYPE) 134 | 135 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/statPPTP.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: this file originally auto-generated by mib2c using 3 | * : mib2c.int_watch.conf 13957 2005-12-20 15:33:08Z tanders $ 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include "statPPTP.h" 10 | 11 | #include "triton.h" 12 | 13 | /* 14 | * The variables we want to tie the relevant OIDs to. 15 | * The agent will handle all GET and (if applicable) SET requests 16 | * to these variables automatically, changing the values as needed. 17 | */ 18 | 19 | void pptp_get_stat(unsigned int **, unsigned int **); 20 | 21 | static unsigned int *stat_starting; 22 | static unsigned int *stat_active; 23 | 24 | /* 25 | * Our initialization routine, called automatically by the agent 26 | * (Note that the function name must match init_FILENAME()) 27 | */ 28 | void 29 | init_statPPTP(void) 30 | { 31 | netsnmp_handler_registration *reg; 32 | netsnmp_watcher_info *winfo; 33 | 34 | static oid statPPTPStarting_oid[] = { 1,3,6,1,4,1,8072,100,1,3,1 }; 35 | static oid statPPTPActive_oid[] = { 1,3,6,1,4,1,8072,100,1,3,2 }; 36 | 37 | /* 38 | * a debugging statement. Run the agent with -DstatPPTP to see 39 | * the output of this debugging statement. 40 | */ 41 | DEBUGMSGTL(("statPPTP", "Initializing the statPPTP module\n")); 42 | 43 | if (!triton_module_loaded("pptp")) 44 | return; 45 | 46 | pptp_get_stat(&stat_starting, &stat_active); 47 | /* 48 | * Register scalar watchers for each of the MIB objects. 49 | * The ASN type and RO/RW status are taken from the MIB definition, 50 | * but can be adjusted if needed. 51 | * 52 | * In most circumstances, the scalar watcher will handle all 53 | * of the necessary processing. But the NULL parameter in the 54 | * netsnmp_create_handler_registration() call can be used to 55 | * supply a user-provided handler if necessary. 56 | * 57 | * This approach can also be used to handle Counter64, string- 58 | * and OID-based watched scalars (although variable-sized writeable 59 | * objects will need some more specialised initialisation). 60 | */ 61 | DEBUGMSGTL(("statPPTP", 62 | "Initializing statPPTPStarting scalar integer. Default value = %d\n", 63 | 0)); 64 | reg = netsnmp_create_handler_registration( 65 | "statPPTPStarting", NULL, 66 | statPPTPStarting_oid, OID_LENGTH(statPPTPStarting_oid), 67 | HANDLER_CAN_RONLY); 68 | winfo = netsnmp_create_watcher_info( 69 | stat_starting, sizeof(*stat_starting), 70 | ASN_INTEGER, WATCHER_FIXED_SIZE); 71 | if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) { 72 | snmp_log( LOG_ERR, "Failed to register watched statPPTPStarting" ); 73 | } 74 | 75 | DEBUGMSGTL(("statPPTP", 76 | "Initializing statPPTPActive scalar integer. Default value = %d\n", 77 | 0)); 78 | reg = netsnmp_create_handler_registration( 79 | "statPPTPActive", NULL, 80 | statPPTPActive_oid, OID_LENGTH(statPPTPActive_oid), 81 | HANDLER_CAN_RONLY); 82 | winfo = netsnmp_create_watcher_info( 83 | stat_active, sizeof(*stat_active), 84 | ASN_INTEGER, WATCHER_FIXED_SIZE); 85 | if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) { 86 | snmp_log( LOG_ERR, "Failed to register watched statPPTPActive" ); 87 | } 88 | 89 | 90 | DEBUGMSGTL(("statPPTP", 91 | "Done initalizing statPPTP module\n")); 92 | } 93 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/statIPOE.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: this file originally auto-generated by mib2c using 3 | * : mib2c.int_watch.conf 13957 2005-12-20 15:33:08Z tanders $ 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include "triton.h" 11 | #include "statIPOE.h" 12 | 13 | /* 14 | * The variables we want to tie the relevant OIDs to. 15 | * The agent will handle all GET and (if applicable) SET requests 16 | * to these variables automatically, changing the values as needed. 17 | */ 18 | 19 | void ipoe_get_stat(unsigned int **, unsigned int **); 20 | 21 | static unsigned int *stat_starting; 22 | static unsigned int *stat_active; 23 | 24 | /* 25 | * Our initialization routine, called automatically by the agent 26 | * (Note that the function name must match init_FILENAME()) 27 | */ 28 | void 29 | init_statIPOE(void) 30 | { 31 | netsnmp_handler_registration *reg; 32 | netsnmp_watcher_info *winfo; 33 | 34 | static oid statIPOEStarting_oid[] = { 1,3,6,1,4,1,8072,100,1,6,1 }; 35 | static oid statIPOEActive_oid[] = { 1,3,6,1,4,1,8072,100,1,6,2 }; 36 | 37 | /* 38 | * a debugging statement. Run the agent with -DstatIPOE to see 39 | * the output of this debugging statement. 40 | */ 41 | DEBUGMSGTL(("statIPOE", "Initializing the statIPOE module\n")); 42 | 43 | if (!triton_module_loaded("ipoe")) 44 | return; 45 | 46 | ipoe_get_stat(&stat_starting, &stat_active); 47 | 48 | /* 49 | * Register scalar watchers for each of the MIB objects. 50 | * The ASN type and RO/RW status are taken from the MIB definition, 51 | * but can be adjusted if needed. 52 | * 53 | * In most circumstances, the scalar watcher will handle all 54 | * of the necessary processing. But the NULL parameter in the 55 | * netsnmp_create_handler_registration() call can be used to 56 | * supply a user-provided handler if necessary. 57 | * 58 | * This approach can also be used to handle Counter64, string- 59 | * and OID-based watched scalars (although variable-sized writeable 60 | * objects will need some more specialised initialisation). 61 | */ 62 | DEBUGMSGTL(("statIPOE", 63 | "Initializing statIPOEStarting scalar integer. Default value = %d\n", 64 | 0)); 65 | reg = netsnmp_create_handler_registration( 66 | "statIPOEStarting", NULL, 67 | statIPOEStarting_oid, OID_LENGTH(statIPOEStarting_oid), 68 | HANDLER_CAN_RONLY); 69 | winfo = netsnmp_create_watcher_info( 70 | stat_starting, sizeof(*stat_starting), 71 | ASN_INTEGER, WATCHER_FIXED_SIZE); 72 | if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) { 73 | snmp_log( LOG_ERR, "Failed to register watched statIPOEStarting" ); 74 | } 75 | 76 | DEBUGMSGTL(("statIPOE", 77 | "Initializing statIPOEActive scalar integer. Default value = %d\n", 78 | 0)); 79 | reg = netsnmp_create_handler_registration( 80 | "statIPOEActive", NULL, 81 | statIPOEActive_oid, OID_LENGTH(statIPOEActive_oid), 82 | HANDLER_CAN_RONLY); 83 | winfo = netsnmp_create_watcher_info( 84 | stat_active, sizeof(*stat_active), 85 | ASN_INTEGER, WATCHER_FIXED_SIZE); 86 | if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) { 87 | snmp_log( LOG_ERR, "Failed to register watched statIPOEActive" ); 88 | } 89 | 90 | 91 | DEBUGMSGTL(("statIPOE", 92 | "Done initalizing statIPOE module\n")); 93 | } 94 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/statL2TP.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: this file originally auto-generated by mib2c using 3 | * : mib2c.int_watch.conf 13957 2005-12-20 15:33:08Z tanders $ 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include "triton.h" 11 | #include "statL2TP.h" 12 | 13 | 14 | /* 15 | * The variables we want to tie the relevant OIDs to. 16 | * The agent will handle all GET and (if applicable) SET requests 17 | * to these variables automatically, changing the values as needed. 18 | */ 19 | 20 | void l2tp_get_stat(unsigned int **, unsigned int **); 21 | 22 | static unsigned int *stat_starting; 23 | static unsigned int *stat_active; 24 | 25 | /* 26 | * Our initialization routine, called automatically by the agent 27 | * (Note that the function name must match init_FILENAME()) 28 | */ 29 | void 30 | init_statL2TP(void) 31 | { 32 | netsnmp_handler_registration *reg; 33 | netsnmp_watcher_info *winfo; 34 | 35 | static oid statL2TPStarting_oid[] = { 1,3,6,1,4,1,8072,100,1,4,1 }; 36 | static oid statL2TPActive_oid[] = { 1,3,6,1,4,1,8072,100,1,4,2 }; 37 | 38 | /* 39 | * a debugging statement. Run the agent with -DstatL2TP to see 40 | * the output of this debugging statement. 41 | */ 42 | DEBUGMSGTL(("statL2TP", "Initializing the statL2TP module\n")); 43 | 44 | if (!triton_module_loaded("l2tp")) 45 | return; 46 | 47 | l2tp_get_stat(&stat_starting, &stat_active); 48 | 49 | /* 50 | * Register scalar watchers for each of the MIB objects. 51 | * The ASN type and RO/RW status are taken from the MIB definition, 52 | * but can be adjusted if needed. 53 | * 54 | * In most circumstances, the scalar watcher will handle all 55 | * of the necessary processing. But the NULL parameter in the 56 | * netsnmp_create_handler_registration() call can be used to 57 | * supply a user-provided handler if necessary. 58 | * 59 | * This approach can also be used to handle Counter64, string- 60 | * and OID-based watched scalars (although variable-sized writeable 61 | * objects will need some more specialised initialisation). 62 | */ 63 | DEBUGMSGTL(("statL2TP", 64 | "Initializing statL2TPStarting scalar integer. Default value = %d\n", 65 | 0)); 66 | reg = netsnmp_create_handler_registration( 67 | "statL2TPStarting", NULL, 68 | statL2TPStarting_oid, OID_LENGTH(statL2TPStarting_oid), 69 | HANDLER_CAN_RONLY); 70 | winfo = netsnmp_create_watcher_info( 71 | stat_starting, sizeof(*stat_starting), 72 | ASN_INTEGER, WATCHER_FIXED_SIZE); 73 | if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) { 74 | snmp_log( LOG_ERR, "Failed to register watched statL2TPStarting" ); 75 | } 76 | 77 | DEBUGMSGTL(("statL2TP", 78 | "Initializing statL2TPActive scalar integer. Default value = %d\n", 79 | 0)); 80 | reg = netsnmp_create_handler_registration( 81 | "statL2TPActive", NULL, 82 | statL2TPActive_oid, OID_LENGTH(statL2TPActive_oid), 83 | HANDLER_CAN_RONLY); 84 | winfo = netsnmp_create_watcher_info( 85 | stat_active, sizeof(*stat_active), 86 | ASN_INTEGER, WATCHER_FIXED_SIZE); 87 | if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) { 88 | snmp_log( LOG_ERR, "Failed to register watched statL2TPActive" ); 89 | } 90 | 91 | 92 | DEBUGMSGTL(("statL2TP", 93 | "Done initalizing statL2TP module\n")); 94 | } 95 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/statPPPOE.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: this file originally auto-generated by mib2c using 3 | * : mib2c.int_watch.conf 13957 2005-12-20 15:33:08Z tanders $ 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include "triton.h" 11 | #include "statPPPOE.h" 12 | 13 | /* 14 | * The variables we want to tie the relevant OIDs to. 15 | * The agent will handle all GET and (if applicable) SET requests 16 | * to these variables automatically, changing the values as needed. 17 | */ 18 | 19 | void pppoe_get_stat(unsigned int **, unsigned int **); 20 | 21 | static unsigned int *stat_starting; 22 | static unsigned int *stat_active; 23 | 24 | /* 25 | * Our initialization routine, called automatically by the agent 26 | * (Note that the function name must match init_FILENAME()) 27 | */ 28 | void 29 | init_statPPPOE(void) 30 | { 31 | netsnmp_handler_registration *reg; 32 | netsnmp_watcher_info *winfo; 33 | 34 | static oid statPPPOEStarting_oid[] = { 1,3,6,1,4,1,8072,100,1,5,1 }; 35 | static oid statPPPOEActive_oid[] = { 1,3,6,1,4,1,8072,100,1,5,2 }; 36 | 37 | /* 38 | * a debugging statement. Run the agent with -DstatPPPOE to see 39 | * the output of this debugging statement. 40 | */ 41 | DEBUGMSGTL(("statPPPOE", "Initializing the statPPPOE module\n")); 42 | 43 | if (!triton_module_loaded("pppoe")) 44 | return; 45 | 46 | pppoe_get_stat(&stat_starting, &stat_active); 47 | 48 | /* 49 | * Register scalar watchers for each of the MIB objects. 50 | * The ASN type and RO/RW status are taken from the MIB definition, 51 | * but can be adjusted if needed. 52 | * 53 | * In most circumstances, the scalar watcher will handle all 54 | * of the necessary processing. But the NULL parameter in the 55 | * netsnmp_create_handler_registration() call can be used to 56 | * supply a user-provided handler if necessary. 57 | * 58 | * This approach can also be used to handle Counter64, string- 59 | * and OID-based watched scalars (although variable-sized writeable 60 | * objects will need some more specialised initialisation). 61 | */ 62 | DEBUGMSGTL(("statPPPOE", 63 | "Initializing statPPPOEStarting scalar integer. Default value = %d\n", 64 | 0)); 65 | reg = netsnmp_create_handler_registration( 66 | "statPPPOEStarting", NULL, 67 | statPPPOEStarting_oid, OID_LENGTH(statPPPOEStarting_oid), 68 | HANDLER_CAN_RONLY); 69 | winfo = netsnmp_create_watcher_info( 70 | stat_starting, sizeof(*stat_starting), 71 | ASN_INTEGER, WATCHER_FIXED_SIZE); 72 | if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) { 73 | snmp_log( LOG_ERR, "Failed to register watched statPPPOEStarting" ); 74 | } 75 | 76 | DEBUGMSGTL(("statPPPOE", 77 | "Initializing statPPPOEActive scalar integer. Default value = %d\n", 78 | 0)); 79 | reg = netsnmp_create_handler_registration( 80 | "statPPPOEActive", NULL, 81 | statPPPOEActive_oid, OID_LENGTH(statPPPOEActive_oid), 82 | HANDLER_CAN_RONLY); 83 | winfo = netsnmp_create_watcher_info( 84 | stat_active, sizeof(*stat_active), 85 | ASN_INTEGER, WATCHER_FIXED_SIZE); 86 | if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) { 87 | snmp_log( LOG_ERR, "Failed to register watched statPPPOEActive" ); 88 | } 89 | 90 | 91 | DEBUGMSGTL(("statPPPOE", 92 | "Done initalizing statPPPOE module\n")); 93 | } 94 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | cmake_policy(SET CMP0005 NEW) 3 | cmake_policy(SET CMP0003 OLD) 4 | 5 | if (CMAKE_BINARY_DIR STREQUAL CMAKE_HOME_DIRECTORY) 6 | message(FATAL_ERROR "Building in source directory is forbidden. Please make separated build directory.") 7 | endif () 8 | 9 | project(accel-ppp C) 10 | 11 | include(cmake/cpack.cmake) 12 | 13 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fno-strict-aliasing -D_GNU_SOURCE -fPIC -rdynamic -Wno-unused-result") 14 | 15 | IF (NOT DEFINED LIB_SUFFIX) 16 | EXECUTE_PROCESS( 17 | COMMAND uname -m 18 | COMMAND tr -d '\n' 19 | OUTPUT_VARIABLE ARCH 20 | ) 21 | message(STATUS "'" ${ARCH} "'") 22 | IF (ARCH STREQUAL x86_64) 23 | SET(LIB_SUFFIX 64) 24 | ENDIF (ARCH STREQUAL x86_64) 25 | ENDIF (NOT DEFINED LIB_SUFFIX) 26 | 27 | #color console example message(FATAL_ERROR "${Esc}[31m Red Text ${Esc}[m Restore Normal Text") 28 | string(ASCII 27 Esc) 29 | 30 | #Check libpcre 31 | find_library(PCRE_LIBRARY pcre 32 | HINTS ${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib 33 | PATHS ${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib 34 | ) 35 | 36 | IF(NOT PCRE_LIBRARY) 37 | message(FATAL_ERROR "${Esc}[31mRequired libpcre not found.\n Install libpcre3-dev and run cmake again${Esc}[m") 38 | ENDIF(NOT PCRE_LIBRARY) 39 | 40 | 41 | IF (EXISTS ${CMAKE_HOME_DIRECTORY}/.git AND NOT IGNORE_GIT) 42 | EXECUTE_PROCESS( 43 | COMMAND git log --no-color 44 | COMMAND head -n1 45 | COMMAND awk "{print $2}" 46 | WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY} 47 | OUTPUT_VARIABLE ACCEL_PPP_VERSION 48 | ) 49 | STRING(STRIP ${ACCEL_PPP_VERSION} ACCEL_PPP_VERSION) 50 | ELSE (EXISTS ${CMAKE_HOME_DIRECTORY}/.git AND NOT IGNORE_GIT) 51 | SET (ACCEL_PPP_VERSION 1.11.0) 52 | ENDIF (EXISTS ${CMAKE_HOME_DIRECTORY}/.git AND NOT IGNORE_GIT) 53 | 54 | ADD_DEFINITIONS(-DACCEL_PPP_VERSION="${ACCEL_PPP_VERSION}") 55 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) 56 | 57 | if (NOT BUILD_DRIVER_ONLY) 58 | if (MEMDEBUG) 59 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector -fstack-protector-all") 60 | endif (MEMDEBUG) 61 | 62 | if (NOT DEFINED CRYPTO) 63 | set(CRYPTO OPENSSL) 64 | endif (NOT DEFINED CRYPTO) 65 | 66 | if (CRYPTO STREQUAL OPENSSL) 67 | find_library(CRYPTO_LIBRARY ssl 68 | HINTS ${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib 69 | PATHS ${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib 70 | ) 71 | IF(NOT CRYPTO_LIBRARY) 72 | message(FATAL_ERROR "${Esc}[31mRequired libcrypto-0.9.8 or probably later (openssl-0.9.8) not found.\n Install libssl-dev and run cmake again${Esc}[m") 73 | ENDIF(NOT CRYPTO_LIBRARY) 74 | add_definitions(-DCRYPTO_OPENSSL) 75 | set(crypto_lib crypto ssl) 76 | elseif (CRYPTO STREQUAL TOMCRYPT) 77 | add_definitions(-DCRYPTO_TOMCRYPT) 78 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/crypto) 79 | set(crypto_lib tomcrypt internal-crypto) 80 | elseif (CRYPTO STREQUAL INTERNAL) 81 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/crypto) 82 | set(crypto_lib internal-crypto) 83 | else (CRYPTO STREQUAL OPENSSL) 84 | message(FATAL_ERROR "unknown CRYPTO type") 85 | endif (CRYPTO STREQUAL OPENSSL) 86 | 87 | add_subdirectory(accel-pppd) 88 | add_subdirectory(crypto) 89 | add_subdirectory(accel-cmd) 90 | 91 | install(DIRECTORY DESTINATION /var/log/accel-ppp) 92 | endif (NOT BUILD_DRIVER_ONLY) 93 | 94 | if (BUILD_PPTP_DRIVER) 95 | add_subdirectory(drivers/pptp) 96 | endif (BUILD_PPTP_DRIVER) 97 | 98 | if (BUILD_IPOE_DRIVER) 99 | add_subdirectory(drivers/ipoe) 100 | endif (BUILD_IPOE_DRIVER) 101 | 102 | if (BUILD_VLAN_MON_DRIVER) 103 | add_subdirectory(drivers/vlan_mon) 104 | endif () 105 | 106 | CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) 107 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/statPPP.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: this file originally auto-generated by mib2c using 3 | * : mib2c.int_watch.conf 13957 2005-12-20 15:33:08Z tanders $ 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include "statPPP.h" 10 | 11 | #include "ppp.h" 12 | 13 | /* 14 | * Our initialization routine, called automatically by the agent 15 | * (Note that the function name must match init_FILENAME()) 16 | */ 17 | void 18 | init_statPPP(void) 19 | { 20 | netsnmp_handler_registration *reg; 21 | netsnmp_watcher_info *winfo; 22 | 23 | static oid statPPPStarting_oid[] = { 1,3,6,1,4,1,8072,100,1,2,1 }; 24 | static oid statPPPActive_oid[] = { 1,3,6,1,4,1,8072,100,1,2,2 }; 25 | static oid statPPPFinishing_oid[] = { 1,3,6,1,4,1,8072,100,1,2,3 }; 26 | 27 | /* 28 | * a debugging statement. Run the agent with -DstatPPP to see 29 | * the output of this debugging statement. 30 | */ 31 | DEBUGMSGTL(("statPPP", "Initializing the statPPP module\n")); 32 | 33 | 34 | /* 35 | * Register scalar watchers for each of the MIB objects. 36 | * The ASN type and RO/RW status are taken from the MIB definition, 37 | * but can be adjusted if needed. 38 | * 39 | * In most circumstances, the scalar watcher will handle all 40 | * of the necessary processing. But the NULL parameter in the 41 | * netsnmp_create_handler_registration() call can be used to 42 | * supply a user-provided handler if necessary. 43 | * 44 | * This approach can also be used to handle Counter64, string- 45 | * and OID-based watched scalars (although variable-sized writeable 46 | * objects will need some more specialised initialisation). 47 | */ 48 | DEBUGMSGTL(("statPPP", 49 | "Initializing statPPPStarting scalar integer. Default value = %d\n", 50 | 0)); 51 | reg = netsnmp_create_handler_registration( 52 | "statPPPStarting", NULL, 53 | statPPPStarting_oid, OID_LENGTH(statPPPStarting_oid), 54 | HANDLER_CAN_RONLY); 55 | winfo = netsnmp_create_watcher_info( 56 | &ap_session_stat.starting, sizeof(ap_session_stat.starting), 57 | ASN_INTEGER, WATCHER_FIXED_SIZE); 58 | if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) { 59 | snmp_log( LOG_ERR, "Failed to register watched statPPPStarting" ); 60 | } 61 | 62 | DEBUGMSGTL(("statPPP", 63 | "Initializing statPPPActive scalar integer. Default value = %d\n", 64 | 0)); 65 | reg = netsnmp_create_handler_registration( 66 | "statPPPActive", NULL, 67 | statPPPActive_oid, OID_LENGTH(statPPPActive_oid), 68 | HANDLER_CAN_RONLY); 69 | winfo = netsnmp_create_watcher_info( 70 | &ap_session_stat.active, sizeof(ap_session_stat.active), 71 | ASN_INTEGER, WATCHER_FIXED_SIZE); 72 | if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) { 73 | snmp_log( LOG_ERR, "Failed to register watched statPPPActive" ); 74 | } 75 | 76 | DEBUGMSGTL(("statPPP", 77 | "Initializing statPPPFinishing scalar integer. Default value = %d\n", 78 | 0)); 79 | reg = netsnmp_create_handler_registration( 80 | "statPPPFinishing", NULL, 81 | statPPPFinishing_oid, OID_LENGTH(statPPPFinishing_oid), 82 | HANDLER_CAN_RONLY); 83 | winfo = netsnmp_create_watcher_info( 84 | &ap_session_stat.finishing, sizeof(ap_session_stat.finishing), 85 | ASN_INTEGER, WATCHER_FIXED_SIZE); 86 | if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) { 87 | snmp_log( LOG_ERR, "Failed to register watched statPPPFinishing" ); 88 | } 89 | 90 | 91 | DEBUGMSGTL(("statPPP", 92 | "Done initalizing statPPP module\n")); 93 | } 94 | -------------------------------------------------------------------------------- /accel-pppd/libnetlink/ipset.c: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | 3 | #ifdef HAVE_IPSET 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #include "triton.h" 22 | #include "log.h" 23 | 24 | #include "libnetlink.h" 25 | #include "ipset.h" 26 | 27 | #include "memdebug.h" 28 | 29 | static int __ipset_cmd(const char *name, in_addr_t addr, int cmd, int flags) 30 | { 31 | struct rtnl_handle rth; 32 | struct req { 33 | struct nlmsghdr n; 34 | struct nfgenmsg nf; 35 | char buf[4096]; 36 | } req; 37 | struct rtattr *tail1, *tail2; 38 | uint8_t protocol = IPSET_PROTOCOL; 39 | 40 | if (rtnl_open_byproto(&rth, 0, NETLINK_NETFILTER)) { 41 | log_error("ipset: cannot open rtnetlink\n"); 42 | return -1; 43 | } 44 | 45 | memset(&req, 0, sizeof(req) - 4096); 46 | 47 | req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct nfgenmsg)); 48 | req.n.nlmsg_flags = flags; 49 | req.n.nlmsg_type = cmd | (NFNL_SUBSYS_IPSET << 8); 50 | req.nf.nfgen_family = AF_INET; 51 | req.nf.version = NFNETLINK_V0; 52 | req.nf.res_id = 0; 53 | 54 | addattr_l(&req.n, 4096, IPSET_ATTR_PROTOCOL, &protocol, 1); 55 | addattr_l(&req.n, 4096, IPSET_ATTR_SETNAME, name, strlen(name) + 1); 56 | 57 | tail1 = addattr_nest(&req.n, MAX_MSG, IPSET_ATTR_DATA | NLA_F_NESTED); 58 | 59 | tail2 = addattr_nest(&req.n, MAX_MSG, IPSET_ATTR_IP | NLA_F_NESTED); 60 | addattr32(&req.n, 4096, IPSET_ATTR_IPADDR_IPV4 | NLA_F_NET_BYTEORDER, addr); 61 | addattr_nest_end(&req.n, tail2); 62 | 63 | addattr_nest_end(&req.n, tail1); 64 | 65 | if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL, 0) < 0) 66 | goto out_err; 67 | 68 | rtnl_close(&rth); 69 | 70 | return 0; 71 | 72 | out_err: 73 | rtnl_close(&rth); 74 | 75 | return -1; 76 | 77 | } 78 | 79 | int __export ipset_add(const char *name, in_addr_t addr) 80 | { 81 | return __ipset_cmd(name, addr, IPSET_CMD_ADD, NLM_F_REQUEST | NLM_F_ACK | NLM_F_EXCL); 82 | } 83 | 84 | int __export ipset_del(const char *name, in_addr_t addr) 85 | { 86 | return __ipset_cmd(name, addr, IPSET_CMD_DEL, NLM_F_REQUEST | NLM_F_ACK); 87 | } 88 | 89 | int __export ipset_flush(const char *name) 90 | { 91 | struct rtnl_handle rth; 92 | struct req { 93 | struct nlmsghdr n; 94 | struct nfgenmsg nf; 95 | char buf[4096]; 96 | } req; 97 | uint8_t protocol = IPSET_PROTOCOL; 98 | 99 | if (rtnl_open_byproto(&rth, 0, NETLINK_NETFILTER)) { 100 | log_error("ipset: cannot open rtnetlink\n"); 101 | return -1; 102 | } 103 | 104 | memset(&req, 0, sizeof(req) - 4096); 105 | 106 | req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct nfgenmsg)); 107 | req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK; 108 | req.n.nlmsg_type = IPSET_CMD_FLUSH | (NFNL_SUBSYS_IPSET << 8); 109 | req.nf.nfgen_family = AF_INET; 110 | req.nf.version = NFNETLINK_V0; 111 | req.nf.res_id = 0; 112 | 113 | addattr_l(&req.n, 4096, IPSET_ATTR_PROTOCOL, &protocol, 1); 114 | addattr_l(&req.n, 4096, IPSET_ATTR_SETNAME, name, strlen(name) + 1); 115 | 116 | if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL, 0) < 0) 117 | goto out_err; 118 | 119 | rtnl_close(&rth); 120 | 121 | return 0; 122 | 123 | out_err: 124 | rtnl_close(&rth); 125 | 126 | return -1; 127 | } 128 | 129 | #else 130 | 131 | #include 132 | #include "triton.h" 133 | 134 | int __export ipset_add(const char *name, in_addr_t addr) 135 | { 136 | return -1; 137 | } 138 | 139 | int __export ipset_del(const char *name, in_addr_t addr) 140 | { 141 | return -1; 142 | } 143 | 144 | int __export ipset_flush(const char *name) 145 | { 146 | return -1; 147 | } 148 | 149 | #endif 150 | -------------------------------------------------------------------------------- /accel-pppd/ppp/ppp.h: -------------------------------------------------------------------------------- 1 | #ifndef PPP_H 2 | #define PPP_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "triton.h" 10 | #include "list.h" 11 | #include "ap_session.h" 12 | 13 | /* 14 | * Packet header = Code, id, length. 15 | */ 16 | #define PPP_HEADERLEN 4 17 | #define PPP_MTU 1500 18 | 19 | /* 20 | * Protocol field values. 21 | */ 22 | #define PPP_IP 0x21 /* Internet Protocol */ 23 | #define PPP_AT 0x29 /* AppleTalk Protocol */ 24 | #define PPP_IPX 0x2b /* IPX protocol */ 25 | #define PPP_VJC_COMP 0x2d /* VJ compressed TCP */ 26 | #define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */ 27 | #define PPP_IPV6 0x57 /* Internet Protocol Version 6 */ 28 | #define PPP_COMP 0xfd /* compressed packet */ 29 | #define PPP_IPCP 0x8021 /* IP Control Protocol */ 30 | #define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */ 31 | #define PPP_IPXCP 0x802b /* IPX Control Protocol */ 32 | #define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */ 33 | #define PPP_CCP 0x80fd /* Compression Control Protocol */ 34 | #define PPP_ECP 0x8053 /* Encryption Control Protocol */ 35 | #define PPP_LCP 0xc021 /* Link Control Protocol */ 36 | #define PPP_PAP 0xc023 /* Password Authentication Protocol */ 37 | #define PPP_LQR 0xc025 /* Link Quality Report protocol */ 38 | #define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */ 39 | #define PPP_CBCP 0xc029 /* Callback Control Protocol */ 40 | #define PPP_EAP 0xc227 /* Extensible Authentication Protocol */ 41 | 42 | struct ppp_t 43 | { 44 | struct ap_session ses; 45 | 46 | struct triton_md_handler_t chan_hnd; 47 | struct triton_md_handler_t unit_hnd; 48 | int fd; 49 | int chan_fd; 50 | int unit_fd; 51 | 52 | int chan_idx; 53 | 54 | int mtu; 55 | int mru; 56 | 57 | void *buf; 58 | int buf_size; 59 | 60 | struct list_head chan_handlers; 61 | struct list_head unit_handlers; 62 | 63 | struct list_head layers; 64 | }; 65 | 66 | struct ppp_layer_t; 67 | struct layer_node_t; 68 | struct ppp_layer_data_t 69 | { 70 | struct list_head entry; 71 | struct ppp_layer_t *layer; 72 | struct layer_node_t *node; 73 | int passive:1; 74 | int optional:1; 75 | int starting:1; 76 | int started:1; 77 | int finished:1; 78 | }; 79 | 80 | struct ppp_layer_t 81 | { 82 | struct list_head entry; 83 | struct ppp_layer_data_t *(*init)(struct ppp_t *); 84 | int (*start)(struct ppp_layer_data_t*); 85 | void (*finish)(struct ppp_layer_data_t*); 86 | void (*free)(struct ppp_layer_data_t *); 87 | }; 88 | 89 | struct ppp_handler_t 90 | { 91 | struct list_head entry; 92 | int proto; 93 | void (*recv)(struct ppp_handler_t*); 94 | void (*recv_proto_rej)(struct ppp_handler_t *h); 95 | }; 96 | 97 | void ppp_init(struct ppp_t *ppp); 98 | int establish_ppp(struct ppp_t *ppp); 99 | int connect_ppp_channel(struct ppp_t *ppp); 100 | int ppp_chan_send(struct ppp_t *ppp, void *data, int size); 101 | int ppp_unit_send(struct ppp_t *ppp, void *data, int size); 102 | void lcp_send_proto_rej(struct ppp_t *ppp, uint16_t proto); 103 | void ppp_recv_proto_rej(struct ppp_t *ppp, uint16_t proto); 104 | 105 | void ppp_layer_started(struct ppp_t *ppp,struct ppp_layer_data_t*); 106 | void ppp_layer_finished(struct ppp_t *ppp,struct ppp_layer_data_t*); 107 | void ppp_layer_passive(struct ppp_t *ppp,struct ppp_layer_data_t*); 108 | 109 | int ppp_terminate(struct ap_session *ses, int hard); 110 | 111 | void ppp_register_chan_handler(struct ppp_t *, struct ppp_handler_t *); 112 | void ppp_register_unit_handler(struct ppp_t * ,struct ppp_handler_t *); 113 | void ppp_unregister_handler(struct ppp_t *, struct ppp_handler_t *); 114 | 115 | int ppp_register_layer(const char *name, struct ppp_layer_t *); 116 | void ppp_unregister_layer(struct ppp_layer_t *); 117 | struct ppp_layer_data_t *ppp_find_layer_data(struct ppp_t *, struct ppp_layer_t *); 118 | 119 | extern int conf_ppp_verbose; 120 | 121 | #endif 122 | -------------------------------------------------------------------------------- /accel-pppd/extra/connlimit.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "ppp.h" 8 | #include "events.h" 9 | #include "triton.h" 10 | #include "log.h" 11 | 12 | #include "memdebug.h" 13 | 14 | struct item 15 | { 16 | struct list_head entry; 17 | uint64_t key; 18 | struct timespec ts; 19 | int count; 20 | }; 21 | 22 | static int conf_burst = 3; 23 | static int conf_burst_timeout = 60 * 1000; 24 | static int conf_limit_timeout = 5000; 25 | 26 | static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; 27 | static LIST_HEAD(items); 28 | 29 | int __export connlimit_check(uint64_t key) 30 | { 31 | struct item *it; 32 | struct timespec ts; 33 | unsigned int d; 34 | struct list_head *pos, *n; 35 | LIST_HEAD(tmp_list); 36 | int r = 1; 37 | 38 | 39 | clock_gettime(CLOCK_MONOTONIC, &ts); 40 | 41 | pthread_mutex_lock(&lock); 42 | log_debug("connlimit: check entry %" PRIu64 "\n", key); 43 | list_for_each_safe(pos, n, &items) { 44 | it = list_entry(pos, typeof(*it), entry); 45 | 46 | d = (ts.tv_sec - it->ts.tv_sec) * 1000 + (ts.tv_nsec - it->ts.tv_nsec) / 1000000; 47 | 48 | if (it->key == key) { 49 | if (d >= conf_burst_timeout) { 50 | it->ts = ts; 51 | list_move(&it->entry, &items); 52 | it->count = 0; 53 | r = 0; 54 | break; 55 | } 56 | it->count++; 57 | if (it->count >= conf_burst) { 58 | if (d >= conf_limit_timeout) { 59 | it->ts = ts; 60 | list_move(&it->entry, &items); 61 | r = 0; 62 | } else 63 | r = -1; 64 | } else 65 | r = 0; 66 | break; 67 | } 68 | 69 | if (d > conf_burst_timeout) { 70 | log_debug("connlimit: remove %" PRIu64 "\n", it->key); 71 | list_move(&it->entry, &tmp_list); 72 | } 73 | } 74 | pthread_mutex_unlock(&lock); 75 | 76 | if (r == 1) { 77 | it = _malloc(sizeof(*it)); 78 | memset(it, 0, sizeof(*it)); 79 | it->ts = ts; 80 | it->key = key; 81 | 82 | log_debug("connlimit: add entry %" PRIu64 "\n", key); 83 | 84 | pthread_mutex_lock(&lock); 85 | list_add(&it->entry, &items); 86 | pthread_mutex_unlock(&lock); 87 | 88 | r = 0; 89 | } 90 | 91 | if (r == 0) 92 | log_debug("connlimit: accept %" PRIu64 "\n", key); 93 | else 94 | log_debug("connlimit: drop %" PRIu64 "\n", key); 95 | 96 | 97 | while (!list_empty(&tmp_list)) { 98 | it = list_entry(tmp_list.next, typeof(*it), entry); 99 | list_del(&it->entry); 100 | _free(it); 101 | } 102 | 103 | return r; 104 | } 105 | 106 | static int parse_limit(const char *opt, int *limit, int *time) 107 | { 108 | char *endptr; 109 | 110 | *limit = strtol(opt, &endptr, 10); 111 | 112 | if (!*endptr) { 113 | *time = 1; 114 | return 0; 115 | } 116 | 117 | if (*endptr != '/') 118 | goto out_err; 119 | 120 | opt = endptr + 1; 121 | *time = strtol(opt, &endptr, 10); 122 | 123 | if (endptr == opt) 124 | *time = 1; 125 | 126 | if (*endptr == 's') 127 | return 0; 128 | 129 | if (*endptr == 'm') { 130 | *time *= 60; 131 | return 0; 132 | } 133 | 134 | if (*endptr == 'h') { 135 | *time *= 3600; 136 | return 0; 137 | } 138 | 139 | out_err: 140 | log_error("connlimit: failed to parse '%s'\n", opt); 141 | return -1; 142 | } 143 | 144 | static void load_config() 145 | { 146 | const char *opt; 147 | int n,t; 148 | 149 | opt = conf_get_opt("connlimit", "limit"); 150 | if (opt) { 151 | if (parse_limit(opt, &n, &t)) 152 | return; 153 | conf_limit_timeout = t * 1000 / n; 154 | } 155 | 156 | opt = conf_get_opt("connlimit", "burst"); 157 | if (opt) 158 | conf_burst = atoi(opt); 159 | 160 | opt = conf_get_opt("connlimit", "timeout"); 161 | if (opt) 162 | conf_burst_timeout = atoi(opt) * 1000; 163 | } 164 | 165 | static void init() 166 | { 167 | load_config(); 168 | 169 | triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config); 170 | } 171 | 172 | DEFINE_INIT(200, init); 173 | -------------------------------------------------------------------------------- /crypto/crypto.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "crypto.h" 5 | 6 | #ifdef LTC_DES 7 | 8 | static int urandom_fd; 9 | 10 | static const unsigned char odd_parity[256] = { 11 | 1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14, 12 | 16, 16, 19, 19, 21, 21, 22, 22, 25, 25, 26, 26, 28, 28, 31, 31, 13 | 32, 32, 35, 35, 37, 37, 38, 38, 41, 41, 42, 42, 44, 44, 47, 47, 14 | 49, 49, 50, 50, 52, 52, 55, 55, 56, 56, 59, 59, 61, 61, 62, 62, 15 | 64, 64, 67, 67, 69, 69, 70, 70, 73, 73, 74, 74, 76, 76, 79, 79, 16 | 81, 81, 82, 82, 84, 84, 87, 87, 88, 88, 91, 91, 93, 93, 94, 94, 17 | 97, 97, 98, 98,100,100,103,103,104,104,107,107,109,109,110,110, 18 | 112,112,115,115,117,117,118,118,121,121,122,122,124,124,127,127, 19 | 128,128,131,131,133,133,134,134,137,137,138,138,140,140,143,143, 20 | 145,145,146,146,148,148,151,151,152,152,155,155,157,157,158,158, 21 | 161,161,162,162,164,164,167,167,168,168,171,171,173,173,174,174, 22 | 176,176,179,179,181,181,182,182,185,185,186,186,188,188,191,191, 23 | 193,193,194,194,196,196,199,199,200,200,203,203,205,205,206,206, 24 | 208,208,211,211,213,213,214,214,217,217,218,218,220,220,223,223, 25 | 224,224,227,227,229,229,230,230,233,233,234,234,236,236,239,239, 26 | 241,241,242,242,244,244,247,247,248,248,251,251,253,253,254,254 27 | }; 28 | 29 | void DES_set_odd_parity(DES_cblock *key) 30 | { 31 | unsigned int i; 32 | 33 | for (i = 0; i < sizeof(DES_cblock); i++) 34 | (*key)[i] = odd_parity[(*key)[i]]; 35 | } 36 | 37 | int DES_check_key_parity(const_DES_cblock *key) 38 | { 39 | unsigned int i; 40 | 41 | for (i = 0; i < sizeof(DES_cblock); i++) { 42 | if ((*key)[i] != odd_parity[(*key)[i]]) 43 | return 0; 44 | } 45 | 46 | return 1; 47 | } 48 | 49 | static const DES_cblock weak_keys[] = { 50 | /* weak keys */ 51 | {0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01}, 52 | {0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE}, 53 | {0x1F,0x1F,0x1F,0x1F,0x0E,0x0E,0x0E,0x0E}, 54 | {0xE0,0xE0,0xE0,0xE0,0xF1,0xF1,0xF1,0xF1}, 55 | /* semi-weak keys */ 56 | {0x01,0xFE,0x01,0xFE,0x01,0xFE,0x01,0xFE}, 57 | {0xFE,0x01,0xFE,0x01,0xFE,0x01,0xFE,0x01}, 58 | {0x1F,0xE0,0x1F,0xE0,0x0E,0xF1,0x0E,0xF1}, 59 | {0xE0,0x1F,0xE0,0x1F,0xF1,0x0E,0xF1,0x0E}, 60 | {0x01,0xE0,0x01,0xE0,0x01,0xF1,0x01,0xF1}, 61 | {0xE0,0x01,0xE0,0x01,0xF1,0x01,0xF1,0x01}, 62 | {0x1F,0xFE,0x1F,0xFE,0x0E,0xFE,0x0E,0xFE}, 63 | {0xFE,0x1F,0xFE,0x1F,0xFE,0x0E,0xFE,0x0E}, 64 | {0x01,0x1F,0x01,0x1F,0x01,0x0E,0x01,0x0E}, 65 | {0x1F,0x01,0x1F,0x01,0x0E,0x01,0x0E,0x01}, 66 | {0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE}, 67 | {0xFE,0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1} 68 | }; 69 | 70 | int DES_is_weak_key(const_DES_cblock *key) 71 | { 72 | int i; 73 | 74 | for (i = 0; i < sizeof(weak_keys); i++) 75 | if (!memcmp(weak_keys[i], key, sizeof(DES_cblock))) 76 | return 1; 77 | 78 | return 0; 79 | } 80 | 81 | int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule) 82 | { 83 | if (!DES_check_key_parity(key)) 84 | return -1; 85 | 86 | if (DES_is_weak_key(key)) 87 | return -2; 88 | 89 | return des_setup((const unsigned char *)key, 8, 0, schedule); 90 | } 91 | 92 | int DES_random_key(DES_cblock *ret) 93 | { 94 | while (1) { 95 | read(urandom_fd, ret, sizeof(DES_cblock)); 96 | if (DES_is_weak_key(ret)) 97 | continue; 98 | break; 99 | } 100 | 101 | DES_set_odd_parity(ret); 102 | 103 | return 0; 104 | } 105 | 106 | void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, DES_key_schedule *ks, int enc) 107 | { 108 | if (enc == DES_ENCRYPT) 109 | des_ecb_encrypt((const unsigned char *) input, (unsigned char *) output, ks); 110 | else 111 | if (enc == DES_DECRYPT) 112 | des_ecb_decrypt((const unsigned char *) input, (unsigned char *) output, ks); 113 | des_done(ks); 114 | } 115 | 116 | static void __attribute__((constructor)) init(void) 117 | { 118 | urandom_fd = open("/dev/urandom", O_RDONLY); 119 | fcntl(urandom_fd, F_SETFD, fcntl(urandom_fd, F_GETFD) | FD_CLOEXEC); 120 | } 121 | #endif 122 | -------------------------------------------------------------------------------- /accel-pppd/extra/net-snmp/exec_cli.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Note: this file originally auto-generated by mib2c using 3 | * : mib2c.scalar.conf 11805 2005-01-07 09:37:18Z dts12 $ 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include "exec_cli.h" 10 | #include "cli_p.h" 11 | 12 | #include "memdebug.h" 13 | 14 | static void no_disconnect(struct cli_client_t *tcln) 15 | { 16 | } 17 | 18 | static int no_send(struct cli_client_t *tcln, const void *_buf, int size) 19 | { 20 | return 0; 21 | } 22 | 23 | static int no_sendv(struct cli_client_t *tcln, const char *fmt, va_list ap) 24 | { 25 | return 0; 26 | } 27 | 28 | static void set_action(const char *cmd, size_t len) 29 | { 30 | struct cli_client_t cc = { 31 | .cmdline = _malloc(len + 1), 32 | .send = no_send, 33 | .sendv = no_sendv, 34 | .disconnect = no_disconnect, 35 | }; 36 | 37 | memcpy(cc.cmdline, cmd, len); 38 | cc.cmdline[len] = 0; 39 | 40 | cli_process_cmd(&cc); 41 | 42 | _free(cc.cmdline); 43 | } 44 | 45 | /** Initializes the cli module */ 46 | void 47 | init_cli(void) 48 | { 49 | static oid cli_oid[] = { 1,3,6,1,4,1,8072,100,3,3 }; 50 | 51 | DEBUGMSGTL(("cli", "Initializing\n")); 52 | 53 | netsnmp_register_scalar( 54 | netsnmp_create_handler_registration("cli", handle_cli, 55 | cli_oid, OID_LENGTH(cli_oid), 56 | HANDLER_CAN_RWRITE 57 | )); 58 | } 59 | 60 | int 61 | handle_cli(netsnmp_mib_handler *handler, 62 | netsnmp_handler_registration *reginfo, 63 | netsnmp_agent_request_info *reqinfo, 64 | netsnmp_request_info *requests) 65 | { 66 | int ret; 67 | /* We are never called for a GETNEXT if it's registered as a 68 | "instance", as it's "magically" handled for us. */ 69 | 70 | /* a instance handler also only hands us one request at a time, so 71 | we don't need to loop over a list of requests; we'll only get one. */ 72 | 73 | switch(reqinfo->mode) { 74 | 75 | case MODE_GET: 76 | netsnmp_set_request_error(reqinfo, requests, SNMP_NOSUCHINSTANCE ); 77 | break; 78 | 79 | /* 80 | * SET REQUEST 81 | * 82 | * multiple states in the transaction. See: 83 | * http://www.net-snmp.org/tutorial-5/toolkit/mib_module/set-actions.jpg 84 | */ 85 | case MODE_SET_RESERVE1: 86 | /* or you could use netsnmp_check_vb_type_and_size instead */ 87 | ret = netsnmp_check_vb_type(requests->requestvb, ASN_OCTET_STR); 88 | if ( ret != SNMP_ERR_NOERROR ) { 89 | netsnmp_set_request_error(reqinfo, requests, ret ); 90 | } 91 | break; 92 | 93 | case MODE_SET_RESERVE2: 94 | /* XXX malloc "undo" storage buffer */ 95 | break; 96 | 97 | case MODE_SET_FREE: 98 | /* XXX: free resources allocated in RESERVE1 and/or 99 | RESERVE2. Something failed somewhere, and the states 100 | below won't be called. */ 101 | break; 102 | 103 | case MODE_SET_ACTION: 104 | /* XXX: perform the value change here */ 105 | set_action((char *)requests->requestvb->val.string, requests->requestvb->val_len); 106 | break; 107 | 108 | case MODE_SET_COMMIT: 109 | /* XXX: delete temporary storage */ 110 | break; 111 | 112 | case MODE_SET_UNDO: 113 | /* XXX: UNDO and return to previous value for the object */ 114 | break; 115 | 116 | default: 117 | /* we should never get here, so this is a really bad error */ 118 | snmp_log(LOG_ERR, "unknown mode (%d) in handle_cli\n", reqinfo->mode ); 119 | return SNMP_ERR_GENERR; 120 | } 121 | 122 | return SNMP_ERR_NOERROR; 123 | } 124 | --------------------------------------------------------------------------------