[SOLVED] Re-starting Unbound after USB hotplug

Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions
Goto page 1, 2, 3  Next
Author Message
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1856
Location: Hung Hom, Hong Kong

PostPosted: Thu Sep 29, 2022 17:33    Post subject: [SOLVED] Re-starting Unbound after USB hotplug Reply with quote
In https://svn.dd-wrt.com/browser/src/router/services/services/usb_hotplug_adv.c?rev=50274,
it reloads minidlna, samba3 and lighttpd, but not unbound! Reloading them enables the use of corresponding config files in USB mount point /jffs/etc/!

Could a developer add unbound into it??

From what I read, it's just a pair of calls, namely, line 62
Code:
static bool usb_stopservices()
....
eval("stopservice", "unbound");
...

and line 84
Code:

static bool usb_startservices(void)
...
eval("startservice", "unbound", "-f");
....

From https://svn.dd-wrt.com/browser/src/router/services/services/unbound.c?rev=50274, the constant to check should be in line 22
Code:
#ifdef HAVE_UNBOUND
!

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw


Last edited by mwchang on Wed Oct 12, 2022 11:47; edited 3 times in total
Sponsor
dale_gribble39
DD-WRT Guru


Joined: 11 Jun 2022
Posts: 1927

PostPosted: Thu Sep 29, 2022 17:48    Post subject: Reply with quote
Because chroot was removed (?):
https://svn.dd-wrt.com/ticket/7584

_________________
"The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep." - Robert Frost

"I am one of the noticeable ones - notice me" - Dale Frances McKenzie Bozzio

<fact>code knows no gender</fact>

This is me, knowing I've ruffled your feathers, and not giving a ****
Some people are still hard-headed.

--------------------------------------
Mac Pro (Mid 2012) - Two 2.4GHz 6-Core Intel Xeon E5645 processors 64GB 1333MHz DDR3 ECC SDRAM OpenSUSE Leap 15.5
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1856
Location: Hung Hom, Hong Kong

PostPosted: Thu Sep 29, 2022 17:52    Post subject: Reply with quote
dale_gribble39 wrote:
Because chroot was removed (?):
https://svn.dd-wrt.com/ticket/7584

It's not relevant. That ticket was about unbound-checkconf, not about starting and stopping Unbound.

If you read carefully, the call to unbound-checkconf was not looking at the specified file. Notice the extra "tmp" in the reply.

I dunno why though, as I had never encountered that when using unbound-checkconf.

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
dale_gribble39
DD-WRT Guru


Joined: 11 Jun 2022
Posts: 1927

PostPosted: Thu Sep 29, 2022 18:02    Post subject: Reply with quote
Well, consider the source of the ticket; I didn't think it was relevant, either. I will say it's likely much easier to develop your own patch for this and submit it via pull request on github than to open tickets or threads.
_________________
"The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep." - Robert Frost

"I am one of the noticeable ones - notice me" - Dale Frances McKenzie Bozzio

<fact>code knows no gender</fact>

This is me, knowing I've ruffled your feathers, and not giving a ****
Some people are still hard-headed.

--------------------------------------
Mac Pro (Mid 2012) - Two 2.4GHz 6-Core Intel Xeon E5645 processors 64GB 1333MHz DDR3 ECC SDRAM OpenSUSE Leap 15.5
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1856
Location: Hung Hom, Hong Kong

PostPosted: Thu Sep 29, 2022 18:12    Post subject: Reply with quote
dale_gribble39 wrote:
Well, consider the source of the ticket; I didn't think it was relevant, either. I will say it's likely much easier to develop your own patch for this and submit it via pull request on github than to open tickets or threads.

If BS or maybe Joker accepted my suggestion, I would not need to open a ticket. Or maybe there was a pending ticket about it? Smile

I was always wondering why Unbound never picked up /jffs/etc/unbound.conf after USB storage was mounted, but not MiniDLNA nor Lighttpd nor Samba. I think this explained it.

And if and only if my suggestion corrected the problem, the patch should be back-ported to previous DD-WRT builds.

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12877
Location: Netherlands

PostPosted: Thu Sep 29, 2022 18:32    Post subject: Reply with quote
You can easily add it yourself Smile

And no there is no backporting.

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
dale_gribble39
DD-WRT Guru


Joined: 11 Jun 2022
Posts: 1927

PostPosted: Thu Sep 29, 2022 19:08    Post subject: Reply with quote
Create github account, fork the repository, create pull request. On your fork, you can edit the file for the intended patch and it will allow you to submit a pull request to the dd-wrt mirror. It's not all that difficult, and I'm sure you're very capable. As stated, patches do not get backported to previous versions of DD-WRT as has always been the case.

https://github.com/mirror/dd-wrt

_________________
"The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep." - Robert Frost

"I am one of the noticeable ones - notice me" - Dale Frances McKenzie Bozzio

