ramips/mtwifi: disable bind apcli interface to lan by default

The apcli interface can be bound to either lan or wan, so cancel the
default settings.
This commit is contained in:
AmadeusGhost 2020-07-26 15:02:08 +08:00 committed by CN_SZTL
parent 1cfad7959f
commit 1d232805f8
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
3 changed files with 23 additions and 21 deletions

View File

@ -769,14 +769,14 @@ function apcli_connect(dev, vif)
mtkwifi.save_profile(cfgs, profiles[devname]) mtkwifi.save_profile(cfgs, profiles[devname])
os.execute("ifconfig "..vifname.." up") os.execute("ifconfig "..vifname.." up")
local brvifs = mtkwifi.__trim(mtkwifi.read_pipe("uci get network.lan.ifname")) -- local brvifs = mtkwifi.__trim(mtkwifi.read_pipe("uci get network.lan.ifname"))
if not string.match(brvifs, vifname) then -- if not string.match(brvifs, vifname) then
brvifs = brvifs.." "..vifname -- brvifs = brvifs.." "..vifname
nixio.syslog("debug", "add "..vifname.." into lan") -- nixio.syslog("debug", "add "..vifname.." into lan")
os.execute("uci set network.lan.ifname=\""..brvifs.."\"") -- os.execute("uci set network.lan.ifname=\""..brvifs.."\"")
os.execute("uci commit") -- os.execute("uci commit")
os.execute("ubus call network.interface.lan add_device \"{\\\"name\\\":\\\""..vifname.."\\\"}\"") -- os.execute("ubus call network.interface.lan add_device \"{\\\"name\\\":\\\""..vifname.."\\\"}\"")
end -- end
os.execute("iwpriv "..vifname.." set MACRepeaterEn="..cfgs.MACRepeaterEn) os.execute("iwpriv "..vifname.." set MACRepeaterEn="..cfgs.MACRepeaterEn)
os.execute("iwpriv "..vifname.." set ApCliEnable=0") os.execute("iwpriv "..vifname.." set ApCliEnable=0")
@ -815,14 +815,14 @@ function apcli_disconnect(dev, vif)
os.execute("iwpriv "..vifname.." set ApCliEnable=0") os.execute("iwpriv "..vifname.." set ApCliEnable=0")
local brvifs = mtkwifi.__trim(mtkwifi.read_pipe("uci get network.lan.ifname")) -- local brvifs = mtkwifi.__trim(mtkwifi.read_pipe("uci get network.lan.ifname"))
if string.match(brvifs, vifname) then -- if string.match(brvifs, vifname) then
brvifs = mtkwifi.__trim(string.gsub(brvifs, vifname, "")) -- brvifs = mtkwifi.__trim(string.gsub(brvifs, vifname, ""))
nixio.syslog("debug", "add "..vifname.." into lan") -- nixio.syslog("debug", "add "..vifname.." into lan")
os.execute("uci set network.lan.ifname=\""..brvifs.."\"") -- os.execute("uci set network.lan.ifname=\""..brvifs.."\"")
os.execute("uci commit") -- os.execute("uci commit")
os.execute("ubus call network.interface.lan remove_device \"{\\\"name\\\":\\\""..vifname.."\\\"}\"") -- os.execute("ubus call network.interface.lan remove_device \"{\\\"name\\\":\\\""..vifname.."\\\"}\"")
end -- end
os.execute("ifconfig "..vifname.." down") os.execute("ifconfig "..vifname.." down")
luci.http.redirect(luci.dispatcher.build_url("admin", "network", "wifi")) luci.http.redirect(luci.dispatcher.build_url("admin", "network", "wifi"))

View File

@ -81,8 +81,10 @@ local devs = mtkwifi.get_all_devs()
<input class="cbi-button cbi-button-apply" style="width:100px" title="禁用无线" value="启用" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "vif_enable", vif.vifname)%>'" /> <input class="cbi-button cbi-button-apply" style="width:100px" title="禁用无线" value="启用" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "vif_enable", vif.vifname)%>'" />
<% end %> <% end %>
<input class="cbi-button cbi-button-edit" style="width:100px" title="修改无线基本设置" value="基本设置" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "vif_cfg_view", dev.devname, vif.vifname)%>'" /> <input class="cbi-button cbi-button-edit" style="width:100px" title="修改无线基本设置" value="基本设置" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "vif_cfg_view", dev.devname, vif.vifname)%>'" />
<% if dev.apcli.state == "down" then %> <% if dev.apcli then %>
<input class="cbi-button cbi-button-apply" style="width:100px" title="启用无线" value="启用中继" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "vif_enable", dev.apcli.vifname)%>'" /> <% if dev.apcli.state == "down" then %>
<input class="cbi-button cbi-button-apply" style="width:100px" title="启用无线" value="启用中继" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "vif_enable", dev.apcli.vifname)%>'" />
<% end %>
<% end %> <% end %>
<input class="cbi-button cbi-button-remove" style="width:100px" title="删除网络" value="移除" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "vif_del", dev.devname, vif.vifname)%>'" /> <input class="cbi-button cbi-button-remove" style="width:100px" title="删除网络" value="移除" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "vif_del", dev.devname, vif.vifname)%>'" />
</td> </td>

View File

@ -1054,8 +1054,8 @@ define Device/xiaomi_mir3g
DEVICE_MODEL := Mi Router 3G DEVICE_MODEL := Mi Router 3G
SUPPORTED_DEVICES += R3G SUPPORTED_DEVICES += R3G
SUPPORTED_DEVICES += mir3g SUPPORTED_DEVICES += mir3g
DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 kmod-usb3 \ DEVICE_PACKAGES := kmod-mt7603e kmod-mt76x2e kmod-usb3 \
kmod-usb-ledtrig-usbport wpad-basic uboot-envtools kmod-usb-ledtrig-usbport luci-app-mtwifi uboot-envtools
endef endef
TARGET_DEVICES += xiaomi_mir3g TARGET_DEVICES += xiaomi_mir3g
@ -1068,7 +1068,7 @@ define Device/xiaomi_mir3g-v2
DEVICE_ALT0_VENDOR := Xiaomi DEVICE_ALT0_VENDOR := Xiaomi
DEVICE_ALT0_MODEL := Mi Router 4A DEVICE_ALT0_MODEL := Mi Router 4A
DEVICE_ALT0_VARIANT := Gigabit Edition DEVICE_ALT0_VARIANT := Gigabit Edition
DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 wpad-basic DEVICE_PACKAGES := kmod-mt7603e kmod-mt76x2e luci-app-mtwifi
endef endef
TARGET_DEVICES += xiaomi_mir3g-v2 TARGET_DEVICES += xiaomi_mir3g-v2