Project

General

Profile

mod_geoip_for_1.4.40.patch

mod_geoip for lighttpd 1.4.40 - gstrauss, 2016-07-02 03:01

View differences:

doc/geoip.txt
1
{{{
2
#!rst
3
==============================
4
ip based geographic lookups...
5
==============================
6

  
7
-----------------
8
Module: mod_geoip
9
-----------------
10

  
11

  
12

  
13
.. contents:: Table of Contents
14

  
15
Requirements
16
============
17

  
18
:Packages: GeoIP C API & Library (http://www.maxmind.com/download/geoip/api/c/)
19

  
20
Overview
21
========
22

  
23
mod_geoip is a module for fast ip/location lookups. It uses MaxMind GeoIP /
24
GeoCity databases.
25
If the ip was found in the database the module sets the appropriate
26
environments variables to the request, thus making other modules/fcgi be
27
informed.
28

  
29
.. note::
30

  
31
  Currently only country/city databases are supported because they have a free
32
  version that i can test.
33

  
34
Configuration Options
35
========================
36

  
37
mod_geoip uses two configuration options.
38

  
39
1) geoip.db-filename = <path to the geoip or geocity database>
40
2) geoip.memory-cache = <enable|disable> : default disabled
41

  
42
if enabled, mod_geoip will load the database binary file to
43
memory for very fast lookups. the only penalty is memory usage.
44

  
45
.. note::
46

  
47
 mod_geoip will determine the database type automatically so if you enter
48
 GeoCity databse path it will load GeoCity Env.
49

  
50
Environment
51
===========
52

  
53
Every database sets it's own ENV:
54

  
55
GeoIP (Country):
56
----------------
57

  
58
::
59

  
60
 GEOIP_COUNTRY_CODE
61
 GEOIP_COUNTRY_CODE3
62
 GEOIP_COUNTRY_NAME
63

  
64
GeoCity:
65
--------
66

  
67
::
68

  
69
 GEOIP_COUNTRY_CODE
70
 GEOIP_COUNTRY_CODE3
71
 GEOIP_COUNTRY_NAME
72
 GEOIP_CITY_NAME
73
 GEOIP_CITY_POSTAL_CODE
74
 GEOIP_CITY_LATITUDE
75
 GEOIP_CITY_LONG_LATITUDE
76
 GEOIP_CITY_DMA_CODE
77
 GEOIP_CITY_AREA_CODE
78

  
79
Examples
80
========
81

  
82
mod_geoip + php
83
---------------
84

  
85
when using fastcgi (not only php) you can access mod_geoip env and do as you
86
please. this example just prints all mod_geoip envs to the client, html.
87

  
88
Config-file ::
89

  
90
 geoip.db-filename = "/your-geoip-db-path/GeoCityLite.dat"
91
 geoip.memory-cache = "enable"
92

  
93
index.php ::
94

  
95
 <?php
96
         $country_code = $_SERVER['GEOIP_COUNTRY_CODE'];
97
         $country_code3 = $_SERVER['GEOIP_COUNTRY_CODE3'];
98
         $country_name = $_SERVER['GEOIP_COUNTRY_NAME'];
99

  
100
         $city_region = $_SERVER['GEOIP_CITY_REGION'];
101
         $city_name = $_SERVER['GEOIP_CITY_NAME'];
102
         $city_postal_code = $_SERVER['GEOIP_CITY_POSTAL_CODE'];
103
         $city_latitude = $_SERVER['GEOIP_CITY_LATITUDE'];
104
         $city_long_latitude = $_SERVER['GEOIP_CITY_LONG_LATITUDE'];
105
         $city_dma_code = $_SERVER['GEOIP_CITY_DMA_CODE'];
106
         $city_area_code = $_SERVER['GEOIP_CITY_AREA_CODE'];
107

  
108
         echo "<html>\n<body>\n\t<br>\n";
109
         echo 'Country Code: ' . $country_code . '<br>';
110
         echo 'Country Code 3: ' . $country_code3 . '<br>';
111
         echo 'Country Name: ' . $country_name . '<br>';
112
         echo '<br>';
113
         echo 'City Region: ' . $city_region . '<br>';
114
         echo 'City Name: ' . $city_name . '<br>';
115
         echo 'City Postal Code: ' . $city_postal_code . '<br>';
116
         echo 'City Latitude: ' . $city_latitude . '<br>';
117
         echo 'City Long Latitude: ' . $city_long_latitude . '<br>';
118
         echo 'City DMA Code: ' . $city_dma_code . '<br>';
119
         echo 'City Area Code: ' . $city_area_code . '<br>';
120
         echo "</html>\n</body>";
121
 ?>
122

  
123
country based redirect
124
----------------------
125

  
126
Config-file ::
127

  
128
 $HTTP["host"] =~ "www.domain.com" {
129
     url.rewrite = ( "" => "/redirect.php")
130
 }
131

  
132
redirect.php ::
133

  
134
 <?php
135
        $country_code = $_SERVER['GEOIP_COUNTRY_CODE'];
136
        header ('Location: http://' . $country_code . '.domain.com/');
137
 ?>
138

  
139
.. note::
140

  
141
 Currently it is not possible to redirect based on mod_geoip directly in
142
lighttpd config file. But i believe with the relase of lighttpd mod_magnet
143
it would be. (mod_magnet will be available in lighttpd 1.4.12+)
144

  
145
Downloads
146
=========
147
mod_geoip.c (http://trac.lighttpd.net/trac/attachment/wiki/Docs/ModGeoip/mod_geoip.c)
148
}}}
src/CMakeLists.txt
553 553
add_and_install_library(mod_extforward mod_extforward.c)
554 554
add_and_install_library(mod_fastcgi mod_fastcgi.c)
555 555
add_and_install_library(mod_flv_streaming mod_flv_streaming.c)
556
add_and_install_library(mod_geoip mod_geoip.c)
556 557
add_and_install_library(mod_indexfile mod_indexfile.c)
557 558
add_and_install_library(mod_magnet "mod_magnet.c;mod_magnet_cache.c")
558 559
add_and_install_library(mod_mysql_vhost mod_mysql_vhost.c)
......
596 597
)
597 598
add_test(NAME test_configfile COMMAND test_configfile)
598 599

  
600
target_link_libraries(lighttpd GeoIP)
601

  
599 602
if(HAVE_PCRE_H)
600 603
	target_link_libraries(lighttpd ${PCRE_LDFLAGS})
