瀏覽代碼

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

(cherry picked from commit 0c16d6824fda729bf481e300992fb6bad057c89d)
Henning Westerholt 3 年之前
父節點
當前提交
0c7abf1010
共有 2 個文件被更改,包括 4 次插入2 次删除
  1. 2 0
      src/modules/geoip2/doc/geoip2_admin.xml
  2. 2 2
      src/modules/geoip2/geoip2_pv.c

+ 2 - 0
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=&gt;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>

+ 2 - 2
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;
 	}