/usr/share/netdisco/html/duplex.html is in netdisco-frontend 1.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | <h1 class="pagehead">Duplex Mismatch Finder</h1>
<& SELF:results &>
<FORM ACTION="<%$r->uri%>" METHOD="get">
<DIV>
<h2 class="subheader">Search</h2>
<INPUT TYPE="submit" CLASS="navbutton" name="search" value="Search for Duplex Mismatches between device ports">
<P>
This search could take a while.
</DIV>
</FORM>
<%args>
$search => undef
</%args>
<%method title>
- Duplex Mismatch Finder \
</%method>
<%shared>
my $results = undef;
</%shared>
<%init>
if (defined $search and $search =~ /duplex/i){
$results = sql_rows('device_port d, device_port t',
['d.ip','d.port','d.duplex','t.ip as remote_ip','t.port as remote_port','t.duplex as remote_duplex'],
{'d.remote_ip' => \'t.ip', 'd.remote_port' => \'t.port', 'd.duplex' => \'!t.duplex'}
);
$results = 'none' unless (defined $results and scalar (@$results));
}
</%init>
<%method results>
% return unless defined $results;
% if ($results eq 'none'){
No Duplex Mismatches found.
% return;}
<h2 class="subheader">Search Results</h2>
<TABLE CELLSPACING=0 CELLPADDING=2 BORDER=0 WIDTH="75%">
<TR>
<TH>Device / Port</TH>
<TH>Duplex</TH>
<TH>Device / Port<BR>(remote)</TH>
<TH>Duplex<BR>(remote)</TH>
</TR>
<TR><TD COLSPAN=4><HR></TD></TR>
<%perl>
my %seen; my $count;
my $domain = $netdisco::CONFIG{domain};
foreach my $result (@$results){
my $ip = $result->{ip};
my $port = $result->{port};
my $duplex = $result->{duplex};
my $remote_ip = $result->{remote_ip};
my $remote_port = $result->{remote_port};
my $remote_duplex = $result->{remote_duplex};
next if defined $seen{$ip}->{$port};
my $dns = sql_scalar('device',['dns'],{'ip' => $ip});
my $remote_dns = sql_scalar('device',['dns'],{'ip' => $remote_ip});
my $name = defined $dns ? $dns : $ip;
$name =~ s/\Q$domain\E//;
my $remote_name = defined $remote_dns ? $remote_dns : $remote_ip;
$remote_name =~ s/\Q$domain\E//;
$count++;
</%perl>
<TR CLASS="match-<% $count % 2 %>">
<TD><A HREF="device.html?ip=<%$ip%>&port=<%$port%>"><%$name%> (<%$port%>)</A></TD>
<TD><%$duplex%></TD>
<TD><A HREF="device.html?ip=<%$remote_ip%>&port=<%$remote_port%>"><%$remote_name%> (<%$remote_port%>)</A></TD>
<TD><%$remote_duplex%></TD>
</TR>
<%perl>
$seen{$ip}->{$port}++;
$seen{$remote_ip}->{$remote_port}++;
}
</%perl>
</TABLE>
<P>
Found <% $count %> Mismatch<% $count > 1 ? 'es' : ''%>
</%method>
%# $Id: duplex.html,v 1.5 2007/12/14 02:18:22 maxbaker Exp $
%# vim:syntax=mason
|