ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/myhttpd/netgeo.pl
(Generate patch)

Comparing Coro/myhttpd/netgeo.pl (file contents):
Revision 1.4 by root, Tue Aug 28 02:30:49 2001 UTC vs.
Revision 1.5 by root, Tue Aug 28 02:43:02 2001 UTC

227 my $v; 227 my $v;
228 228
229 if (!$c->c_get((inet_aton $ip), $v, DB_SET_RANGE)) { 229 if (!$c->c_get((inet_aton $ip), $v, DB_SET_RANGE)) {
230 my ($ip0, $ip1, $whois) = split /\x0/, $v; 230 my ($ip0, $ip1, $whois) = split /\x0/, $v;
231 my $_ip = ip2int $ip; 231 my $_ip = ip2int $ip;
232 print "looked for $_ip, found $ip0, $ip1 ", length($v),"\n";
233 if ($ip0 <= $_ip && $_ip <= $ip1) { 232 if ($ip0 <= $_ip && $_ip <= $ip1) {
234 return $whois; 233 return $whois;
235 } 234 }
236 } 235 }
237 236
238 print "looked for $ip, ONLY found $v->[0], $v->[1]\n";
239
240 my ($arin, $ripe, $apnic); 237 my ($arin, $ripe, $apnic);
241 238
242 $whois = $WHOIS{APNIC}->ip_request($ip) 239 $whois = $WHOIS{APNIC}->ip_request($ip)
243 || $WHOIS{RIPE} ->ip_request($ip) 240 || $WHOIS{RIPE} ->ip_request($ip)
244 || $WHOIS{ARIN} ->ip_request($ip); 241 || $WHOIS{ARIN} ->ip_request($ip);
256 $_ip = $_ip & 0xffffff00; 253 $_ip = $_ip & 0xffffff00;
257 $_ip0 = $_ip if $_ip0 < $_ip; 254 $_ip0 = $_ip if $_ip0 < $_ip;
258 $_ip1 = $_ip + 255 if $_ip1 > $_ip + 255; 255 $_ip1 = $_ip + 255 if $_ip1 > $_ip + 255;
259 } 256 }
260 257
261 print "setting entry ($_ip0, $_ip, $_ip1)\n";
262 $iprange->db_put((pack "N", $_ip1), (join "\x0", $_ip0, $_ip1, $whois)); 258 $iprange->db_put((pack "N", $_ip1), (join "\x0", $_ip0, $_ip1, $whois));
263 (tied %whois)->db_sync; 259 (tied %whois)->db_sync;
264 $iprange->db_sync; 260 $iprange->db_sync;
265 261
266 $whois; 262 $whois;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines