mirror of
				https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
				synced 2025-10-31 03:53:54 +00:00 
			
		
		
		
	mostly cosmetic: have one msc_conn_close() with cause argument
Change-Id: Ied7663f856cfce6e7ed1c0314fd558af85091dcc
This commit is contained in:
		| @@ -77,7 +77,7 @@ int msc_compl_l3(struct gsm_subscriber_connection *conn, | ||||
| void msc_dtap(struct gsm_subscriber_connection *conn, uint8_t link_id, struct msgb *msg); | ||||
| void msc_cipher_mode_compl(struct gsm_subscriber_connection *conn, | ||||
| 			   struct msgb *msg, uint8_t alg_id); | ||||
| void msc_close_connection(struct gsm_subscriber_connection *conn); | ||||
| void msc_conn_close(struct gsm_subscriber_connection *conn, uint32_t cause); | ||||
|  | ||||
| bool msc_subscr_conn_is_accepted(struct gsm_subscriber_connection *conn); | ||||
| void msc_subscr_conn_communicating(struct gsm_subscriber_connection *conn); | ||||
|   | ||||
| @@ -202,8 +202,7 @@ void gsm0408_clear_request(struct gsm_subscriber_connection *conn, uint32_t caus | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	/* TODO add cause item to msc_close_connection() */ | ||||
| 	osmo_fsm_inst_dispatch(conn->conn_fsm, SUBSCR_CONN_E_CN_CLOSE, &cause); | ||||
| 	msc_conn_close(conn, cause); | ||||
| } | ||||
|  | ||||
| /* clear all transactions globally; used in case of MNCC socket disconnect */ | ||||
| @@ -802,7 +801,7 @@ static int gsm48_rx_mm_imsi_detach_ind(struct gsm_subscriber_connection *conn, s | ||||
| 		return 0; | ||||
| #endif | ||||
|  | ||||
| 	msc_close_connection(conn); | ||||
| 	msc_conn_close(conn, 0); | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| @@ -898,7 +897,7 @@ static int gsm48_rx_mm_auth_resp(struct gsm_subscriber_connection *conn, struct | ||||
| 	if (!conn->vsub) { | ||||
| 		LOGP(DMM, LOGL_ERROR, | ||||
| 		     "MM AUTHENTICATION RESPONSE: invalid: no subscriber\n"); | ||||
| 		gsm0408_clear_request(conn, GSM_CAUSE_AUTH_FAILED); | ||||
| 		msc_conn_close(conn, GSM_CAUSE_AUTH_FAILED); | ||||
| 		return -EINVAL; | ||||
| 	} | ||||
|  | ||||
| @@ -912,7 +911,7 @@ static int gsm48_rx_mm_auth_resp(struct gsm_subscriber_connection *conn, struct | ||||
| 	} | ||||
|  | ||||
| 	if (rc) { | ||||
| 		gsm0408_clear_request(conn, GSM_CAUSE_AUTH_FAILED); | ||||
| 		msc_conn_close(conn, GSM_CAUSE_AUTH_FAILED); | ||||
| 		return -EINVAL; | ||||
| 	} | ||||
|  | ||||
| @@ -937,7 +936,7 @@ static int gsm48_rx_mm_auth_fail(struct gsm_subscriber_connection *conn, struct | ||||
| 	if (!conn->vsub) { | ||||
| 		LOGP(DMM, LOGL_ERROR, | ||||
| 		     "MM R99 AUTHENTICATION FAILURE: invalid: no subscriber\n"); | ||||
| 		gsm0408_clear_request(conn, GSM_CAUSE_AUTH_FAILED); | ||||
| 		msc_conn_close(conn, GSM_CAUSE_AUTH_FAILED); | ||||
| 		return -EINVAL; | ||||
| 	} | ||||
|  | ||||
| @@ -946,7 +945,7 @@ static int gsm48_rx_mm_auth_fail(struct gsm_subscriber_connection *conn, struct | ||||
| 		     "%s: MM R99 AUTHENTICATION FAILURE:" | ||||
| 		     " l3 length invalid: %u\n", | ||||
| 		     vlr_subscr_name(conn->vsub), msgb_l3len(msg)); | ||||
| 		gsm0408_clear_request(conn, GSM_CAUSE_AUTH_FAILED); | ||||
| 		msc_conn_close(conn, GSM_CAUSE_AUTH_FAILED); | ||||
| 		return -EINVAL; | ||||
| 	} | ||||
|  | ||||
| @@ -969,7 +968,7 @@ static int gsm48_rx_mm_auth_fail(struct gsm_subscriber_connection *conn, struct | ||||
| 		     "%s: MM R99 AUTHENTICATION FAILURE:" | ||||
| 		     " invalid Synch Failure: missing AUTS IE\n", | ||||
| 		     vlr_subscr_name(conn->vsub)); | ||||
| 		gsm0408_clear_request(conn, GSM_CAUSE_AUTH_FAILED); | ||||
| 		msc_conn_close(conn, GSM_CAUSE_AUTH_FAILED); | ||||
| 		return -EINVAL; | ||||
| 	} | ||||
|  | ||||
| @@ -986,7 +985,7 @@ static int gsm48_rx_mm_auth_fail(struct gsm_subscriber_connection *conn, struct | ||||
| 		     " got IE 0x%02x of %u bytes\n", | ||||
| 		     vlr_subscr_name(conn->vsub), | ||||
| 		     GSM48_IE_AUTS, auts_tag, auts_len); | ||||
| 		gsm0408_clear_request(conn, GSM_CAUSE_AUTH_FAILED); | ||||
| 		msc_conn_close(conn, GSM_CAUSE_AUTH_FAILED); | ||||
| 		return -EINVAL; | ||||
| 	} | ||||
|  | ||||
| @@ -995,7 +994,7 @@ static int gsm48_rx_mm_auth_fail(struct gsm_subscriber_connection *conn, struct | ||||
| 		     "%s: MM R99 AUTHENTICATION FAILURE:" | ||||
| 		     " invalid Synch Failure msg: message truncated (%u)\n", | ||||
| 		     vlr_subscr_name(conn->vsub), msgb_l3len(msg)); | ||||
| 		gsm0408_clear_request(conn, GSM_CAUSE_AUTH_FAILED); | ||||
| 		msc_conn_close(conn, GSM_CAUSE_AUTH_FAILED); | ||||
| 		return -EINVAL; | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -151,7 +151,7 @@ int gsm0408_rcvmsg_iucs(struct gsm_network *network, struct msgb *msg, | ||||
| 		     " %s from LAC %d to %d\n", | ||||
| 		     vlr_subscr_name(conn->vsub), conn->lac, *lac); | ||||
| 		/* Deallocate conn with previous LAC */ | ||||
| 		gsm0408_clear_request(conn, 0); | ||||
| 		msc_conn_close(conn, GSM_CAUSE_INV_MAND_INFO); | ||||
| 		/* At this point we could be tolerant and allocate a new | ||||
| 		 * connection, but changing the LAC within the same connection | ||||
| 		 * is shifty. Rather cancel everything. */ | ||||
|   | ||||
| @@ -241,7 +241,11 @@ struct bsc_api *msc_bsc_api() { | ||||
| 	return &msc_handler; | ||||
| } | ||||
|  | ||||
| void msc_close_connection(struct gsm_subscriber_connection *conn) | ||||
| /* Signal the connection's FSM to gracefully terminate the connection by a | ||||
|  * SUBSCR_CONN_E_CN_CLOSE event. | ||||
|  * \param cause  a GSM_CAUSE_* constant, e.g. GSM_CAUSE_AUTH_FAILED. | ||||
|  */ | ||||
| void msc_conn_close(struct gsm_subscriber_connection *conn, uint32_t cause) | ||||
| { | ||||
| 	if (!conn) | ||||
| 		return; | ||||
| @@ -251,7 +255,7 @@ void msc_close_connection(struct gsm_subscriber_connection *conn) | ||||
| 		return; | ||||
| 	if (conn->conn_fsm->state == SUBSCR_CONN_S_RELEASED) | ||||
| 		return; | ||||
| 	osmo_fsm_inst_dispatch(conn->conn_fsm, SUBSCR_CONN_E_CN_CLOSE, NULL); | ||||
| 	osmo_fsm_inst_dispatch(conn->conn_fsm, SUBSCR_CONN_E_CN_CLOSE, &cause); | ||||
| } | ||||
|  | ||||
| /* increment the ref-count. Needs to be called by every user */ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user