1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Fix wizard for macvlan

This commit is contained in:
Ycarus (Yannick Chabanois) 2020-06-09 22:35:58 +02:00
parent 6fd6e8b73d
commit d82777a0a1

View file

@ -124,8 +124,7 @@ function wizard_add()
ucic:set("openmptcprouter","wan" .. i,"interface") ucic:set("openmptcprouter","wan" .. i,"interface")
if ointf ~= "" then if ointf ~= "" then
ucic:set("network","wan" .. i,"type","macvlan") ucic:set("network","wan" .. i,"type","macvlan")
ucic:set("macvlan","wan" .. i,"macvlan") ucic:set("network","wan" .. i,"masterintf",defif)
ucic:set("macvlan","wan" .. i,"ifname",defif)
end end
ucic:set("network","wan" .. i,"ip4table","wan") ucic:set("network","wan" .. i,"ip4table","wan")
if multipath_master then if multipath_master then
@ -137,8 +136,6 @@ function wizard_add()
end end
ucic:set("network","wan" .. i,"defaultroute","0") ucic:set("network","wan" .. i,"defaultroute","0")
ucic:reorder("network","wan" .. i, i + 2) ucic:reorder("network","wan" .. i, i + 2)
ucic:save("macvlan")
ucic:commit("macvlan")
ucic:save("network") ucic:save("network")
ucic:commit("network") ucic:commit("network")
ucic:save("openmptcprouter") ucic:save("openmptcprouter")
@ -201,9 +198,6 @@ function wizard_add()
ucic:delete("openmptcprouter",intf) ucic:delete("openmptcprouter",intf)
ucic:save("openmptcprouter") ucic:save("openmptcprouter")
ucic:commit("openmptcprouter") ucic:commit("openmptcprouter")
ucic:delete("macvlan",intf)
ucic:save("macvlan")
ucic:commit("macvlan")
if defif ~= nil and defif ~= "" then if defif ~= nil and defif ~= "" then
luci.sys.call("uci -q del_list vnstat.@vnstat[-1].interface=" .. defif) luci.sys.call("uci -q del_list vnstat.@vnstat[-1].interface=" .. defif)
end end
@ -269,21 +263,27 @@ function wizard_add()
ucic:set("sqm",intf,"eqdisc_opts","nat dual-srchost") ucic:set("sqm",intf,"eqdisc_opts","nat dual-srchost")
end end
if downloadspeed ~= "0" and uploadspeed ~= "0" and downloadspeed ~= "" and uploadspeed ~= "" then if downloadspeed ~= "0" and downloadspeed ~= "" then
ucic:set("network",intf,"downloadspeed",downloadspeed) ucic:set("network",intf,"downloadspeed",downloadspeed)
ucic:set("network",intf,"uploadspeed",uploadspeed)
ucic:set("sqm",intf,"download",math.ceil(downloadspeed*95/100)) ucic:set("sqm",intf,"download",math.ceil(downloadspeed*95/100))
ucic:set("sqm",intf,"upload",math.ceil(uploadspeed*95/100))
ucic:set("qos",intf,"download",math.ceil(downloadspeed*95/100)) ucic:set("qos",intf,"download",math.ceil(downloadspeed*95/100))
ucic:set("qos",intf,"upload",math.ceil(uploadspeed*95/100))
else else
ucic:set("sqm",intf,"download","0") ucic:set("sqm",intf,"download","0")
ucic:set("sqm",intf,"upload","0")
ucic:set("sqm",intf,"enabled","0")
ucic:set("qos",intf,"download","0") ucic:set("qos",intf,"download","0")
end
if uploadspeed ~= "0" and uploadspeed ~= "" then
ucic:set("network",intf,"uploadspeed",uploadspeed)
ucic:set("sqm",intf,"upload",math.ceil(uploadspeed*95/100))
ucic:set("qos",intf,"upload",math.ceil(uploadspeed*95/100))
else
ucic:set("sqm",intf,"upload","0")
ucic:set("qos",intf,"upload","0") ucic:set("qos",intf,"upload","0")
end
if downloadspeed ~= "0" and downloadspeed ~= "" and uploadspeed ~= "0" and uploadspeed ~= "" then
ucic:set("sqm",intf,"enabled","0")
ucic:set("qos",intf,"enabled","0") ucic:set("qos",intf,"enabled","0")
end end
if sqmenabled == "1" then if sqmenabled == "1" then
ucic:set("sqm",intf,"iqdisc_opts","autorate-ingress nat dual-dsthost") ucic:set("sqm",intf,"iqdisc_opts","autorate-ingress nat dual-dsthost")
ucic:set("sqm",intf,"eqdisc_opts","nat dual-srchost") ucic:set("sqm",intf,"eqdisc_opts","nat dual-srchost")