Wireshark-bugs: [Wireshark-bugs] [Bug 4030] GeoIP issues.
Date: Tue, 11 Oct 2011 17:05:20 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4030

--- Comment #23 from Guy Harris <guy@xxxxxxxxxxxx> 2011-10-11 17:05:19 PDT ---
It appears that, somewhere between 1.4.6 and 1.4.8, MaxMind added pread() calls
to the GeoIP C API code - without, I guess, realizing that Microsoft haven't
picked up that particular UN*Xism in their C library.

pread() is seek-and-read-in-one-call, so it's more thread-safe than
lseek-followed-by-read, as another thread can move the file pointer between the
lseek and the read.  I'm not seeing any obvious equivalent call in the MSDN
documentation, so, assuming the GeoIP lookups are confined to one thread, or
that we wrap the lseek and read calls with a mutex on Windows, we could
probably fix the problem by modifying the GeoIP code to have a "HAVE_PREAD"
#define and, if it's not defined, define a pread() wrapper that does an lseek()
followed by a read().  configure.in should check for pread() (I think most
modern UN*Xes have it, but there might be some older ones lacking it), and it
should not be defined on Windows.

Then, of course, we should send the patch back to the folks at MaxMind
(assuming we don't have to fix anything else for Windows).

-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are watching all bug changes.