[GH-ISSUE #53] Change 192.168. to IP check #42

Closed
opened 2026-03-04 11:58:00 +03:00 by kerem · 4 comments
Owner

Originally created by @GektorUA on GitHub (Dec 2, 2023).
Original GitHub issue: https://github.com/4IceG/luci-app-3ginfo-lite/issues/53

github.com/4IceG/luci-app-3ginfo-lite@5e2542a9be/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}$'

Originally created by @GektorUA on GitHub (Dec 2, 2023). Original GitHub issue: https://github.com/4IceG/luci-app-3ginfo-lite/issues/53 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}$'`
kerem closed this issue 2026-03-04 11:58:00 +03:00
Author
Owner

@4IceG commented on GitHub (Dec 3, 2023):

Hi @GektorUA ,
I changed this piece of code.

<!-- gh-comment-id:1837550234 --> @4IceG commented on GitHub (Dec 3, 2023): Hi @GektorUA , I changed this piece of code.
Author
Owner

@GektorUA commented on GitHub (Dec 7, 2023):

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."
?

<!-- gh-comment-id:1843894642 --> @GektorUA commented on GitHub (Dec 7, 2023): 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."` ?
Author
Owner

@4IceG commented on GitHub (Dec 7, 2023):

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.

<!-- gh-comment-id:1845257736 --> @4IceG commented on GitHub (Dec 7, 2023): 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.
Author
Owner

@GektorUA commented on GitHub (Dec 7, 2023):

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.

<!-- gh-comment-id:1845514153 --> @GektorUA commented on GitHub (Dec 7, 2023): 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.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/luci-app-3ginfo-lite#42
No description provided.