diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2018-06-01 10:50:58 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2018-06-01 10:50:58 +0300 |
commit | ac8e3062dd7c9f3b9d6b4c88ac34f005e9644468 (patch) | |
tree | 952f253f74896c32fadaf82aa2cba33393b58955 /accel-pppd/ctrl | |
parent | d6a798fe417525581677e227d312fd851e511f7e (diff) | |
download | accel-ppp-ac8e3062dd7c9f3b9d6b4c88ac34f005e9644468.tar.gz accel-ppp-ac8e3062dd7c9f3b9d6b4c88ac34f005e9644468.zip |
ipoe: lua: introduced ipaddr field to session object
Diffstat (limited to 'accel-pppd/ctrl')
-rw-r--r-- | accel-pppd/ctrl/ipoe/lua.c | 17 |
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; |