[rancid] clutter with DHCP Snooping or VMPS

Václav Ovsík vaclav.ovsik at i.cz
Mon Jul 11 12:20:26 UTC 2016


Hi,
I have a small mod for Rancid 3.4.1 for
    * DHCP snooping - everchanging file in NVRAM
    * VMPS active - everchanging VLAN port assignment

--- ios.pm.orig	2016-05-18 08:09:10.000000000 +0200
+++ ios.pm	2016-06-15 13:24:26.268000000 +0200
@@ -976,7 +976,7 @@
 	# to:
 	#                                     vlan.dat
 	#                                            vlan.dat
-	if (/(dhcp_[^. ]*\.txt|vlan\.dat|sflog|syslog)\s*$/) {
+	if (/(dhcp_[^. ]*\.txt|vlan\.dat|sflog|snooping|syslog)\s*$/) {
 	    if (/(\s*\d+)(\s+[-rwx]+\s+)(\d+)(\s+)(\w+ \d+\s+\d+ \d+:\d+:\d+ .\d+:\d+)/) {
 		my($fn, $a, $sz, $c, $dt, $rem) = ($1, $2, $3, $4, $5, $');
 		my($fnl, $szl, $dtl) = (length($fn), length($sz), length($dt));
@@ -1950,6 +1950,8 @@
 
     ($_ = <$INPUT>, return(1)) if ($DO_SHOW_VLAN);
 
+    my $ports_column = undef;
+
     while (<$INPUT>) {
 	tr/\015//d;
 	last if (/^$prompt/);
@@ -1980,6 +1982,17 @@
 
 	next if (/total.*packets.*(input|output)/i);
 
+	if ( m/^VLAN\s+Name\s+Status\s+Ports$/ ) {
+	    $ports_column = index($_, 'Ports');
+	} elsif ( m/^[^-0-9 ]/ ) {
+	    undef $ports_column;
+	}
+	if ( defined $ports_column ) {
+	    $_ = substr($_, 0, $ports_column);
+	    next if m/^\s*$/;
+	    $_ .= "\n";
+	}
+
 	ProcessHistory("COMMENTS","keysort","IO","!VLAN: $_");
     }
 OUT:ProcessHistory("COMMENTS","keysort","IO","!\n");


Maybe usable for someone.
-- 
Zito



More information about the Rancid-discuss mailing list