BUGFIX: if SCTP uses SEQPACKET, sock should not use hash key.

This commit is contained in:
Sukchan Lee 2019-05-06 19:22:43 +09:00
parent f097364d52
commit bb67705a66
3 changed files with 46 additions and 18 deletions

View File

@ -1653,7 +1653,8 @@ mme_enb_t *mme_enb_add(ogs_sock_t *sock, ogs_sockaddr_t *addr)
ogs_list_init(&enb->enb_ue_list);
ogs_hash_set(self.enb_sock_hash, enb->sock, sizeof(ogs_sock_t), enb);
if (enb->sock_type == SOCK_STREAM)
ogs_hash_set(self.enb_sock_hash, enb->sock, sizeof(ogs_sock_t), enb);
ogs_hash_set(self.enb_addr_hash, enb->addr, sizeof(ogs_sockaddr_t), enb);
#if HAVE_USRSCTP != 1
@ -1680,7 +1681,8 @@ int mme_enb_remove(mme_enb_t *enb)
ogs_fsm_fini(&enb->sm, &e);
ogs_fsm_delete(&enb->sm);
ogs_hash_set(self.enb_sock_hash, enb->sock, sizeof(ogs_sock_t), NULL);
if (enb->sock_type == SOCK_STREAM)
ogs_hash_set(self.enb_sock_hash, enb->sock, sizeof(ogs_sock_t), NULL);
ogs_hash_set(self.enb_addr_hash, enb->addr, sizeof(ogs_sockaddr_t), NULL);
ogs_hash_set(self.enb_id_hash, &enb->enb_id, sizeof(enb->enb_id), NULL);

View File

@ -384,6 +384,7 @@ static int s1ap_usrsctp_recv_handler(struct socket *sock,
{
if (data)
{
int rv;
mme_event_t *e = NULL;
#undef MSG_NOTIFICATION
@ -425,8 +426,14 @@ static int s1ap_usrsctp_recv_handler(struct socket *sock,
ogs_assert(e);
e->enb_sock = (ogs_sock_t *)sock;
e->enb_addr = addr;
mme_event_send(e);
ogs_pollset_notify(mme_self()->pollset);
rv = ogs_queue_push(mme_self()->queue, e);
if (rv != OGS_OK) {
ogs_warn("ogs_queue_push() failed:%d", (int)rv);
ogs_free(addr);
mme_event_free(e);
} else {
ogs_pollset_notify(mme_self()->pollset);
}
}
else if (not->sn_assoc_change.sac_state == SCTP_COMM_UP)
{
@ -444,8 +451,14 @@ static int s1ap_usrsctp_recv_handler(struct socket *sock,
not->sn_assoc_change.sac_inbound_streams;
e->outbound_streams =
not->sn_assoc_change.sac_outbound_streams;
mme_event_send(e);
ogs_pollset_notify(mme_self()->pollset);
rv = ogs_queue_push(mme_self()->queue, e);
if (rv != OGS_OK) {
ogs_warn("ogs_queue_push() failed:%d", (int)rv);
ogs_free(addr);
mme_event_free(e);
} else {
ogs_pollset_notify(mme_self()->pollset);
}
}
break;
}
@ -464,8 +477,14 @@ static int s1ap_usrsctp_recv_handler(struct socket *sock,
ogs_assert(e);
e->enb_sock = (ogs_sock_t *)sock;
e->enb_addr = addr;
mme_event_send(e);
ogs_pollset_notify(mme_self()->pollset);
rv = ogs_queue_push(mme_self()->queue, e);
if (rv != OGS_OK) {
ogs_warn("ogs_queue_push() failed:%d", (int)rv);
ogs_free(addr);
mme_event_free(e);
} else {
ogs_pollset_notify(mme_self()->pollset);
}
break;
}
case SCTP_PEER_ADDR_CHANGE:
@ -517,8 +536,15 @@ static int s1ap_usrsctp_recv_handler(struct socket *sock,
e->enb_sock = (ogs_sock_t *)sock;
e->enb_addr = addr;
e->pkbuf = pkbuf;
mme_event_send(e);
ogs_pollset_notify(mme_self()->pollset);
rv = ogs_queue_push(mme_self()->queue, e);
if (rv != OGS_OK) {
ogs_warn("ogs_queue_push() failed:%d", (int)rv);
ogs_free(addr);
ogs_pkbuf_free(pkbuf);
mme_event_free(e);
} else {
ogs_pollset_notify(mme_self()->pollset);
}
}
else
{

View File

@ -313,18 +313,18 @@ static void handover_test1(abts_case *tc, void *data)
mongoc_collection_destroy(collection);
/* Two eNB disonncect from MME */
rv = testenb_s1ap_close(sock1);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
rv = testenb_s1ap_close(sock2);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* eNB disonncect from SGW */
rv = testenb_gtpu_close(gtpu2);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
rv = testenb_gtpu_close(gtpu1);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
rv = testenb_gtpu_close(gtpu2);
/* Two eNB disonncect from MME */
rv = testenb_s1ap_close(sock2);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
rv = testenb_s1ap_close(sock1);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(300);