Nmap Development mailing list archives

Re: manufacturer information for address-info.nse


From: Vasiliy Kulikov <segoon () openwall com>
Date: Sat, 24 Sep 2011 23:16:23 +0400

On Sat, Sep 24, 2011 at 09:21 -0700, David Fifield wrote:
On Sat, Sep 24, 2011 at 05:00:10PM +0400, Vasiliy Kulikov wrote:
Hi,

On Sat, Sep 24, 2011 at 15:34 +0300, Toni Ruottu wrote:
+local function get_manuf(mac)
+ if not nmap.registry.mac then
...
+         nmap.registry.mac.prefixes = try(datafiles.parse_mac_prefixes())
+ end

FWIW, while this is not a big deal for this specific usage, but there is
a race condition as nmap.registry is a global variable.  If two parallel
invocations of the script simultaneously test nmap.registry.mac they
both recalc and set mac.prefixes variable.  For this usage it's harmless
as Lua has a garbage collector and recalc doesn't do anything significant.

No, that's not how parallelism works in NSE. See
http://www.lua.org/manual/5.1/manual.html#2.11. It's not possible for
two scripts to access this value simultaneously because only one script
runs at a time.

Ah, so all NSE scripts are run as coroutines, which run not in parallel
unless yield is called, even if run against different target hosts?  I
didn't know that, thank you for the information!

-- 
Vasiliy Kulikov
http://www.openwall.com - bringing security into open computing environments
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: