aboutsummaryrefslogtreecommitdiffstats
path: root/mmdbresolve.c
AgeCommit message (Collapse)AuthorFilesLines
2019-06-26mmdbresolve: check the return value of mallocXuNiu1-0/+4
The return value of malloc() is used without validation Bug: 15851 Change-Id: I2635937d3107a75076e9bbee536797d97792683d Reviewed-on: https://code.wireshark.org/review/33705 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-05-15mmdbresolve: Improve our main loop check.Gerald Combs1-2/+6
Check the return value of fscanf() instead of relying on feof(). This should help ensure that we exit correctly. Bug: 15777 Change-Id: I8b5985f6015cb6a85378db5135b29bb2c3de1e90 Reviewed-on: https://code.wireshark.org/review/33196 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-02-16Re-implement "Map" feature for EndpointsPeter Wu1-1/+3
This feature was removed in v2.5.1rc0-427-gf529ab5d0a, anticipating that MaxMind would remove support for it in 2019. They have however changed their mind and maintained latitude and longitude information. They recommend displaying an accuracy radius, but the reported values are 50, 100, 200 and 1000km. When implemented literally, a marker in Ireland would cover the whole island plus mainland, so I have instead opted to use a fixed radius of 1km at deeper zoom levels. The old ipmap.html file was outdated and had broken tiles, I rewrote a new one from scratch using the light-weight Leaflet library combined with tiles from OpenStreetMap. This is more mobile-friendly and secure (https, SRI). To improve handling of nearby or overlapping nodes, clustering is used (individual nodes can still be inspected). Browser compatibility results: IE8 is unusable, IE9 partially works (tooltips sometimes disappear and the cluster radius control is gone), IE11 works. Of course Firefox 65 and Chromium 72 have no issues. The map popup description in the generated GeoJSON structure is now split in several properties, allowing presentation to be handled by the HTML page instead of the C code. Bug: 14693 Change-Id: If2ec9c518f7723ac0ab27b6272463356875a0ff2 Reviewed-on: https://code.wireshark.org/review/31952 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-05-24maxmind: Move request processing to a thread.Gerald Combs1-0/+15
It's possible to block while we're writing to our mmdbresolve pipe, particularly on Windows. Move the write to a separate thread. Add an #ifdef to mmdbresolve.c which helps test blocking. Bug: 14701 Change-Id: I6cb8a46a190a268da64f1e6f54d1052d03743c95 Reviewed-on: https://code.wireshark.org/review/27750 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-10Avoid the realloc() warning from VS Code Analyzer.Guy Harris1-3/+5
It's not just worrying about the lack of a check for a null return, it's worried about the leak. Assign the result to a different variable and, if the result is null, free the old data before exiting, and if it's not null, assign the new variable to the one we're using as a pointer to the array. Change-Id: Ia1d5d271293e13708c35a7562a1f40671304c417 Reviewed-on: https://code.wireshark.org/review/26410 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-03-09entry_data.type is unsigned, so print it with %u.Guy Harris1-1/+1
This should squelch a warning from VS Code Analyzer. Change-Id: I69e528c3dfd851d287b1faebc1469cd700fa9ef5 Reviewed-on: https://code.wireshark.org/review/26402 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-03-09Check for realloc() failing.Guy Harris1-0/+4
Unlikely, but not impossible, and should squelch a VS Code Analyzer warning. Change-Id: I399c08896a3f08962ca46483d47ba5f6cbe4f28e Reviewed-on: https://code.wireshark.org/review/26400 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-03-09mmdbresolve: remove leak (found by clang).Dario Lombardo1-0/+2
Change-Id: I7de7707d75c80bc12ec2c4a30a19f6988932b0b7 Reviewed-on: https://code.wireshark.org/review/26392 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-03-06mmdbresolve: Process our command line arguments by hand.Gerald Combs1-13/+15
Visual Studio doesn't ship with a getopt implementation, so process our arguments ourselves. Note that if we add support for more flags we'll probably want to use GOption. Change-Id: Ie78204aa64321ca68f3e66195b8c39e47ca410d9 Reviewed-on: https://code.wireshark.org/review/26288 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-03-06Transition from GeoIP Legacy to MaxMindDB.Gerald Combs1-0/+169
MaxMind is discontinuing its legacy databases in April in favor of GeoIP2, which use a newer database format (MaxMind DB). The reference C library (libmaxminddb) is available under the Apache 2.0 license which isn't quite compatible with ours. Add mmdbresolve, a utility that reads IPv4 and IPv6 addresses on stdin and prints resolved information on stdout. Place it under a liberal license (MIT) so that we can keep libmaxminddb at arm's length. Add epan/maxmind_db.[ch], which spawns mmdbresolve and communicates with it via stdio. Migrate the preferences and documentation to MaxMindDB. Change the IPv4 and IPv6 asnum fields to FT_UINT32s. Change the geographic coordinate fields to FT_DOUBLEs. Bug: 10658 Change-Id: I24aeed637bea1b41d173270bda413af230f4425f Reviewed-on: https://code.wireshark.org/review/26214 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>