]> granicus.if.org Git - pdns/commitdiff
lua iputils ipset was accidentally port number sensitive. it is not an ipportset.
authorbert hubert <bert.hubert@netherlabs.nl>
Tue, 20 Jan 2015 09:20:03 +0000 (10:20 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Tue, 20 Jan 2015 09:20:03 +0000 (10:20 +0100)
pdns/lua-iputils.cc

index 261a780c601591fa9789bf41a32437ba26994ba4..980c0aabe40d720e1d357a72f6f21f0030f2e0ca 100644 (file)
@@ -84,9 +84,11 @@ static const struct luaL_Reg iputils_ca_methods[]={
 
 /////////////////////////////
 
+typedef set<ComboAddress, ComboAddress::addressOnlyLessThan> ourset_t;
+
 static int l_ipset_index(lua_State* L)
 {
-  set<ComboAddress>*ourset = (set<ComboAddress>*)luaL_checkudata(L, 1, "iputils.ipset");
+  ourset_t *ourset = (ourset_t*)luaL_checkudata(L, 1, "iputils.ipset");
   ComboAddress* ca1 = (ComboAddress*)luaL_checkudata(L, 2, "iputils.ca");
   if(ourset->count(*ca1)) {
     lua_pushboolean(L, 1);
@@ -98,7 +100,7 @@ static int l_ipset_index(lua_State* L)
 
 static int l_ipset_newindex(lua_State* L)
 {
-  set<ComboAddress>*ourset = (set<ComboAddress>*)luaL_checkudata(L, 1, "iputils.ipset");
+  ourset_t*ourset = (ourset_t*)luaL_checkudata(L, 1, "iputils.ipset");
   ComboAddress* ca1 = (ComboAddress*)luaL_checkudata(L, 2, "iputils.ca");
   ourset->insert(*ca1);
   return 0;
@@ -106,7 +108,7 @@ static int l_ipset_newindex(lua_State* L)
 
 static int l_newipset(lua_State* L)
 {
-  new(lua_newuserdata(L, sizeof(set<ComboAddress>))) set<ComboAddress>();
+  new(lua_newuserdata(L, sizeof(ourset_t))) ourset_t();
   luaL_getmetatable(L, "iputils.ipset");
   lua_setmetatable(L, -2);
   return 1;
@@ -114,8 +116,8 @@ static int l_newipset(lua_State* L)
 
 static int l_ipset_gc(lua_State* L)
 {
-  set<ComboAddress>*ourset = (set<ComboAddress>*)luaL_checkudata(L, 1, "iputils.ipset");
-  ourset->~set<ComboAddress>();
+  ourset_t*ourset = (ourset_t*)luaL_checkudata(L, 1, "iputils.ipset");
+  ourset->~ourset_t();
   return 0;
 }