summaryrefslogtreecommitdiff
path: root/accel-pppd/ctrl/ipoe/lua.c
diff options
context:
space:
mode:
Diffstat (limited to 'accel-pppd/ctrl/ipoe/lua.c')
-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;