Hello MikroTik Support,
we observed a reproducible scripting behavior on RouterOS 7.24.4 on CCR1016 devices after upgrading.
Environment
- RouterOS: 7.24.4
- Hardware: CCR1016-12G / CCR1016 series
- PPPoE concentrator with scripts configured in PPP Profile
on-upandon-down
Issue 1 – :execute from PPP profile script
The PPP profile script creates a global variable:
:global telegramMessage ("PPP [" . [/system identity get name] . "] " . $user . " = UP!")
:log info ("PPP UP MSG=[" . $telegramMessage . "]")
:execute "Send2Telegram"
The first log confirms that telegramMessage contains the expected value.
However, inside Send2Telegram:
:global telegramMessage
:log info ("TG TYPE=[" . [:typeof $telegramMessage] . "]")
:log info ("TG VALUE=[" . $telegramMessage . "]")
:log info ("TG LEN=[" . [:len $telegramMessage] . "]")
the variable is received as an empty string.
Replacing only:
:execute "Send2Telegram"
with:
/system script run Send2Telegram
immediately resolves the problem. The global variable is then available with its correct value and the same script works.
We reproduced this with both PPP on-up and on-down.
Issue 2 – PPP on-down appears to be stored with the active PPP session
During testing we discovered that changing the PPP profile on-down script does not change the script executed when an already-established PPP session disconnects.
Reproduction:
- PPP session is established while
on-downcontains script A. - While that PPP session remains active, change the profile
on-downto script B and Apply the configuration. - Disconnect the existing PPP session.
- Script A is executed.
- Reconnect the same PPP user.
- Disconnect it again.
- Script B is now executed.
We confirmed this using unique log messages in scripts A and B.
We also observed old PPP sessions executing references to scripts that had already been removed from the current PPP profile configuration. After those clients reconnected, the old behavior disappeared.
This suggests that the on-down script is copied/bound to the PPP session when the session is established rather than evaluated from the current PPP profile when the session terminates.
Additional observation
Some sessions established with the previous script produce:
executing script
(ppp:<pppoe-USERNAME>) expected command name (line 1 column 1)
while newly established sessions using the modified profile execute correctly.
Questions
- Is the different execution context of
:executefrom PPP profile event scripts intentional in RouterOS 7.24.x? - Was this behavior changed in 7.24 compared with previous RouterOS versions?
- Is
/system script run <name>the recommended method when a PPP event script needs to pass global variables to another RouterOS script? - Is the per-session snapshot/binding behavior of PPP
on-downintentional and documented?
We can provide supout.rif, configuration excerpts and timestamped logs from the reproduction if required.