601 604
	add_target_properties(lighttpd COMPILE_FLAGS ${PCRE_CFLAGS})
src/Makefile.am
112 112
mod_flv_streaming_la_LDFLAGS = $(common_module_ldflags)
113 113
mod_flv_streaming_la_LIBADD = $(common_libadd)
114 114

  
115
lib_LTLIBRARIES += mod_geoip.la
116
mod_geoip_la_SOURCES = mod_geoip.c
117
mod_geoip_la_LDFLAGS = $(common_module_ldflags)
118
mod_geoip_la_LIBADD = $(common_libadd) -lGeoIP
119

  
115 120
lib_LTLIBRARIES += mod_evasive.la
116 121
mod_evasive_la_SOURCES = mod_evasive.c
117 122
mod_evasive_la_LDFLAGS = $(common_module_ldflags)
......
314 319
  mod_extforward.c \
315 320
  mod_fastcgi.c \
316 321
  mod_flv_streaming.c \
322
  mod_geoip.c \
317 323
  mod_indexfile.c \
318 324
  mod_magnet.c mod_magnet_cache.c \
319 325
  mod_mysql_vhost.c \
src/SConscript
112 112
		'src' : [ 'mod_cml_lua.c', 'mod_cml.c', 'mod_cml_funcs.c' ],
113 113
		'lib' : [ env['LIBPCRE'], env['LIBMEMCACHED'], env['LIBLUA'] ]
114 114
	},
115
	'mod_geoip' : { 'src' : [ 'mod_geoip.c' ], 'lib' : [ 'GeoIP' ] },
