Fwd: Suggested patch for IPv6 support in .../scripts/services/named

"Kirk Bauer" <[email protected]>
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
---------- Forwarded message ----------
From: Niall O'Reilly <[email protected]>
Date: Jan 22, 2008 3:24 AM
Subject: Suggested patch for IPv6 support in .../scripts/services/named
To: [email protected]
Cc: Niall O'Reilly <[email protected]>


This patch gives IP-version-agnostic address-matching in the
LogWatch analysis script for named.  Minimal regexps are used;
these should involve reduced parsing overhead.  Different
regexps are used according to whether a matched token is
needed for re-use.

The patch is included in-line for clarity and also as an
attachment in order to protect against damage by line-folding.

--- logwatch-script-named-1.56  2008-01-11 15:21:50.000000000 +0000
+++ logwatch-script-named-suggested     2008-01-14 12:09:21.000000000 +0000
@@ -187,7 +187,8 @@
        ($ThisLine =~ /weak RSASHA1 \(5\) key found \(exponent=3\)/) or
        ($ThisLine =~ /Bad file descriptor/) or
        ($ThisLine =~ /open: .*: file not found/) or
-      ($ThisLine =~ /queries: client [0-9.#:]* view
localhost_resolver: query: .* IN .*/) or
+## ucd.ie: IPv[46] -- not re-using addr or port -- just match non-
whitespace
+      ($ThisLine =~ /queries: client \S* view localhost_resolver:
query: .* IN .*/) or
        ($ThisLine =~ /zone .*: NS '.*' is a CNAME \(illegal\)/) or
        ($ThisLine =~ /zone .*: zone serial unchanged. zone may fail
to transfer to slaves/) or
        ($ThisLine =~ /zone .*: loading from master file .* failed/) or
@@ -280,7 +281,8 @@
        $NonAuthoritative{$Zone}++;
     } elsif ( ($ThisLine =~ /unexpected RCODE \((.*)\) resolving/) ){
        $UnexpRCODE{$1}++;
-   } elsif ( ($ThisLine =~ /FORMERR resolving '[^ ]+: [0-9.#]+/) ) {
+## ucd.ie: IPv[46] -- not re-using addr or port -- just match non-
whitespace
+   } elsif ( ($ThisLine =~ /FORMERR resolving '[^ ]+: \S+/) ) {
        chomp($ThisLine);
        $FormErr{$ThisLine}++;
     } elsif ( ($ThisLine =~ /found [0-9]* CPU(s)?, using [0-9]*
worker thread(s)?/) ) {
@@ -295,7 +297,8 @@
             (($ErrorText) = ($ThisLine =~ /^(.* REQUIRE.* failed.*)$/)) or
             (($ErrorText) = ($ThisLine =~ /(.*: fatal error)/)) ) {
        $NError{$ErrorText}++;
-   } elsif ( ($From,$Log) = ($ThisLine =~ /invalid command from ([.
0-9]*)#[0-9]*: (.*)/) ) {
+## ucd.ie: IPv[46] -- addr needed for re-use -- can be just non-hash
+   } elsif ( ($From,$Log) = ($ThisLine =~ /invalid command from ([^#]
*)#\d*: (.*)/i) ) {
        $CCMessages{"$From,$Log"}++;
     } elsif ( (($Log) = ($ThisLine =~ /(freezing .*zone.*)/)) or
             (($Log) = ($ThisLine =~ /(thawing .*zone.*)/)) ) {
@@ -307,7 +310,8 @@
     } else {
        # Report any unmatched entries...
        # remove PID from named messages
-      $ThisLine =~ s/(client [.0-9]+)\S+/$1/;
+## ucd.ie: IPv[46] -- addr needed for re-use -- can be just non-hash
+      $ThisLine =~ s/(client [^#]+)\S*/$1/;
        chomp($ThisLine);
        $OtherList{$ThisLine}++;
     }









-- 
Kirk Bauer <[email protected]>
http://linux.kaybee.org | www.logwatch.org
Author, Automating UNIX & Linux Administration

_______________________________________________
Logwatch-Devel mailing list
[email protected]
http://www2.list.logwatch.org:81/mailman/listinfo/logwatch-devel
logwatch-script-named.diff-u (application/octet-stream, 2.2 KB) - not displayed
PGP.sig (application/pgp-signature, 186 B) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.