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.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/accel-pppd/ctrl/ipoe/lua.c b/accel-pppd/ctrl/ipoe/lua.c
index 9fbce92..22279f4 100644
--- a/accel-pppd/ctrl/ipoe/lua.c
+++ b/accel-pppd/ctrl/ipoe/lua.c
@@ -35,7 +35,7 @@ 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);
static int packet4_hwaddr(lua_State *L);
-
+static int packet4_ipaddr(lua_State *L);
static const struct luaL_Reg packet4_lib [] = {
{"hdr", packet4_hdr},
@@ -46,6 +46,7 @@ static const struct luaL_Reg packet4_lib [] = {
{"agent_remote_id", packet4_agent_remote_id},
{"vlan", packet4_vlan},
{"hwaddr", packet4_hwaddr},
+ {"ipaddr", packet4_ipaddr},
{NULL, NULL}
};
@@ -201,6 +202,20 @@ static int packet4_hwaddr(lua_State *L)
return 1;
}
+static int packet4_ipaddr(lua_State *L)
+{
+ struct ipoe_session *ses = luaL_checkudata(L, 1, IPOE_PACKET4);
+ char str[20];
+
+ if (!ses)
+ return 0;
+
+ u_inet_ntoa(ses->yiaddr, str);
+ lua_pushstring(L, str);
+
+ return 1;
+}
+
static void init_lua()
{
__serial = serial;