From c8a726f1657b950ba2a93ef5b8d53b22c3b44d22 Mon Sep 17 00:00:00 2001 From: Maniacikarus Date: Fri, 5 Sep 2008 15:24:43 +0200 Subject: [PATCH] Upgraded hostap because of new madwifi hal release Fixed and commented the migrate.pl --- config/qos/migrate.pl | 50 ++++++++++++++++++++++++++++++++++++++++- doc/packages-list.txt | 2 +- html/cgi-bin/wlanap.cgi | 2 +- lfs/madwifi | 4 ++-- 4 files changed, 53 insertions(+), 5 deletions(-) diff --git a/config/qos/migrate.pl b/config/qos/migrate.pl index 48ef5585e6..5c93d26ece 100755 --- a/config/qos/migrate.pl +++ b/config/qos/migrate.pl @@ -1,18 +1,53 @@ #!/usr/bin/perl +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2008 Michael Tremer & Christian Schmidt # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### + +# This skript will migrate all old rrd files with ADSL Optimizer Style to a +# custom IPFire one only collecting byte count for the QoS classes + +# Fore testing purpose i recommend to copy your rrd files to /tmp and change +# the rrddir, then you are able to test the migration without problems +# Migration will take all classes rrd into count my $rrddir = "/var/log/rrd"; -my @files = `cd $rrddir && ls class_* `; +my @files = `cd $rrddir && ls class_*.rrd`; +# Ff migration was already done we will skip this to avoid errors if ( -e "$rrddir/migrated" ){print "Already migrated rrd files -> exit.\n";exit 1;} +# Stop collectd and qos to ensure that no one further write to the rrds system("/etc/init.d/collectd stop"); system("/usr/local/bin/qosctrl stop"); foreach (@files){ chomp($_); + + # Dump the whole rrd file to human readable xml format into an array my @lines = `rrdtool dump $rrddir/$_`; + # to ensure only needed raw data is extracted we will use a marker my $fromhere = 0; + + # because every rrd hase the same header we can use a general one deleting + # lastupdate and lastvalue they will be set the first time rrd is written + # after migration my @newlines = " 0003 10 @@ -48,12 +83,18 @@ foreach (@files){ "; foreach (@lines){ + + # if database content line is found we will start to extract the values if ( $_ =~ /\/ ){ $fromhere = 1;next; } + # if database content is finished we will stop to extract the values if ( $_ =~ /\<\/database\>/ ){ $fromhere = 0;next; } + # if extraction is not set we will skip this line else we will extract + # only the first row and drop all the other ones, the new raw line + # will be written to and array if ( $fromhere eq "0" ){ next; }else{ @@ -61,19 +102,26 @@ foreach (@files){ push(@newlines,$t[0]."".$t[1]."\n"); } } +# Add default footer to the array so a valid rrd xml file will be created push(@newlines," "); +# Now write the whole array to an xml file open(DATEI, ">/tmp/rrd.xml") || die "Unable to create temp file"; print DATEI @newlines; close(DATEI); +# Delete the old rrd file and restore a new one with content from the xml file system("rm -f $rrddir/$_"); system("rrdtool restore -f /tmp/rrd.xml $rrddir/$_"); print "$_ ... resized\n"; } +# Now we can restart the collection system("/etc/init.d/collectd start"); system("/usr/local/bin/qosctrl start"); + +# Finaly we will delete unneeded evt files and touch the migration file +system("rf $rrddir/*.evt"); system("touch $rrddir/migrated"); exit 0; diff --git a/doc/packages-list.txt b/doc/packages-list.txt index 109702d136..cd6a008eec 100644 --- a/doc/packages-list.txt +++ b/doc/packages-list.txt @@ -183,7 +183,7 @@ * lzo-2.02 * m4-1.4.4 * mISDNuser-1_1_8 -* madwifi-hal-2008-08-15-r3851-20080829 +* madwifi-hal-2008-08-15-r3862-20080903 * make-3.81 * man-db-2.4.3 * man-pages-2.34 diff --git a/html/cgi-bin/wlanap.cgi b/html/cgi-bin/wlanap.cgi index 18f01678bf..a238f7a8d7 100644 --- a/html/cgi-bin/wlanap.cgi +++ b/html/cgi-bin/wlanap.cgi @@ -2,7 +2,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2007 Michael Tremer & Christian Schmidt # +# Copyright (C) 2008 Michael Tremer & Christian Schmidt # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # diff --git a/lfs/madwifi b/lfs/madwifi index 2818b0565c..509013e2cb 100644 --- a/lfs/madwifi +++ b/lfs/madwifi @@ -24,7 +24,7 @@ include Config -VER = hal-2008-08-15-r3851-20080829 +VER = hal-2008-08-15-r3862-20080903 THISAPP = madwifi-$(VER) DL_FILE = $(THISAPP).tar.gz @@ -44,7 +44,7 @@ objects = $(DL_FILE) $(DL_FILE) = $(DL_FROM)/$(DL_FILE) -$(DL_FILE)_MD5 = 5e66a7d080636675830a94775d13c760 +$(DL_FILE)_MD5 = 3c9726acd5ffa180fa7b274b625a6082 install : $(TARGET) -- 2.39.2