new version of ip address storage
[spider.git] / perl / DXProtHandle.pm
index 9921d8289d1ad5aed3e3753eae91f18f67fe3fab..6dc13795deccd8ff99c2c8530e961536155baec9 100644 (file)
@@ -232,11 +232,13 @@ sub handle_11
        my $ip = $spot[14] if exists $spot[14];
        my $implied = '';
        if ($ip) {
-               $user->ip($ip), $user->put if !$user->ip || $user->ip ne $ip;
-               $r->ip($ip) if $r && !$r->ip;
+               $ip =~ s/[\(\)\*]+//g;  # strip these off :-)
+               $user->ip($spot[7], $ip);
+               $user->put;
+               $r->ip($spot[7], $ip) if $r;
        } else {
-               $ip ||= $r->ip if $r;
-               $ip ||= $user->ip;
+               $ip ||= $r->ip($spot[7]) if $r;
+               $ip ||= $user->ip($spot[7]);
                $implied = '*' if $ip;
        }
        
@@ -1521,10 +1523,11 @@ sub _add_thingy
                                $user->sort('U') unless $user->sort;
                        }
                }
-               $ip ||= $user->ip;
+               $ip ||= $user->ip($ncall);
                if ($ip) {
-                       $user->ip($ip);
-                       $r->ip($ip);
+                       $ip =~ s/^::ffff://; #  remove ipv6 stuff from the front of an ipv4 address
+                       $user->ip($ncall, $ip);
+                       $r->ip($ncall, $ip);
                        my $s = "PC92A $call -> $ip on $ncall";
                        Log('DXProt', $s);
                        dbg($s) if isdbg('routelow');