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