summaryrefslogtreecommitdiff
path: root/accel-pppd/ctrl/ipoe
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2016-12-07 23:18:06 +0300
committerDmitry Kozlov <xeb@mail.ru>2016-12-07 23:18:06 +0300
commitbe063e68bbbba46048215a8fdfccf511af45c490 (patch)
tree7f93d40f850acd02900845e706bd38bad3ba4805 /accel-pppd/ctrl/ipoe
parent618179e8a5ce78adeff358025031f36fac937dd9 (diff)
downloadaccel-ppp-be063e68bbbba46048215a8fdfccf511af45c490.tar.gz
accel-ppp-be063e68bbbba46048215a8fdfccf511af45c490.zip
ipoe: lua: add "vlan" field to session object
resulting value is vlan | (parent_vlan << 16)
Diffstat (limited to 'accel-pppd/ctrl/ipoe')
-rw-r--r--accel-pppd/ctrl/ipoe/lua.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/accel-pppd/ctrl/ipoe/lua.c b/accel-pppd/ctrl/ipoe/lua.c
index 0f5a1dc4..f0785066 100644
--- a/accel-pppd/ctrl/ipoe/lua.c
+++ b/accel-pppd/ctrl/ipoe/lua.c
@@ -32,6 +32,7 @@ static int packet4_option(lua_State *L);
static int packet4_options(lua_State *L);
static int packet4_agent_circuit_id(lua_State *L);
static int packet4_agent_remote_id(lua_State *L);
+static int packet4_vlan(lua_State *L);
int luaopen_lpack(lua_State *L);
@@ -42,6 +43,7 @@ static const struct luaL_reg packet4_lib [] = {
{"options", packet4_options},
{"agent_circuit_id", packet4_agent_circuit_id},
{"agent_remote_id", packet4_agent_remote_id},
+ {"vlan", packet4_vlan},
{NULL, NULL}
};
@@ -170,6 +172,18 @@ static int packet4_agent_remote_id(lua_State *L)
return 1;
}
+static int packet4_vlan(lua_State *L)
+{
+ struct ipoe_session *ses = luaL_checkudata(L, 1, IPOE_PACKET4);
+
+ if (!ses)
+ return 0;
+
+ lua_pushinteger(L, (ses->serv->parent_vid << 16) | ses->serv->vid);
+
+ return 1;
+}
+
static void init_lua()
{
__serial = serial;