What's new

Need help with custom config files and AB-Solution

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

IsaacFL

Regular Contributor
I was trying to modify my dnsmasq.conf (I am using ipv6) using the dnsmasq.postconf script method described in the wiki.

I am trying to change from:
Code:
dhcp-range=lan,::1000,::2000,constructor:br0,86400
to: (adding ra-names)
Code:
dhcp-range=lan,::1000,::2000,constructor:br0,ra-names,86400

Now I already have AB-Solution 3.8 installed, so it already had an entry, so I added to it to get this:
Code:
IsaacFL@RT-AC1900P:/jffs/scripts# cat dnsmasq.postconf
#!/bin/sh

CONFIG=$1
source /usr/sbin/helper.sh
pc_insert "constructor:br0," "ra-names," $CONFIG

# DO NOT EDIT this part of the file #
# generated by AB-Solution 3.8
if [ -d "/tmp/mnt/AdBlock" ];then
    source /tmp/mnt/AdBlock/adblocking/scripts/ab_dnsmasq_postconf.sh
        logger "AB-Solution linked ab_dnsmasq_postconf.sh via $0"
fi
# end of DO NOT EDIT #

When I rebooted, this killed the router and had to do a default reset to get it working again. I had saved backup so ok.

My question, is it my script that hosed it up, or some sort of interaction with AB-Solution adblocker?

My scripting competence is basically copy/paste and hope it works, so probably something I don't understand. If there is another way to activate the ra-names option, I couldn't find it.
 
Your addition should not interfere with what AB adds through the /tmp/mnt/AdBlock/adblocking/scripts/ab_dnsmasq_postconf.sh.
But instead of rebooting the router, run your script and see if it works by entering this into the SSH terminal:
Code:
service restart_dnsmasq
This restarts dnsmasq, applying the changes you made.

Before that, open /etc/dnsmasq.conf and save a copy of it on your PC.
Then run the above command and look at the newly generated dnsmasq.conf to see if your changes have been applied.
Your inserts should be above the comment line AB-Solution adds for clarity:
## begin of AB-Solution entries ##

What also is important:
- the dnsmasq.postconf needs the executable permission (altough AB-Solution makes sure this is set), run:
Code:
chmod a+rx /jffs/scripts/*
- make sure the line endings are in Unix format, run:
Code:
dos2unix /jffs/scripts/dnsmasq.postconf
 
Your addition should not interfere with what AB adds through the /tmp/mnt/AdBlock/adblocking/scripts/ab_dnsmasq_postconf.sh.
But instead of rebooting the router, run your script and see if it works by entering this into the SSH terminal:
Code:
service restart_dnsmasq
This restarts dnsmasq, applying the changes you made.

Before that, open /etc/dnsmasq.conf and save a copy of it on your PC.
Then run the above command and look at the newly generated dnsmasq.conf to see if your changes have been applied.
Your inserts should be above the comment line AB-Solution adds for clarity:
## begin of AB-Solution entries ##

What also is important:
- the dnsmasq.postconf needs the executable permission (altough AB-Solution makes sure this is set), run:
Code:
chmod a+rx /jffs/scripts/*
- make sure the line endings are in Unix format, run:
Code:
dos2unix /jffs/scripts/dnsmasq.postconf
Thanks, as soon as it didn't reboot I thought to myself I should have just restarted the service.

I am being taken out to look at furniture stores all day today so will try your suggestions tonight.
 
I am being taken out to look at furniture stores all day today (...)
The inside, outside or both?
Stores can be interesting from a builders point of view but I am not in that business myself.
I have seen some interesting buildings, but not particularly those containing furniture to sell.
I heard Museum's can be very nice buildings too.
Some even sell food or beverages, might want to expand your horizon ;)
 
Got a short reprieve so was able to try your suggestion.

The pc_insert didn't act like I thought. It inserts the text on the line after the found text instead of in the line.
Code:
pc_insert "constructor:br0," "ra-names," $CONFIG
produced this in dnsmasq.conf:
Code:
dhcp-range=lan,::1000,::2000,constructor:br0,86400
ra-names,

so crashed dnsmasq.
used this instead, which works:
Code:
pc_replace "constructor:br0," "constructor:br0,ra-names," $CONFIG
 
Got a short reprieve so was able to try your suggestion.

The pc_insert didn't act like I thought. It inserts the text on the line after the found text instead of in the line.
Code:
pc_insert "constructor:br0," "ra-names," $CONFIG
produced this in dnsmasq.conf:
Code:
dhcp-range=lan,::1000,::2000,constructor:br0,86400
ra-names,

so crashed dnsmasq.
used this instead, which works:
Code:
pc_replace "constructor:br0," "constructor:br0,ra-names," $CONFIG
As it says on that wiki page, when replacing a string, you have to tell in the first field the exact default line, then your replacement of it.
Glad it works.
 

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