From: <ow...@us...> - 2008-10-27 19:42:29
|
Revision: 2023 http://ipcop.svn.sourceforge.net/ipcop/?rev=2023&view=rev Author: owes Date: 2008-10-27 19:42:19 +0000 (Mon, 27 Oct 2008) Log Message: ----------- The XML output of conntrack has changed, fix parsing. Modified Paths: -------------- ipcop/trunk/html/cgi-bin/connections.cgi Modified: ipcop/trunk/html/cgi-bin/connections.cgi =================================================================== --- ipcop/trunk/html/cgi-bin/connections.cgi 2008-10-27 06:22:28 UTC (rev 2022) +++ ipcop/trunk/html/cgi-bin/connections.cgi 2008-10-27 19:42:19 UTC (rev 2023) @@ -61,9 +61,6 @@ $cgiparams{'ACTION'} = ''; &General::getcgihash(\%cgiparams); -# Fetch connection tracking info in XML format -my @active = `/usr/local/bin/conntrack_helper`; - if ($cgiparams{'ACTION'} eq 'SAVE') { $mainsettings{'DISPLAY_CONNECTIONS'} = $cgiparams{'DISPLAY_CONNECTIONS'}; &General::writehash('/var/ipcop/main/settings', \%mainsettings); @@ -246,11 +243,13 @@ my $unknownlines = ''; # should be empty all the time... my $index = 0; # just a counter to make unique entryies in entries -foreach my $line (@active) { - chomp($line); - my $xml = new XML::Simple; - my $data = $xml->XMLin($line); +# Fetch connection tracking info in XML format +my $lines = `/usr/local/bin/conntrack_helper`; +my $xml = new XML::Simple; +my $active = $xml->XMLin($lines); +foreach my $data (@{$active->{flow}}) { + foreach my $elt (@{$data->{meta}}) { if ($elt->{direction} eq 'original') { $entries{$index}->{protocol} = $elt->{layer4}->{protoname}; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |