diff options
author | Manuel Munz <freifunk@somakoma.de> | 2011-10-10 16:04:27 +0000 |
---|---|---|
committer | Manuel Munz <freifunk@somakoma.de> | 2011-10-10 16:04:27 +0000 |
commit | 61778a32394378c6b120a290739984f3c9c812ce (patch) | |
tree | 28b19125b488d1eada7889c6f63d7c49b516f78d /modules/freifunk/luasrc/view | |
parent | bb5986cf13b5cdfffc00ce721fe0829e3a5aca2d (diff) |
modules/freifunk: Make display of ipv4 default route in public status work with freifunk-policyrouting enabled
Diffstat (limited to 'modules/freifunk/luasrc/view')
-rw-r--r-- | modules/freifunk/luasrc/view/freifunk/public_status.htm | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/modules/freifunk/luasrc/view/freifunk/public_status.htm b/modules/freifunk/luasrc/view/freifunk/public_status.htm index 9cb185688..0203f2ae8 100644 --- a/modules/freifunk/luasrc/view/freifunk/public_status.htm +++ b/modules/freifunk/luasrc/view/freifunk/public_status.htm @@ -49,6 +49,18 @@ local has_iwinfo = pcall(require, "iwinfo") local defroutev4 = sys.net.defaultroute() local defroutev6 = sys.net.defaultroute6() +if defroutev4 then + defroutev4.dest = defroutev4.dest:string() + defroutev4.gateway = defroutev4.gateway:string() +else + local dr4 = sys.exec("ip r s t olsr-default") + if dr4 then + defroutev4 = { } + defroutev4.dest, defroutev4.gateway, defroutev4.device, defroutev4.metric = dr4:match("^(%w+) via (%d+.%d+.%d+.%d+) dev (%w+) +metric (%d+)$ + end +end + + -%> <%+header%> @@ -283,9 +295,9 @@ local defroutev6 = sys.net.defaultroute6() <% if defroutev4 then %> <tr class="cbi-section-table-row cbi-rowstyle-1"> - <td class="cbi-value-field" id="v4dst"><%=defroutev4.dest:string()%></td> + <td class="cbi-value-field" id="v4dst"><%=defroutev4.dest%></td> <td class="cbi-value-field" id="v4dev"><%=defroutev4.device%></td> - <td class="cbi-value-field" id="v4gw"><%=defroutev4.gateway:string()%></td> + <td class="cbi-value-field" id="v4gw"><%=defroutev4.gateway%></td> <td class="cbi-value-field" id="v4metr"><%=defroutev4.metric%></td> </tr> |