mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-31 18:38:10 +00:00 
			
		
		
		
	Wifi-2952. Fix for flooding client events for Auth and Assoc
Sometimes we see a Client session created with sessionId=0, and this never gets deleted. The AP keep on sending this event as long as it exist in the events list. SessionId=0 is invalid. Adding checks to avoid creating session with Id=0. Also added a check in the opensync ubus to skip already processed events. Signed-off-by: ravi vaishnav <ravi.vaishnav@netexperience.com>
This commit is contained in:
		 ravi vaishnav
					ravi vaishnav
				
			
				
					committed by
					
						 Rick Sommerville
						Rick Sommerville
					
				
			
			
				
	
			
			
			 Rick Sommerville
						Rick Sommerville
					
				
			
						parent
						
							f5470bf439
						
					
				
				
					commit
					3cefdead18
				
			| @@ -0,0 +1,14 @@ | |||||||
|  | Index: hostapd-2020-07-02-58b384f4/src/ap/ubus.c | ||||||
|  | =================================================================== | ||||||
|  | --- hostapd-2020-07-02-58b384f4.orig/src/ap/ubus.c | ||||||
|  | +++ hostapd-2020-07-02-58b384f4/src/ap/ubus.c | ||||||
|  | @@ -1655,7 +1655,8 @@ int hostapd_ubus_handle_rt_event(struct | ||||||
|  |  	session_id = sta->cl_session_id; | ||||||
|  |   | ||||||
|  |  	/* find by session id */ | ||||||
|  | -	rec = avl_find_element(&hapd->ubus.rt_events, &session_id, rec, avl); | ||||||
|  | +	if (session_id) | ||||||
|  | +		rec = avl_find_element(&hapd->ubus.rt_events, &session_id, rec, avl); | ||||||
|  |   | ||||||
|  |  	/* prepare rec if not found */ | ||||||
|  |  	if (!rec) { | ||||||
| @@ -0,0 +1,14 @@ | |||||||
|  | Index: hostapd-2020-06-08-5a8b3662/src/ap/ubus.c | ||||||
|  | =================================================================== | ||||||
|  | --- hostapd-2020-06-08-5a8b3662.orig/src/ap/ubus.c | ||||||
|  | +++ hostapd-2020-06-08-5a8b3662/src/ap/ubus.c | ||||||
|  | @@ -1657,7 +1657,8 @@ int hostapd_ubus_handle_rt_event(struct | ||||||
|  |  	session_id = sta->cl_session_id; | ||||||
|  |   | ||||||
|  |  	/* find by session id */ | ||||||
|  | -	rec = avl_find_element(&hapd->ubus.rt_events, &session_id, rec, avl); | ||||||
|  | +	if (session_id) | ||||||
|  | +		rec = avl_find_element(&hapd->ubus.rt_events, &session_id, rec, avl); | ||||||
|  |   | ||||||
|  |  	/* prepare rec if not found */ | ||||||
|  |  	if (!rec) { | ||||||
| @@ -395,6 +395,19 @@ static void ubus_collector_complete_session_cb(struct ubus_request *req, int ret | |||||||
| 		free(req); | 		free(req); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | static bool ubus_collector_is_session_processed(uint64_t session_id) | ||||||
|  | { | ||||||
|  | 	delete_entry_t *delete_entry = NULL; | ||||||
|  |  | ||||||
|  | 	ds_dlist_foreach(&deletion_pending_list, delete_entry) { | ||||||
|  | 		if ( delete_entry && (delete_entry->session_id == session_id)) { | ||||||
|  | 			return true; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	return false; | ||||||
|  | } | ||||||
|  |  | ||||||
| static void ubus_collector_session_cb(struct ubus_request *req, int type, | static void ubus_collector_session_cb(struct ubus_request *req, int type, | ||||||
| 			      struct blob_attr *msg) | 			      struct blob_attr *msg) | ||||||
| { | { | ||||||
| @@ -447,13 +460,24 @@ static void ubus_collector_session_cb(struct ubus_request *req, int type, | |||||||
| 			continue; | 			continue; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		event_record = dpp_event_record_alloc(); | 		session_id = blobmsg_get_u64(tb_client_events[CLIENT_SESSION_ID]); | ||||||
|  | 		if (!session_id) { | ||||||
|  | 			LOG(DEBUG, "ubus_collector: Invalid sessionId"); | ||||||
|  | 			continue; | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		/* Check if the session is already processed */ | ||||||
|  | 		if (ubus_collector_is_session_processed(session_id) == true) { | ||||||
|  | 			LOG(DEBUG, "ubus_collector: Session already processed"); | ||||||
|  | 			continue; | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		event_record = dpp_event_record_alloc(); | ||||||
| 		if (!event_record) { | 		if (!event_record) { | ||||||
| 			LOG(ERR, "ubus_collector: not enough memory for event_record"); | 			LOG(ERR, "ubus_collector: not enough memory for event_record"); | ||||||
| 			continue; | 			continue; | ||||||
| 		} | 		} | ||||||
| 		session_id = blobmsg_get_u64(tb_client_events[CLIENT_SESSION_ID]); |  | ||||||
| 		event_record->client_session.session_id = session_id; | 		event_record->client_session.session_id = session_id; | ||||||
|  |  | ||||||
| 		for (i = 0; i < __CLIENT_EVENTS_MAX - 1; i++) { | 		for (i = 0; i < __CLIENT_EVENTS_MAX - 1; i++) { | ||||||
| @@ -757,10 +781,7 @@ static void ubus_garbage_collector(void *arg) | |||||||
|  |  | ||||||
| 	delete_entry = ds_dlist_head(&deletion_pending_list); | 	delete_entry = ds_dlist_head(&deletion_pending_list); | ||||||
| 	if (delete_entry) { | 	if (delete_entry) { | ||||||
| 		if (delete_entry->session_id) { | 		ubus_collector_hostapd_clear(delete_entry->session_id, delete_entry->bss); | ||||||
| 			ubus_collector_hostapd_clear(delete_entry->session_id, |  | ||||||
| 						delete_entry->bss); |  | ||||||
| 		} |  | ||||||
| 		ds_dlist_remove_head(&deletion_pending_list); | 		ds_dlist_remove_head(&deletion_pending_list); | ||||||
| 		free(delete_entry); | 		free(delete_entry); | ||||||
| 		delete_entry = NULL; | 		delete_entry = NULL; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user