Feature #3136
closedCaptive Portal Increment Id
0%
Description
Assign the Pass-though Mac | Allowed IP Address | Allowed Hostnames static id's
that always increases when adding data rather then relaying on the foreach array
that dynamically asigning the $_GET id.
This can cause problems per say when you scrape the data to obtain the id for
a row delete. Since the id's change each time you add or remove a row and depending
on what current id or ip,hostname,mac number is being removed causes all the
remaining id's each time a data row is added or removed.
In the end it can cause the wrong id to be deleted.
Adding a numeric increment in the config and assign each data row its very own id
will correct this from happing. Since per say id 20 will never be used again it.
Even if the id reaches a silly number such as 100,000,000 its just a nine digit
number stored in the config array. No worse then a timestamp.
Updated by Aye Can almost 12 years ago
Correction | Old
causes all the
remaining id's each time a data row is added or removed
Correction | New
causes all the
remaining id's to change each time a data row is added or removed
Updated by Chris Buechler almost 12 years ago
- Target version deleted (
2.1) - Affected Version deleted (
2.1)
Updated by A FL almost 7 years ago
I would vote for a "reject"/"won't fix".
What you want is to update pfSense settings using a script, which is completly possible but not officially supported nor recommanded. So if you really want to create a script, you need to addapt this script to make it work with pfSense, and not the opposite.
Plus...as you mentionned, every time you add or delete a row, the numeric id is updated meaning you need to add one or subract one to the array's length. This is easy to handle in a script.
'''here is an example, in python'''
function fetchFromPfSense():
# for demonstration purpose. in real script you would need to make an http request.
return ["aa:bb:cc:dd:ee:00","aa:bb:cc:dd:ee:01","aa:bb:cc:dd:ee:02","aa:bb:cc:dd:ee:03","aa:bb:cc:dd:ee:04"]
macList = fetchFromPfSense()
for id in range(0,len(macList)):
print(macList[id])
if macList[id] == "aa:bb:cc:dd:ee:03" or macList[id] == "aa:bb:cc:dd:ee:04":
removeMac(id) # this function should make an HTTP request to delete the MAC matching this ID
del macList[id]
id = id-1
'''This script will delete aa:bb:cc:dd:ee:03 and aa:bb:cc:dd:ee:04'''