wifi-scripts: add macaddr_base wifi-device option
This can be used to configure the base mac address from which all interface mac addresses are derived Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
@@ -490,6 +490,10 @@
|
||||
"type": "alias",
|
||||
"default": "bssid"
|
||||
},
|
||||
"macaddr_base": {
|
||||
"type": "string",
|
||||
"description": "Base MAC address used for deriving interface MAC addresses"
|
||||
},
|
||||
"max_amsdu": {
|
||||
"description": "Maximum A-MSDU length of 7935 octects (3839 octets if option set to 0)",
|
||||
"type": "boolean",
|
||||
|
||||
@@ -544,6 +544,8 @@ export function setup(data) {
|
||||
|
||||
if (data.config.num_global_macaddr)
|
||||
append('\n#num_global_macaddr', data.config.num_global_macaddr);
|
||||
if (data.config.macaddr_base)
|
||||
append('\n#macaddr_base', data.config.macaddr_base);
|
||||
|
||||
for (let k, interface in data.interfaces) {
|
||||
if (interface.config.mode != 'ap')
|
||||
|
||||
@@ -178,9 +178,9 @@ function macaddr_random() {
|
||||
}
|
||||
|
||||
let mac_idx = 0;
|
||||
export function prepare(data, phy, num_global_macaddr) {
|
||||
export function prepare(data, phy, num_global_macaddr, macaddr_base) {
|
||||
if (!data.macaddr) {
|
||||
let pipe = fs.popen(`ucode /usr/share/hostap/wdev.uc ${phy} get_macaddr id=${mac_idx} num_global=${num_global_macaddr} mbssid=${data.mbssid ?? 0}`);
|
||||
let pipe = fs.popen(`ucode /usr/share/hostap/wdev.uc ${phy} get_macaddr id=${mac_idx} num_global=${num_global_macaddr} mbssid=${data.mbssid ?? 0} macaddr_base=${macaddr_base}`);
|
||||
|
||||
data.macaddr = trim(pipe.read("all"), '\n');
|
||||
pipe.close();
|
||||
|
||||
@@ -221,6 +221,7 @@ export function setup(config, data) {
|
||||
config,
|
||||
defer: true,
|
||||
num_global_macaddr: data.config.num_global_macaddr,
|
||||
macaddr_base: data.config.macaddr_base,
|
||||
});
|
||||
|
||||
if (ret)
|
||||
@@ -235,5 +236,6 @@ export function start(data) {
|
||||
phy: data.phy,
|
||||
radio: data.config.radio,
|
||||
num_global_macaddr: data.config.num_global_macaddr,
|
||||
macaddr_base: data.config.macaddr_base,
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user