Is it possible to add a sorting (or manually move) option to Services -> Static Leases?
Issue I run into (maybe just me), is that as I add static leases over time I dont always add them sequentially. So after a while the list is unorganized mess. It would be nice if I could sort the list by ip (ascending/descending).
Joined: 31 Jul 2021 Posts: 2146 Location: All over YOUR webs
Posted: Wed Jun 08, 2022 22:20 Post subject:
Duxa wrote:
Do you do any work with default GUI?
That's is pretty much all I do. There is no other UI, all of the UI is default.
Duxa wrote:
Is it possible to add a sorting (or manually move) option to Services -> Static Leases?
Issue I run into (maybe just me), is that as I add static leases over time I dont always add them sequentially. So after a while the list is unorganized mess. It would be nice if I could sort the list by ip (ascending/descending).
Understand, I use my free time to do what I do for DD-WRT. and there is a great deal of workload and improvements that take precedence over making someones live easier that doesn't help me achieve any of those preset goals and then there is real life and I have several other opensource projects that I maintain only by myself and they get neglected too often.
I will always welcome and encourage new contributions from other community members though, but tbh, I suggest for the time being you plan your topology and setup accordingly once and forget about -- it using your own free time to solve this problem. It is the same way I have solved my static leases for nearly 2 decades and its is and always been in order.
That's is pretty much all I do. There is no other UI, all of the UI is default.
Duxa wrote:
Is it possible to add a sorting (or manually move) option to Services -> Static Leases?
Issue I run into (maybe just me), is that as I add static leases over time I dont always add them sequentially. So after a while the list is unorganized mess. It would be nice if I could sort the list by ip (ascending/descending).
Understand, I use my free time to do what I do for DD-WRT. and there is a great deal of workload and improvements that take precedence over making someones live easier that doesn't help me achieve any of those preset goals and then there is real life and I have several other opensource projects that I maintain only by myself and they get neglected too often.
I will always welcome and encourage new contributions from other community members though, but tbh, I suggest for the time being you plan your topology and setup accordingly once and forget about -- it using your own free time to solve this problem. It is the same way I have solved my static leases for nearly 2 decades and its is and always been in order.
But could happen, just dont wait standing up
understood, a hacky way to do it could be to simply include a "sort" button which triggers the following script:
Code:
nvram set static_leases="`nvram get static_leases | sed 's/\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\)/.\1./g' | tr ' ' '\n' | sort -n -k2,2n -k3,3n -k4,4n -k5,5n -t. | tr '\n' ' ' | sed 's/\.\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\)\./\1/g' | sed 's/^ //'; echo`"
Joined: 31 Jul 2021 Posts: 2146 Location: All over YOUR webs
Posted: Thu Jun 09, 2022 8:41 Post subject:
Duxa wrote:
understood, a hacky way to do it could be to simply include a "sort" button which triggers the following script:
Code:
nvram set static_leases="`nvram get static_leases | sed 's/\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\)/.\1./g' | tr ' ' '\n' | sort -n -k2,2n -k3,3n -k4,4n -k5,5n -t. | tr '\n' ' ' | sed 's/\.\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\)\./\1/g' | sed 's/^ //'; echo`"
Very clever but, I dont think this will stick as is, there is no nvram commit command there, which means for instance that when the router refreshes (by default every 3 seconds) the sorting will revert unless committed to nvram, and even then, Im not sure if the how you implemented that, it is completely safe.
Historic on sorting: We have tables that are sortable, but sorting tables in a browser for ANY website on refresh gets lost, this is how browsers work, to make browsers do stuff that sticks, we would need cookies and storing site data, I dont like that and will never support that, because caching is the enemy I rather not fight more than already do as well as storing possible identifiable/sensitive info in a browser is something I dont support.
The router refreshes every 3 seconds, and even though you can disable dd-wrt refreshing, this causes other data to never update until user clicks the refresh button. So we are a bit stuck between undesired browser behaviors and what users expect.
For your purposes, assuming with nvram commit it sticks and survives refreshes, if I were you, I would a cron job, to run (e.g. every month/or your desired interval) and call this script btw, do not set script into the static_leases variable because this is where the leases are stored and the command will likely get wiped out, and tbh Im not sure this wont cause any other issues while its part of the static_leases variable, so dont recommend that.
I would expand the script, to include nvram commit after it runs and store in on USB/JFFS and setup cron to call this script at your desired interval.
You could further expand script, wack the sorting code into a function and create another function to check is leases are sorted and only run if they are not while also adding a self check via PID to ensure the script isnt already running and if it is kill duplicates and exit gracefully, and even perhaps some logging to syslog.
Including buttons to call hacks like that is not any ideal solution so it wont happen guaranteed, there already exists various mechanisms e.g. cron, startup scripts, USB scripts, firewall scripts that can all be used to trigger this for you, so you dont need the convenience of a button.
Very clever though even is a little too hacky for general consumption as is, need is the mother on ingenuity, so with a bit of a spit polish to the script with my suggestions to make it saner, you can even create a new thread ( I really think you should) and share the improved script with the community. Then if there is interest in this functiona from more than 1 or 2 people, it will be a good measure to decide if this should be implemented sooner rather than later in a proper way.
Take care now and thanks for the feedback and returning with a suggestion. I hope to see a new thread and the script evolve into something sane and stable and that sticks.
Joined: 18 Mar 2014 Posts: 12837 Location: Netherlands
Posted: Thu Jun 09, 2022 9:15 Post subject:
Although the static leases GUI has been improved tremendously thanks to the-joker, many of us just add the static leases to the DNSMasq additional options e.g.:
Especially if you have a lot of static leases it is just easier to save and restore them after a reset and you can save them to a spreadsheet and sort them like you want and copy them back.
You should be able to grab the current static leases you have already set with:
cat /tmp/dnsmasq.conf | grep dhcp-host
Complaint department is closed until further notice.
Im up to my eyeballs with English strings and harcoded nonsense strings wise... I mean what did I expect when I pulled the top out of that can of worms... I was hoping for a naked sexy, teasing woman, but it turned out to be a fat hairy, sweaty guy.
Router status page still shows IP Filter / P2P that was renamed on the Administration page. I know full well you're not finished, just a friendly reminder. _________________ "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
Joined: 31 Jul 2021 Posts: 2146 Location: All over YOUR webs
Posted: Thu Jul 07, 2022 17:57 Post subject:
As of latest commits this are should be fully resolved, both label names, defaults and help text entries for Network Stack Tuning section.
DD-WRT builds from 49424 onward should equally be resolved for Memory values before / after slash
To normalize, info.htm uses MiB for said values without progress bars and Status_router.asp uses KiB with Progress bars, IMO this should be all MiB for both consistency and simple novice user understanding at first glance, and necessary progress bar calculations, despite my personal preference it remains inconsistent, no further work has happened so far in this area, and not entirely sure if both representing values in MiB will work for progress bar calculations. So Im fine as is or both being KiB/MiB respectively or unchanged, personally one single measurement standard is ideal.
Next is remote access. A pet peeve, it makes no sense, telnet remote management is 100% insecure, and the IP ranges are for IPv4 only and dont account for IPv6 or DDNS or various tunnel solutions like VPN/SSH tunnels from client side.
status_router.net_maxports="IP Filter Maximum Ports";
_________________ "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
Indeed, that is what I was pointing out, as you discovered for yourself.
Things can slip through the cracks if only one set of eyes, hands, and/or
ears are involved. <grin> _________________ "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
I don't know why they initially considered it "ports" other than it's part of netfilter (ip_conntrack) in the network stack and each connection uses a tcp or udp port - that is my only guesstimation. That change will definitely suffice in clearing up the confusion and give some standardization. I'm hesitant to weigh in on the active clients issue. I've already pointed at what I surmise as part of the problem elsewhere. _________________ "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