Nmap Development mailing list archives

Re: manufacturer information for address-info.nse


From: David Fifield <david () bamsoftware com>
Date: Sat, 24 Sep 2011 09:21:13 -0700

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.

David Fifield
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: