Closed GektorUA closed 7 months ago
Hi @GektorUA , I changed this piece of code.
I saw i reverted changes, something wrong with regular expression? Why i am asking - on some Hi-Link firmwares there is possible to change all DHCP segment, not only 192.168.0.0/16, and sometimes users using something look like 10.0.0.0/8 172.16.0.0/12 , and in that case 3ginfo doesn't work with that DHCP modem settings. Maybe it's acceptable to do this in more simple and clear way:
grep -q "^192.168.\|^172.16\|^10."
?
HI @GektorUA , I rolled back changes because I received an error report https://github.com/4IceG/luci-app-3ginfo-lite/issues/54 that after making the changes, 3ginfo stopped showing data from the modem. That's why I preferred to leave something that works.
Seems that not all versions of OpenWrt grep working good with regular expressions, so i have propose simple 100% working solution. In my condition grep -q "192.168."
doesn't work because i am using more then one modem and not in 192.168.0.0/24 subnet.
https://github.com/4IceG/luci-app-3ginfo-lite/blob/5e2542a9befef045d25c5047e6756c608f90df59/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo.sh#L334C42-L334C42
My propose to change
grep -q "192.168."
to something more universal, like:grep -qE '^([0-9]{1,3}\.){3}[0-9]{1,3}$'