[sr-dev] git:master:0c16d682: geoip2: log errors for cases where the container could not evaluated and add docs

Henning Westerholt hw at gilawa.com
Mon May 9 18:44:48 CEST 2022


Module: kamailio
Branch: master
Commit: 0c16d6824fda729bf481e300992fb6bad057c89d
URL: https://github.com/kamailio/kamailio/commit/0c16d6824fda729bf481e300992fb6bad057c89d

Author: Henning Westerholt <hw at gilawa.com>
Committer: Henning Westerholt <hw at gilawa.com>
Date: 2022-05-09T16:43:22Z

geoip2: log errors for cases where the container could not evaluated and add docs

- log errors for cases where the container could not evaluated due to missing
  initialization of the pvc container because no actual access is done in the cfg
- add documentation describing that at least one access to the container is necessary
  for the match function to work correctly

---

Modified: src/modules/geoip2/doc/geoip2_admin.xml
Modified: src/modules/geoip2/geoip2_pv.c

---

Diff:  https://github.com/kamailio/kamailio/commit/0c16d6824fda729bf481e300992fb6bad057c89d.diff
Patch: https://github.com/kamailio/kamailio/commit/0c16d6824fda729bf481e300992fb6bad057c89d.patch

---

diff --git a/src/modules/geoip2/doc/geoip2_admin.xml b/src/modules/geoip2/doc/geoip2_admin.xml
index 8c5a96caa8..a82b1a9a29 100644
--- a/src/modules/geoip2/doc/geoip2_admin.xml
+++ b/src/modules/geoip2/doc/geoip2_admin.xml
@@ -112,6 +112,8 @@ modparam("geoip2", "path", "/usr/local/share/GeoIP/GeoLite2-City.mmdb")
 	    <para>
 			Match ipaddr against the GeoIP database and set the pvc container. The
 			function has to be called before accessing a key via: $gip2(pvc=>key).
+			At least one function needs to be present that access the pvc container,
+			otherwise this function will not work.
 	    </para>
 		<example>
 		<title><function>geoip2_match</function> usage</title>
diff --git a/src/modules/geoip2/geoip2_pv.c b/src/modules/geoip2/geoip2_pv.c
index 0995ae2d25..ff427f259f 100644
--- a/src/modules/geoip2/geoip2_pv.c
+++ b/src/modules/geoip2/geoip2_pv.c
@@ -565,14 +565,14 @@ int geoip2_update_pv(str *tomatch, str *name)
 
 	if(tomatch->len>255)
 	{
-		LM_DBG("target too long (max 255): %s\n", tomatch->s);
+		LM_ERR("target too long (max 255): %s\n", tomatch->s);
 		return -3;
 	}
 
 	gr = sr_geoip2_get_record(name);
 	if(gr==NULL)
 	{
-		LM_DBG("container not found: %s\n", tomatch->s);
+		LM_ERR("container not found: %s\n", tomatch->s);
 		return - 4;
 	}
 




More information about the sr-dev mailing list