+ # Check if this is a survey reply
+ if ($dport >= $Config::survey_port_low && $dport <= $Config::survey_port_high) {
+ if (!exists($active_surveys{$dport})) {
+ print "WARNING: Unknown survey port $dport, ignoring\n";
+ next;
+ }
+ if (!$active_surveys{$dport}{active}) {
+ # remains
+ next;
+ }
+
+ ++$active_surveys{$dport}{num};
+
+ next;
+ }
+
+ # Rate limiting
+ if (exists($last_sent{$saddr}{$dport})) {
+ my $elapsed = Time::HiRes::tv_interval($last_sent{$saddr}{$dport}, $now);
+ if ($elapsed < 1.0) {
+ print LOG "$dport $size 2\n";
+ print inet_ntoa($saddr), ", $dport, $size bytes => rate-limited ($elapsed secs since last)\n";
+ }
+ next;
+ }
+