summaryrefslogtreecommitdiff
path: root/accel-pppd/ctrl/ipoe
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2018-06-01 10:50:58 +0300
committerDmitry Kozlov <xeb@mail.ru>2018-06-01 10:50:58 +0300
commitac8e3062dd7c9f3b9d6b4c88ac34f005e9644468 (patch)
tree952f253f74896c32fadaf82aa2cba33393b58955 /accel-pppd/ctrl/ipoe
parentd6a798fe417525581677e227d312fd851e511f7e (diff)
downloadaccel-ppp-ac8e3062dd7c9f3b9d6b4c88ac34f005e9644468.tar.gz
accel-ppp-ac8e3062dd7c9f3b9d6b4c88ac34f005e9644468.zip
ipoe: lua: introduced ipaddr field to session object
Diffstat (limited to 'accel-pppd/ctrl/ipoe')
-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 9fbce926..22279f43 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;