diff --git a/feeds/ucentral/ucentral-event/files/ucentral-event b/feeds/ucentral/ucentral-event/files/ucentral-event index a47a382fe..2931a6aa5 100755 --- a/feeds/ucentral/ucentral-event/files/ucentral-event +++ b/feeds/ucentral/ucentral-event/files/ucentral-event @@ -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) {