Addon page suppresses Dnsmasq restart

  • ATTENTION! You'll notice a Prefix dropdown when you create a thread. If your post applies to one of the topics listed, please use that Prefix for your post. When browsing the thread list you can use the Prefix to filter the view.
  • ATTENTION! As of November 1, 2020, you are not able to reply to threads 6 months after the thread is opened if there are more than 500 posts in the thread.
    Threads will not be locked, so posts may still be edited by their authors.
    Just start a new thread on the topic to post if you get an error message when trying to reply to a thread.

thelonelycoder

Part of the Furniture
I have a peculiar problem which I can reproduce on 384.17.
When Changing a state through the Diversion WebUI, the following relevant events are logged in syslog:
Code:
rc_service: httpd 6400:notify_rc restart_diversion
custom_script: Running /jffs/scripts/service-event (args: restart diversion)
Diversion: WebUI action, ad-blocking state changed to off
rc_service: service 21086:notify_rc restart_dnsmasq
rc_service: waitting "restart_diversion" via httpd ...
rc_service: skip the event: restart_dnsmasq.
The httpd requests service restart_diversion which runs a Diversion file that sets the new state of services, then issues a restart of Dnsmasq.
But that request is skipped over and consequently leaves Diversion in a state where the service is disabled in its settings, but the changes are not written to dnsmasq.conf.

Is there any way I can force a service restart_dnsmasq?
I have lowered the httpd wait time to 4 and 1 secs in the page: <input type="hidden" name="action_wait" value="4">
Still no luck.
@RMerlin ?
 

dave14305

Part of the Furniture
I found it is too recursive to issue a service restart command when in a script (service-event) that is blocking an existing service start/restart command from completing.
 

dave14305

Part of the Furniture
You might consider issuing "restart_diversion;restart_dnsmasq" from your page in parallel, and use dnsmasq.postconf to read the new settings from custom_settings. It's what I ended up doing in one of my pages.
 

thelonelycoder

Part of the Furniture
You might consider issuing "restart_diversion;restart_dnsmasq" from your page in parallel, and use dnsmasq.postconf to read the new settings from custom_settings. It's what I ended up doing in one of my pages.
This will not work for me. I first have to set the states in Diversion before I can issue a Dnsmasq restart, they can be complicated with pixelserv-tls and other services Diversion offers.
Doing a Dnsmasq restart through the webui would trigger it without those sertings written to its config file.
 

dave14305

Part of the Furniture
This will not work for me. I first have to set the states in Diversion before I can issue a Dnsmasq restart, they can be complicated with pixelserv-tls and other services Diversion offers.
Doing a Dnsmasq restart through the webui would trigger it without those sertings written to its config file.
I don't know if it would make a difference, but what if you catch "restart_diversion" in service-event-end instead of service-event?
 

thelonelycoder

Part of the Furniture
I don't know if it would make a difference, but what if you catch "restart_diversion" in service-event-end instead of service-event?
Ah, let me check that.
But one problem still remains: When Diversion writes its config file, the associated states are written to custom_settings.txt, which then are reflected when the web page refreshes.
This would not work wit that event-end script.
 

john9527

Part of the Furniture
Since restart_diversion is taking too long and tripping the timer to skip dnsmasq, it it possible to break the diversion restart into two pieces....

diversion1 calls diversion2 calls dnsmasq

Maybe have diversion2 wait for some event before continuing....
 

thelonelycoder

Part of the Furniture
Since restart_diversion is taking too long and tripping the timer to skip dnsmasq, it it possible to break the diversion restart into two pieces....

diversion1 calls diversion2 calls dnsmasq
But after 1 or 0 secs "spinning wait" it should still do the job.
I might just run a delayed separate script that runs after 5 secs or so.
 

john9527

Part of the Furniture
I need to double check....but I think the 'skip' timer is 15sec....so the router doesn't think that diversion has completed by then...
 

thelonelycoder

Part of the Furniture
I need to double check....but I think the 'skip' timer is 15sec....so the router doesn't think that diversion has completed by then...
What is that timer for then, can we add that separate timeout somehow to the page?
 

thelonelycoder

Part of the Furniture
I need to double check....but I think the 'skip' timer is 15sec....so the router doesn't think that diversion has completed by then...
That syslog action posted above only takes about 1 second for Diversion to process.
 

dave14305

Part of the Furniture
notify_rc is closed source in Merlin now, but in John's fork you can see it's waiting for the previous service command to finish before processing the next. But in service-event, you're blocking the previous event from finishing (restart_diversion) because you're waiting for restart_dnsmasq to run from within restart_diversion.

https://github.com/john9527/asuswrt...ate/release/src/router/shared/notify_rc.c#L89

It messes with your head. Until the rc_service and rc_service_pid nvram get cleared, I think it's never going to complete. Even service-event-end runs before the nvram is cleared.

It's a 25 second wait in John's fork.

Try forking service restart_dnsmasq?
 

thelonelycoder

Part of the Furniture

thelonelycoder

Part of the Furniture
OK, with a 10 sec delayed forked job it works, but it leaves a stale taste in my mouth. I am not happy that way.
It would mean I'd have three states to consider, the webui, Diversion settings file and Dnsmasq.
I might just abandon that WebUI project if there's no better way, too much work for not much gain.
 

thelonelycoder

Part of the Furniture
Would
Code:
exec service restart_dnsmasq
work? I haven't tested it myself, away from router
Nope: rc_service: skip the event: restart_dnsmasq.
 

thelonelycoder

Part of the Furniture
I think it's worth testing restart_diversion;restart_dnsmasq because it looks like they are processed sequentially in services.c ("goto again").
Diversion is - lets say - complicated with how certain events are executed. Which means I cannot have the web page issue a Dnsmasq restart.
It all has to run in precise order and only Diversion itself can handle that sequence properly.
 

heysoundude

Very Senior Member
Diversion is - lets say - complicated with how certain events are executed. Which means I cannot have the web page issue a Dnsmasq restart.
It all has to run in precise order and only Diversion itself can handle that sequence properly.
Uh oh. Something tells me your weekend is going to get eaten up by this. But we’ll benefit from the resulting update...somehow and eventually.
Go team!


Sent from my iPhone using Tapatalk
 

thelonelycoder

Part of the Furniture
Looks like if I set <input type="hidden" name="action_wait" value="10"> and a delayed Dnsmasq by also 10 secs it works.
Or would that trigger a cat and mouse game down the road?
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top