summaryrefslogtreecommitdiff
path: root/accel-pppd/include
AgeCommit message (Collapse)Author
2021-12-16vrf: T10: Add VRF supportDmitriyEshenko
Co-authored-by: Sergey V. Lobanov <svlobanov@users.noreply.github.com> Co-authored-by: Vladislav Grishenko <themiron@users.noreply.github.com>
2021-03-20Fix unsigned bitfileds leftovers after 62f7740033f05053a581e864742575a46ccc6da2Vladislav Grishenko
2021-03-20Fixed some errors found by valgrind and pvs-studio (#11)[anp/hsw]
* Fix errors found by valgrind ==12312== Syscall param sendmsg(msg.msg_iov[0]) points to uninitialised byte(s) ==12312== at 0x486CCF0: sendmsg (in /lib/libpthread-2.22.so) ==12312== by 0x12F57F: rtnl_talk (libnetlink.c:316) ==12312== by 0x132DA3: genl_resolve_mcg (genl.c:52) ==12312== by 0x484E1CB: init (vlan_mon.c:528) ==12312== by 0x484CDC0: vlan_mon_register_proto (vlan_mon.c:48) ==12312== by 0x510B763: load_vlan_mon (pppoe.c:1914) ==12312== by 0x510BFF2: load_config (pppoe.c:2064) ==12312== by 0x510C22A: pppoe_init (pppoe.c:2108) ==12312== by 0x483E9EB: triton_load_modules (triton.c:704) ==12312== by 0x1384B2: main (main.c:339) ==12312== Address 0xbedacdd8 is on thread 1's stack ==12312== in frame #2, created by genl_resolve_mcg (genl.c:23) ==12312== 15 bytes in 1 blocks are definitely lost in loss record 352 of 836 ==12312== at 0x482A9A9: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==12312== by 0x4B97524: strdup (in /lib/libc-2.22.so) ==12312== by 0x12C30C: init (telnet.c:769) ==12312== by 0x483E9EB: triton_load_modules (triton.c:704) ==12312== by 0x1384B2: main (main.c:339) ==12312== ==12312== 15 bytes in 1 blocks are definitely lost in loss record 353 of 836 ==12312== at 0x482A9A9: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==12312== by 0x4B97524: strdup (in /lib/libc-2.22.so) ==12312== by 0x12D60A: init (tcp.c:392) ==12312== by 0x483E9EB: triton_load_modules (triton.c:704) ==12312== by 0x1384B2: main (main.c:339) * Fix another warnings by cppcheck [accel-pppd/ctrl/ipoe/arp.c:256]: (error) Uninitialized variable: n [accel-pppd/ctrl/pppoe/mac_filter.c:90]: (warning) %x in format string (no. 1) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/ctrl/pppoe/mac_filter.c:90]: (warning) %x in format string (no. 2) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/ctrl/pppoe/mac_filter.c:90]: (warning) %x in format string (no. 3) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/ctrl/pppoe/mac_filter.c:90]: (warning) %x in format string (no. 4) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/ctrl/pppoe/mac_filter.c:90]: (warning) %x in format string (no. 5) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/ctrl/pppoe/mac_filter.c:90]: (warning) %x in format string (no. 6) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/ctrl/pppoe/mac_filter.c:129]: (warning) %x in format string (no. 1) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/ctrl/pppoe/mac_filter.c:129]: (warning) %x in format string (no. 2) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/ctrl/pppoe/mac_filter.c:129]: (warning) %x in format string (no. 3) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/ctrl/pppoe/mac_filter.c:129]: (warning) %x in format string (no. 4) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/ctrl/pppoe/mac_filter.c:129]: (warning) %x in format string (no. 5) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/ctrl/pppoe/mac_filter.c:129]: (warning) %x in format string (no. 6) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/ctrl/pppoe/mac_filter.c:158]: (warning) %x in format string (no. 1) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/ctrl/pppoe/mac_filter.c:158]: (warning) %x in format string (no. 2) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/ctrl/pppoe/mac_filter.c:158]: (warning) %x in format string (no. 3) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/ctrl/pppoe/mac_filter.c:158]: (warning) %x in format string (no. 4) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/ctrl/pppoe/mac_filter.c:158]: (warning) %x in format string (no. 5) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/ctrl/pppoe/mac_filter.c:158]: (warning) %x in format string (no. 6) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/ctrl/pppoe/pppoe.c:738]: (warning) Possible null pointer dereference [accel-pppd/ipv6/dhcpv6.c:911]: (warning) %x in format string (no. 1) requires 'unsigned int *' but the argument type is 'int *'. [accel-pppd/ipv6/dhcpv6.c:911]: (warning) %x in format string (no. 2) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/ipv6/dhcpv6.c:911]: (warning) %x in format string (no. 3) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/ipv6/dhcpv6.c:911]: (warning) %x in format string (no. 4) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/libnetlink/libnetlink.c:515]: (warning) Possible null pointer dereference [accel-pppd/ppp/ipv6cp_opt_intfid.c:185]: (warning) %x in format string (no. 1) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/ppp/ipv6cp_opt_intfid.c:298]: (warning) %x in format string (no. 1) requires 'unsigned int *' but the argument type is 'int *'. [accel-pppd/ppp/ipv6cp_opt_intfid.c:298]: (warning) %x in format string (no. 2) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/ppp/ipv6cp_opt_intfid.c:298]: (warning) %x in format string (no. 3) requires 'unsigned int *' but the argument type is 'signed int *'. [accel-pppd/ppp/ipv6cp_opt_intfid.c:298]: (warning) %x in format string (no. 4) requires 'unsigned int *' but the argument type is 'signed int *'. * Suppress compiler warnings * Fix locking errors /opt/pvs/accel-ppp/accel-pppd/extra/pppd_compat.c 279 warn V1020 The function exited without calling the 'sigchld_unlock' function. Check lines: 279, 249. /opt/pvs/accel-ppp/accel-pppd/extra/pppd_compat.c 333 warn V1020 The function exited without calling the 'sigchld_unlock' function. Check lines: 333, 315. /opt/pvs/accel-ppp/accel-pppd/extra/pppd_compat.c 422 warn V1020 The function exited without calling the 'sigchld_unlock' function. Check lines: 422, 372. /opt/pvs/accel-ppp/accel-pppd/extra/pppd_compat.c 488 warn V1020 The function exited without calling the 'sigchld_unlock' function. Check lines: 488, 468. /opt/pvs/accel-ppp/accel-pppd/triton/mempool.c 119 warn V1020 The function exited without calling the 'pthread_spin_unlock' function. Check lines: 119, 116. * Fix array len errors /opt/pvs/accel-ppp/accel-pppd/triton/conf_file.c 75 warn V557 Array underrun is possible. The value of 'len - 1' index could reach -1. /opt/pvs/accel-ppp/accel-pppd/triton/conf_file.c 76 warn V557 Array underrun is possible. The value of '-- len' index could reach -1. * Fix possible memory leaks /opt/pvs/accel-ppp/accel-pppd/radius/radius.c 936 err V773 The function was exited without releasing the 'str' pointer. A memory leak is possible. /opt/pvs/accel-ppp/accel-pppd/radius/serv.c 622 err V773 The function was exited without releasing the 'str' pointer. A memory leak is possible. /opt/pvs/accel-ppp/accel-pppd/triton/conf_file.c 144 err V773 The function was exited without releasing the 'raw' pointer. A memory leak is possible. * Fix unsafe code /opt/pvs/accel-ppp/accel-pppd/cli/tcp.c 364 warn V1004 The 'host' pointer was used unsafely after it was verified against nullptr. Check lines: 338, 364. /opt/pvs/accel-ppp/accel-pppd/cli/telnet.c 701 warn V1004 The 'host' pointer was used unsafely after it was verified against nullptr. Check lines: 675, 701. /opt/pvs/accel-ppp/accel-pppd/extra/ippool.c 241 err V614 Potentially uninitialized pointer 'pos' used. /opt/pvs/accel-ppp/accel-pppd/radius/dict.c 165 err V614 Uninitialized pointer 'parent_items' used. * Remove duplicate code /opt/pvs/accel-ppp/accel-pppd/radius/serv.c 202 warn V547 Expression 'ts.tv_sec < req->serv->fail_time' is always false. * Fix treating signed bool variables as unsigned * Add nullptr checking /opt/pvs/accel-ppp/accel-pppd/ipv6/dhcpv6.c 886 err V595 The 'opt->val' pointer was utilized before it was verified against nullptr. Check lines: 886, 890. /opt/pvs/accel-ppp/accel-pppd/ipv6/nd.c 479 err V595 The 'opt->val' pointer was utilized before it was verified against nullptr. Check lines: 479, 483. /opt/pvs/accel-ppp/accel-pppd/radius/auth.c 152 err V595 The 'rpd->auth_ctx' pointer was utilized before it was verified against nullptr. Check lines: 152, 154. /opt/pvs/accel-ppp/accel-pppd/triton/conf_file.c 114 err V595 The 'cur_sect' pointer was utilized before it was verified against nullptr. Check lines: 114, 117. * Add logging of exit conditions * Clarify calculation [accel-pppd/ppp/ccp_mppe.c:281]: (style) Clarify calculation precedence for '&' and '?'. [accel-pppd/ppp/ccp_mppe.c:282]: (style) Clarify calculation precedence for '&' and '?'. [accel-pppd/ppp/ccp_mppe.c:283]: (style) Clarify calculation precedence for '&' and '?'. [accel-pppd/ppp/ccp_mppe.c:284]: (style) Clarify calculation precedence for '&' and '?'. [accel-pppd/ppp/ccp_mppe.c:285]: (style) Clarify calculation precedence for '&' and '?'. [accel-pppd/ppp/ccp_mppe.c:286]: (style) Clarify calculation precedence for '&' and '?'. [drivers/ipoe/ipoe.c:307]: (style) Clarify calculation precedence for '&' and '?'. * Fix void calculations [accel-pppd/ctrl/pppoe/disc.c:211]: (portability) 'pkt' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [accel-pppd/ctrl/pptp/pptp.c:150]: (portability) 'buf' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [accel-pppd/radius/acct.c:37]: (portability) 'req.pack.buf' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [accel-pppd/radius/auth.c:35]: (portability) 'req.pack.buf' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [accel-pppd/radius/auth.c:79]: (portability) 'req.pack.buf' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [accel-pppd/radius/dm_coa.c:43]: (portability) 'pack.buf' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [accel-pppd/radius/dm_coa.c:47]: (portability) 'pack.buf' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [accel-pppd/radius/dm_coa.c:57]: (portability) 'pack.buf' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [accel-pppd/radius/dm_coa.c:65]: (portability) 'req.buf' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [accel-pppd/radius/dm_coa.c:97]: (portability) 'req.buf' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [accel-pppd/radius/serv.c:364]: (portability) 'req.pack.buf' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [accel-pppd/triton/mempool.c:115]: (portability) 'mmap_ptr' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [accel-pppd/triton/mempool.c:122]: (portability) 'mmap_ptr' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [accel-pppd/triton/mempool.c:276]: (portability) 'ptr' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. * Fix void part 2 [accel-pppd/ipv6/dhcpv6.c:844]: (portability) 'conf_dnssl' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [accel-pppd/ipv6/nd.c:199]: (portability) '(void*)dnsslinfo' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [accel-pppd/ipv6/nd.c:432]: (portability) 'conf_dnssl' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. * Fix null pointer dereference [accel-pppd/ctrl/ipoe/ipoe.c:2048]: (warning) Possible null pointer dereference: eth [accel-pppd/ctrl/ipoe/ipoe.c:2049]: (warning) Possible null pointer dereference: iph * Remove redundant check /opt/pvs/accel-ppp/accel-pppd/ctrl/l2tp/packet.c 656 warn V547 Expression 'attr->length <= 16' is always false. * PR fixes * PR fixes 2
2020-06-29sstp: fix MITM w/o SSTP_MSG_CALL_CONNECTED is being sentVladislav Grishenko
3.3.2.1 Negotiation Timer When establishing the SSTP connection, the SSTP server starts the negotiation timer. 2. After sending the Call Connect Acknowledge message, if the server does not receive a Call Connected message before the Negotiation timer expires then it MUST send a Call Abort message and start the process of bringing down (disconnecting) the connection. The server MAY implement different timer values for the Call Connected message and the Call Connect Request message. 3.3.7.1 Server-Side Interface with PPP When the server receives a PPP data frame from the PPP layer, the server MUST perform the following steps: * If CurrentState is set to Server_Call_Connected: Generate an SSTP data packet (section 2.2.3) with the PPP frame as the higher-layer payload and send the packet to the HTTPS layer. * Else, drop the PPP frame. sstp-client is known to be broken, it doesn't send SSTP_MSG_CALL_CONNECTED with PAP and CHAP-MD5 auth, no network data flow and disconnect by negotiation timer is expected.
2020-03-18net: new function get_ifindexSimon Chopin
The index of a given interface is an operation that highly depends on the network namespace we're in. This patch simply cuts out a function to get the index for a given interface name from the session initialization code, and expose it in the ap_net structure. This function can then be used to refresh the index when moving interfaces around. Signed-off-by: Simon Chopin <s.chopin@alphalink.fr>
2020-03-07session: add global [common]max-starting optionVladislav Grishenko
usually there's no need to have per-proto limitation, since the need of max starting limitation affects the whole server, not particular protocol only.
2020-01-11ipv6pool: add per-proto ipv6-pool and ipv6-pool-delegate optionsVladislav Grishenko
also, disable ipv6 pools via chap-secrets, need to find another syntax for it, may be with comments.
2020-01-10ipv6pool/radius: implement named ipv6 poolsVladislav Grishenko
default stateful ipv6 address & prefix radius attrs are per-rfc6911: 171 Delegated-IPv6-Prefix-Pool 172 Stateful-IPv6-Address-Pool the single pool name from chap-secret file pool is shared for ipv4/ipv6/ipv6 dp, new config syntax TBD. per-proto pool names are still for ipv4 only, new config syntax TBD.
2018-10-26vlan_mon: make vlan_mon.h self-containedGuillaume Nault
We need to include <stdint.h> to define 'uint16_t'. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2018-10-26core: make ap_net.h self-containedGuillaume Nault
We need to include <sys/socket.h> to define 'socklen_t', <sys/types.h> for 'ssize_t' and "list.h" for 'struct list_head'. Also, let's include "libnetlink.h" so that we don't need a forward declaration for 'struct rtnl_handle'. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2018-10-26connlimit: make connlimit.h self-containedGuillaume Nault
We need to include <stdint.h> to define 'uint*_t' and <string.h> for 'memcpy'. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2018-10-26backup: make ap_session_backup.h self-containedGuillaume Nault
We need to include <netinet/in.h> to define 'struct in6_addr' and <stdint.h> for 'uint8_t'. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2017-10-17radius: implemented lua supportDmitry Kozlov
to get radius object use session:module("radius") function radius object provides flollowing functions: radius:attrs() - returns array of attributes {"name" = NAME, "vendor" = VENDOR|nil} radius:attr(name[,vendor]) - returns value of attribute (may return multiple results) Example: function ip_up(ses) rad = ses:module("radius") attrs = rad:attrs() if attrs then print("attrs:") for _,a in pairs(attrs) do io.write("\t") if a.vendor then io.write(a.vendor..":") end io.write(a.name.."=") print(rad:attr(a.name, a.vendor)) end end end
2017-10-16lua: implemented "session" module that provides session object to be passed ↵Dmitry Kozlov
to lua scripts session object consists of following functions: ifname() - interface name ifindex() - interface ifindex sid() - Acct-Session-ID uptime() - session uptime in seconds username() ctrl_type() - type of session (pppt/pppoe/l2tp/ipoe) calling_sid() - Calling-Station-ID called_sid() - Called-Station-ID ipv4() - retuns pair (peer address, local address) ipv6() - ipv6 address or nil rx_bytes() tx_bytes()
2017-10-13improved lua supportDmitry Kozlov
Implemented support for lua 5.2/5.3. To build accel-ppp with exact lua version pass it in -DLUA=x.y, for example -DLUA=5.2 (cmake 3.0 is required for this). Old style -DLUA=TRUE supports only 5.1 and does not require cmake 3.0. Also extra lua modules (lua_lpack, lua_bit) took out into separated library luasupp.
2017-04-18implemented session count limitingDmitry Kozlov
new config option: [common] max-sessions=N If set then accel-pppd stops reply to new connection requests if total number of sessions (active and starting) is reached specified limit.
2017-04-18Revert "implemented session count limiting"Dmitry Kozlov
This reverts commit 88a908974b0b2e9c7eee8ad9a8b0b4432e95d167.
2017-04-18implemented session count limitingDmitry Kozlov
new config option: [common] max-sessions=N If set then accel-pppd stops reply to new connection requests if total number of sessions (active and starting) is reached specified limit.
2017-04-18Revert "implemented session count limiting"Dmitry Kozlov
This reverts commit 9ea88bac7d5bf8fc5cf2d5f7d0a734ec7a9e6df6.
2017-04-18implemented session count limitingDmitry Kozlov
new config option: [common] max-sessions=N If set then accel-pppd stops reply to new connection requests if total number of sessions (active and starting) is reached specified limit.
2016-07-11implemented support for network namespaceDmitry Kozlov
This is done using radius attribute NAS-Port-Id. The new format of this attribute is NAS-Port-Id=[ns/][name]. Namespaces must be created malually by "ip netns add ..." command
2016-06-02ppp: make include/ppp_auth.h a symlinkGuillaume Nault
include/ppp_auth.h used to be a symlink to ppp/ppp_auth.h, until it was made a copy by ebbd6f580322 ("fix typo (successed -> succeeded)"). Therefore, changes to ppp/ppp_auth.h aren't visible to files including ppp_auth.h anymore. These files have already diverged (just a whitespace fix for now), so let's restore the original symlink before more changes occur. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2016-04-30radius: add Delegated-IPv6-Prefix to accounting packetsDmitry Kozlov
2016-04-15preparation for DPDK intergation (part 6)Dmitry Kozlov
2016-04-11Revert "pppoe: do not negotiate LCP MRU option if it is larger than 1492"Dmitry Kozlov
This reverts commit fc098b3062badfd802f91241533069cad4886b6f.
2016-04-10pppoe: do not negotiate LCP MRU option if it is larger than 1492Dmitry Kozlov
2016-04-05improved logging: if session's interface is empty log ctrl's interfaceDmitry Kozlov
2016-04-04vlan_mon: make possible to work other module after message "vlan not started"Dmitry Kozlov
2016-04-04ipoe,pppoe,vlan_mon: deleted conditions to simultaneous start ipoe and pppoe ↵Dmitry Kozlov
on same interfaces (started by vlan_mon)
2016-04-02for single-session=deny make early check for duplicate username (before ↵Dmitry Kozlov
calling radius)
2016-03-18make termination caused by SIGTERM softDmitry Kozlov
2016-03-17vlan_mon,ipoe,pppoe: implemented detection of vlan existanceDmitry Kozlov
2015-12-04preparation for DPDK intergation (part 5)Dmitry Kozlov
2015-12-04preparation for DPDK intergation (part 4)Dmitry Kozlov
2015-12-04preparation for DPDK intergation (part 3)Dmitry Kozlov
2015-12-04preparation for DPDK intergationDmitry Kozlov
2015-11-21move parse_vlan_mon function to vlan-mon moduleDmitry Kozlov
2015-11-21split ipoe driver to ipoe and vlan_monDmitry Kozlov
introduced new module "vlan-mon"
2015-11-18ipoe: do not send immediate Accounting Stop in soft terminate modeDmitry Kozlov
2015-11-17ipoe: use single socket for arp processingDmitry Kozlov
2015-02-21session: implemented idle and timeout timersDmitry Kozlov
2014-11-22remove trailing whitespacesDmitry Kozlov
2014-11-05ipv6: move ipv6_dp from dhcpv6 private data to ap_sessionDmitry Kozlov
2014-09-20rewrite of authentication/accounting proceduresDmitry Kozlov
This patch gets rid of synchronuos style of authentication/accounting. Synchronous style of authentication/accounting produced sleeping threads which becomes a problem when lots of sessions started/stopped and all they want authorization/accounting.
2014-07-11terminate session if interface rename failsDmitry Kozlov
2014-05-182-way interface renamingDmitry Kozlov
First try to rename interface immediately and if it fails then do second try later just before bring interface up. In case single-session=replace first try to rename interface may fail because first session may be active
2014-05-18improved single-session=replace handlingDmitry Kozlov
Wait for previous session completely terminated before continuing authorization new session.
2014-05-12radius: use NAS-Port-Id in Access-Accept for interface renamingDmitry Kozlov
2013-08-28ipoe: add ipset support for l4 redirectKozlov Dmitry
2013-06-29connlimit: Initialise connlimit key (MAC)Guillaume Nault
Initialise 'key' before calling memcpy() to ensure that all bytes are set in the return value. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>