"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "mod_asn.c" between
mod_asn-1.6.tar.gz and mod_asn-1.7.tar.gz

About: mod_asn is an Apache 2.4 module that uses BGP routing data to do lookups of the autonomous system (AS) number, and the network prefix, that an IP address is contained in.

mod_asn.c  (mod_asn-1.6):mod_asn.c  (mod_asn-1.7)
/* /*
* Copyright (c) 2008-2010 Peter Poeml <poeml@mirrorbrain.org> / Novell Inc. * Copyright (c) 2008-2010 Peter Poeml <poeml@mirrorbrain.org> / Novell Inc.
* Copyright (c) 2008-2014 Peter Poeml <poeml@mirrorbrain.org> * Copyright (c) 2008-2015 Peter Poeml <poeml@mirrorbrain.org>
* All rights reserved. * All rights reserved.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
skipping to change at line 50 skipping to change at line 50
#include "apu_version.h" #include "apu_version.h"
#include "apr_strings.h" #include "apr_strings.h"
#include "apr_lib.h" #include "apr_lib.h"
#include "apr_dbd.h" #include "apr_dbd.h"
#include "mod_dbd.h" #include "mod_dbd.h"
#ifndef UNSET #ifndef UNSET
#define UNSET (-1) #define UNSET (-1)
#endif #endif
#define MOD_ASN_VER "1.6" #define MOD_ASN_VER "1.7"
#define VERSION_COMPONENT "mod_asn/"MOD_ASN_VER #define VERSION_COMPONENT "mod_asn/"MOD_ASN_VER
/* from ssl/ssl_engine_config.c */ /* from ssl/ssl_engine_config.c */
#define cfgMerge(el,unset) mrg->el = (add->el == (unset)) ? base->el : add->el #define cfgMerge(el,unset) mrg->el = (add->el == (unset)) ? base->el : add->el
#define cfgMergeArray(el) mrg->el = apr_array_append(p, add->el, base->el) #define cfgMergeArray(el) mrg->el = apr_array_append(p, add->el, base->el)
#define cfgMergeString(el) cfgMerge(el, NULL) #define cfgMergeString(el) cfgMerge(el, NULL)
#define cfgMergeBool(el) cfgMerge(el, UNSET) #define cfgMergeBool(el) cfgMerge(el, UNSET)
#define cfgMergeInt(el) cfgMerge(el, UNSET) #define cfgMergeInt(el) cfgMerge(el, UNSET)
#define DEFAULT_QUERY "SELECT pfx, asn FROM pfx2asn WHERE pfx >>= ip4r(%s) ORDER BY ip4r_size(pfx) LIMIT 1" #define DEFAULT_QUERY "SELECT pfx, asn FROM pfx2asn WHERE pfx >>= ipaddress(%s) ORDER BY @ pfx LIMIT 1"
module AP_MODULE_DECLARE_DATA asn_module; module AP_MODULE_DECLARE_DATA asn_module;
/* per-dir configuration */ /* per-dir configuration */
typedef struct typedef struct
{ {
int asn_enabled; int asn_enabled;
int set_headers; int set_headers;
int debug; int debug;
} asn_dir_conf; } asn_dir_conf;
skipping to change at line 320 skipping to change at line 320
clientip = apr_pstrdup(r->pool, r->connection->remote_ip); clientip = apr_pstrdup(r->pool, r->connection->remote_ip);
#endif #endif
} }
if (!clientip) { if (!clientip) {
debugLog(r, cfg, "empty client ip... not doing a lookup"); debugLog(r, cfg, "empty client ip... not doing a lookup");
asn_dbd_close_fn(r->server, dbd); asn_dbd_close_fn(r->server, dbd);
return DECLINED; return DECLINED;
} }
if (ap_strchr_c(clientip, ':')) {
debugLog(r, cfg, "IPv6 address lookup is not supported (%s)", clientip);
asn_dbd_close_fn(r->server, dbd);
return DECLINED;
}
/* 0: sequential. must loop over all rows. /* 0: sequential. must loop over all rows.
* 1: random. accessing invalid row (-1) will clear the cursor. */ * 1: random. accessing invalid row (-1) will clear the cursor. */
if (apr_dbd_pvselect(dbd->driver, r->pool, dbd->handle, &res, statement, 0, if (apr_dbd_pvselect(dbd->driver, r->pool, dbd->handle, &res, statement, 0,
clientip, NULL) != 0) { clientip, NULL) != 0) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
"[mod_asn] Error looking up %s in database", clientip); "[mod_asn] Error looking up %s in database", clientip);
asn_dbd_close_fn(r->server, dbd); asn_dbd_close_fn(r->server, dbd);
return DECLINED; return DECLINED;
} }
 End of changes. 4 change blocks. 
9 lines changed or deleted 3 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS