PPP, PPPoS, only check PPPoS PCB pointer if PPPoS is not the only enabled lower protocol

We only need to keep track of existing PPPoS interfaces if PPPoS
is not the only enabled protocol.

PPP CORE does not have callbacks pointers for all PPPoS callbacks
which should actually be required for PPPoS (VJ config, asyncmap, ...),
there is too much callbacks to create and PPPoS must be kept light,
especially for users who are only using PPPoS.

But there is a drawback, PPP CORE does not know which
lower protocols it is talking to thanks to the abstraction,
therefore if PPPoS is enabled as well as PPPoE or PPPoL2TP there
might be situation where PPP CORE calls pppos_ config functions
on interfaces which are NOT PPPoS one. This is very unlikely to
happen because protocols not supported by PPPoE or PPPoL2TP are
disabled at LCP/IPCP negotiation but we are better safe than sorry.

So we check if passed PPP pointer to PPPoS configuration functions
is a PPPoS interface by checking against a linked list of existing
PPPoS interfaces.
This commit is contained in:
Sylvain Rochet
2015-02-18 23:12:06 +01:00
parent 9f93c16bbf
commit f511bec26c
2 changed files with 43 additions and 4 deletions

View File

@@ -87,6 +87,12 @@
#define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */
#define PPP_TRANS 0x20 /* Asynchronous transparency modifier */
/*
* Number of enabled low-level protocols
* Useful for low-level protocols to check whether they are alone.
*/
#define PPP_LINK_ENABLED_NUMBER (!!PPPOS_SUPPORT+!!PPPOE_SUPPORT+!!PPPOL2TP_SUPPORT)
/*
* Low-level links commands
*/