Skip to content

Commit

Permalink
fix sfp communication #1065 #917 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancYescO committed Jan 31, 2024
1 parent 7e66e3c commit fdb36d2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
17 changes: 10 additions & 7 deletions decompressed/gui_file/usr/share/transformer/scripts/check_wan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,31 @@ check_wan() {
}

set_sfp() {
if [ $sfp_wanlan_mode == "1" ]; then

#this is to forcely use network.sfp otherwise /usr/sbin/sfp_get.sh will use network.sfptag that is managed by nothing
[ "$(uci get -q network.sfptag)" ] && uci delete network.sfptag

if [ "$sfp_wanlan_mode" = "0" ]; then
if [ ! "$(uci get -q network.lan.ifname | grep eth4)" ]; then
uci set network.lan.ifname='eth0 eth1 eth2 eth3 eth4 eth5'
uci set network.sfptag.ifname=''
uci commit
/etc/init.d/network restart
/etc/init.d/ethernet reload
fi
else
if [ ! "$(uci get -q network.sfptag.ifname | grep eth4)" ]; then
if [ ! "$(uci get -q network.sfp.ifname | grep eth4)" ]; then
uci set network.lan.ifname='eth0 eth1 eth2 eth3 eth5'
uci set network.sfptag.ifname='eth4'
uci set network.sfp.ifname='eth4'
uci commit
/etc/init.d/network restart
/etc/init.d/ethernet reload
fi
fi
}

if [ $(uci get -q env.rip.sfp) ]; then
if [ $sfp_presence == "0" ]; then
if [ $(uci get -q ethernet.eth4.wan) ] ; then
if [ "$(uci get -q env.rip.sfp)" ]; then
if [ "$sfp_presence" = "0" ]; then
if [ "$(uci get -q ethernet.eth4.wan)" ] ; then
check_wan
fi
else
Expand Down
14 changes: 5 additions & 9 deletions decompressed/gui_file/www/docroot/modals/ethernet-modal.lp
Original file line number Diff line number Diff line change
Expand Up @@ -537,13 +537,9 @@ end
local mapParSFP = {}
local mapValSFP = {}

local sfpintf = "sfptag"
local sfpintf = "sfp"

if sfp_presence and (sfp_presence[1].value == "1") then
--if sfptag interface not found change name to sfp (fastweb naming)
if not proxy.get("uci.network.interface.@"..sfpintf..".ipaddr") then
sfpintf = "sfp"
end
mapParSFP.ethsfp = "uci.ethernet.globals.eth4lanwanmode"
mapValSFP.ethsfp = vB
else
Expand Down Expand Up @@ -671,9 +667,9 @@ end
local function validateLeaseTime(value, postdata, key)
-- Check every possibile value...
-- One tip NEVER EVER MAKE USER INSERT WORD FOR A INT VALUE... INT DON'T FUC*ING HAVE UPPER OR LOWER CHAR -.-
if value == '-1' or
value == "infinite" or
value == timhelper.ethtrans().eth_infinit or
if value == '-1' or
value == "infinite" or
value == timhelper.ethtrans().eth_infinit or
value:sub(1,1):upper()..value:sub(2) == timhelper.ethtrans().eth_infinit or
value:sub(1,1):lower()..value:sub(2) == timhelper.ethtrans().eth_infinit then -- included '-1' as a feasible set value as specified in TR 181
postdata[key] = "infinite" -- included to ensure uci parameter is set as infinite
Expand Down Expand Up @@ -1428,4 +1424,4 @@ $("#btn-dhcp-reset").on("click", function(){\
</script>\
\
'); ngx.print(ui_helper.createFooter()) ngx.print('\
');
');

0 comments on commit fdb36d2

Please sign in to comment.