Permalink
Browse files

Removed lastResortMasks function

- Last resort masks have been replaced with the fallback option
- Fallback no longer an experimental feature
  • Loading branch information...
1 parent da96406 commit ae3aa01a0b2d95deccbac612ae55a84c28979c7f @Ratler committed Jan 5, 2011
Showing with 2 additions and 30 deletions.
  1. +2 −30 ripecheck.tcl
View
32 ripecheck.tcl
@@ -1001,17 +1001,11 @@ namespace eval ::ripecheck {
# Experimental feature that might replace lastResortMasks in the future
if {[::ripecheck::isConfigEnabled fallback] && ![dict exists $whoisData Country] && [dict exists $whoisData fallback]} {
- ::ripecheck::debug "Using fallback method (EXPERIMENTAL) for '[dict get $whoisData fallback]' original host was $host ($ip)"
+ ::ripecheck::debug "Using fallback method for '[dict get $whoisData fallback]' original host was $host ($ip)"
::ripecheck::whoisConnect [dict get $whoisData fallback] $host $nick $channel $orghost $whoisdb 43 $rtype
return 1
}
- # Last resort, check if we get a match from hardcoded netmasks
- if {![dict exists $whoisData Country] && [::ripecheck::lastResortMasks $ip] != ""} {
- dict set whoisdata Country [::ripecheck::lastResortMasks $ip]
- ::ripecheck::debug "Got '[dict get $whoisData Country]' from lastResortMasks"
- }
-
if {[dict exists $whoisData Country]} {
::ripecheck::debug "Running mode: '$rtype' for country: [dict get $whoisData Country]"
set country [::ripecheck::getCountry [dict get $whoisData Country]]
@@ -1274,26 +1268,6 @@ namespace eval ::ripecheck {
}
}
- # Define whois overrides for netmasks with incomplete records
- proc lastResortMasks { ip } {
- set masks(24.16.0.0/13) "us"
- set masks(24.239.32.0/19) "us"
- set masks(208.151.241.0/24) "us"
- set masks(208.151.242.0/23) "us"
- set masks(208.151.244.0/22) "us"
- set masks(208.151.248.0/21) "us"
-
- # Create a list from the masks array
- foreach mask [array names masks] {
- lappend masklist $mask
- }
-
- set matchmask [::ip::longestPrefixMatch $ip $masklist]
- if {$matchmask != ""} {
- return $masks($matchmask)
- }
- }
-
# Return a country based on tld or return "" if no country is found
proc getCountry { tld } {
if {[array size ::ripecheck::tldtocountry] > 0 && [info exists ::ripecheck::tldtocountry($tld)]} {
@@ -1428,10 +1402,8 @@ namespace eval ::stderreu {
putidx $idx " geoban \[on|off\] : Enable or disable GeoIP data as primary method of banning, whois will be used"
putidx $idx " as fallback"
putidx $idx " logmode \[on|off\] : Enable or disable log only mode, this will disable channel bans and kick counter."
- putidx $idx " fallback \[on|off\] : \002EXPERIMENTAL!!! Use with caution!\002"
- putidx $idx " This function will _try_ to detect country for an host where the whois server"
+ putidx $idx " fallback \[on|off\] : This function will _try_ to detect country for an host where the whois server"
putidx $idx " only return a few NET-XXX-XXX-XXX-XXX entries."
- putidx $idx " The intention is to replace lastResortMask."
putidx $idx " ipinfodbkey \[apikey\] : Set ipinfodb.com API key."
putidx $idx " Register with ipinfodb.com to recieve a FREE API key: http://www.ipinfodb.com/register.php"
putidx $idx " \002Examples\002:"

0 comments on commit ae3aa01

Please sign in to comment.