ebdd64ad486d3cd96c1ddb5a5cc08b631de9ec29
[project/luci.git] / modules / luci-mod-admin-full / luasrc / view / admin_status / routes.htm
1 <%#
2  Copyright 2008-2009 Steven Barth <steven@midlink.org>
3  Copyright 2008-2009 Jo-Philipp Wich <xm@subsignal.org>
4  Licensed to the public under the Apache License 2.0.
5 -%>
6
7 <%-
8         require "luci.sys"
9         require "luci.tools.webadmin"
10         require "nixio.fs"
11
12         local style = true
13 -%>
14
15 <%+header%>
16
17 <div class="cbi-map" id="cbi-network">
18         <h2><a id="content" name="content"><%:Routes%></a></h2>
19         <div class="cbi-map-descr"><%:The following rules are currently active on this system.%></div>
20
21         <fieldset class="cbi-section" id="cbi-table-table">
22                 <legend>ARP</legend>
23                 <div class="cbi-section-node">
24                         <table class="cbi-section-table">
25                                 <tr class="cbi-section-table-titles">
26                                         <th class="cbi-section-table-cell"><%_<abbr title="Internet Protocol Version 4">IPv4</abbr>-Address%></th>
27                                         <th class="cbi-section-table-cell"><%_<abbr title="Media Access Control">MAC</abbr>-Address%></th>
28                                         <th class="cbi-section-table-cell"><%:Interface%></th>
29                                 </tr>
30
31                                 <% luci.sys.net.arptable(function(e) %>
32                                 <tr class="cbi-section-table-row cbi-rowstyle-<%=(style and 1 or 2)%>">
33                                         <td class="cbi-value-field"><%=e["IP address"]%></td>
34                                         <td class="cbi-value-field"><%=e["HW address"]%></td>
35                                         <td class="cbi-value-field"><%=e["Device"]%></td>
36                                 </tr>
37                                 <% style = not style; end) %>
38                         </table>
39                 </div>
40         </fieldset>
41         <br />
42
43         <fieldset class="cbi-section" id="cbi-table-table">
44                 <legend><%_Active <abbr title="Internet Protocol Version 4">IPv4</abbr>-Routes%></legend>
45
46                 <div class="cbi-section-node">
47                         <table class="cbi-section-table">
48                                 <tr class="cbi-section-table-titles">
49                                         <th class="cbi-section-table-cell"><%:Network%></th>
50                                         <th class="cbi-section-table-cell"><%:Target%></th>
51                                         <th class="cbi-section-table-cell"><%_<abbr title="Internet Protocol Version 4">IPv4</abbr>-Gateway%></th>
52                                         <th class="cbi-section-table-cell"><%:Metric%></th>
53                                 </tr>
54                                 <% luci.sys.net.routes(function(rt) %>
55                                 <tr class="cbi-section-table-row cbi-rowstyle-<%=(style and 1 or 2)%>">
56                                         <td class="cbi-value-field"><%=luci.tools.webadmin.iface_get_network(rt.device) or rt.device%></td>
57                                         <td class="cbi-value-field"><%=rt.dest:string()%></td>
58                                         <td class="cbi-value-field"><%=rt.gateway:string()%></td>
59                                         <td class="cbi-value-field"><%=rt.metric%></td>
60                                 </tr>
61                                 <% style = not style; end) %>
62                         </table>
63                 </div>
64         </fieldset>
65         <br />
66
67         <% if nixio.fs.access("/proc/net/ipv6_route") then
68                 style = true
69                 fe80 = luci.ip.IPv6("fe80::/10")
70         %>
71         <fieldset class="cbi-section" id="cbi-table-table">
72                 <legend><%_Active <abbr title="Internet Protocol Version 6">IPv6</abbr>-Routes%></legend>
73
74                 <div class="cbi-section-node">
75                         <table class="cbi-section-table">
76                                 <tr class="cbi-section-table-titles">
77                                         <th class="cbi-section-table-cell"><%:Network%></th>
78                                         <th class="cbi-section-table-cell"><%:Target%></th>
79                                         <th class="cbi-section-table-cell"><%_<abbr title="Internet Protocol Version 6">IPv6</abbr>-Gateway%></th>
80                                         <th class="cbi-section-table-cell"><%:Metric%></th>
81                                 </tr>
82                                 <% luci.sys.net.routes6(function(rt) if fe80:contains(rt.dest) then return end %>
83                                 <tr class="cbi-section-table-row cbi-rowstyle-<%=(style and 1 or 2)%>">
84                                         <td class="cbi-value-field"><%=luci.tools.webadmin.iface_get_network(rt.device) or '(' .. rt.device .. ')'%></td>
85                                         <td class="cbi-value-field"><%=rt.dest:string()%></td>
86                                         <td class="cbi-value-field"><%=rt.source:string()%></td>
87                                         <td class="cbi-value-field"><%=rt.metric_raw:upper()%></td>
88                                 </tr>
89                                 <% style = not style; end) %>
90                         </table>
91                 </div>
92         </fieldset>
93         <br />
94         <% end %>
95 </div>
96
97 <%+footer%>