Change State improvemenst.
FossilOrigin-Name: be00dd3a2e9d0c0daecb49eed1bfcc76f0820443e488a65647faf17af129672c
This commit is contained in:
		| @ -151,6 +151,18 @@ static void wtpman_run_discovery(void *arg) | ||||
|  | ||||
| } | ||||
|  | ||||
| int xprocess_message(struct conn *conn, uint8_t * rawmsg, int rawlen, | ||||
| 		    struct sockaddr *from) | ||||
| { | ||||
| 	uint8_t *msgptr = rawmsg + cw_get_hdr_msg_offset(rawmsg); | ||||
| 	uint32_t type = cw_get_msg_type(msgptr); | ||||
| 	cw_log(LOG_ERR,"Hey: %d",type); | ||||
| 	if (type == CW_MSG_DISCOVERY_REQUEST)  | ||||
| 		conn->capwap_state=CW_STATE_DISCOVERY; | ||||
|  | ||||
|  | ||||
| 	return process_message(conn,rawmsg,rawlen,from); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| @ -646,6 +658,7 @@ void wtpman_lw_addpacket(struct wtpman *wtpman, uint8_t * packet, int len) | ||||
|  | ||||
| } | ||||
|  | ||||
| int nodtls=0; | ||||
|  | ||||
| void wtpman_start(struct wtpman *wtpman, int dtlsmode) | ||||
| { | ||||
| @ -657,6 +670,14 @@ void wtpman_start(struct wtpman *wtpman, int dtlsmode) | ||||
| 	} else { | ||||
| 		cw_dbg(DBG_INFO, "Starting wtpman in non-dtls mode"); | ||||
|  | ||||
| 		if (nodtls){ | ||||
| 			wtpman->conn->process_message=xprocess_message; | ||||
| 			pthread_create(&wtpman->thread, NULL, (void *) wtpman_run, | ||||
| 				       (void *) wtpman); | ||||
| 			return; | ||||
|  | ||||
| 		} | ||||
|  | ||||
| 		pthread_create(&wtpman->thread, NULL, (void *) wtpman_run_discovery, | ||||
| 			       (void *) wtpman); | ||||
| 	} | ||||
|  | ||||
| @ -1,13 +1,15 @@ | ||||
|  | ||||
| #include "capwap.h" | ||||
| #include "intavltree.h" | ||||
| #include "dbg.h" | ||||
| #include "log.h" | ||||
| #include "capwap_items.h" | ||||
| #include "cw.h" | ||||
|  | ||||
| int cw_in_check_chng_state_evnt_req(struct conn *conn, struct cw_action_in *a, uint8_t * data, | ||||
| 			 int len,struct sockaddr *from) | ||||
| { | ||||
| 	conn->capwap_state = CW_STATE_RUN; | ||||
| 	return 0;	 | ||||
| 	conn->capwap_state = CW_STATE_NONE; | ||||
| 	int rc = cw_in_check_generic_req(conn,a,data,len,from); | ||||
| 	if (rc==0) | ||||
| 		conn->capwap_state = CW_STATE_RUN; | ||||
| 	return rc; | ||||
|  | ||||
| } | ||||
|  | ||||
| @ -14,9 +14,9 @@ int cw_in_check_disc_req(struct conn *conn, struct cw_action_in *a, uint8_t * da | ||||
| 	cw_action_in_t *mlist[120]; | ||||
| 	int n = cw_check_missing_mand(mlist, conn, a); | ||||
|  | ||||
|  | ||||
| 	conn->capwap_state = CW_STATE_NONE; | ||||
|  | ||||
|  | ||||
| 	if (n && conn->strict_capwap) { | ||||
| 		cw_dbg_missing_mand(DBG_MSG_ERR, conn, mlist, n, a); | ||||
| 		/* if mandatory elements are missing, in strict  | ||||
| @ -35,6 +35,7 @@ int cw_in_check_disc_req(struct conn *conn, struct cw_action_in *a, uint8_t * da | ||||
| 		 | ||||
|  | ||||
| 	/* ok, send response */ | ||||
| 	conn->capwap_state = CW_STATE_JOIN; | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user