mirror of
				https://git.kernel.org/pub/scm/network/wireless/iwd.git
				synced 2025-10-30 20:37:26 +01:00 
			
		
		
		
	wiphy: Move handshake_failed handler out of wiphy.c
This commit is contained in:
		
							parent
							
								
									64d382cc89
								
							
						
					
					
						commit
						c714b20102
					
				
							
								
								
									
										23
									
								
								src/netdev.c
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								src/netdev.c
									
									
									
									
									
								
							| @ -311,6 +311,27 @@ static void netdev_operstate_cb(bool success, void *user_data) | ||||
| 		netdev->connect_cb(netdev, result, netdev->user_data); | ||||
| } | ||||
| 
 | ||||
| static void netdev_handshake_failed(uint32_t ifindex, | ||||
| 					const uint8_t *aa, const uint8_t *spa, | ||||
| 					uint16_t reason_code, void *user_data) | ||||
| { | ||||
| 	struct l_genl_msg *msg; | ||||
| 	struct netdev *netdev; | ||||
| 
 | ||||
| 	netdev = netdev_find(ifindex); | ||||
| 	if (!netdev) | ||||
| 		return; | ||||
| 
 | ||||
| 	l_error("4-Way Handshake failed for ifindex: %d", ifindex); | ||||
| 
 | ||||
| 	msg = netdev_build_cmd_deauthenticate(netdev, reason_code); | ||||
| 	l_genl_family_send(nl80211, msg, NULL, NULL, NULL); | ||||
| 
 | ||||
| 	if (netdev->connect_cb) | ||||
| 		netdev->connect_cb(netdev, NETDEV_RESULT_HANDSHAKE_FAILED, | ||||
| 						netdev->user_data); | ||||
| } | ||||
| 
 | ||||
| static void netdev_associate_event(struct l_genl_msg *msg, | ||||
| 							struct netdev *netdev) | ||||
| { | ||||
| @ -772,6 +793,8 @@ bool netdev_init(struct l_genl_family *in) | ||||
| 								NULL, NULL)) | ||||
| 		l_error("Registering for MLME notification failed"); | ||||
| 
 | ||||
| 	__eapol_set_deauthenticate_func(netdev_handshake_failed); | ||||
| 
 | ||||
| 	return true; | ||||
| } | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										18
									
								
								src/wiphy.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								src/wiphy.c
									
									
									
									
									
								
							| @ -495,23 +495,6 @@ static void setting_keys_failed(struct device *device, uint16_t reason_code) | ||||
| 	device_enter_state(device, DEVICE_STATE_DISCONNECTING); | ||||
| } | ||||
| 
 | ||||
| static void handshake_failed(uint32_t ifindex, | ||||
| 				const uint8_t *aa, const uint8_t *spa, | ||||
| 				uint16_t reason_code, void *user_data) | ||||
| { | ||||
| 	struct device *device = user_data; | ||||
| 	struct l_genl_msg *msg; | ||||
| 
 | ||||
| 	l_error("4-Way Handshake failed for ifindex: %d", ifindex); | ||||
| 
 | ||||
| 	msg = l_genl_msg_new_sized(NL80211_CMD_DEAUTHENTICATE, 512); | ||||
| 	msg_append_attr(msg, NL80211_ATTR_IFINDEX, 4, &ifindex); | ||||
| 	msg_append_attr(msg, NL80211_ATTR_REASON_CODE, 2, &reason_code); | ||||
| 	msg_append_attr(msg, NL80211_ATTR_MAC, ETH_ALEN, aa); | ||||
| 	l_genl_family_send(nl80211, msg, deauthenticate_cb, device, NULL); | ||||
| 	device_enter_state(device, DEVICE_STATE_DISCONNECTING); | ||||
| } | ||||
| 
 | ||||
| static void mlme_set_pairwise_key_cb(struct l_genl_msg *msg, void *data) | ||||
| { | ||||
| 	struct device *device = data; | ||||
| @ -1445,7 +1428,6 @@ bool wiphy_init(struct l_genl_family *in) | ||||
| 
 | ||||
| 	__eapol_set_install_tk_func(wiphy_set_tk); | ||||
| 	__eapol_set_install_gtk_func(wiphy_set_gtk); | ||||
| 	__eapol_set_deauthenticate_func(handshake_failed); | ||||
| 
 | ||||
| 	wiphy_list = l_queue_new(); | ||||
| 	device_list = l_queue_new(); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Denis Kenzior
						Denis Kenzior