1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-12 17:14:46 +02:00

Update GeoIP question in ./Config and use some magic to support both

geoip_classic and geoip_mmdb in modules.default.conf with Conditional
Config, a dynamic loadmodule line, and auto-updates.

Somewhere in a later version, probably 6.2.5, we will default to mmdb
for all cases.
This commit is contained in:
Bram Matthys
2026-03-22 17:48:38 +01:00
parent b7cd383186
commit ba3fa1d7b6
8 changed files with 71 additions and 13 deletions
+10 -10
View File
@@ -113,8 +113,8 @@ ARG="$ARG--enable-dynamic-linking "
if [ "$GEOIP" = "classic" ]; then if [ "$GEOIP" = "classic" ]; then
ARG="$ARG--enable-geoip-classic " ARG="$ARG--enable-geoip-classic "
fi fi
if [ "$GEOIP" = "libmaxminddb" ]; then if [ "$GEOIP" = "mmdb" -o "$GEOIP" = "libmaxminddb" ]; then
ARG="$ARG--enable-libmaxminddb " ARG="$ARG--enable-mmdb "
fi fi
if [ "$SANITIZER" = "asan" ]; then if [ "$SANITIZER" = "asan" ]; then
ARG="$ARG--enable-asan " ARG="$ARG--enable-asan "
@@ -281,7 +281,7 @@ OPEROVERRIDEVERIFY=""
GENCERTIFICATE="1" GENCERTIFICATE="1"
EXTRAPARA="" EXTRAPARA=""
SANITIZER="" SANITIZER=""
GEOIP="classic" GEOIP="mmdb"
if [ "`eval echo -n 'a'`" = "-n a" ] ; then if [ "`eval echo -n 'a'`" = "-n a" ] ; then
c="\c" c="\c"
else else
@@ -773,12 +773,12 @@ while [ -z "$TEST" ] ; do
echo "" echo ""
echo "GeoIP is a feature that allows converting an IP address to a location (country)" echo "GeoIP is a feature that allows converting an IP address to a location (country)"
echo "Possible build options:" echo "Possible build options:"
echo " classic: This is the DEFAULT geoip engine. It should work on all systems" echo "classic: This is the classic (OLD) geoip engine. Slowly being phased out."
echo " and receives automatic updates." echo " It receives automatic updates."
echo "libmaxminddb: This uses the libmaxminddb library. If you want to use this, then" echo " mmdb: This uses the build-in mmdb library. It is the NEW geoip engine."
echo " you need to install the libmaxminddb library on your system first" echo " It receives automatic updates as well."
echo " none: Don't build with any geoip library (geoip-csv is still built)" echo " none: Don't build classic, and load neither classic nor mmdb by default."
echo "Choose one of: classic, libmaxminddb, none" echo "Choose one of: classic, mmdb, none"
echo $n "[$TEST] -> $c" echo $n "[$TEST] -> $c"
read cc read cc
if [ -z "$cc" ] ; then if [ -z "$cc" ] ; then
@@ -789,7 +789,7 @@ while [ -z "$TEST" ] ; do
classic) classic)
GEOIP="$cc" GEOIP="$cc"
;; ;;
libmaxminddb) mmdb)
GEOIP="$cc" GEOIP="$cc"
;; ;;
none) none)
+1
View File
@@ -467,5 +467,6 @@ AC_DEFUN([CHECK_GEOIP_CLASSIC],
GEOIP_CLASSIC_OBJECTS="geoip_classic.so" GEOIP_CLASSIC_OBJECTS="geoip_classic.so"
AC_SUBST(GEOIP_CLASSIC_OBJECTS) AC_SUBST(GEOIP_CLASSIC_OBJECTS)
AC_DEFINE([GEOIP_ENGINE], ["geoip_classic"], [Classic GeoIP engine])
]) dnl AS_IF(enable_geoip_classic) ]) dnl AS_IF(enable_geoip_classic)
]) ])
Vendored
+21
View File
@@ -784,6 +784,7 @@ enable_werror
enable_asan enable_asan
enable_libcurl enable_libcurl
enable_geoip_classic enable_geoip_classic
enable_mmdb
' '
ac_precious_vars='build_alias ac_precious_vars='build_alias
host_alias host_alias
@@ -1446,6 +1447,7 @@ Optional Features:
--enable-libcurl=DIR enable libcurl (remote include) support --enable-libcurl=DIR enable libcurl (remote include) support
--enable-geoip-classic=no/yes --enable-geoip-classic=no/yes
enable GeoIP Classic support enable GeoIP Classic support
--enable-mmdb=no/yes enable GeoIP mmdb support
Optional Packages: Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -10133,6 +10135,25 @@ fi
GEOIP_CLASSIC_OBJECTS="geoip_classic.so" GEOIP_CLASSIC_OBJECTS="geoip_classic.so"
printf "%s\n" "#define GEOIP_ENGINE \"geoip_classic\"" >>confdefs.h
fi
# Check whether --enable-mmdb was given.
if test ${enable_mmdb+y}
then :
enableval=$enable_mmdb; enable_mmdb=$enableval
else case e in #(
e) enable_mmdb=no ;;
esac
fi
if test "x$enable_mmdb" = "xyes"
then :
printf "%s\n" "#define GEOIP_ENGINE \"geoip_mmdb\"" >>confdefs.h
fi fi
UNRLINCDIR="`pwd`/include" UNRLINCDIR="`pwd`/include"
+9
View File
@@ -930,6 +930,15 @@ CHECK_LIBCURL
CHECK_GEOIP_CLASSIC CHECK_GEOIP_CLASSIC
dnl This does not do much anymore but..
AC_ARG_ENABLE(mmdb,
[AC_HELP_STRING([--enable-mmdb=no/yes],[enable GeoIP mmdb support])],
[enable_mmdb=$enableval],
[enable_mmdb=no])
AS_IF([test "x$enable_mmdb" = "xyes"],
[AC_DEFINE([GEOIP_ENGINE], ["geoip_mmdb"], [MMDB GeoIP engine])])
dnl Set to include dir
UNRLINCDIR="`pwd`/include" UNRLINCDIR="`pwd`/include"
dnl This is at the end so the (potential) -std=gnu17 is not used dnl This is at the end so the (potential) -std=gnu17 is not used
+8 -2
View File
@@ -7,8 +7,14 @@ This is work in progress and may not always be a stable version.
### Enhancements: ### Enhancements:
### Changes: ### Changes:
* [GeoIP](https://www.unrealircd.org/docs/GeoIP): Move from `geoip_classic` * [GeoIP](https://www.unrealircd.org/docs/GeoIP):
to `geoip_mmdb` as the default backend, at least for new installations. * We now ship with our own mmdb engine and `geoip_mmdb` (replacement for
`geoip_maxmind`).
* The `./Config` question on GeoIP now defaults to `mmdb`. Existing users
who upgrade will keep their current setting (usually `classic`) for now.
* Both `geoip_classic` and `geoip_mmdb` now receive automatic updates
* You can `@define $NO_GEOIP_CONFIG "1"` to disable auto configuration
and updates.
### Fixes: ### Fixes:
+14 -1
View File
@@ -313,8 +313,21 @@ loadmodule "utf8only"; /* UTF8ONLY via set::utf8-only */
loadmodule "portinfo"; /* storing local_port and server_port of users */ loadmodule "portinfo"; /* storing local_port and server_port of users */
loadmodule "isupport"; /* ISUPPORT / numeric 005 handling */ loadmodule "isupport"; /* ISUPPORT / numeric 005 handling */
loadmodule "geoip_mmdb"; @if $GEOIP_ENGINE != "none"
loadmodule "$GEOIP_ENGINE";
@endif
@if !defined(NO_GEOIP_CONFIG) @if !defined(NO_GEOIP_CONFIG)
@if module-loaded("geoip_classic")
set {
geoip-classic {
ipv4-database "https://www.unrealircd.org/files/geo/classic/GeoIP.dat" { url-refresh 14d; url-fail warn; }
ipv6-database "https://www.unrealircd.org/files/geo/classic/GeoIPv6.dat" { url-refresh 14d; url-fail warn; }
asn-ipv4-database "https://www.unrealircd.org/files/geo/classic/GeoIPASNum.dat" { url-refresh 14d; url-fail warn; }
asn-ipv6-database "https://www.unrealircd.org/files/geo/classic/GeoIPASNumv6.dat" { url-refresh 14d; url-fail warn; }
}
}
@endif
@if module-loaded("geoip_mmdb") @if module-loaded("geoip_mmdb")
set { set {
geoip-mmdb { geoip-mmdb {
+3
View File
@@ -25,6 +25,9 @@
/* Define the location of the documentation */ /* Define the location of the documentation */
#undef DOCDIR #undef DOCDIR
/* MMDB GeoIP engine */
#undef GEOIP_ENGINE
/* Define if you have getrusage */ /* Define if you have getrusage */
#undef GETRUSAGE_2 #undef GETRUSAGE_2
+5
View File
@@ -433,6 +433,11 @@ void init_config_defines(void)
add_nvplist(&config_defines, 0, "UNREALIRCD_VERSION_MAJOR", PATCH2); add_nvplist(&config_defines, 0, "UNREALIRCD_VERSION_MAJOR", PATCH2);
add_nvplist(&config_defines, 0, "UNREALIRCD_VERSION_MINOR", PATCH3); add_nvplist(&config_defines, 0, "UNREALIRCD_VERSION_MINOR", PATCH3);
add_nvplist(&config_defines, 0, "UNREALIRCD_VERSION_SUFFIX", PATCH4); add_nvplist(&config_defines, 0, "UNREALIRCD_VERSION_SUFFIX", PATCH4);
#ifdef GEOIP_ENGINE
add_nvplist(&config_defines, 0, "GEOIP_ENGINE", GEOIP_ENGINE);
#else
add_nvplist(&config_defines, 0, "GEOIP_ENGINE", "none");
#endif
} }
/** Return the complete struct for a defined value */ /** Return the complete struct for a defined value */