diff -Naur milter-greylist-4.5.14/conf_lex.l milter-greylist-4.5.14.geoip6/conf_lex.l
--- milter-greylist-4.5.14/conf_lex.l	2014-02-04 16:19:25.000000000 +0100
+++ milter-greylist-4.5.14.geoip6/conf_lex.l	2015-07-03 08:06:25.421376975 +0200
@@ -115,6 +115,7 @@
 body		[Bb][Oo][Dd][Yy]
 maxpeek		[Mm][Aa][Xx][Pp][Ee][Ee][Kk]
 geoipdb		[Gg][Ee][Oo][Ii][Pp][Dd][Bb]
+geoipdb6	[Gg][Ee][Oo][Ii][Pp][Dd][Bb]6
 geoip		[Gg][Ee][Oo][Ii][Pp]
 ldapconf	[Ll][Dd][Aa][Pp][Cc][Oo][Nn][Ff]
 ldapcheck	[Ll][Dd][Aa][Pp][Cc][Hh][Ee][Cc][Kk]
@@ -307,6 +308,7 @@
 {body}		{ BEGIN(S_REGEX); return BODY; }
 {maxpeek}	{ return MAXPEEK; }
 {geoipdb}	{ return GEOIPDB; }
+{geoipdb6}	{ return GEOIPDB6; }
 {geoip}		{ return GEOIP; }
 {ldapconf}	{ return LDAPCONF; }
 {ldapcheck}	{ return LDAPCHECK; }
diff -Naur milter-greylist-4.5.14/conf_yacc.y milter-greylist-4.5.14.geoip6/conf_yacc.y
--- milter-greylist-4.5.14/conf_yacc.y	2015-06-16 14:27:29.000000000 +0200
+++ milter-greylist-4.5.14.geoip6/conf_yacc.y	2015-07-03 08:07:06.493376500 +0200
@@ -8,8 +8,8 @@
 %token OPENLIST CLOSELIST BLACKLIST FLUSHADDR CODE ECODE MSG SM_MACRO
 %token UNSET URLCHECK RACL DACL GLHEADER BODY MAXPEEK STAT POSTMSG FORK
 %token GETPROP CLEAR PROP AUTH TLS SPF MSGSIZE RCPTCOUNT OP NO SLASH MINUS
-%token COMMA TIME GEOIPDB GEOIP PASS FAIL SOFTFAIL NEUTRAL UNKNWON ERROR
-%token SELF SPF_STATUS LDAPCONF LDAPCHECK LOGFAC LOGFAC_KERN LOGFAC_USER
+%token COMMA TIME GEOIPDB GEOIPDB6 GEOIP PASS FAIL SOFTFAIL NEUTRAL UNKNWON
+%token ERROR SELF SPF_STATUS LDAPCONF LDAPCHECK LOGFAC LOGFAC_KERN LOGFAC_USER
 %token LOGFAC_MAIL LOGFAC_DAEMON LOGFAC_AUTH LOGFAC_SYSLOG LOGFAC_LPR
 %token LOGFAC_NEWS LOGFAC_UUCP LOGFAC_CRON LOGFAC_AUTHPRIV LOGFAC_FTP
 %token LOGFAC_LOCAL0 LOGFAC_LOCAL1 LOGFAC_LOCAL2 LOGFAC_LOCAL3 LOGFAC_LOCAL4
@@ -749,13 +749,19 @@
 geoipdb:	GEOIPDB QSTRING	{
 #ifdef USE_GEOIP
 				char path[QSTRLEN + 1];
-
 				geoip_set_db(quotepath(path, $2, QSTRLEN));
 #else
-				mg_log(LOG_INFO, 
-				    "GeoIP support not compiled in, "
-				    "ignore line %d", 
-				    conf_line);
+				mg_log(LOG_INFO, "GeoIP support not compiled "
+				    "in, ignore line %d", conf_line);
+#endif
+				}
+	|	GEOIPDB6 QSTRING {
+#ifdef USE_GEOIP
+				char path[QSTRLEN + 1];
+				geoip_set_db6(quotepath(path, $2, QSTRLEN));
+#else
+				mg_log(LOG_INFO, "GeoIP support not compiled "
+				    "in, ignore line %d", conf_line);
 #endif
 				}
 	;
diff -Naur milter-greylist-4.5.14/geoip.c milter-greylist-4.5.14.geoip6/geoip.c
--- milter-greylist-4.5.14/geoip.c	2013-03-23 02:43:01.000000000 +0100
+++ milter-greylist-4.5.14.geoip6/geoip.c	2015-07-03 08:21:51.461366307 +0200
@@ -58,8 +58,12 @@
 #include <dmalloc.h> 
 #endif
 
-static GeoIP *geoip_handle = NULL;
+static GeoIP *geoip_handle;
 static char geoip_database[MAXPATHLEN + 1];
+
+static GeoIP *geoip6_handle;
+static char geoip6_database[MAXPATHLEN + 1];
+
 static pthread_rwlock_t geoip_lock;
 
 void
@@ -80,13 +84,12 @@
 geoip_set_db(name)
 	char *name;
 {
+	strncpy(geoip_database, name, MAXPATHLEN);
+
 	if (geoip_handle != NULL) {
 		GeoIP_delete(geoip_handle);
 		geoip_handle = NULL;
 	}
-	
-	strncpy(geoip_database, name, MAXPATHLEN);
-	geoip_database[MAXPATHLEN] = '\0';
 
 	geoip_handle = GeoIP_open(geoip_database, GEOIP_STANDARD);
 	if (geoip_handle == NULL) {
@@ -97,6 +100,26 @@
 	}
 }
 
+void
+geoip_set_db6(name)
+	char *name;
+{
+	strncpy(geoip6_database, name, MAXPATHLEN);
+
+	if (geoip6_handle != NULL) {
+		GeoIP_delete(geoip6_handle);
+		geoip6_handle = NULL;
+	}
+
+	geoip6_handle = GeoIP_open(geoip6_database, GEOIP_STANDARD);
+	if (geoip6_handle == NULL) {
+		mg_log(LOG_WARNING, 
+		    "GeoIP databade \"%s\" cannot be used",
+		    geoip6_database);
+		return;
+	}
+}
+
 int
 geoip_filter(ad, stage, ap, priv)
 	acl_data_t *ad;
@@ -135,7 +158,10 @@
 	}
 
 	WRLOCK(geoip_lock);
-	priv->priv_ccode = GeoIP_country_code_by_addr(geoip_handle, ipstr);
+	if (SA(&priv->priv_addr)->sa_family == AF_INET6)
+		priv->priv_ccode = GeoIP_country_code_by_addr_v6(geoip6_handle, ipstr);
+	else
+		priv->priv_ccode = GeoIP_country_code_by_addr(geoip_handle, ipstr);
 	UNLOCK(geoip_lock);
 
 	if (priv->priv_ccode == NULL)
