2697c1cda38238df94b6630e9e95a85f79bf7e25
[project/luci.git] / modules / admin-full / luasrc / view / admin_status / conntrack.htm
1 <%#
2 LuCI - Lua Configuration Interface
3 Copyright 2008-2009 Steven Barth <steven@midlink.org>
4 Copyright 2008-2011 Jo-Philipp Wich <xm@subsignal.org>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13
14 -%>
15
16 <%-
17         require "luci.sys"
18         local style = true
19 -%>
20
21 <%+header%>
22
23 <div class="cbi-map" id="cbi-conntrack">
24         <h2><a id="content" name="content"><%:Active Connections%></a></h2>
25         <div class="cbi-map-descr"><%:This page gives an overview over currently active network connections.%></div>
26
27         <fieldset class="cbi-section" id="cbi-table-table">
28                 <legend>ARP</legend>
29                 <div class="cbi-section-node">
30                         <table class="cbi-section-table">
31                                 <tr class="cbi-section-table-titles">
32                                         <th class="cbi-section-table-cell"><%_<abbr title="Internet Protocol Version 4">IPv4</abbr>-Address%></th>
33                                         <th class="cbi-section-table-cell"><%_<abbr title="Media Access Control">MAC</abbr>-Address%></th>
34                                         <th class="cbi-section-table-cell"><%:Interface%></th>
35                                 </tr>
36
37                                 <% luci.sys.net.arptable(function(e) %>
38                                 <tr class="cbi-section-table-row cbi-rowstyle-<%=(style and 1 or 2)%>">
39                                         <td class="cbi-value-field"><%=e["IP address"]%></td>
40                                         <td class="cbi-value-field"><%=e["HW address"]%></td>
41                                         <td class="cbi-value-field"><%=e["Device"]%></td>
42                                 </tr>
43                                 <% style = not style; end) %>
44                         </table>
45                 </div>
46         </fieldset>
47         <br />
48
49         <fieldset class="cbi-section" id="cbi-table-table">
50                 <legend><%:Active Connections%></legend>
51                 <div class="cbi-section-node">
52                         <table class="cbi-section-table">
53                                 <tr class="cbi-section-table-titles">
54                                         <th class="cbi-section-table-cell"><%:Network%></th>
55                                         <th class="cbi-section-table-cell"><%:Protocol%></th>
56                                         <th class="cbi-section-table-cell"><%:Source%></th>
57                                         <th class="cbi-section-table-cell"><%:Destination%></th>
58                                 </tr>
59
60                                 <% style = true; luci.sys.net.conntrack(function(c) %>
61                                 <tr class="cbi-section-table-row cbi-rowstyle-<%=(style and 1 or 2)%>">
62                                         <td class="cbi-value-field"><%=c.layer3:upper()%></td>
63                                         <td class="cbi-value-field"><%=c.layer4:upper()%></td>
64                                         <td class="cbi-value-field"><%=
65                                                 c.layer3 == "ipv6"
66                                                         and "[%s]:%d" %{ c.src, c.sport }
67                                                         or  "%s:%d"   %{ c.src, c.sport }
68                                         %></td>
69                                         <td class="cbi-value-field"><%=
70                                                 c.layer3 == "ipv6"
71                                                         and "[%s]:%d" %{ c.dst, c.dport }
72                                                         or  "%s:%d"   %{ c.dst, c.dport }
73                                         %></td>
74                                 </tr>
75                                 <% style = not style; end) %>
76                         </table>
77                 </div>
78         </fieldset>
79         <br />
80 </div>
81
82 <%+footer%>