Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 159917 Details for
Bug 231242
Patch for Bind 9.4.x to allow use of Maxmind's free GeoIPCityLite
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch against Bind 9.4.2 for GeoDNS
bind-9.4.2-geodns-patch.diff (text/plain), 3.78 KB, created by
Michael Moody
on 2008-07-08 23:54:27 UTC
(
hide
)
Description:
Patch against Bind 9.4.2 for GeoDNS
Filename:
MIME Type:
Creator:
Michael Moody
Created:
2008-07-08 23:54:27 UTC
Size:
3.78 KB
patch
obsolete
>diff -ruN bind-9.4.2.orig/lib/dns/acl.c bind-9.4.2/lib/dns/acl.c >--- bind-9.4.2.orig/lib/dns/acl.c 2006-03-01 16:37:21.000000000 -0800 >+++ bind-9.4.2/lib/dns/acl.c 2008-04-02 19:32:27.000000000 -0700 >@@ -21,12 +21,16 @@ > > #include <config.h> > >+#include <GeoIP.h> >+#include <GeoIPCity.h> > #include <isc/mem.h> > #include <isc/string.h> > #include <isc/util.h> > > #include <dns/acl.h> > >+static GeoIP *geoip = NULL; >+ > isc_result_t > dns_acl_create(isc_mem_t *mctx, int n, dns_acl_t **target) { > isc_result_t result; >@@ -208,7 +212,28 @@ > e->u.ip_prefix.prefixlen)) > goto matched; > break; >- >+ >+ case dns_aclelementtype_ipregion: >+ /* We only match V4 addresses */ >+ if (reqaddr->family == AF_INET) { >+ /* Region match */ >+ >+ if (NULL == geoip) { >+ geoip = GeoIP_new(GEOIP_MEMORY_CACHE); >+ } >+ if (NULL != geoip) { >+ GeoIPRecord * value; >+ >+ value = GeoIP_record_by_addr(geoip,inet_ntoa(reqaddr->type.in)); >+ if ((NULL != value) && (NULL != value->region) && (2 == strlen(value->region))) { >+ if ((e->u.region[0] == value->region[0]) && (e->u.region[1] == value->region[1])) { >+ goto matched; >+ } >+ } >+ } >+ } >+ break; >+ > case dns_aclelementtype_keyname: > if (reqsigner != NULL && > dns_name_equal(reqsigner, &e->u.keyname)) >diff -ruN bind-9.4.2.orig/lib/dns/include/dns/acl.h bind-9.4.2/lib/dns/include/dns/acl.h >--- bind-9.4.2.orig/lib/dns/include/dns/acl.h 2006-03-01 16:37:21.000000000 -0800 >+++ bind-9.4.2/lib/dns/include/dns/acl.h 2008-04-02 19:30:17.000000000 -0700 >@@ -47,6 +47,7 @@ > > typedef enum { > dns_aclelementtype_ipprefix, >+ dns_aclelementtype_ipregion, > dns_aclelementtype_keyname, > dns_aclelementtype_nestedacl, > dns_aclelementtype_localhost, >@@ -55,6 +56,7 @@ > } dns_aclelemettype_t; > > typedef struct dns_aclipprefix dns_aclipprefix_t; >+typedef char dns_aclipregion[3]; > > struct dns_aclipprefix { > isc_netaddr_t address; /* IP4/IP6 */ >@@ -66,6 +68,7 @@ > isc_boolean_t negative; > union { > dns_aclipprefix_t ip_prefix; >+ dns_aclipregion region; > dns_name_t keyname; > dns_acl_t *nestedacl; > } u; >diff -ruN bind-9.4.2.orig/lib/isccfg/aclconf.c bind-9.4.2/lib/isccfg/aclconf.c >--- bind-9.4.2.orig/lib/isccfg/aclconf.c 2006-03-01 16:37:22.000000000 -0800 >+++ bind-9.4.2/lib/isccfg/aclconf.c 2008-04-02 19:29:10.000000000 -0700 >@@ -228,6 +228,12 @@ > } else if (strcasecmp(name, "none") == 0) { > de->type = dns_aclelementtype_any; > de->negative = ISC_TF(! de->negative); >+ } else if ((0 == (strncmp("region_", name, 7))) && (9 == strlen(name))) { >+ /* It is a region code */ >+ de->type = dns_aclelementtype_ipregion; >+ de->u.region[0] = name[7]; >+ de->u.region[1] = name[8]; >+ de->u.region[2] = '\0'; > } else { > de->type = dns_aclelementtype_nestedacl; > result = convert_named_acl(ce, cctx, lctx,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 231242
:
159917
|
159919
|
159921
|
160153
|
178544
|
178547
|
178549
|
178551
|
178552
|
179167
|
179168
|
179170
|
179186
|
179323