ppp on-up/on-down variables

Hi,

I’ve struggled for quite a bit to get the variables working that is exposed by the ppp on-up and on-down scripts, because

  1. variable names includes dashes: local-address, remote-address, caller-id, called-id
  2. interface variable isn’t the interface’s name

So after a while I have managed to reconstruct new and useful variables:

:local localAddr
:local remoteAddr
:local callerId
:local calledId
:local interfaceName

:set localAddr $"local-address"
:set remoteAddr $"remote-address"
:set callerId $"caller-id"
:set calledId $"called-id"
:set interfaceName [/interface get $interface name]

:log info "$user (srcIp=$callerId, dstIp=$calledId) connected: was given $remoteAddr IP (GW $localAddr) and assigned to $interfaceName interface"

I hope this example is useful to others.

My idea in the end is to add/remove Firewall Filter rules for a given IPSec client interface, since the interface name changes to unknown after the client disconnected AND because when I make use of the PPP incoming-filter/outgoing-filter and jump to ppp chain from the forward chain, then my ROS 6.33.3 goes into a weird state by removing all my bridge interfaces.

Hi,

Thanks a lot, it helped me.

Regards,

Thanks, it helped me too.

It can be made shorter by combining declaration and assignment like this:

:local remoteAddr $"remote-address"

AWESOME! you, my dir sir, saved me a lot of googling.

Awesome - thank you! I’ve been using the on-up and on-down things to invoke remote API calls by means of an http request - sorta clunky. This will make things much faster.

https://wiki.mikrotik.com/wiki/Manual:PPP_AAA#User_Profiles

Execute script on user login-event. These are available variables that are accessible for the event script:
    user
    local-address
    remote-address
    caller-id
    called-id
    interface

You made my day!!! I was succesfully using $user but struggling with caller-id. Thanks Sr.