Page 1 of 1

Lua script for ifname

Posted: 05 Dec 2016, 20:38
by hugleo
I'm not using DHCP Option 82 agent-id but I would like to apply some transformation to ifname interface so accel sends a custom username to radius.

by example:

eth0.100.9
I would like to strip out eth0.100 and create a username like ipoe9

сat /etc/accel-ppp.lua
#!lua
function username(pkt)
local interfacename=pkt:getifnameexists()?
return mytransformationfunction(interfacename)
end

But for it I need to get the interface name. So are there a way that I get ifame in lua script?

Re: Lua script for ifname

Posted: 06 Dec 2016, 07:01
by nik247

Code: Select all

function username_iface(pkt)
    local username = pkt:ifname()
    return username
end