115 116
}
116 117

  
117 118
if env['with_memcached']:
src/mod_geoip.c
1
#include <GeoIP.h>
2
#include <GeoIPCity.h>
3

  
4
#include <ctype.h>
5
#include <stdlib.h>
6
#include <string.h>
7

  
8
#include "base.h"
9
#include "log.h"
10
#include "buffer.h"
11

  
12
#include "plugin.h"
13

  
14
#ifdef HAVE_CONFIG_H
15
#include "config.h"
16
#endif
17

  
18
/**
19
 *
20
 * $mod_geoip.c (v2.0) (13.09.2006 00:29:11)
21
 *
22
 * Name:
23
 * 	mod_geoip.c
24
 *
25
 * Description:
26
 * 	GeoIP module (plugin) for lighttpd.
27
 *	the module loads a geoip database of type "country" or "city" and
28
 *	sets new ENV vars based on ip record lookups.
29
 *
30
 *	country db env's:
31
 *		GEOIP_COUNTRY_CODE
32
 *		GEOIP_COUNTRY_CODE3
33
 *		GEOIP_COUNTRY_NAME
34
 *
35
 *	city db env's:
36
 *		GEOIP_COUNTRY_CODE
37
 *		GEOIP_COUNTRY_CODE3
38
 *		GEOIP_COUNTRY_NAME
39
 *		GEOIP_CITY_NAME
40
 *		GEOIP_CITY_POSTAL_CODE
41
 *		GEOIP_CITY_LATITUDE
42
 *		GEOIP_CITY_LONG_LATITUDE
43
 *		GEOIP_CITY_DMA_CODE
44
 *		GEOIP_CITY_AREA_CODE
45
 *
46
 * Usage (configuration options):
47
 *	geoip.db-filename = <path to the geoip or geocity database>
48
 *	geoip.memory-cache = <enable|disable> : default disabled
49
 *		if enabled, mod_geoip will load the database binary file to
50
 *		memory for very fast lookups. the only penalty is memory usage.
51
 *
52
 * Author:
53
 * 	Ami E. Bizamcher (amix)
54
 *	duke.amix@gmail.com
55
 *
56
 * Note:
57
 * 	GeoIP Library and API must be installed!
58
 */
