Page MenuHomeVyOS Platform

accel-ppp-ng: PPPoE session ids still in use are handed out again above ~32k sessions
Open, NormalPublicBUG

Description

On a PPPoE server with more than about 32,000 sessions, accel-ppp-ng hands out session ids that are still in use by other sessions, keeps ids of ended sessions allocated, and now and then does not answer a PADR (pppoe: no free sid available) while most of the 65,535 ids are free.

Cause. disconnect() in accel-pppd/ctrl/pppoe/pppoe.c (line 212 in current) returns the id to sid_map with 1 << (conn->sid % (8*sizeof(long))), an int shift into an unsigned long word, while the allocation clears it with 1lu << bit. For bits 32-63 the shift is undefined, and gcc emits a 32-bit shift with sign extension (x86-64 shl %cl,%eax; cltq, arm64 lsl w1,w1,w2; sxtw). Releasing an id with bit 32-62 therefore leaves that id allocated and marks the id 32 below it free, which may belong to a live session. Releasing bit 31 or 63 marks bits 31-63 of the word free at once.

The allocator takes the lowest free bit of one word after the other, so bits 32 and above are only used once more than about 32,768 ids are in use. Below that nothing shows.

Two side effects follow from the same line: releasing id 32 marks id 0 free, and the next login that gets id 0 is treated as no free sid available and its PADR is dropped. Releasing bit 31 of the last word marks 0xFFFF free, which RFC 2516 reserves.

Measured. VyOS rolling 2026.11.16 x86 with its VPP 25.10 package, accel-ppp-ng current with accel-ppp/accel-ppp-ng#42 (which does not touch pppoe.c), BNG Blaster as clients, FreeRADIUS. 40,000 sessions on one PPPoE interface at 1000/s, then 10 rounds of 3,000 random sessions terminated at once while the clients log in again (30,000 reconnects). Session ids that VPP has more than once (show pppoe session):

current (1 << bit)with 1lu << bit on release
after the first login97 (logins that failed authentication and were retried)0
after the 30,000 reconnects4,815 (39,705 sessions, 34,791 distinct ids)0 (39,699 sessions, 39,699 ids)
no free sid available1, with 40,000 of 65,535 ids in use0

Steps to reproduce. More than 32,768 PPPoE sessions, then terminate a few thousand of them and let them reconnect (for example BNG Blaster with reconnect, and sudo accel-cmd -p 2001 terminate if pppoe_sessionN hard or a RADIUS Disconnect-Request). Then compare the number of sessions with the number of distinct session ids in sudo vppctl show pppoe session.

Expected. Every live session has its own id, and the id of an ended session is free again.

Fix. Use 1lu << bit on release, as the allocation does. The same line is in upstream accel-ppp (accel-ppp/accel-ppp).

Details

Version
VyOS rolling 2026.11.16-0022 (accel-ppp-ng 1.13.0)
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)