<fact>code knows no gender</fact>

This is me, knowing I've ruffled your feathers, and not giving a ****
Some people are still hard-headed.

--------------------------------------
Mac Pro (Mid 2012) - Two 2.4GHz 6-Core Intel Xeon E5645 processors 64GB 1333MHz DDR3 ECC SDRAM OpenSUSE Leap 15.5
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1856
Location: Hung Hom, Hong Kong

PostPosted: Fri Sep 30, 2022 11:23    Post subject: Reply with quote
dale_gribble39 wrote:
Create github account, fork the repository, create pull request. On your fork, you can edit the file for the intended patch and it will allow you to submit a pull request to the dd-wrt mirror.

I rather suggest changes and wait patiently for the developers to patch the codes. They are more familiar with the codes than me.

As I said before, I just wanna find out how things work or break by reading the C source codes.

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12877
Location: Netherlands

PostPosted: Fri Sep 30, 2022 11:26    Post subject: Reply with quote
That is fine

I will see what I can do Smile

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
the-joker
DD-WRT Developer/Maintainer


Joined: 31 Jul 2021
Posts: 2146
Location: All over YOUR webs

PostPosted: Fri Sep 30, 2022 12:04    Post subject: Reply with quote
mwchang wrote:
dale_gribble39 wrote:
Create github account, fork the repository, create pull request. On your fork, you can edit the file for the intended patch and it will allow you to submit a pull request to the dd-wrt mirror.

I rather suggest changes and wait patiently for the developers to patch the codes. They are more familiar with the codes than me.

As I said before, I just wanna find out how things work or break by reading the C source codes.


This sort of stance after your analyzes is not how one learns, if you made a patch and its wrong, you learn more than by asking someone else to do it for you. There is value in failing, not just succeeding.

I cant imagine its laziness either after you scour through files endlessly, so it must be something else.

Git is not that difficult either, you need to know maybe 5 commands to do the lot from cloning a fork to making a dev branch and only 3 commends there after. I use daily around 2 git commands to make a patch and submit it. If you use the right editor you dont even need to know Git command line anything.

_________________
Saving your retinas from the burn!🔥
DD-WRT Inspired themes for routers
DD-WRT Inspired themes for the phpBB Forum
DD-WRT Inspired themes for the SVN Trac & FTP site
Join in for a chat @ #style_it_themes_public:matrix.org or #style_it_themes:discord

DD-WRT UI Themes Bug Reporting and Discussion thread

Router: ANus RT-AC68U E1 (recognized as C1)
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12877
Location: Netherlands

PostPosted: Fri Sep 30, 2022 12:44    Post subject: Reply with quote
If you are confined to windows you can use tortoise and only do a partial download:
https://tortoisesvn.net/

I have it on my travel laptop which has little storage and only windows

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1856
Location: Hung Hom, Hong Kong

PostPosted: Fri Sep 30, 2022 13:57    Post subject: Reply with quote
the-joker wrote:
This sort of stance after your analyzes is not how one learns, if you made a patch and its wrong, you learn more than by asking someone else to do it for you. There is value in failing, not just succeeding.

I cant imagine its laziness either after you scour through files endlessly, so it must be something else.

It's not about laziness. I still need to spend time to read, discover, report and suggest. That still helps the whole DD-WRT project anyway. As long as I make things clear when suggesting patches.... Wink

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1856
Location: Hung Hom, Hong Kong

PostPosted: Sat Oct 01, 2022 1:47    Post subject: Reply with quote
egc wrote:
If you are confined to windows you can use tortoise and only do a partial download:
https://tortoisesvn.net/
I have it on my travel laptop which has little storage and only windows

Thanks!! I don't frequently read the codes, so it's fine to download the whole master.zip.

The Linux kernel source included ( https://github.com/jameshilliard/DD-WRT/tree/master/src/linux ) is indeed not my interest. Smile


_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1856
Location: Hung Hom, Hong Kong

PostPosted: Sun Oct 02, 2022 12:00    Post subject: Reply with quote
egc wrote:
That is fine
I will see what I can do Smile

I think we forgot one thing: a patch can be submitted via the forum as a file attachment! Wink

Thus developers and helpers can review and talk about the patch using the forum.

I don't wanna directly touch the source codes using git until I can properly secure my PC like those mainframe computers in big banks. It's really very dangerous to do it otherwise.


_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12877
Location: Netherlands

PostPosted: Mon Oct 03, 2022 9:42    Post subject: Reply with quote
I have been discussing it with BS and the problem with your solution is that it always restarts unbound after the USB is up so also if there is no conf file on USB.

But BS has found a more sophisticated and universal solution which he also implemented for other services which can have a .conf file on USB.

If there are no show stoppers it will be solved in the next build Smile

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
Goto page 1, 2, 3  Next Display posts from previous:    Page 1 of 3
Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum