ucentral-event: add option82 handling

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2023-05-30 07:57:11 +02:00
parent 52f6189c10
commit 1371a9d3d8

View File

@@ -134,6 +134,7 @@ let handlers = {
vlan: [ `${notify.data.vlan_id}` ]
};
ubus.call('network.interface.up_none', 'add_device', msg);
ubus.call('dhcprelay', 'check_devices');
},
};
@@ -231,13 +232,23 @@ function dhcp_subscriber_remove_cb(remove) {
}
function dhcp_relay_subscriber_notify_cb(notify) {
printf('%.J\n', notify.data);
return {
address: relay.config.server,
options: [
[ 62, "hello, world" ]
]
};
let ifname = split(notify.data.info.device, '-v');
let hapd = hostapd[ifname[0]];
let vlan = ifname[1];
if (hapd) {
vlan ??= hapd.config.vlan_id;
let circuit_id = `${vlan}`;
let remote_id = hapd.bssid;
return {
address: relay['vlan' + vlan]?.server,
options: [
[ 82,
chr(1) + chr(length(circuit_id)) + circuit_id +
chr(2) + chr(length(remote_id)) + remote_id
]
]
};
}
}
function dhcp_relay_subscriber_remove_cb(remove) {