Your message dated Mon, 21 Dec 2009 19:47:12 +0000
with message-id <[email protected]>
and subject line Bug#561886: fixed in geoip 1.4.6.dfsg-16
has caused the Debian Bug report #561886,
regarding geoip: please correctly handle 6to4 mapped addresses
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
561886: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=561886
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: geoip
Version: 1.4.6.dfsg-15
Severity: wishlist
Tags: patch

Hi there,

Currently geoip does not handle the 6to4 mapped range (the 2002: range
of v6), as it can't find them in the database for v6.  It would be
possible to add them to the database, but this seems like needless
duplication, so I've written a fairly trivial patch to convert the
mapped addresses to v4 addresses and look them up in the v4 database.

I am not all that familiar with the geoip calling conventions, so please
don't assume this is the best of all patches for it - it's strictly a
Works For Me[TM] patch, tested on amd64 and ppc to get the endian part
right.

Cheers,
-- 
 -----------------------------------------------------------------
|   ,''`.                                            Stephen Gran |
|  : :' :                                        [email protected] |
|  `. `'                        Debian user, admin, and developer |
|    `-                                     http://www.debian.org |
 -----------------------------------------------------------------
diff -Nru geoip-1.4.6.dfsg/debian/changelog geoip-1.4.6.dfsg/debian/changelog
--- geoip-1.4.6.dfsg/debian/changelog	2009-12-06 19:41:31.000000000 +0000
+++ geoip-1.4.6.dfsg/debian/changelog	2009-12-21 00:18:17.000000000 +0000
@@ -1,3 +1,10 @@
+geoip (1.4.6.dfsg-15.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Fix to correctly lookup 6to4 mapped addresses in the 2002: prefix
+
+ -- Stephen Gran <[email protected]>  Mon, 21 Dec 2009 00:17:58 +0000
+
 geoip (1.4.6.dfsg-15) unstable; urgency=low
 
   * Update both databases to the 2.12.2009 version.
diff -Nru geoip-1.4.6.dfsg/debian/patches/debian-changes-1.4.6.dfsg-15.1 geoip-1.4.6.dfsg/debian/patches/debian-changes-1.4.6.dfsg-15.1
--- geoip-1.4.6.dfsg/debian/patches/debian-changes-1.4.6.dfsg-15.1	1970-01-01 01:00:00.000000000 +0100
+++ geoip-1.4.6.dfsg/debian/patches/debian-changes-1.4.6.dfsg-15.1	2009-12-21 00:52:34.000000000 +0000
@@ -0,0 +1,76 @@
+--- geoip-1.4.6.dfsg.orig/libGeoIP/GeoIP.c
++++ geoip-1.4.6.dfsg/libGeoIP/GeoIP.c
+@@ -18,7 +18,7 @@
+  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+  */
+ 
+-#include "GeoIP.h"
++#include "GeoIP_internal.h"
+ 
+ static geoipv6_t IPV6_NULL;
+ 
+@@ -27,6 +27,11 @@ static geoipv6_t IPV6_NULL;
+ #include <sys/mman.h>
+ #endif /* !defined(_WIN32) */ 
+ 
++#include <sys/socket.h>
++#include <netinet/in.h>
++#include <arpa/inet.h>
++
++
+ #include <errno.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -501,6 +506,52 @@ int _check_mtime(GeoIP *gi) {
+ 
+ #define ADDR_STR_LEN (8 * 4 + 7 + 1) 
+ unsigned int _GeoIP_seek_record_v6 (GeoIP *gi, geoipv6_t ipnum) {
++
++       /* 
++        * First we check the v6 address to see if it looks like a 6to4 address.
++        * These begin with 2002:, so it's a fairly easy prefix to check, but we
++        * have to deal with it in a way that deals with endian issues, so it's not
++        * all that pretty.  Sadly, we don't seem to have portable macros like htonl
++        * for this v6 funtion just yet.  Using a cast to uint32_t so that we get
++        * the first 4 bytes of the address (as the prefix will actually be in the
++        * lower two bytes on little endian machines)
++        */
++
++#ifdef _BIG_ENDIAN
++       if ((((__const uint32_t *) (ipnum.s6_addr))[0] & 0xffff0000) == 0x20020000) {
++#else /* _BIG_ENDIAN */
++       if ((((__const uint32_t *) (ipnum.s6_addr))[0] & 0x0000ffff) == 0x00000220) {
++#endif /* _BIG_ENDIAN */
++
++         struct in_addr v4;
++         memset(&v4, 0, sizeof(struct in_addr));
++         int part;
++         unsigned int ret;
++         int type;
++
++         /*
++          * The v6 address field is uint8_t[16], and the first two members of that
++          * array are taken up the 2002: prefix.  We want to iterate the next 4, as
++          * that will get us the mapped v4 address back.
++          */
++
++         for (part = 2; part <= 5; part++) {
++           v4.s_addr <<= 8;
++           v4.s_addr |= (((__const uint8_t *) (ipnum.s6_addr))[part]);
++         }
++
++         if (gi->databaseType == GEOIP_COUNTRY_EDITION_V6) {
++           type = GEOIP_COUNTRY_EDITION;
++         } else {
++           type = gi->databaseType;
++         }
++
++         GeoIP *gi2 = GeoIP_open_type(type, gi->flags);
++         ret = _GeoIP_seek_record(gi2, v4.s_addr);
++         free(gi2);
++         return ret;
++       }
++
+        int depth;
+        char paddr[ADDR_STR_LEN];
+        unsigned int x;
diff -Nru geoip-1.4.6.dfsg/debian/patches/series geoip-1.4.6.dfsg/debian/patches/series
--- geoip-1.4.6.dfsg/debian/patches/series	2009-12-06 19:41:31.000000000 +0000
+++ geoip-1.4.6.dfsg/debian/patches/series	2009-12-21 00:18:20.000000000 +0000
@@ -1,2 +1,3 @@
 01-fix_exit_code_and_v_flag.diff
 02-add_asnum_support.diff
+debian-changes-1.4.6.dfsg-15.1

--- End Message ---
--- Begin Message ---
Source: geoip
Source-Version: 1.4.6.dfsg-16

We believe that the bug you reported is fixed in the latest version of
geoip, which is due to be installed in the Debian FTP archive:

geoip-bin_1.4.6.dfsg-16_amd64.deb
  to main/g/geoip/geoip-bin_1.4.6.dfsg-16_amd64.deb
geoip-database_1.4.6.dfsg-16_all.deb
  to main/g/geoip/geoip-database_1.4.6.dfsg-16_all.deb
geoip_1.4.6.dfsg-16.debian.tar.gz
  to main/g/geoip/geoip_1.4.6.dfsg-16.debian.tar.gz
geoip_1.4.6.dfsg-16.dsc
  to main/g/geoip/geoip_1.4.6.dfsg-16.dsc
libgeoip-dev_1.4.6.dfsg-16_amd64.deb
  to main/g/geoip/libgeoip-dev_1.4.6.dfsg-16_amd64.deb
libgeoip1_1.4.6.dfsg-16_amd64.deb
  to main/g/geoip/libgeoip1_1.4.6.dfsg-16_amd64.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Patrick Matthäi <[email protected]> (supplier of updated geoip package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Mon, 21 Dec 2009 20:36:13 +0100
Source: geoip
Binary: libgeoip1 libgeoip-dev geoip-bin geoip-database
Architecture: source all amd64
Version: 1.4.6.dfsg-16
Distribution: unstable
Urgency: low
Maintainer: Patrick Matthäi <[email protected]>
Changed-By: Patrick Matthäi <[email protected]>
Description: 
 geoip-bin  - IP lookup command line tools that use the GeoIP library
 geoip-database - IP lookup command line tools that use the GeoIP library 
(country
 libgeoip-dev - Development files for the GeoIP library
 libgeoip1  - A non-DNS IP-to-country resolver library
Closes: 561886
Changes: 
 geoip (1.4.6.dfsg-16) unstable; urgency=low
 .
   * Map IPv6 6to4 addresses to the IPv4 database. Much thanks for the patch
     to Stephen Gran <[email protected]>.
     Closes: #561886
   * Merge 1.4.6.dfsg-15~bpo50+1 changelog.
Checksums-Sha1: 
 e0cff6b99a913d386c56a95c2a94695860804b7d 1122 geoip_1.4.6.dfsg-16.dsc
 386812efd0a11dcef2541d881949cd0dd7e25a53 1812621 
geoip_1.4.6.dfsg-16.debian.tar.gz
 fef2d7347f9a162ef4e0ef533d52f7e26f51d4fc 656998 
geoip-database_1.4.6.dfsg-16_all.deb
 b8eca2eeda89b6ccb456367e3a3fe1cc16457469 116658 
libgeoip1_1.4.6.dfsg-16_amd64.deb
 3ad21890f4bf31739a72a04e7d852b2e91359716 170158 
libgeoip-dev_1.4.6.dfsg-16_amd64.deb
 f2219efcf2b9f0ca6f55ba7935ab645b53450c74 34486 
geoip-bin_1.4.6.dfsg-16_amd64.deb
Checksums-Sha256: 
 8373d56da0376ba4e0bac6903393a9f33df49d90a851d3a7365ef4806ac2c8a5 1122 
geoip_1.4.6.dfsg-16.dsc
 64f5c752cc641a4677a328a3ea0ed61be19ba8445f509edab40d9a4012ce10ac 1812621 
geoip_1.4.6.dfsg-16.debian.tar.gz
 9444818da817f83e0fafe54e5810428e1581edf2591ee737c0e0a17f1353f1dc 656998 
geoip-database_1.4.6.dfsg-16_all.deb
 81401aaeca94737386074bd90384af4f514ef80871615831facecb7f61194126 116658 
libgeoip1_1.4.6.dfsg-16_amd64.deb
 bcdb72fce1bffd7571318262c7aa0655bc132d9c7a19d34ad71c3c1049a6d82e 170158 
libgeoip-dev_1.4.6.dfsg-16_amd64.deb
 a7df1615bb9d6392d3081ed1b9b2d8c6c914855a92f9cf8015ad1bcc3a775395 34486 
geoip-bin_1.4.6.dfsg-16_amd64.deb
Files: 
 da05d9dceea6aa974f694f4afa52d2b8 1122 net optional geoip_1.4.6.dfsg-16.dsc
 11b60de48f4365df706db8b78a65a405 1812621 net optional 
geoip_1.4.6.dfsg-16.debian.tar.gz
 943031026504e46be9f0da3d7a6aa7ac 656998 net optional 
geoip-database_1.4.6.dfsg-16_all.deb
 00dd7919be5d41ec7c6cf452a2979d7e 116658 libs optional 
libgeoip1_1.4.6.dfsg-16_amd64.deb
 d7fdd9e7007bbac03814781be578776e 170158 libdevel optional 
libgeoip-dev_1.4.6.dfsg-16_amd64.deb
 f065c4109e562eefb54aed48ddbb096a 34486 net optional 
geoip-bin_1.4.6.dfsg-16_amd64.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAksvz6MACgkQ2XA5inpabMeA1gCfSJyKwhDUEWH3xyQyOTlkztxQ
HacAoIIyF78MgORfCNxPnmbxDAtclNZG
=n0aE
-----END PGP SIGNATURE-----



--- End Message ---

Reply via email to