Browse code

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

Henning Westerholt authored on 09/05/2022 16:43:22
Showing 2 changed files
... ...
@@ -112,6 +112,8 @@ modparam("geoip2", "path", "/usr/local/share/GeoIP/GeoLite2-City.mmdb")
112 112
 	    <para>
113 113
 			Match ipaddr against the GeoIP database and set the pvc container. The
114 114
 			function has to be called before accessing a key via: $gip2(pvc=&gt;key).
115
+			At least one function needs to be present that access the pvc container,
116
+			otherwise this function will not work.
115 117
 	    </para>
116 118
 		<example>
117 119
 		<title><function>geoip2_match</function> usage</title>
... ...
@@ -565,14 +565,14 @@ int geoip2_update_pv(str *tomatch, str *name)
565 565
 
566 566
 	if(tomatch->len>255)
567 567
 	{
568
-		LM_DBG("target too long (max 255): %s\n", tomatch->s);
568
+		LM_ERR("target too long (max 255): %s\n", tomatch->s);
569 569
 		return -3;
570 570
 	}
571 571
 
572 572
 	gr = sr_geoip2_get_record(name);
573 573
 	if(gr==NULL)
574 574
 	{
575
-		LM_DBG("container not found: %s\n", tomatch->s);
575
+		LM_ERR("container not found: %s\n", tomatch->s);
576 576
 		return - 4;
577 577
 	}
578 578