From: <ow...@us...> - 2010-08-27 09:52:12
|
Revision: 4879 http://ipcop.svn.sourceforge.net/ipcop/?rev=4879&view=rev Author: owes Date: 2010-08-27 09:52:05 +0000 (Fri, 27 Aug 2010) Log Message: ----------- Add exceptions to display IGMP protocol. 'Fix' display of source and destination port for protocols without ports. Modified Paths: -------------- ipcop/trunk/html/cgi-bin/connections.cgi ipcop/trunk/html/cgi-bin/logfirewall.cgi Modified: ipcop/trunk/html/cgi-bin/connections.cgi =================================================================== --- ipcop/trunk/html/cgi-bin/connections.cgi 2010-08-26 07:11:45 UTC (rev 4878) +++ ipcop/trunk/html/cgi-bin/connections.cgi 2010-08-27 09:52:05 UTC (rev 4879) @@ -303,6 +303,9 @@ if ($elt->{layer4}->{protonum} == 50) { $entries{$index}->{protocol} = "esp"; } + elsif ($elt->{layer4}->{protonum} == 2) { + $entries{$index}->{protocol} = "igmp"; + } else { $entries{$index}->{protocol} = "($elt->{layer4}->{protonum})"; } Modified: ipcop/trunk/html/cgi-bin/logfirewall.cgi =================================================================== --- ipcop/trunk/html/cgi-bin/logfirewall.cgi 2010-08-26 07:11:45 UTC (rev 4878) +++ ipcop/trunk/html/cgi-bin/logfirewall.cgi 2010-08-27 09:52:05 UTC (rev 4879) @@ -347,21 +347,27 @@ my $dstaddr = $1; $packet =~ /MAC=([\w+\:]+)/; my $macaddr = $1; - $packet =~ /PROTO=(\w+)/; - my $proto = $1; - $packet =~ /SPT=(\d+)/; - my $srcport = $1; - $packet =~ /DPT=(\d+)/; - my $dstport = $1; - my $servi = uc(getservbyport($srcport, lc($proto))); - - if ($servi ne '' && $srcport < 1024) { - $srcport = "$srcport($servi)"; + my $proto = ($packet =~ /PROTO=(\w+)/) ? $1 : "-"; + # Set protoname to IGMP, proto 2 can be confusing + $proto = 'IGMP' if ($proto eq '2'); + my $servi = ''; + my $srcport = '-'; + my $dstport = '-'; + if ($packet =~ /SPT=(\d+)/) { + $srcport = $1; + $servi = uc(getservbyport($srcport, lc($proto))); + if ($servi ne '' && $srcport < 1024) { + $srcport = "$srcport($servi)"; + } } - $servi = uc(getservbyport($dstport, lc($proto))); - if ($servi ne '' && $dstport < 1024) { - $dstport = "$dstport($servi)"; + if ($packet =~ /DPT=(\d+)/) { + $dstport = $1; + $servi = uc(getservbyport($dstport, lc($proto))); + if ($servi ne '' && $dstport < 1024) { + $dstport = "$dstport($servi)"; + } } + my @mactemp = split(/:/, $macaddr); $macaddr = "$mactemp[6]:$mactemp[7]:$mactemp[8]:$mactemp[9]:$mactemp[10]:$mactemp[11]"; print "<tr class='table".int(($lines % 2) + 1)."colour'>"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |