From bbc78828fcf10eb27ea158b27a0585c6f662e03d Mon Sep 17 00:00:00 2001 From: Venkat Chimata Date: Mon, 15 Jul 2024 13:16:26 +0530 Subject: [PATCH] ieee8021x: Fix connectivity issues with a non-vlan based event Non-vlan based ieee8021x client was not able get IP Addess through the AP. The reason was that ieee8021x.uc subscriptions could n't subscribe hostapd events as the subscribe functions are called before creating the interfaces. To handle this, invoke hapd_subscriber.subscribe after the interface is created. Also dont delete the interface from ifaces as ifaces should always contain the configured ports (from uci config) per ieee8021x.uc design. Deleting interfaces from ifaces will lead to ieee8021x.uc crashes. Signed-off-by: Venkat Chimata --- feeds/ucentral/ieee8021x/files/usr/bin/ieee8021x.uc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/feeds/ucentral/ieee8021x/files/usr/bin/ieee8021x.uc b/feeds/ucentral/ieee8021x/files/usr/bin/ieee8021x.uc index e5ae2e04f..f16aa99b4 100755 --- a/feeds/ucentral/ieee8021x/files/usr/bin/ieee8021x.uc +++ b/feeds/ucentral/ieee8021x/files/usr/bin/ieee8021x.uc @@ -135,9 +135,11 @@ function hostapd_start(iface) { log.syslog(LOG_USER, "Remove the config ${iface}"); ubus.call('hostapd', 'config_remove', { iface: iface }); } - log.syslog(LOG_USER, "Add config (clear the old one) ${iface}"); + log.syslog(LOG_USER, "Add config (clear the old one) " + iface); ubus.call('hostapd', 'config_add', { iface: iface, config: path }); system('ifconfig ' + iface + ' up'); + // Subscribe to corresponding hostapd if it is (re)added + hapd_subscriber.subscribe("hostapd." + iface); } /* build a list of all running and new interfaces */ @@ -188,13 +190,14 @@ function ubus_unsub_object(add, id, path) { if (object_hostapd != 'hostapd' || !ifaces[object_ifaces]) return; if (add) { - log.syslog(LOG_USER, "adding ${path}"); + log.syslog(LOG_USER, "adding " + path); hapd_subscriber.subscribe(path); ifaces[object_ifaces].hostapd = true; ifaces[object_ifaces].path = path; } else { + // Mark the port as unauthorized. but dont delete it + // ifaces contains the configured (from uci config) ports netifd_handle_iface(object_ifaces, false); - delete ifaces[object_ifaces]; } }