On Jun 22, 2018, at 7:27 AM, Kefi Ammar . <kefiammar@gmail.com> wrote:
Could someone help me to strip the calling station id recieved in the request to use it later for the checkval module.
I am applying the mac authentication using checkval but the problem is that I am recieving a long calling station id containing the mac address.
this is an exemple of the calling station id recieved : lag-50:1201.0#BNG Kasbah###pppoe 94:a7:b7:3e:93:5b#
That's not normally the recommended form. But NAS vendors are inventive. <sigh> The NAS-Port-ID attribute should really be used for that kind of information.
its always in this format and I only want to extract the mac address from it. I dont know if it can be achieved using unlang or anything else.
Use a regular expression: update request { NAS-Port-Id += &Calling-Station-ID } if (Calling-Station-Id =~ /pppoe ([^#]+#/) { update request { Calling-Station-ID := "${1}" } } You'll have to modify it for your needs, but that's the basic idea. Alan DeKok.