Sophie

Sophie

distrib > Fedora > 13 > i386 > media > updates-src > by-pkgid > 8ff15aaec6aa7c6a6bfade293a2cfbaa > files > 19

logwatch-7.3.6-55.fc13.src.rpm

--- logwatch-7.3.6/scripts/services/dhcpd	2006-10-20 22:12:27.000000000 +0100
+++ logwatch-7.3.6-fedora/scripts/services/dhcpd	2010-10-09 13:01:42.000000000 +0100
@@ -16,6 +16,8 @@
 
 my %data;
 
+my %clientrequest;
+
 # This filter is very basic... much more could be done with it
 
 while (my $line = <STDIN>) {
@@ -46,13 +48,22 @@
       ($line =~ /^DHCPDISCOVER/) or
       ($line =~ /^DHCPREQUEST/) or
       ($line =~ /^DHCPRELEASE/) or
+      ($line =~ /^Solicit message from/) or
+      ($line =~ /^Sending Advertise to/) or
       ($line =~ /^pool [0-9a-f]+ /)
       ) {
       # Ignore these lines
    } elsif ($line =~ s/Listening on\s+//) {
+      if ($line =~ /\/[0-9a-fA-F:]+\/\d+$/) {
+         $data{'DHCP Server Listening On'}{'Configured for DHCPv6 (IPv6)'}++;
+      } else {
+         $data{'DHCP Server Listening On'}{'Configured for DHCPD (IPv4)'}++;
+      }
+      $data{'DHCP Server Listening On'}{$line}++;
+   } elsif ($line =~ s/Bound to\s+/IPv6 Port /) {
       $data{'DHCP Server Listening On'}{$line}++;
    } elsif (
-      ($line =~ /^you want, please write a subnet declaration/) or
+      ($line =~ /^you want, please write a subnet6? declaration/) or
       ($line =~ /^in your dhcpd.conf file for the network segment/) or
       ($line =~ /^to which interface [a-z\d]+ is attached./) or
 
@@ -81,7 +92,11 @@
       $data{'Generic error'}{$line}++;
    } elsif ($line =~ s/^\*\* Ignoring requests on ([a-z\d]+).  If this is not what\s*$/Ignoring interface $1/) {
       $data{'Config error'}{$line}++;
-   } elsif ($line =~ s/^No subnet declaration for ([a-z\d]+) ([()\d.]+).\s*$/No subnet declaration for $1 $2/) {
+   } elsif ($line =~ s/^No subnet6? declaration for ([a-z\d]+) ([()\d.ia-fA-F:]+).\s*$/No subnet declaration for $1 $2/) {
+      $data{'Config error'}{$line}++;
+   } elsif ($line =~ s/^WARNING: (Host declarations are global).\s+.*$/\1/) {
+      $data{'Config error'}{$line}++;
+   } elsif ($line =~ s/Not searching LDAP\s+.*$/No support for LDAP configured/) {
       $data{'Config error'}{$line}++;
    } elsif ($line =~ s/^DHCPOFFER on ([\d\.]+) to ([a-f\d:]+) via (\S+)\s*$/$1 -> $2 ($3)/) {
       if ($Detail >= 5) {
@@ -99,6 +114,24 @@
       if ($Detail >= 5) {
          $data{'Addresses Leased'}{$line}++;
       }
+   } elsif ($line =~ /^(Request|Confirm|Rebind|Renew|Information-request|Release) message from ([0-9a-fA-F:]+)/) {
+      $clientrequest{$2} = $1;
+   } elsif ($line =~ s/^Sending Reply to ([0-9a-fA-F:]+) port \d+/$1 (IPv6)/) {
+      my $clientrequest = $clientrequest{$1};
+      undef($clientrequest{$1});
+      if (($Detail >= 5) and ($clientrequest eq 'Request')) {
+         $data{'Addresses Leased'}{$line}++;
+      } elsif (($Detail >= 10) and ($clientrequest =~ /Rebind|Renew/)) {
+         $data{"Addresses $clientrequest"}{$line}++;
+      }
+   } elsif ($line =~ /^Client ([0-9a-fA-F:]+) releases address ([0-9a-fA-F:]+), which is not leased to it.$/) {
+      if ($Detail >= 5) {
+         $data{'Warnings'}{$line}++;
+      }
+   } elsif ($line =~ s/^Client ([0-9a-fA-F:]+) releases address ([0-9a-fA-F:]+)$/$1\n      -> $2 (IPv6)/) {
+      if ($Detail >= 5) {
+         $data{'Addresses Released'}{$line}++;
+      }
    } elsif ($line =~ s/^added reverse map from ([\d]+).([\d]+).([\d]+).([\d]+).in-addr.arpa. to ([a-zA-Z\d._-]+)\s*$/Add reverse $4.$3.$2.$1 -> $5/) {
       if ($Detail >= 7) {
          $data{'DNS Mappings'}{$line}++;
@@ -127,13 +160,17 @@
       if ($Detail >= 3) {
          $data{'Warnings'}{$line}++;
       }
+   } elsif ($line =~ s/^uid lease ([\da-fA-F.:]+) for client ([\da-fA-F:]+) is duplicate on ([\da-fA-F.:\/]+)/Host $2: duplicate $1 (range $3)\n      - probably both static and dynamic leases/) {
+      if ($Detail >= 3) {
+         $data{'Warnings'}{$line}++;
+      }
    } else {
       $data{'Unknown Entries'}{$line}++;
    }
 }
 
 if (keys %data) {
-   foreach my $type (keys %data) {
+   foreach my $type (sort keys %data) {
       print "$type:\n";
       foreach my $entry (sort {$a cmp $b} keys %{$data{$type}}) {
          print "   $entry: $data{$type}{$entry} Time(s)\n";