Skip to content

Commit fdb36d2

Browse files
committed
fix sfp communication #1065 #917 (comment)
1 parent 7e66e3c commit fdb36d2

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

decompressed/gui_file/usr/share/transformer/scripts/check_wan.sh

+10-7
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,31 @@ check_wan() {
2323
}
2424

2525
set_sfp() {
26-
if [ $sfp_wanlan_mode == "1" ]; then
26+
27+
#this is to forcely use network.sfp otherwise /usr/sbin/sfp_get.sh will use network.sfptag that is managed by nothing
28+
[ "$(uci get -q network.sfptag)" ] && uci delete network.sfptag
29+
30+
if [ "$sfp_wanlan_mode" = "0" ]; then
2731
if [ ! "$(uci get -q network.lan.ifname | grep eth4)" ]; then
2832
uci set network.lan.ifname='eth0 eth1 eth2 eth3 eth4 eth5'
29-
uci set network.sfptag.ifname=''
3033
uci commit
3134
/etc/init.d/network restart
3235
/etc/init.d/ethernet reload
3336
fi
3437
else
35-
if [ ! "$(uci get -q network.sfptag.ifname | grep eth4)" ]; then
38+
if [ ! "$(uci get -q network.sfp.ifname | grep eth4)" ]; then
3639
uci set network.lan.ifname='eth0 eth1 eth2 eth3 eth5'
37-
uci set network.sfptag.ifname='eth4'
40+
uci set network.sfp.ifname='eth4'
3841
uci commit
3942
/etc/init.d/network restart
4043
/etc/init.d/ethernet reload
4144
fi
4245
fi
4346
}
4447

45-
if [ $(uci get -q env.rip.sfp) ]; then
46-
if [ $sfp_presence == "0" ]; then
47-
if [ $(uci get -q ethernet.eth4.wan) ] ; then
48+
if [ "$(uci get -q env.rip.sfp)" ]; then
49+
if [ "$sfp_presence" = "0" ]; then
50+
if [ "$(uci get -q ethernet.eth4.wan)" ] ; then
4851
check_wan
4952
fi
5053
else

decompressed/gui_file/www/docroot/modals/ethernet-modal.lp

+5-9
Original file line numberDiff line numberDiff line change
@@ -537,13 +537,9 @@ end
537537
local mapParSFP = {}
538538
local mapValSFP = {}
539539

540-
local sfpintf = "sfptag"
540+
local sfpintf = "sfp"
541541

542542
if sfp_presence and (sfp_presence[1].value == "1") then
543-
--if sfptag interface not found change name to sfp (fastweb naming)
544-
if not proxy.get("uci.network.interface.@"..sfpintf..".ipaddr") then
545-
sfpintf = "sfp"
546-
end
547543
mapParSFP.ethsfp = "uci.ethernet.globals.eth4lanwanmode"
548544
mapValSFP.ethsfp = vB
549545
else
@@ -671,9 +667,9 @@ end
671667
local function validateLeaseTime(value, postdata, key)
672668
-- Check every possibile value...
673669
-- One tip NEVER EVER MAKE USER INSERT WORD FOR A INT VALUE... INT DON'T FUC*ING HAVE UPPER OR LOWER CHAR -.-
674-
if value == '-1' or
675-
value == "infinite" or
676-
value == timhelper.ethtrans().eth_infinit or
670+
if value == '-1' or
671+
value == "infinite" or
672+
value == timhelper.ethtrans().eth_infinit or
677673
value:sub(1,1):upper()..value:sub(2) == timhelper.ethtrans().eth_infinit or
678674
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
679675
postdata[key] = "infinite" -- included to ensure uci parameter is set as infinite
@@ -1428,4 +1424,4 @@ $("#btn-dhcp-reset").on("click", function(){\
14281424
</script>\
14291425
\
14301426
'); ngx.print(ui_helper.createFooter()) ngx.print('\
1431-
');
1427+
');

0 commit comments

Comments
 (0)