Paulzzh

一个过期东方苟的博客


Explore Me
Paulzzh
Paulzzh
一个过期东方苟的博客
16
4
21
东方Project随机图片API[置顶]
接口地址点击获得随机图片自己做的随机图片api,收录4W+张图片,虽然服务器在国外但是速度依然很快,
6年前 · Paulzzh
修复 TL-ER2260T 网桥添加虚接口后网页后台异常
按这篇文章说的把 vlan 虚接口接入网桥后,路由器重启一次之后网页后台不正常,具体表现为首页系统状
9小时前 · Paulzzh
lxc linux debian13 xfce4 桌面 相关坑 记录 2.0
目标:PVE上所有LXC容器都是无特权安装 trixie-backports intel gpu 驱
2月前 · Paulzzh
在 debian 13 上为 xrdp 启用 h264 / x264
前提网络上的教程大部分都是教你用这个脚本,实际上这里有第一个坑,首先他们用的参数是-s -e,未启用
2月前 · Paulzzh
为 TiviMate 2.1.5 增加回放支持
本文章同步发表在 https://github.com/stackia/rtp2httpd/issu
6月前 · Paulzzh
TP-LINK TL-ER2260T 1.2.x 固件开启 telnet
曾经不懂事升级了 1.1.x 后再也找不回来的 SSH,现在回来了首先打开你的浏览器,登录路由器管理
7月前 · Paulzzh
修复 TL-ER2260T 网桥添加虚接口后网页后台异常
折腾 Paulzzh · 9小时前

这篇文章说的把 vlan 虚接口接入网桥后,路由器重启一次之后网页后台不正常,具体表现为首页系统状态下的快速显示(quick_show)无法加载,并且无法添加。接口设置中也无法查看添加了虚接口的那个物理接口(if_info),并且添加其他虚接口报错。并且网桥也无法编辑,都是 500 报错。

500 报错问题

报错统一为 attempt to compare number with nil

/usr/lib/lua/luci/dispatcher.lua:684: Failed to execute firstchild dispatcher target for entry '/ds'.
The called action terminated with an exception:
/usr/lib/lua/luci/dispatcher.lua:684: Failed to execute call dispatcher target for entry '/ds/ds'.
The called action terminated with an exception:
/usr/lib/lua/luci/controller/admin/network.lua:1431: attempt to compare number with nil
stack traceback:
    [C]: in function 'assert'
    /usr/lib/lua/luci/dispatcher.lua:684: in function 'dispatch'
    /usr/lib/lua/luci/dispatcher.lua:540: in function </usr/lib/lua/luci/dispatcher.lua:540>

故障点

问题出在 network.lua 的 1431 行,也就是 get_interface_config 方法,格式化后的代码可以在这里查看

            local i = o:get(uciNetwork.filename, e, uciNetwork.optname.mtu) or 1500
            local e = o:get(uciNetwork.filename, n[".name"], uciNetwork.optname.mtu)
            if r == "pppoe" then
                if tonumber(e) > tonumber(i) - 8 then
                    e = tonumber(i) - 8
                end
            else
                if tonumber(e) > tonumber(i) then
                    e = i
                end
            end

这里是在尝试读取接口的 MTU 值,tonumber(e) > tonumber(i),但此时 enil

验证

登录 telnet,输入 uci show|grep network|grep V10 V10 换成你的虚接口名字。

root@TP-LINK:/usr/lib/lua/luci# uci show|grep network|grep V10
network.LAN.t_bindif=GE3 GE4 10GE1 V10
network.V10=interface
network.V10.t_vlanid=10
network.V10.ifname=eth4.10
network.V10.t_bindif=10GE2
network.V10.metric=0
network.V10.t_name=V10
network.V10.t_type=ethernet
network.V10.peerdns=1
network.V10.ipv6_enable=off
network.V10.macaddr=68:DD:B7:4C:BE:7E
network.V10.untag=0
network.V10.t_issys=0
network.V10.t_reference=1
network.V10.t_brref=1
network.V10.t_isbridged=1
network.V10.proto=none
root@TP-LINK:/usr/lib/lua/luci#

可以看到确实没有 MTU 字段。

修复

输入 uci set network.V10.mtu='1500' V10 换成你的虚接口名字。
uci commit network 提交。

root@TP-LINK:~# uci set network.V10.mtu='1500'
root@TP-LINK:~# uci commit network
root@TP-LINK:~#

此时后台网页恢复正常。但仍不建议编辑其他接口。

后台

吐槽

明明 i 做了防空值,但 e 却没做,何意味??/

彩蛋

彩蛋

  评论
  • 您正在回复给 Poi