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}` ] vlan: [ `${notify.data.vlan_id}` ]
}; };
ubus.call('network.interface.up_none', 'add_device', msg); 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) { function dhcp_relay_subscriber_notify_cb(notify) {
printf('%.J\n', notify.data); let ifname = split(notify.data.info.device, '-v');
return { let hapd = hostapd[ifname[0]];
address: relay.config.server, let vlan = ifname[1];
options: [ if (hapd) {
[ 62, "hello, world" ] 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) { function dhcp_relay_subscriber_remove_cb(remove) {