Centralized control of the AC IP address into recv function
This commit is contained in:
		| @ -395,8 +395,23 @@ int wtp_dfa_running(void) { | ||||
| 				} else { | ||||
| 					int check; | ||||
|  | ||||
| 					/* Check of packet */ | ||||
| 					/* Retrieve network information */ | ||||
| 					capwap_get_network_socket(&g_wtp.net, &socket, fds[index].fd); | ||||
|  | ||||
| 					/* Check source */ | ||||
| 					if (socket.isctrlsocket && (g_wtp.acctrladdress.ss_family != AF_UNSPEC)) { | ||||
| 						if (capwap_compare_ip(&g_wtp.acctrladdress, &recvfromaddr)) { | ||||
| 							/* Unknown source */ | ||||
| 							continue; | ||||
| 						} | ||||
| 					} else if (!socket.isctrlsocket && (g_wtp.acdataaddress.ss_family != AF_UNSPEC)) { | ||||
| 						if (capwap_compare_ip(&g_wtp.acdataaddress, &recvfromaddr)) { | ||||
| 							/* Unknown source */ | ||||
| 							continue; | ||||
| 						} | ||||
| 					} | ||||
|  | ||||
| 					/* Check of packet */ | ||||
| 					check = capwap_sanity_check(socket.isctrlsocket, g_wtp.dfa.state, buffer, buffersize, g_wtp.ctrldtls.enable, g_wtp.datadtls.enable); | ||||
| 					if (check == CAPWAP_DTLS_PACKET) { | ||||
| 						struct capwap_dtls* dtls = (socket.isctrlsocket ? &g_wtp.ctrldtls : &g_wtp.datadtls); | ||||
|  | ||||
| @ -26,19 +26,17 @@ int wtp_dfa_state_configure(struct capwap_parsed_packet* packet, struct timeout_ | ||||
| 	ASSERT(timeout != NULL); | ||||
|  | ||||
| 	if (packet) { | ||||
| 		if (!capwap_compare_ip(&g_wtp.acctrladdress, &packet->connection->remoteaddr)) { | ||||
| 			unsigned short binding; | ||||
| 		unsigned short binding; | ||||
| 		 | ||||
| 			/* */ | ||||
| 			binding = GET_WBID_HEADER(packet->rxmngpacket->header); | ||||
| 			if (packet->rxmngpacket->isctrlpacket && (binding == g_wtp.binding) && (packet->rxmngpacket->ctrlmsg.type == CAPWAP_CONFIGURATION_STATUS_RESPONSE) && ((g_wtp.localseqnumber - 1) == packet->rxmngpacket->ctrlmsg.seq)) { | ||||
| 				/* Valid packet, free request packet */ | ||||
| 				wtp_free_reference_last_request(); | ||||
| 		/* */ | ||||
| 		binding = GET_WBID_HEADER(packet->rxmngpacket->header); | ||||
| 		if (packet->rxmngpacket->isctrlpacket && (binding == g_wtp.binding) && (packet->rxmngpacket->ctrlmsg.type == CAPWAP_CONFIGURATION_STATUS_RESPONSE) && ((g_wtp.localseqnumber - 1) == packet->rxmngpacket->ctrlmsg.seq)) { | ||||
| 			/* Valid packet, free request packet */ | ||||
| 			wtp_free_reference_last_request(); | ||||
|  | ||||
| 				/* Parsing response values */ | ||||
| 				wtp_dfa_change_state(wtp_configure_ac(packet)); | ||||
| 				status = WTP_DFA_NO_PACKET; | ||||
| 			} | ||||
| 			/* Parsing response values */ | ||||
| 			wtp_dfa_change_state(wtp_configure_ac(packet)); | ||||
| 			status = WTP_DFA_NO_PACKET; | ||||
| 		} | ||||
| 	} else { | ||||
| 		/* No Configuration status response received */ | ||||
|  | ||||
| @ -17,33 +17,31 @@ int wtp_dfa_state_datacheck(struct capwap_parsed_packet* packet, struct timeout_ | ||||
| 	ASSERT(timeout != NULL); | ||||
|  | ||||
| 	if (packet) { | ||||
| 		if (!capwap_compare_ip(&g_wtp.acctrladdress, &packet->connection->remoteaddr)) { | ||||
| 			unsigned short binding; | ||||
| 		unsigned short binding; | ||||
|  | ||||
| 			/* */ | ||||
| 			binding = GET_WBID_HEADER(packet->rxmngpacket->header); | ||||
| 		/* */ | ||||
| 		binding = GET_WBID_HEADER(packet->rxmngpacket->header); | ||||
|  | ||||
| 			if (packet->rxmngpacket->isctrlpacket) { | ||||
| 				if (binding == g_wtp.binding) { | ||||
| 					if (packet->rxmngpacket->ctrlmsg.type == CAPWAP_CHANGE_STATE_EVENT_RESPONSE) { | ||||
| 						if ((g_wtp.localseqnumber - 1) == packet->rxmngpacket->ctrlmsg.seq) { | ||||
| 							if (packet->rxmngpacket->packetlength > 0) { | ||||
| 								int a = packet->rxmngpacket->packetlength; | ||||
| 								a++; | ||||
| 							} | ||||
| 		if (packet->rxmngpacket->isctrlpacket) { | ||||
| 			if (binding == g_wtp.binding) { | ||||
| 				if (packet->rxmngpacket->ctrlmsg.type == CAPWAP_CHANGE_STATE_EVENT_RESPONSE) { | ||||
| 					if ((g_wtp.localseqnumber - 1) == packet->rxmngpacket->ctrlmsg.seq) { | ||||
| 						if (packet->rxmngpacket->packetlength > 0) { | ||||
| 							int a = packet->rxmngpacket->packetlength; | ||||
| 							a++; | ||||
| 						} | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 			if (packet->rxmngpacket->isctrlpacket && (binding == g_wtp.binding) && (packet->rxmngpacket->ctrlmsg.type == CAPWAP_CHANGE_STATE_EVENT_RESPONSE) && ((g_wtp.localseqnumber - 1) == packet->rxmngpacket->ctrlmsg.seq)) { | ||||
| 				/* Valid packet, free request packet */ | ||||
| 				wtp_free_reference_last_request(); | ||||
| 		if (packet->rxmngpacket->isctrlpacket && (binding == g_wtp.binding) && (packet->rxmngpacket->ctrlmsg.type == CAPWAP_CHANGE_STATE_EVENT_RESPONSE) && ((g_wtp.localseqnumber - 1) == packet->rxmngpacket->ctrlmsg.seq)) { | ||||
| 			/* Valid packet, free request packet */ | ||||
| 			wtp_free_reference_last_request(); | ||||
|  | ||||
| 				/* Parsing response values */ | ||||
| 				wtp_dfa_change_state(wtp_datacheck_ac(packet)); | ||||
| 				status = WTP_DFA_NO_PACKET; | ||||
| 			} | ||||
| 			/* Parsing response values */ | ||||
| 			wtp_dfa_change_state(wtp_datacheck_ac(packet)); | ||||
| 			status = WTP_DFA_NO_PACKET; | ||||
| 		} | ||||
| 	} else { | ||||
| 		/* No change state response received */ | ||||
|  | ||||
| @ -126,19 +126,17 @@ int wtp_dfa_state_join(struct capwap_parsed_packet* packet, struct timeout_contr | ||||
| 	ASSERT(timeout != NULL); | ||||
|  | ||||
| 	if (packet) { | ||||
| 		if (!capwap_compare_ip(&g_wtp.acctrladdress, &packet->connection->remoteaddr)) { | ||||
| 			unsigned short binding; | ||||
| 		unsigned short binding; | ||||
|  | ||||
| 			/* */ | ||||
| 			binding = GET_WBID_HEADER(packet->rxmngpacket->header); | ||||
| 			if (packet->rxmngpacket->isctrlpacket && (binding == g_wtp.binding) && (packet->rxmngpacket->ctrlmsg.type == CAPWAP_JOIN_RESPONSE) && ((g_wtp.localseqnumber - 1) == packet->rxmngpacket->ctrlmsg.seq)) { | ||||
| 				/* Valid packet, free request packet */ | ||||
| 				wtp_free_reference_last_request(); | ||||
| 		/* */ | ||||
| 		binding = GET_WBID_HEADER(packet->rxmngpacket->header); | ||||
| 		if (packet->rxmngpacket->isctrlpacket && (binding == g_wtp.binding) && (packet->rxmngpacket->ctrlmsg.type == CAPWAP_JOIN_RESPONSE) && ((g_wtp.localseqnumber - 1) == packet->rxmngpacket->ctrlmsg.seq)) { | ||||
| 			/* Valid packet, free request packet */ | ||||
| 			wtp_free_reference_last_request(); | ||||
|  | ||||
| 				/* Parsing response values  */ | ||||
| 				wtp_dfa_change_state(wtp_join_ac(packet)); | ||||
| 				status = WTP_DFA_NO_PACKET; | ||||
| 			} | ||||
| 			/* Parsing response values  */ | ||||
| 			wtp_dfa_change_state(wtp_join_ac(packet)); | ||||
| 			status = WTP_DFA_NO_PACKET; | ||||
| 		} | ||||
| 	} else { | ||||
| 		/* No Join response received */ | ||||
|  | ||||
		Reference in New Issue
	
	Block a user