59

  
60

  
61
/* plugin config for all request/connections */
62

  
63
typedef struct {
64
	unsigned short mem_cache;
65
	buffer	*db_name;
66
	GeoIP   *gi;
67
} plugin_config;
68

  
69
typedef struct {
70
	PLUGIN_DATA;
71

  
72
	plugin_config **config_storage;
73

  
74
	plugin_config conf;
75
} plugin_data;
76

  
77
/* init the plugin data */
78
INIT_FUNC(mod_geoip_init) {
79
	plugin_data *p;
80

  
81
	p = calloc(1, sizeof(*p));
82

  
83
	return p;
84
}
85

  
86
/* destroy the plugin data */
87
FREE_FUNC(mod_geoip_free) {
88
	plugin_data *p = p_d;
89

  
90
	UNUSED(srv);
91

  
92
	if (!p) return HANDLER_GO_ON;
93

  
94
	if (p->config_storage) {
95
		size_t i;
96

  
97
		for (i = 0; i < srv->config_context->used; i++) {
98
			plugin_config *s = p->config_storage[i];
99

  
100
			if (!s) continue;
101

  
102
			buffer_free(s->db_name);
103

  
104
			/* clean up */
105
			if (s->gi) GeoIP_delete(s->gi);
106

  
107
			free(s);
108
		}
109
		free(p->config_storage);
110
	}
111

  
112
	free(p);
113

  
114
	return HANDLER_GO_ON;
115
}
116

  
117
/* handle plugin config and check values */
118

  
119
SETDEFAULTS_FUNC(mod_geoip_set_defaults) {
120
	plugin_data *p = p_d;
121
	size_t i = 0;
122

  
123
	config_values_t cv[] = {
124
		{ "geoip.db-filename",	NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },	/* 0 */
125
		{ "geoip.memory-cache",	NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION },    /* 1 */
126
		{ NULL,			NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
127
	};
128

  
129
	if (!p) return HANDLER_ERROR;
130

  
131
	p->config_storage = calloc(1, srv->config_context->used * sizeof(specific_config *));
132

  
133
	for (i = 0; i < srv->config_context->used; i++) {
134
		data_config const* config = (data_config const*)srv->config_context->data[i];
135
		plugin_config *s;
136
		int mode;
137

  
138
		s = calloc(1, sizeof(plugin_config));
139

  
140
		s->db_name = buffer_init();
141
		s->mem_cache = 0; /* default: do not load db to cache */
142
		s->gi = NULL;
143

  
144
		cv[0].destination = s->db_name;
145
		cv[1].destination = &(s->mem_cache);
146

  
147
		p->config_storage[i] = s;
148

  
149
		if (0 != config_insert_values_global(srv, config->value, cv, i == 0 ? T_CONFIG_SCOPE_SERVER : T_CONFIG_SCOPE_CONNECTION)) {
150
			return HANDLER_ERROR;
151
		}
152

  
153
		mode = GEOIP_STANDARD | GEOIP_CHECK_CACHE;
154

  
155
		/* country db filename is requeried! */
156
		if (!buffer_is_empty(s->db_name)) {
157

  
158
			/* let's start cooking */
159
			if (s->mem_cache != 0)
160
				mode = GEOIP_MEMORY_CACHE | GEOIP_CHECK_CACHE;
161

  
162
			if (NULL == (s->gi = GeoIP_open(s->db_name->ptr, mode))) {
163
				log_error_write(srv, __FILE__, __LINE__, "s",
164
					"failed to open GeoIP database!!!");
165

  
166
				return HANDLER_ERROR;
167
			}
168

  
169
			/* is the db supported ? */
170
			if (s->gi->databaseType != GEOIP_COUNTRY_EDITION &&
171
				s->gi->databaseType != GEOIP_CITY_EDITION_REV0 &&
172
				s->gi->databaseType != GEOIP_CITY_EDITION_REV1) {
173
				log_error_write(srv, __FILE__, __LINE__, "s",
174
					"GeoIP database is of unsupported type!!!");
175
			}
176
		}
177
	}
178

  
179
	return HANDLER_GO_ON;
180
}
181

  
182
#define PATCH(x) \
183
	p->conf.x = s->x;
184
static int mod_geoip_patch_connection(server *srv, connection *con, plugin_data *p) {
185
	size_t i, j;
186
	plugin_config *s = p->config_storage[0];
187

  
188
	PATCH(db_name);
189
	PATCH(mem_cache);
190
	PATCH(gi);
191

  
192
	/* skip the first, the global context */
193
	for (i = 1; i < srv->config_context->used; i++) {
194
		data_config *dc = (data_config *)srv->config_context->data[i];
195
		s = p->config_storage[i];
196

  
197
		/* condition didn't match */
198
		if (!config_check_cond(srv, con, dc)) continue;
199

  
200
		/* merge config */
201
		for (j = 0; j < dc->value->used; j++) {
202
			data_unset *du = dc->value->data[j];
203

  
204
			if (buffer_is_equal_string(du->key, CONST_STR_LEN("geoip.db-filename"))) {
205
				PATCH(db_name);
206
			}
207

  
208
			if (buffer_is_equal_string(du->key, CONST_STR_LEN("geoip.memory-cache"))) {
209
				PATCH(mem_cache);
210
			}
211
		}
212
	}
213

  
214
	return 0;
215
}
216
#undef PATCH
217

  
218
URIHANDLER_FUNC(mod_geoip_subrequest) {
219
	plugin_data *p = p_d;
220

  
221
	mod_geoip_patch_connection(srv, con, p);
222

  
223
	if (!buffer_is_empty(p->conf.db_name)) {
224
		const char *remote_ip;
225
		data_string *ds;
226
		GeoIPRecord *gir;
227
		const char *returnedCountry;
228

  
229
		remote_ip = con->dst_addr_buf->ptr;
230

  
231
		if (p->conf.gi->databaseType == GEOIP_COUNTRY_EDITION) {
232
			/* get the country code 2 chars */
233
			if (NULL == (ds = (data_string *)array_get_element(con->environment, "GEOIP_COUNTRY_CODE"))) {
234
				if (NULL != (returnedCountry = GeoIP_country_code_by_addr(p->conf.gi, remote_ip))) {
235
					if (NULL == (ds = (data_string *)array_get_unused_element(con->environment, TYPE_STRING))) {
236
						ds = data_string_init();
237
					}
238

  
239
					buffer_copy_string(ds->key, "GEOIP_COUNTRY_CODE");
240
					buffer_copy_string(ds->value, returnedCountry);
241
					array_insert_unique(con->environment, (data_unset *)ds);
242
				}
243
			}
244

  
245
			/* get the country code 3 chars */
246
			if (NULL == (ds = (data_string *)array_get_element(con->environment, "GEOIP_COUNTRY_CODE3"))) {
247
				if (NULL != (returnedCountry = GeoIP_country_code3_by_addr(p->conf.gi, remote_ip))) {
248
					if (NULL == (ds = (data_string *)array_get_unused_element(con->environment, TYPE_STRING))) {
249
						ds = data_string_init();
250
					}
251

  
252
					buffer_copy_string(ds->key, "GEOIP_COUNTRY_CODE3");
253
					buffer_copy_string(ds->value, returnedCountry);
254
					array_insert_unique(con->environment, (data_unset *)ds);
255
				}
256
			}
257

  
258
			/* get the country name */
259
			if (NULL == (ds = (data_string *)array_get_element(con->environment, "GEOIP_COUNTRY_NAME"))) {
260
				if (NULL != (returnedCountry = GeoIP_country_name_by_addr(p->conf.gi, remote_ip))) {
261
					if (NULL == (ds = (data_string *)array_get_unused_element(con->environment, TYPE_STRING))) {
262
						ds = data_string_init();
263
					}
264

  
265
					buffer_copy_string(ds->key, "GEOIP_COUNTRY_NAME");
266
					buffer_copy_string(ds->value, returnedCountry);
267
					array_insert_unique(con->environment, (data_unset *)ds);
268
				}
269
			}
270

  
271
			/* go on... */
272
			return HANDLER_GO_ON;
273
		}
274

  
275
		/* if we are here, geo city is in use */
276

  
277
		if (NULL != (gir = GeoIP_record_by_addr(p->conf.gi, remote_ip))) {
278
			/* get the country code 2 chars */
279
			if (NULL == (ds = (data_string *)array_get_element(con->environment, "GEOIP_COUNTRY_CODE"))) {
280
				if (NULL == (ds = (data_string *)array_get_unused_element(con->environment, TYPE_STRING))) {
281
					ds = data_string_init();
282
				}
283

  
284
				buffer_copy_string(ds->key, "GEOIP_COUNTRY_CODE");
285
				buffer_copy_string(ds->value, gir->country_code);
286
				array_insert_unique(con->environment, (data_unset *)ds);
287
			}
288

  
289
			/* get the country code 3 chars */
290
			if (NULL == (ds = (data_string *)array_get_element(con->environment, "GEOIP_COUNTRY_CODE3"))) {
291
				if (NULL == (ds = (data_string *)array_get_unused_element(con->environment, TYPE_STRING))) {
292
					ds = data_string_init();
293
				}
294

  
295
				buffer_copy_string(ds->key, "GEOIP_COUNTRY_CODE3");
296
				buffer_copy_string(ds->value, gir->country_code3);
297
				array_insert_unique(con->environment, (data_unset *)ds);
298
			}
299

  
300
			/* get the country name */
301
			if (NULL == (ds = (data_string *)array_get_element(con->environment, "GEOIP_COUNTRY_NAME"))) {
302
				if (NULL == (ds = (data_string *)array_get_unused_element(con->environment, TYPE_STRING))) {
303
					ds = data_string_init();
304
				}
305

  
306
				buffer_copy_string(ds->key, "GEOIP_COUNTRY_NAME");
307
				buffer_copy_string(ds->value, gir->country_name);
308
				array_insert_unique(con->environment, (data_unset *)ds);
309
			}
310

  
311
			/* get the city region */
312
			if (NULL == (ds = (data_string *)array_get_element(con->environment, "GEOIP_CITY_REGION"))) {
313
				if (NULL == (ds = (data_string *)array_get_unused_element(con->environment, TYPE_STRING))) {
314
					ds = data_string_init();
315
				}
316

  
317
				buffer_copy_string(ds->key, "GEOIP_CITY_REGION");
318
				buffer_copy_string(ds->value, gir->region);
319
				array_insert_unique(con->environment, (data_unset *)ds);
320
			}
321

  
322
			/* get the city */
323
			if (NULL == (ds = (data_string *)array_get_element(con->environment, "GEOIP_CITY_NAME"))) {
324
				if (NULL == (ds = (data_string *)array_get_unused_element(con->environment, TYPE_STRING))) {
325
					ds = data_string_init();
326
				}
327

  
328
				buffer_copy_string(ds->key, "GEOIP_CITY_NAME");
329
				buffer_copy_string(ds->value, gir->city);
330
				array_insert_unique(con->environment, (data_unset *)ds);
331
			}
332

  
333
			/* get the postal code */
334
			if (NULL == (ds = (data_string *)array_get_element(con->environment, "GEOIP_CITY_POSTAL_CODE"))) {
335
				if (NULL == (ds = (data_string *)array_get_unused_element(con->environment, TYPE_STRING))) {
336
					ds = data_string_init();
337
				}
338

  
339
				buffer_copy_string(ds->key, "GEOIP_CITY_POSTAL_CODE");
340
				buffer_copy_string(ds->value, gir->postal_code);
341
				array_insert_unique(con->environment, (data_unset *)ds);
342
			}
343

  
344
			/* get the latitude */
345
			if (NULL == (ds = (data_string *)array_get_element(con->environment, "GEOIP_CITY_LATITUDE"))) {
346
				char latitude[32];
347
				if (NULL == (ds = (data_string *)array_get_unused_element(con->environment, TYPE_STRING))) {
348
					ds = data_string_init();
349
				}
350

  
351
				snprintf(latitude, sizeof(latitude), "%f", gir->latitude);
352
				buffer_copy_string(ds->key, "GEOIP_CITY_LATITUDE");
353
				buffer_copy_string(ds->value, latitude);
354
				array_insert_unique(con->environment, (data_unset *)ds);
355
			}
356

  
357
			/* get the long latitude */
358
			if (NULL == (ds = (data_string *)array_get_element(con->environment, "GEOIP_CITY_LONG_LATITUDE"))) {
359
				char long_latitude[32];
360
				if (NULL == (ds = (data_string *)array_get_unused_element(con->environment, TYPE_STRING))) {
361
					ds = data_string_init();
362
				}
363

  
364
				snprintf(long_latitude, sizeof(long_latitude), "%f", gir->longitude);
365
				buffer_copy_string(ds->key, "GEOIP_CITY_LONG_LATITUDE");
366
				buffer_copy_string(ds->value, long_latitude);
367
				array_insert_unique(con->environment, (data_unset *)ds);
368
			}
369

  
370
			/* get the dma code */
371
			if (NULL == (ds = (data_string *)array_get_element(con->environment, "GEOIP_CITY_DMA_CODE"))) {
372
				char dc[5];
373
				if (NULL == (ds = (data_string *)array_get_unused_element(con->environment, TYPE_STRING))) {
374
					ds = data_string_init();
375
				}
376

  
377
				snprintf(dc, sizeof(dc), "%i", gir->dma_code);
378
				buffer_copy_string(ds->key, "GEOIP_CITY_DMA_CODE");
379
				buffer_copy_string(ds->value, dc);
380
				array_insert_unique(con->environment, (data_unset *)ds);
381
			}
382

  
383
			/* get the area code */
384
			if (NULL == (ds = (data_string *)array_get_element(con->environment, "GEOIP_CITY_AREA_CODE"))) {
385
				char ac[5];
386
				if (NULL == (ds = (data_string *)array_get_unused_element(con->environment, TYPE_STRING))) {
387
					ds = data_string_init();
388
				}
389

  
390
				snprintf(ac, sizeof(ac), "%i", gir->area_code);
391
				buffer_copy_string(ds->key, "GEOIP_CITY_AREA_CODE");
392
				buffer_copy_string(ds->value, ac);
393
				array_insert_unique(con->environment, (data_unset *)ds);
394
			}
395

  
396
			GeoIPRecord_delete(gir);
397
		}
398
	}
399

  
400
	/* keep walking... (johnnie walker style ;) */
401
	return HANDLER_GO_ON;
402
}
403

  
404
/* this function is called at dlopen() time and inits the callbacks */
405

  
406
int mod_geoip_plugin_init(plugin *p);
407
int mod_geoip_plugin_init(plugin *p) {
408
	p->version     = LIGHTTPD_VERSION_ID;
409
	p->name        = buffer_init_string("geoip");
410

  
411
	p->init        = mod_geoip_init;
412
	p->handle_subrequest_start = mod_geoip_subrequest;
413
	p->set_defaults  = mod_geoip_set_defaults;
414
	p->cleanup     = mod_geoip_free;
415

  
416
	p->data        = NULL;
417

  
418
	return 0;
419
}