Index: /home/majek/.workspace/nmap-pcap/liblua/Makefile =================================================================== --- /home/majek/.workspace/nmap-pcap/liblua/Makefile (revision 408) +++ /home/majek/.workspace/nmap-pcap/liblua/Makefile (working copy) @@ -8,11 +8,11 @@ PLAT= none CC= gcc -CFLAGS= -g -O2 -Wall $(MYCFLAGS) +CFLAGS= -O2 -Wall $(MYCFLAGS) AR= ar rcu RANLIB= ranlib RM= rm -f -LIBS= -lm -g $(MYLIBS) +LIBS= -lm $(MYLIBS) MYCFLAGS= MYLDFLAGS= Index: /home/majek/.workspace/nmap-pcap/nse_init.cc =================================================================== --- /home/majek/.workspace/nmap-pcap/nse_init.cc (revision 408) +++ /home/majek/.workspace/nmap-pcap/nse_init.cc (working copy) @@ -50,7 +50,6 @@ {LUA_DBLIBNAME, luaopen_debug}, {NSE_BITLIBNAME, luaopen_bitlib}, {NSE_PCRELIBNAME, luaopen_pcrelib}, - {NSE_DNETLIBNAME, luaopen_dnet}, {NULL, NULL} }; Index: /home/majek/.workspace/nmap-pcap/nse_nmaplib.cc =================================================================== --- /home/majek/.workspace/nmap-pcap/nse_nmaplib.cc (revision 408) +++ /home/majek/.workspace/nmap-pcap/nse_nmaplib.cc (working copy) @@ -47,6 +47,7 @@ {"set_port_version", l_port_accessor}, {"new_socket", l_nsock_new}, {"new_dnet", l_dnet_new}, + {"get_interface_link", l_dnet_get_interface_link}, {"clock_ms", l_clock_ms}, {"print_debug_unformatted", l_print_debug_unformatted}, {"new_try", l_exc_newtry}, Index: /home/majek/.workspace/nmap-pcap/nse_nsock.cc =================================================================== --- /home/majek/.workspace/nmap-pcap/nse_nsock.cc (revision 408) +++ /home/majek/.workspace/nmap-pcap/nse_nsock.cc (working copy) @@ -106,8 +106,7 @@ auxiliar_newclass(l, "nsock", l_nsock); nsp = nsp_new(NULL); - if(o.debugging>0) - nsp_settrace(nsp, o.debugging-1, o.getStartTime()); + nsp_settrace(nsp, o.debugging, o.getStartTime()); return NSOCK_WRAPPER_SUCCESS; } @@ -492,7 +491,7 @@ pcap_nsiod_cache *pnc; /* create cache key */ char kbuf[8192]; // key buffer - snprintf(kbuf, sizeof(kbuf), "%s|%i|%i|%s|%u|%i|%i",pcapdev,snaplen,promisc,bpf,strlen(bpf),test_off,test_len); + snprintf(kbuf, sizeof(kbuf), "%s|%i|%i|%s|%u|%i|%i",pcapdev,snaplen,promisc,bpf,(unsigned int)strlen(bpf),test_off,test_len); std::string key = kbuf; pnc = pcap_nsiod_map[key]; @@ -767,7 +766,7 @@ } if(o.scripttrace) { char buf[128]; - snprintf(buf, sizeof(buf),"packet l2len=%u l3len=%u packet_len=%u",l2_len, l3_len, packet_len); + snprintf(buf, sizeof(buf),"packet l2len=%u l3len=%u packet_len=%u", (unsigned int)l2_len, (unsigned int)l3_len, (unsigned int)packet_len); l_nsock_trace(nse_iod(nse), buf, TO); hexified = nse_hexify((const void*) l2_data, (size_t) l2_len+l3_len); l_nsock_trace(nse_iod(nse), hexified, FROM); @@ -787,7 +786,6 @@ -static int l_dnet_get_interface_link(lua_State* l); static int l_dnet_open_ethernet(lua_State* l); static int l_dnet_close_ethernet(lua_State* l); static int l_dnet_send_ethernet(lua_State* l); @@ -793,7 +791,6 @@ static int l_dnet_send_ethernet(lua_State* l); static luaL_reg l_dnet [] = { - {"get_interface_link", l_dnet_get_interface_link}, {"ethernet_open", l_dnet_open_ethernet}, {"ethernet_close", l_dnet_close_ethernet}, {"ethernet_send", l_dnet_send_ethernet}, @@ -805,14 +802,6 @@ return NSOCK_WRAPPER_SUCCESS; } -LUALIB_API int luaopen_dnet (lua_State *L) { - - - luaL_openlib(L, NSE_DNETLIBNAME, l_dnet, 0); - return 1; -} - - struct l_dnet_udata { char *interface; eth_t *eth; @@ -828,9 +817,8 @@ return 1; } -static int l_dnet_get_interface_link(lua_State* l) { - //l_dnet_udata* udata = (l_dnet_udata*) auxiliar_checkclass(l, "dnet", 1); - const char* interface_name = luaL_checkstring(l, 2); +int l_dnet_get_interface_link(lua_State* l) { + const char* interface_name = luaL_checkstring(l, 1); struct interface_info *ii = getInterfaceByName((char*)interface_name); if(!ii){ @@ -895,8 +883,6 @@ assert(dem); dem->references--; if(dem->references==0){ - return; - // okay, don't free now... dnet_eth_cache.erase(key); eth_close(dem->eth); free(dem); Index: /home/majek/.workspace/nmap-pcap/nse_nsock.h =================================================================== --- /home/majek/.workspace/nmap-pcap/nse_nsock.h (revision 408) +++ /home/majek/.workspace/nmap-pcap/nse_nsock.h (working copy) @@ -11,13 +11,9 @@ int l_nsock_new(lua_State* l); int l_nsock_loop(int tout); - -#define NSE_DNETLIBNAME "dnet" - -LUALIB_API int luaopen_dnet (lua_State *L); int l_dnet_new(lua_State* l); - int l_dnet_open(lua_State* l); +int l_dnet_get_interface_link(lua_State* l); #endif