Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(flashstart): fixed pinging issues #956

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/ns-flashstart/files/flashstart-apply
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if [ "$enabled" = "1" ]; then
/etc/init.d/dnsdist restart
fi
/usr/share/ns-flashstart/flashstart-auth
crontab -l | grep -q '/usr/share/ns-flashstart/flashstart-auth' || echo '*/30 * * * * sleep $$(( RANDOM % 60 )); /usr/share/ns-flashstart/flashstart-auth' >> /etc/crontabs/root
crontab -l | grep -q '/usr/share/ns-flashstart/flashstart-auth' || echo '*/30 * * * * sleep $(( RANDOM % 60 )); /usr/share/ns-flashstart/flashstart-auth' >> /etc/crontabs/root
else
crontab -l | grep -v '/usr/share/ns-flashstart/flashstart-auth' | sort | uniq | crontab -
rm -f "$conf"
Expand Down
8 changes: 6 additions & 2 deletions packages/ns-flashstart/files/flashstart-auth
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from euci import EUci
from nethsec import utils
import subprocess
import sys
import syslog

u = EUci()

Expand All @@ -27,6 +29,8 @@ for wan in utils.get_all_wan_devices(u):
else:
id = user
url = f"https://ddns.flashstart.com/nic/update?hostname=&myip=&wildcard=NOCHG&username={id}&password={password}"
cmd = ["curl", "-s", "-o", "/dev/null", "--interface", wan, url]
subprocess.run(cmd)
cmd = ["curl", "-s", "--connect-timeout", "10", "--interface", wan, url]
res = subprocess.run(cmd, capture_output=True, text=True)
if res.returncode != 0:
syslog.syslog(syslog.LOG_ERR, f'Failed to update IP for WAN {wan} -> {id} with error: {res.stdout}')
gsanchietti marked this conversation as resolved.
Show resolved Hide resolved
counter = counter + 1
Loading