Skip to content

Commit

Permalink
Fixes compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoBiscosi committed Nov 28, 2024
1 parent c329277 commit d11b0a9
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/LuaEngineInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2025,7 +2025,7 @@ static int ntop_interface_insert_ip_acl(lua_State *vm) {
u_int16_t port = 0, l7_proto = 0;
bool is_allowed = true, res = false;
char *src, *dst;

#ifdef NTOPNG_PRO
if (ntop_lua_check(vm, __FUNCTION__, 1, LUA_TNUMBER) != CONST_LUA_OK)
return (ntop_lua_return_value(vm, __FUNCTION__, CONST_LUA_ERROR));
protocol = (u_int8_t) lua_tointeger(vm, 1);
Expand All @@ -2050,7 +2050,7 @@ static int ntop_interface_insert_ip_acl(lua_State *vm) {

if (curr_iface)
res = curr_iface->insertIPACL(protocol, src, dst, port, l7_proto, is_allowed);
#endif
lua_pushboolean(vm, res);

return (ntop_lua_return_value(vm, __FUNCTION__, CONST_LUA_OK));
Expand All @@ -2065,6 +2065,7 @@ static int ntop_interface_remove_ip_acl(lua_State *vm) {
bool res = false;
char *src, *dst;

#ifdef NTOPNG_PRO
if (ntop_lua_check(vm, __FUNCTION__, 1, LUA_TNUMBER) != CONST_LUA_OK)
return (ntop_lua_return_value(vm, __FUNCTION__, CONST_LUA_ERROR));
protocol = (u_int8_t) lua_tointeger(vm, 1);
Expand All @@ -2085,7 +2086,7 @@ static int ntop_interface_remove_ip_acl(lua_State *vm) {

if (curr_iface)
res = curr_iface->removeIPACL(protocol, src, dst, port, l7_proto);
#endif
lua_pushboolean(vm, res);

return (ntop_lua_return_value(vm, __FUNCTION__, CONST_LUA_OK));
Expand All @@ -2099,6 +2100,7 @@ static int ntop_interface_insert_mac_acl(lua_State *vm) {
u_int32_t _mac[6];
bool is_allowed = true, res = false;

#ifdef NTOPNG_PRO
if (ntop_lua_check(vm, __FUNCTION__, 1, LUA_TSTRING) != CONST_LUA_OK)
return (ntop_lua_return_value(vm, __FUNCTION__, CONST_LUA_ERROR));
mac_string = (char *) lua_tostring(vm, 1);
Expand All @@ -2112,7 +2114,7 @@ static int ntop_interface_insert_mac_acl(lua_State *vm) {
for (int i = 0; i < 6; i++) mac[i] = (u_int8_t)_mac[i];
if (curr_iface) res = curr_iface->insertMacACL(mac, is_allowed);
}
#endif
lua_pushboolean(vm, res);

return (ntop_lua_return_value(vm, __FUNCTION__, CONST_LUA_OK));
Expand All @@ -2126,6 +2128,7 @@ static int ntop_interface_remove_mac_acl(lua_State *vm) {
bool res = false;
u_int32_t _mac[6];

#ifdef NTOPNG_PRO
if (ntop_lua_check(vm, __FUNCTION__, 1, LUA_TSTRING) != CONST_LUA_OK)
return (ntop_lua_return_value(vm, __FUNCTION__, CONST_LUA_ERROR));
mac_string = (char *) lua_tostring(vm, 1);
Expand All @@ -2136,7 +2139,7 @@ static int ntop_interface_remove_mac_acl(lua_State *vm) {
for (int i = 0; i < 6; i++) mac[i] = (u_int8_t)_mac[i];
if (curr_iface) res = curr_iface->removeMacACL(mac);
}
#endif
lua_pushboolean(vm, res);

return (ntop_lua_return_value(vm, __FUNCTION__, CONST_LUA_OK));
Expand Down

0 comments on commit d11b0a9

Please sign in to comment.