What's new

Feature request: Better custom configs

  • 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!

krbvroc1

New Around Here
I have a very basic request. I need to override radvd.conf so that I can replace the RDNSS with the local link of the router, rather than the ipv6 servers the ISP tells us about. This is required if you want dnsmasq to be used for resolving domains (especially if you have local domain search enabled). On a dual stack machine all your dnsmasq.conf work is bypassed when radvd gives out the ISP DNS server rather than the local dnsmasq one.
(Disabling radvd and using dnsmasq is a partial option, but not there yet).

I propose a new 'filter' is needed. Instead of the simplistic append config or replace config file, a script should be called which gives the opportunity for dynamic modification of the config file.

For example, take /etc/radvd.conf. Using an 'append config' is useless since the syntax of the file is structured. Using a 'replace config' is not very helpful because radvd rewrites the /etc/radvd.conf file when dhcp6s gets a new ipv6 lease from the ISP.

So what is need is a way to take the existing file and process it via a script where things like 'sed' / 'awk' and 'nvram get' can be used to modify it.
 
Last edited:
The problem is that I can't think of any way to implement this that would be a) simple to use, and b) program-agnostic. Each program seem to have its own syntax and config structure, so I can't make assumptions as to the syntax used by a specific program.

If I provided some form of custom format where you'd enter a pattern on the first line and the replacement on the second line, this would be unusable by anyone but quite experienced users, and would still hit quite a few corner-cases where it wouldn't work.

I'm all for a solution, but I can't think of any good one at the moment.
 
I guess I wasn't suggesting a solution that was easy to use or program agnostic. Rather, a generic hook that allow advanced users more flexibility.

I would suggest somethihng like the following:
Modify (or add to) the current call to 'use_custom_config()' in release/src/router/rc/common.c

The modification would be that when it is called, it would call a script in
/jffs/scripts called 'modify_config', if it exists. The script would be passed the config name, and the config file name. The user script would be responsible returning a code of 0 or 1 depending on if it took action or not.

So in my example:
Whenever the following is called:
use_custom_config("radvd.conf", "/etc/radvd.conf");

/jffs/scripts/modify_config would be called with args of "radvd.conf" and "/etc/radvd.conf"

My custom script would look for $1 of "radvd.conf" and do whatever processing is required to create "/etc/radvd.conf". And I would return 0 for success. If the same script was called with say "pptpd.conf" and I did not care to modify it, I would simply return 1. Then use_custom_config would proceed as normal.

Make sense?

There is a run_custom_script_blocking() function that might even work.
 

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