Changeset 2287


Ignore:
Timestamp:
Mar 15, 2013, 9:57:48 AM (6 years ago)
Author:
matthijs
Message:

luci: Don't display a gateway of 0.0.0.0.

In some cases, a 3G dongle could fail to supply a remote IP address. In
these cases, a default route is still created by sending all traffic
into the ppp connection, without needing a specific gateway address.
However, luci would then show a gateway of 0.0.0.0, which might be
confusing. So instead show N/A for these cases. In addition, the control
flow is slightly changed to handle more exceptional cases.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/luci/modules/admin-fon/luasrc/view/fon/admin_fon_summary.htm

    r2286 r2287  
    3232        if netdata[wan] then
    3333                wan_ip = netdata[wan]["inet addr"] or "N/A"
    34                 wan_gateway = uci:get("network", "wan", "gateway") or "N/A"
    35                 if wan_gateway and #wan_gateway == 0 then
    36                         wan_gateway = "N/A"
    37                 end
     34                wan_gateway = uci:get("network", "wan", "gateway")
    3835                if wan_ip ~= "N/A" then
    3936                        wan_dns = net.getnameserver()
     
    4542                end
    4643        end
     44end
     45
     46if not wan_gateway or #wan_gateway == 0 or wan_gateway == "0.0.0.0" then
     47        wan_gateway = "N/A"
    4748end
    4849
Note: See TracChangeset for help on using the changeset viewer.