forked from acouzens/open5gs
[LOG] remove ogs_expect_or_return()/return_val()
This commit is contained in:
parent
ed5cd4d513
commit
c6fd4ae6b8
|
@ -28,7 +28,10 @@ ogs_pkbuf_t *ogs_asn_encode(const asn_TYPE_descriptor_t *td, void *sptr)
|
|||
ogs_assert(sptr);
|
||||
|
||||
pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
|
||||
ogs_expect_or_return_val(pkbuf, NULL);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_pkbuf_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
ogs_pkbuf_put(pkbuf, OGS_MAX_SDU_LEN);
|
||||
|
||||
enc_ret = aper_encode_to_buffer(td, NULL,
|
||||
|
|
|
@ -191,10 +191,16 @@ char *ogs_uint64_to_string(uint64_t x)
|
|||
char *str, *p, *dup;
|
||||
|
||||
str = ogs_uint64_to_0string(x);
|
||||
ogs_expect_or_return_val(str, NULL);
|
||||
if (!str) {
|
||||
ogs_error("ogs_uint64_to_0string[%lld] failed", (long long)x);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
p = ogs_left_trimcharacter(str, '0');
|
||||
ogs_expect_or_return_val(p, NULL);
|
||||
if (!p) {
|
||||
ogs_error("ogs_left_trimcharacter[%s] failld", str);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dup = ogs_strdup(p);
|
||||
ogs_free(str);
|
||||
|
|
|
@ -112,7 +112,10 @@ static int epoll_add(ogs_poll_t *poll)
|
|||
map = ogs_hash_get(context->map_hash, &poll->fd, sizeof(poll->fd));
|
||||
if (!map) {
|
||||
map = ogs_calloc(1, sizeof(*map));
|
||||
ogs_expect_or_return_val(map, OGS_ERROR);
|
||||
if (!map) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
op = EPOLL_CTL_ADD;
|
||||
ogs_hash_set(context->map_hash, &poll->fd, sizeof(poll->fd), map);
|
||||
|
|
|
@ -72,7 +72,10 @@ ogs_hash_t *ogs_hash_make()
|
|||
ogs_time_t now = ogs_get_monotonic_time();
|
||||
|
||||
ht = ogs_malloc(sizeof(ogs_hash_t));
|
||||
ogs_expect_or_return_val(ht, NULL);
|
||||
if (!ht) {
|
||||
ogs_error("ogs_malloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ht->free = NULL;
|
||||
ht->count = 0;
|
||||
|
@ -88,7 +91,10 @@ ogs_hash_t *ogs_hash_make()
|
|||
ogs_hash_t *ogs_hash_make_custom(ogs_hashfunc_t hash_func)
|
||||
{
|
||||
ogs_hash_t *ht = ogs_hash_make();
|
||||
ogs_expect_or_return_val(ht, NULL);
|
||||
if (!ht) {
|
||||
ogs_error("ogs_hash_make() failed");
|
||||
return NULL;
|
||||
}
|
||||
ht->hash_func = hash_func;
|
||||
return ht;
|
||||
}
|
||||
|
|
|
@ -125,24 +125,6 @@ void ogs_log_hexdump_func(ogs_log_level_e level, int domain_id,
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
#define ogs_expect_or_return(expr) \
|
||||
do { \
|
||||
if (ogs_likely(expr)) ; \
|
||||
else { \
|
||||
ogs_error("%s: Expectation `%s' failed.", OGS_FUNC, #expr); \
|
||||
return; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ogs_expect_or_return_val(expr, val) \
|
||||
do { \
|
||||
if (ogs_likely(expr)) ; \
|
||||
else { \
|
||||
ogs_error("%s: Expectation `%s' failed.", OGS_FUNC, #expr); \
|
||||
return (val); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -124,7 +124,11 @@ void *ogs_malloc_debug(size_t size, const char *file_line)
|
|||
|
||||
headroom = sizeof(ogs_pkbuf_t *);
|
||||
pkbuf = ogs_pkbuf_alloc_debug(NULL, headroom + size, file_line);
|
||||
ogs_expect_or_return_val(pkbuf, NULL);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_pkbuf_alloc_debug[headroom:%d, size:%d] failed",
|
||||
(int)headroom, (int)size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ogs_pkbuf_reserve(pkbuf, headroom);
|
||||
memcpy(pkbuf->head, &pkbuf, headroom);
|
||||
|
@ -155,7 +159,11 @@ void *ogs_calloc_debug(size_t nmemb, size_t size, const char *file_line)
|
|||
void *ptr = NULL;
|
||||
|
||||
ptr = ogs_malloc_debug(nmemb * size, file_line);
|
||||
ogs_expect_or_return_val(ptr, NULL);
|
||||
if (!ptr) {
|
||||
ogs_error("ogs_malloc_debug[nmemb:%d, size:%d] failed",
|
||||
(int)nmemb, (int)size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(ptr, 0, nmemb * size);
|
||||
return ptr;
|
||||
|
@ -174,10 +182,17 @@ void *ogs_realloc_debug(void *ptr, size_t size, const char *file_line)
|
|||
|
||||
memcpy(&pkbuf, (unsigned char*)ptr - headroom, headroom);
|
||||
|
||||
ogs_expect_or_return_val(pkbuf, NULL);
|
||||
if (!pkbuf) {
|
||||
ogs_error("Cannot get pkbuf from ptr[%p], headroom[%d]",
|
||||
ptr, (int)headroom);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cluster = pkbuf->cluster;
|
||||
ogs_expect_or_return_val(cluster, NULL);
|
||||
if (!cluster) {
|
||||
ogs_error("No cluster");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!size) {
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
|
@ -188,7 +203,10 @@ void *ogs_realloc_debug(void *ptr, size_t size, const char *file_line)
|
|||
void *new = NULL;
|
||||
|
||||
new = ogs_malloc_debug(size, file_line);
|
||||
ogs_expect_or_return_val(new, NULL);
|
||||
if (!new) {
|
||||
ogs_error("ogs_malloc_debug[%d] failed", (int)size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memcpy(new, ptr, pkbuf->len);
|
||||
|
||||
|
|
|
@ -374,31 +374,52 @@ static ogs_cluster_t *cluster_alloc(
|
|||
|
||||
if (size <= OGS_CLUSTER_128_SIZE) {
|
||||
ogs_pool_alloc(&pool->cluster_128, (ogs_cluster_128_t**)&buffer);
|
||||
ogs_expect_or_return_val(buffer, NULL);
|
||||
if (!buffer) {
|
||||
ogs_error("ogs_pool_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
cluster->size = OGS_CLUSTER_128_SIZE;
|
||||
} else if (size <= OGS_CLUSTER_256_SIZE) {
|
||||
ogs_pool_alloc(&pool->cluster_256, (ogs_cluster_256_t**)&buffer);
|
||||
ogs_expect_or_return_val(buffer, NULL);
|
||||
if (!buffer) {
|
||||
ogs_error("ogs_pool_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
cluster->size = OGS_CLUSTER_256_SIZE;
|
||||
} else if (size <= OGS_CLUSTER_512_SIZE) {
|
||||
ogs_pool_alloc(&pool->cluster_512, (ogs_cluster_512_t**)&buffer);
|
||||
ogs_expect_or_return_val(buffer, NULL);
|
||||
if (!buffer) {
|
||||
ogs_error("ogs_pool_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
cluster->size = OGS_CLUSTER_512_SIZE;
|
||||
} else if (size <= OGS_CLUSTER_1024_SIZE) {
|
||||
ogs_pool_alloc(&pool->cluster_1024, (ogs_cluster_1024_t**)&buffer);
|
||||
ogs_expect_or_return_val(buffer, NULL);
|
||||
if (!buffer) {
|
||||
ogs_error("ogs_pool_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
cluster->size = OGS_CLUSTER_1024_SIZE;
|
||||
} else if (size <= OGS_CLUSTER_2048_SIZE) {
|
||||
ogs_pool_alloc(&pool->cluster_2048, (ogs_cluster_2048_t**)&buffer);
|
||||
ogs_expect_or_return_val(buffer, NULL);
|
||||
if (!buffer) {
|
||||
ogs_error("ogs_pool_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
cluster->size = OGS_CLUSTER_2048_SIZE;
|
||||
} else if (size <= OGS_CLUSTER_16384_SIZE) {
|
||||
ogs_pool_alloc(&pool->cluster_16384, (ogs_cluster_16384_t**)&buffer);
|
||||
ogs_expect_or_return_val(buffer, NULL);
|
||||
if (!buffer) {
|
||||
ogs_error("ogs_pool_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
cluster->size = OGS_CLUSTER_16384_SIZE;
|
||||
} else if (size <= OGS_CLUSTER_BIG_SIZE) {
|
||||
ogs_pool_alloc(&pool->cluster_big, (ogs_cluster_big_t**)&buffer);
|
||||
ogs_expect_or_return_val(buffer, NULL);
|
||||
if (!buffer) {
|
||||
ogs_error("ogs_pool_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
cluster->size = OGS_CLUSTER_BIG_SIZE;
|
||||
} else {
|
||||
ogs_fatal("invalid size = %d", size);
|
||||
|
|
|
@ -35,7 +35,10 @@ bool ogs_pollset_actions_initialized = false;
|
|||
ogs_pollset_t *ogs_pollset_create(unsigned int capacity)
|
||||
{
|
||||
ogs_pollset_t *pollset = ogs_calloc(1, sizeof *pollset);
|
||||
ogs_expect_or_return_val(pollset, NULL);
|
||||
if (!pollset) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pollset->capacity = capacity;
|
||||
|
||||
|
|
|
@ -70,7 +70,10 @@ typedef struct ogs_queue_s {
|
|||
ogs_queue_t *ogs_queue_create(unsigned int capacity)
|
||||
{
|
||||
ogs_queue_t *queue = ogs_calloc(1, sizeof *queue);
|
||||
ogs_expect_or_return_val(queue, NULL);
|
||||
if (!queue) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
ogs_assert(queue);
|
||||
|
||||
ogs_thread_mutex_init(&queue->one_big_mutex);
|
||||
|
@ -78,7 +81,11 @@ ogs_queue_t *ogs_queue_create(unsigned int capacity)
|
|||
ogs_thread_cond_init(&queue->not_full);
|
||||
|
||||
queue->data = ogs_calloc(1, capacity * sizeof(void*));
|
||||
ogs_expect_or_return_val(queue->data, NULL);
|
||||
if (!queue->data) {
|
||||
ogs_error("ogs_calloc[capacity:%d, sizeof(void*):%d] failed",
|
||||
(int)capacity, (int)sizeof(void*));
|
||||
return NULL;
|
||||
}
|
||||
queue->bounds = capacity;
|
||||
queue->nelts = 0;
|
||||
queue->in = 0;
|
||||
|
|
|
@ -130,7 +130,10 @@ int ogs_addaddrinfo(ogs_sockaddr_t **sa_list,
|
|||
continue;
|
||||
|
||||
new = ogs_calloc(1, sizeof(ogs_sockaddr_t));
|
||||
ogs_expect_or_return_val(new, OGS_ERROR);
|
||||
if (!new) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
memcpy(&new->sa, ai->ai_addr, ai->ai_addrlen);
|
||||
new->ogs_sin_port = htobe16(port);
|
||||
|
||||
|
@ -204,15 +207,24 @@ int ogs_copyaddrinfo(ogs_sockaddr_t **dst, const ogs_sockaddr_t *src)
|
|||
for (*dst = d = NULL, s = src; s; s = s->next) {
|
||||
if (!d) {
|
||||
*dst = d = ogs_memdup(s, sizeof *s);
|
||||
ogs_expect_or_return_val(*dst, OGS_ERROR);
|
||||
if (!(*dst)) {
|
||||
ogs_error("ogs_memdup() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
} else {
|
||||
d = d->next = ogs_memdup(s, sizeof *s);
|
||||
ogs_expect_or_return_val(d, OGS_ERROR);
|
||||
if (!d) {
|
||||
ogs_error("ogs_memdup() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
if (s->hostname) {
|
||||
if (s == src || s->hostname != src->hostname) {
|
||||
d->hostname = ogs_strdup(s->hostname);
|
||||
ogs_expect_or_return_val(d->hostname, OGS_ERROR);
|
||||
if (!d->hostname) {
|
||||
ogs_error("ogs_memdup() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
} else {
|
||||
d->hostname = (*dst)->hostname;
|
||||
}
|
||||
|
@ -287,7 +299,10 @@ ogs_sockaddr_t *ogs_link_local_addr(const char *dev, const ogs_sockaddr_t *sa)
|
|||
continue;
|
||||
|
||||
addr = ogs_calloc(1, sizeof(ogs_sockaddr_t));
|
||||
ogs_expect_or_return_val(addr, NULL);
|
||||
if (!addr) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
ogs_assert(addr);
|
||||
memcpy(&addr->sa, cur->ifa_addr, ogs_sockaddr_len(cur->ifa_addr));
|
||||
|
||||
|
|
|
@ -55,7 +55,10 @@ ogs_sock_t *ogs_sock_create(void)
|
|||
ogs_sock_t *sock = NULL;
|
||||
|
||||
sock = ogs_calloc(1, sizeof(*sock));
|
||||
ogs_expect_or_return_val(sock, NULL);
|
||||
if (!sock) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sock->fd = INVALID_SOCKET;
|
||||
|
||||
|
|
|
@ -39,7 +39,10 @@ ogs_socknode_t *ogs_socknode_new(ogs_sockaddr_t *addr)
|
|||
ogs_assert(addr);
|
||||
|
||||
node = ogs_calloc(1, sizeof(ogs_socknode_t));
|
||||
ogs_expect_or_return_val(node, NULL);
|
||||
if (!node) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
node->addr = addr;
|
||||
|
||||
|
|
|
@ -237,7 +237,10 @@ char *ogs_strdup_debug(const char *s, const char *file_line)
|
|||
|
||||
len = strlen(s) + 1;
|
||||
res = ogs_memdup_debug(s, len, file_line);
|
||||
ogs_expect_or_return_val(res, res);
|
||||
if (!res) {
|
||||
ogs_error("ogs_memdup_debug[len:%d] failed", (int)len);
|
||||
return res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -254,7 +257,10 @@ char *ogs_strndup_debug(
|
|||
if (end != NULL)
|
||||
n = end - s;
|
||||
res = ogs_malloc_debug(n + 1, file_line);
|
||||
ogs_expect_or_return_val(res, res);
|
||||
if (!res) {
|
||||
ogs_error("ogs_malloc_debug[n:%d] failed", (int)n);
|
||||
return res;
|
||||
}
|
||||
memcpy(res, s, n);
|
||||
res[n] = '\0';
|
||||
return res;
|
||||
|
@ -269,7 +275,10 @@ void *ogs_memdup_debug(
|
|||
return NULL;
|
||||
|
||||
res = ogs_malloc_debug(n, file_line);
|
||||
ogs_expect_or_return_val(res, res);
|
||||
if (!res) {
|
||||
ogs_error("ogs_malloc_debug[n:%d] failed", (int)n);
|
||||
return res;
|
||||
}
|
||||
memcpy(res, m, n);
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -77,7 +77,10 @@ static void *thread_worker(void *arg)
|
|||
ogs_thread_t *ogs_thread_create(void (*func)(void *), void *data)
|
||||
{
|
||||
ogs_thread_t *thread = ogs_calloc(1, sizeof *thread);
|
||||
ogs_expect_or_return_val(thread, NULL);
|
||||
if (!thread) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ogs_thread_mutex_init(&thread->mutex);
|
||||
ogs_thread_cond_init(&thread->cond);
|
||||
|
|
|
@ -55,7 +55,10 @@ static void add_timer_node(
|
|||
ogs_timer_mgr_t *ogs_timer_mgr_create(unsigned int capacity)
|
||||
{
|
||||
ogs_timer_mgr_t *manager = ogs_calloc(1, sizeof *manager);
|
||||
ogs_expect_or_return_val(manager, NULL);
|
||||
if (!manager) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ogs_pool_init(&manager->pool, capacity);
|
||||
|
||||
|
@ -87,7 +90,6 @@ ogs_timer_t *ogs_timer_add(
|
|||
ogs_fatal("ogs_pool_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
ogs_expect_or_return_val(timer, NULL);
|
||||
|
||||
memset(timer, 0, sizeof *timer);
|
||||
timer->cb = cb;
|
||||
|
|
|
@ -107,12 +107,21 @@ static ogs_tlv_t *tlv_add_leaf(
|
|||
case OGS_TV_INT8:
|
||||
{
|
||||
ogs_tlv_uint8_t *v = (ogs_tlv_uint8_t *)msg;
|
||||
if (parent_tlv)
|
||||
if (parent_tlv) {
|
||||
tlv = ogs_tlv_embed(parent_tlv, tlv_mode,
|
||||
desc->type, 1, desc->instance, &v->u8);
|
||||
else
|
||||
tlv = ogs_tlv_add(tlv, tlv_mode, desc->type, 1, desc->instance, &v->u8);
|
||||
ogs_expect_or_return_val(tlv, NULL);
|
||||
if (!tlv) {
|
||||
ogs_error("ogs_tlv_embed()");
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
tlv = ogs_tlv_add(tlv, tlv_mode,
|
||||
desc->type, 1, desc->instance, &v->u8);
|
||||
if (!tlv) {
|
||||
ogs_error("ogs_tlv_add()");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OGS_TLV_UINT16:
|
||||
|
@ -124,12 +133,21 @@ static ogs_tlv_t *tlv_add_leaf(
|
|||
|
||||
v->u16 = htobe16(v->u16);
|
||||
|
||||
if (parent_tlv)
|
||||
if (parent_tlv) {
|
||||
tlv = ogs_tlv_embed(parent_tlv, tlv_mode,
|
||||
desc->type, 2, desc->instance, &v->u16);
|
||||
else
|
||||
tlv = ogs_tlv_add(tlv, tlv_mode, desc->type, 2, desc->instance, &v->u16);
|
||||
ogs_expect_or_return_val(tlv, NULL);
|
||||
if (!tlv) {
|
||||
ogs_error("ogs_tlv_embed()");
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
tlv = ogs_tlv_add(tlv, tlv_mode,
|
||||
desc->type, 2, desc->instance, &v->u16);
|
||||
if (!tlv) {
|
||||
ogs_error("ogs_tlv_add()");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OGS_TLV_UINT24:
|
||||
|
@ -142,12 +160,21 @@ static ogs_tlv_t *tlv_add_leaf(
|
|||
v->u24 = v->u24 << 8;
|
||||
v->u24 = htobe32(v->u24);
|
||||
|
||||
if (parent_tlv)
|
||||
if (parent_tlv) {
|
||||
tlv = ogs_tlv_embed(parent_tlv, tlv_mode,
|
||||
desc->type, 3, desc->instance, &v->u24);
|
||||
else
|
||||
tlv = ogs_tlv_add(tlv, tlv_mode, desc->type, 3, desc->instance, &v->u24);
|
||||
ogs_expect_or_return_val(tlv, NULL);
|
||||
if (!tlv) {
|
||||
ogs_error("ogs_tlv_embed()");
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
tlv = ogs_tlv_add(tlv, tlv_mode,
|
||||
desc->type, 3, desc->instance, &v->u24);
|
||||
if (!tlv) {
|
||||
ogs_error("ogs_tlv_add()");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OGS_TLV_UINT32:
|
||||
|
@ -159,13 +186,21 @@ static ogs_tlv_t *tlv_add_leaf(
|
|||
|
||||
v->u32 = htobe32(v->u32);
|
||||
|
||||
if (parent_tlv)
|
||||
if (parent_tlv) {
|
||||
tlv = ogs_tlv_embed(parent_tlv, tlv_mode,
|
||||
desc->type, 4, desc->instance, &v->u32);
|
||||
else
|
||||
if (!tlv) {
|
||||
ogs_error("ogs_tlv_embed()");
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
tlv = ogs_tlv_add(tlv, tlv_mode,
|
||||
desc->type, 4, desc->instance, &v->u32);
|
||||
ogs_expect_or_return_val(tlv, NULL);
|
||||
if (!tlv) {
|
||||
ogs_error("ogs_tlv_add()");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OGS_TLV_FIXED_STR:
|
||||
|
@ -173,13 +208,21 @@ static ogs_tlv_t *tlv_add_leaf(
|
|||
{
|
||||
ogs_tlv_octet_t *v = (ogs_tlv_octet_t *)msg;
|
||||
|
||||
if (parent_tlv)
|
||||
if (parent_tlv) {
|
||||
tlv = ogs_tlv_embed(parent_tlv, tlv_mode,
|
||||
desc->type, desc->length, desc->instance, v->data);
|
||||
else
|
||||
if (!tlv) {
|
||||
ogs_error("ogs_tlv_embed()");
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
tlv = ogs_tlv_add(tlv, tlv_mode,
|
||||
desc->type, desc->length, desc->instance, v->data);
|
||||
ogs_expect_or_return_val(tlv, NULL);
|
||||
if (!tlv) {
|
||||
ogs_error("ogs_tlv_add()");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OGS_TLV_VAR_STR:
|
||||
|
@ -189,33 +232,49 @@ static ogs_tlv_t *tlv_add_leaf(
|
|||
if (v->len == 0) {
|
||||
ogs_error("No TLV length - [%s] T:%d I:%d (vsz=%d)",
|
||||
desc->name, desc->type, desc->instance, desc->vsize);
|
||||
ogs_expect_or_return_val(0, NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (parent_tlv)
|
||||
if (parent_tlv) {
|
||||
tlv = ogs_tlv_embed(parent_tlv, tlv_mode,
|
||||
desc->type, v->len, desc->instance, v->data);
|
||||
else
|
||||
if (!tlv) {
|
||||
ogs_error("ogs_tlv_embed()");
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
tlv = ogs_tlv_add(tlv, tlv_mode,
|
||||
desc->type, v->len, desc->instance, v->data);
|
||||
ogs_expect_or_return_val(tlv, NULL);
|
||||
if (!tlv) {
|
||||
ogs_error("ogs_tlv_add()");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OGS_TLV_NULL:
|
||||
case OGS_TV_NULL:
|
||||
{
|
||||
if (parent_tlv)
|
||||
if (parent_tlv) {
|
||||
tlv = ogs_tlv_embed(parent_tlv, tlv_mode,
|
||||
desc->type, 0, desc->instance, NULL);
|
||||
else
|
||||
if (!tlv) {
|
||||
ogs_error("ogs_tlv_embed()");
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
tlv = ogs_tlv_add(tlv, tlv_mode,
|
||||
desc->type, 0, desc->instance, NULL);
|
||||
ogs_expect_or_return_val(tlv, NULL);
|
||||
if (!tlv) {
|
||||
ogs_error("ogs_tlv_add()");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ogs_expect_or_return_val(0, NULL);
|
||||
break;
|
||||
ogs_error("Unknown type [%d]", desc->ctype);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return tlv;
|
||||
|
@ -258,16 +317,21 @@ static uint32_t tlv_add_compound(ogs_tlv_t **root, ogs_tlv_t *parent_tlv,
|
|||
desc->vsize, p + offset2);
|
||||
|
||||
if (parent_tlv)
|
||||
tlv = ogs_tlv_embed(parent_tlv, tlv_ctype2mode(desc->ctype, mode),
|
||||
tlv = ogs_tlv_embed(parent_tlv,
|
||||
tlv_ctype2mode(desc->ctype, mode),
|
||||
desc->type, 0, desc->instance, NULL);
|
||||
else
|
||||
tlv = ogs_tlv_add(tlv, tlv_ctype2mode(desc->ctype, mode),
|
||||
tlv = ogs_tlv_add(tlv,
|
||||
tlv_ctype2mode(desc->ctype, mode),
|
||||
desc->type, 0, desc->instance, NULL);
|
||||
|
||||
r = tlv_add_compound(&emb_tlv, tlv, desc,
|
||||
p + offset2 + sizeof(ogs_tlv_presence_t),
|
||||
depth + 1, mode);
|
||||
ogs_expect_or_return_val(r > 0 && emb_tlv, 0);
|
||||
if (r <= 0 || !emb_tlv) {
|
||||
ogs_error("tlv_add_compound() failed");
|
||||
return 0;
|
||||
}
|
||||
count += 1 + r;
|
||||
} else {
|
||||
ogs_trace("BUILD %sL#%d [%s] T:%d L:%d I:%d "
|
||||
|
@ -276,8 +340,12 @@ static uint32_t tlv_add_compound(ogs_tlv_t **root, ogs_tlv_t *parent_tlv,
|
|||
desc->instance, desc->ctype, desc->vsize,
|
||||
p + offset2);
|
||||
|
||||
tlv = tlv_add_leaf(parent_tlv, tlv, desc, p + offset2, mode);
|
||||
ogs_expect_or_return_val(tlv, 0);
|
||||
tlv = tlv_add_leaf(parent_tlv, tlv, desc,
|
||||
p + offset2, mode);
|
||||
if (!tlv) {
|
||||
ogs_error("tlv_add_leaf() failed");
|
||||
return 0;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
|
@ -298,16 +366,21 @@ static uint32_t tlv_add_compound(ogs_tlv_t **root, ogs_tlv_t *parent_tlv,
|
|||
desc->vsize, p + offset);
|
||||
|
||||
if (parent_tlv)
|
||||
tlv = ogs_tlv_embed(parent_tlv, tlv_ctype2mode(desc->ctype, mode),
|
||||
tlv = ogs_tlv_embed(parent_tlv,
|
||||
tlv_ctype2mode(desc->ctype, mode),
|
||||
desc->type, 0, desc->instance, NULL);
|
||||
else
|
||||
tlv = ogs_tlv_add(tlv, tlv_ctype2mode(desc->ctype, mode),
|
||||
tlv = ogs_tlv_add(tlv,
|
||||
tlv_ctype2mode(desc->ctype, mode),
|
||||
desc->type, 0, desc->instance, NULL);
|
||||
|
||||
r = tlv_add_compound(&emb_tlv, tlv, desc,
|
||||
p + offset + sizeof(ogs_tlv_presence_t),
|
||||
depth + 1, mode);
|
||||
ogs_expect_or_return_val(r > 0 && emb_tlv, 0);
|
||||
if (r <= 0 || !emb_tlv) {
|
||||
ogs_error("tlv_add_compound() failed");
|
||||
return 0;
|
||||
}
|
||||
count += 1 + r;
|
||||
} else {
|
||||
ogs_trace("BUILD %sL#%d [%s] T:%d L:%d I:%d "
|
||||
|
@ -317,7 +390,10 @@ static uint32_t tlv_add_compound(ogs_tlv_t **root, ogs_tlv_t *parent_tlv,
|
|||
p + offset);
|
||||
|
||||
tlv = tlv_add_leaf(parent_tlv, tlv, desc, p + offset, mode);
|
||||
ogs_expect_or_return_val(tlv, 0);
|
||||
if (!tlv) {
|
||||
ogs_error("tlv_add_leaf() failed");
|
||||
return 0;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
|
@ -344,20 +420,30 @@ ogs_pkbuf_t *ogs_tlv_build_msg(ogs_tlv_desc_t *desc, void *msg, int mode)
|
|||
|
||||
if (desc->child_descs[0]) {
|
||||
r = tlv_add_compound(&root, NULL, desc, msg, 0, mode);
|
||||
ogs_expect_or_return_val(r > 0 && root, NULL);
|
||||
if (r <= 0 || !root) {
|
||||
ogs_error("tlv_add_compound() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
length = ogs_tlv_calc_length(root);
|
||||
} else {
|
||||
length = 0;
|
||||
}
|
||||
pkbuf = ogs_pkbuf_alloc(NULL, OGS_TLV_MAX_HEADROOM+length);
|
||||
ogs_expect_or_return_val(pkbuf, NULL);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_pkbuf_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
ogs_pkbuf_reserve(pkbuf, OGS_TLV_MAX_HEADROOM);
|
||||
ogs_pkbuf_put(pkbuf, length);
|
||||
|
||||
if (desc->child_descs[0]) {
|
||||
rendlen = ogs_tlv_render(root, pkbuf->data, length);
|
||||
ogs_expect_or_return_val(rendlen == length, NULL);
|
||||
if (rendlen != length) {
|
||||
ogs_error("ogs_tlv_render[rendlen:%d != length:%d] failed",
|
||||
rendlen, length);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ogs_tlv_free_all(root);
|
||||
}
|
||||
|
|
|
@ -530,7 +530,10 @@ ogs_gtp_node_t *ogs_gtp_node_new(ogs_sockaddr_t *sa_list)
|
|||
ogs_assert(sa_list);
|
||||
|
||||
ogs_pool_alloc(&pool, &node);
|
||||
ogs_expect_or_return_val(node, NULL);
|
||||
if (!node) {
|
||||
ogs_error("ogs_pool_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
memset(node, 0, sizeof(ogs_gtp_node_t));
|
||||
|
||||
node->sa_list = sa_list;
|
||||
|
@ -563,7 +566,10 @@ ogs_gtp_node_t *ogs_gtp_node_add_by_f_teid(
|
|||
ogs_assert(port);
|
||||
|
||||
rv = ogs_gtp2_f_teid_to_sockaddr(f_teid, port, &addr);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp2_f_teid_to_sockaddr() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rv = ogs_filter_ip_version(
|
||||
&addr,
|
||||
|
@ -688,7 +694,10 @@ ogs_gtp_node_t *ogs_gtp_node_add_by_ip(
|
|||
ogs_assert(port);
|
||||
|
||||
rv = ogs_ip_to_sockaddr(ip, port, &addr);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_ip_to_sockaddr() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rv = ogs_filter_ip_version(
|
||||
&addr,
|
||||
|
|
|
@ -30,7 +30,10 @@ int ogs_gtp1_gsn_addr_to_sockaddr(const ogs_gtp1_gsn_addr_t *gsnaddr,
|
|||
switch (gsnaddr_len) {
|
||||
case OGS_GTP_GSN_ADDRESS_IPV4_LEN:
|
||||
addr = ogs_calloc(1, sizeof(ogs_sockaddr_t));
|
||||
ogs_expect_or_return_val(addr, OGS_ERROR);
|
||||
if (!addr) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
addr->ogs_sa_family = AF_INET;
|
||||
addr->ogs_sin_port = port;
|
||||
addr->sin.sin_addr.s_addr = gsnaddr->addr;
|
||||
|
@ -38,7 +41,10 @@ int ogs_gtp1_gsn_addr_to_sockaddr(const ogs_gtp1_gsn_addr_t *gsnaddr,
|
|||
break;
|
||||
case OGS_GTP_GSN_ADDRESS_IPV6_LEN:
|
||||
addr6 = ogs_calloc(1, sizeof(ogs_sockaddr_t));
|
||||
ogs_expect_or_return_val(addr6, OGS_ERROR);
|
||||
if (!addr6) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
addr6->ogs_sa_family = AF_INET6;
|
||||
addr6->ogs_sin_port = port;
|
||||
memcpy(addr6->sin6.sin6_addr.s6_addr, gsnaddr->addr6, OGS_IPV6_LEN);
|
||||
|
|
|
@ -43,7 +43,10 @@ ogs_pkbuf_t *ogs_gtp1_handle_echo_req(ogs_pkbuf_t *pkb)
|
|||
|
||||
pkb_resp = ogs_pkbuf_alloc(NULL,
|
||||
100 /* enough for ECHO_RSP; use smaller buffer */);
|
||||
ogs_expect_or_return_val(pkb_resp, NULL);
|
||||
if (!pkb_resp) {
|
||||
ogs_error("ogs_pkbuf_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
ogs_pkbuf_put(pkb_resp, 100);
|
||||
gtph_resp = (ogs_gtp1_header_t *)pkb_resp->data;
|
||||
|
||||
|
@ -125,10 +128,16 @@ void ogs_gtp1_send_error_message(
|
|||
tlv->u8 = cause_value;
|
||||
|
||||
pkbuf = ogs_gtp1_build_msg(&errmsg);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_gtp1_build_msg() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp1_xact_update_tx(xact, &errmsg.h, pkbuf);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_xact_update_tx() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -151,7 +160,10 @@ void ogs_gtp1_send_echo_request(
|
|||
h.teid = 0;
|
||||
|
||||
pkbuf = ogs_gtp1_build_echo_request(h.type);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_gtp1_build_echo_request() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
xact = ogs_gtp1_xact_local_create(gnode, &h, pkbuf, NULL, NULL);
|
||||
|
||||
|
@ -174,10 +186,16 @@ void ogs_gtp1_send_echo_response(ogs_gtp_xact_t *xact, uint8_t recovery)
|
|||
h.teid = 0;
|
||||
|
||||
pkbuf = ogs_gtp1_build_echo_response(h.type, recovery);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_gtp1_build_echo_response() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp1_xact_update_tx(xact, &h, pkbuf);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_xact_update_tx() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
|
|
@ -68,7 +68,10 @@ ogs_pkbuf_t *ogs_gtp2_build_error_indication(
|
|||
|
||||
pkbuf = ogs_pkbuf_alloc(
|
||||
NULL, 100 /* enough for Error Indiciation; use smaller buffer */);
|
||||
ogs_expect_or_return_val(pkbuf, NULL);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_pkbuf_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
ogs_pkbuf_reserve(pkbuf, OGS_GTPV1U_5GC_HEADER_LEN);
|
||||
|
||||
/*
|
||||
|
|
|
@ -28,7 +28,10 @@ int ogs_gtp2_f_teid_to_sockaddr(
|
|||
ogs_assert(list);
|
||||
|
||||
addr = ogs_calloc(1, sizeof(ogs_sockaddr_t));
|
||||
ogs_expect_or_return_val(addr, OGS_ERROR);
|
||||
if (!addr) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
addr->ogs_sa_family = AF_INET;
|
||||
addr->ogs_sin_port = htobe16(port);
|
||||
|
||||
|
|
|
@ -149,7 +149,10 @@ ogs_pkbuf_t *ogs_gtp2_handle_echo_req(ogs_pkbuf_t *pkb)
|
|||
|
||||
pkb_resp = ogs_pkbuf_alloc(NULL,
|
||||
100 /* enough for ECHO_RSP; use smaller buffer */);
|
||||
ogs_expect_or_return_val(pkb_resp, NULL);
|
||||
if (!pkb_resp) {
|
||||
ogs_error("ogs_pkbuf_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
ogs_pkbuf_put(pkb_resp, 100);
|
||||
gtph_resp = (ogs_gtp2_header_t *)pkb_resp->data;
|
||||
|
||||
|
@ -266,10 +269,16 @@ void ogs_gtp2_send_error_message(
|
|||
tlv->data = &cause;
|
||||
|
||||
pkbuf = ogs_gtp2_build_msg(&errmsg);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_gtp2_build_msg() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(xact, &errmsg.h, pkbuf);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -292,7 +301,10 @@ void ogs_gtp2_send_echo_request(
|
|||
h.teid = 0;
|
||||
|
||||
pkbuf = ogs_gtp2_build_echo_request(h.type, recovery, features);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_gtp2_build_echo_request() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
xact = ogs_gtp_xact_local_create(gnode, &h, pkbuf, NULL, NULL);
|
||||
|
||||
|
@ -316,10 +328,16 @@ void ogs_gtp2_send_echo_response(ogs_gtp_xact_t *xact,
|
|||
h.teid = 0;
|
||||
|
||||
pkbuf = ogs_gtp2_build_echo_response(h.type, recovery, features);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_gtp2_build_echo_response() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(xact, &h, pkbuf);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
|
|
@ -81,25 +81,44 @@ char *ogs_nas_5gs_suci_from_mobile_identity(
|
|||
(ogs_nas_5gs_mobile_identity_suci_t *)mobile_identity->buffer;
|
||||
ogs_assert(mobile_identity_suci);
|
||||
|
||||
ogs_expect_or_return_val(mobile_identity_suci->h.supi_format ==
|
||||
OGS_NAS_5GS_SUPI_FORMAT_IMSI, NULL);
|
||||
ogs_expect_or_return_val(mobile_identity_suci->protection_scheme_id ==
|
||||
OGS_PROTECTION_SCHEME_NULL || mobile_identity_suci->protection_scheme_id ==
|
||||
OGS_PROTECTION_SCHEME_PROFILE_A || mobile_identity_suci->protection_scheme_id ==
|
||||
OGS_PROTECTION_SCHEME_PROFILE_B, NULL);
|
||||
if (mobile_identity_suci->h.supi_format !=
|
||||
OGS_NAS_5GS_SUPI_FORMAT_IMSI) {
|
||||
ogs_error("Not implemented SUPI format [%d]",
|
||||
mobile_identity_suci->h.supi_format);
|
||||
return NULL;
|
||||
}
|
||||
if (mobile_identity_suci->protection_scheme_id !=
|
||||
OGS_PROTECTION_SCHEME_NULL &&
|
||||
mobile_identity_suci->protection_scheme_id !=
|
||||
OGS_PROTECTION_SCHEME_PROFILE_A &&
|
||||
mobile_identity_suci->protection_scheme_id !=
|
||||
OGS_PROTECTION_SCHEME_PROFILE_B) {
|
||||
ogs_error("Not supported Protection-Scheme-Id [%d]",
|
||||
mobile_identity_suci->protection_scheme_id);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
suci = ogs_msprintf("suci-%d-", mobile_identity_suci->h.supi_format);
|
||||
ogs_expect_or_return_val(suci, NULL);
|
||||
if (!suci) {
|
||||
ogs_error("ogs_msprintf() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ogs_nas_to_plmn_id(&plmn_id, &mobile_identity_suci->nas_plmn_id);
|
||||
if (ogs_plmn_id_mnc_len(&plmn_id) == 2) {
|
||||
suci = ogs_mstrcatf(suci, "%03d-%02d-",
|
||||
ogs_plmn_id_mcc(&plmn_id), ogs_plmn_id_mnc(&plmn_id));
|
||||
ogs_expect_or_return_val(suci, NULL);
|
||||
if (!suci) {
|
||||
ogs_error("ogs_mstrcatf() failed");
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
suci = ogs_mstrcatf(suci, "%03d-%03d-",
|
||||
ogs_plmn_id_mcc(&plmn_id), ogs_plmn_id_mnc(&plmn_id));
|
||||
ogs_expect_or_return_val(suci, NULL);
|
||||
if (!suci) {
|
||||
ogs_error("ogs_mstrcatf() failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
memset(routing_indicator, 0, sizeof(routing_indicator));
|
||||
|
|
|
@ -2817,7 +2817,10 @@ ogs_pkbuf_t *ogs_nas_5gmm_encode(ogs_nas_5gs_message_t *message)
|
|||
/* The Packet Buffer(ogs_pkbuf_t) for NAS message MUST make a HEADROOM.
|
||||
* When calculating AES_CMAC, we need to use the headroom of the packet. */
|
||||
pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
|
||||
ogs_expect_or_return_val(pkbuf, NULL);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_pkbuf_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
ogs_pkbuf_reserve(pkbuf, OGS_NAS_HEADROOM);
|
||||
ogs_pkbuf_put(pkbuf, OGS_MAX_SDU_LEN-OGS_NAS_HEADROOM);
|
||||
|
||||
|
@ -2984,7 +2987,10 @@ ogs_pkbuf_t *ogs_nas_5gsm_encode(ogs_nas_5gs_message_t *message)
|
|||
/* The Packet Buffer(ogs_pkbuf_t) for NAS message MUST make a HEADROOM.
|
||||
* When calculating AES_CMAC, we need to use the headroom of the packet. */
|
||||
pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
|
||||
ogs_expect_or_return_val(pkbuf, NULL);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_pkbuf_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
ogs_pkbuf_reserve(pkbuf, OGS_NAS_HEADROOM);
|
||||
ogs_pkbuf_put(pkbuf, OGS_MAX_SDU_LEN-OGS_NAS_HEADROOM);
|
||||
|
||||
|
|
|
@ -886,7 +886,10 @@ f.write("""ogs_pkbuf_t *ogs_nas_5gmm_encode(ogs_nas_5gs_message_t *message)
|
|||
/* The Packet Buffer(ogs_pkbuf_t) for NAS message MUST make a HEADROOM.
|
||||
* When calculating AES_CMAC, we need to use the headroom of the packet. */
|
||||
pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
|
||||
ogs_expect_or_return_val(pkbuf, NULL);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_pkbuf_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
ogs_pkbuf_reserve(pkbuf, OGS_NAS_HEADROOM);
|
||||
ogs_pkbuf_put(pkbuf, OGS_MAX_SDU_LEN-OGS_NAS_HEADROOM);
|
||||
|
||||
|
@ -937,7 +940,10 @@ f.write("""ogs_pkbuf_t *ogs_nas_5gsm_encode(ogs_nas_5gs_message_t *message)
|
|||
/* The Packet Buffer(ogs_pkbuf_t) for NAS message MUST make a HEADROOM.
|
||||
* When calculating AES_CMAC, we need to use the headroom of the packet. */
|
||||
pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
|
||||
ogs_expect_or_return_val(pkbuf, NULL);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_pkbuf_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
ogs_pkbuf_reserve(pkbuf, OGS_NAS_HEADROOM);
|
||||
ogs_pkbuf_put(pkbuf, OGS_MAX_SDU_LEN-OGS_NAS_HEADROOM);
|
||||
|
||||
|
|
|
@ -383,7 +383,10 @@ int ogs_nas_build_qos_flow_descriptions(
|
|||
ogs_assert(num_of_flow_description);
|
||||
|
||||
buffer = ogs_calloc(1, OGS_NAS_MAX_QOS_FLOW_DESCRIPTIONS_LEN);
|
||||
ogs_expect_or_return_val(buffer, OGS_ERROR);
|
||||
if (!buffer) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
length = 0;
|
||||
|
||||
for (i = 0; i < num_of_flow_description; i++) {
|
||||
|
@ -528,7 +531,10 @@ int ogs_nas_build_qos_rules(ogs_nas_qos_rules_t *rules,
|
|||
ogs_assert(num_of_rule);
|
||||
|
||||
buffer = ogs_calloc(1, OGS_NAS_MAX_QOS_RULES_LEN);
|
||||
ogs_expect_or_return_val(buffer, OGS_ERROR);
|
||||
if (!buffer) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_assert(buffer);
|
||||
length = 0;
|
||||
|
||||
|
|
|
@ -3243,7 +3243,10 @@ ogs_pkbuf_t *ogs_nas_emm_encode(ogs_nas_eps_message_t *message)
|
|||
/* The Packet Buffer(ogs_pkbuf_t) for NAS message MUST make a HEADROOM.
|
||||
* When calculating AES_CMAC, we need to use the headroom of the packet. */
|
||||
pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
|
||||
ogs_expect_or_return_val(pkbuf, NULL);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_pkbuf_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
ogs_pkbuf_reserve(pkbuf, OGS_NAS_HEADROOM);
|
||||
ogs_pkbuf_put(pkbuf, OGS_MAX_SDU_LEN-OGS_NAS_HEADROOM);
|
||||
|
||||
|
@ -3429,7 +3432,10 @@ ogs_pkbuf_t *ogs_nas_esm_encode(ogs_nas_eps_message_t *message)
|
|||
/* The Packet Buffer(ogs_pkbuf_t) for NAS message MUST make a HEADROOM.
|
||||
* When calculating AES_CMAC, we need to use the headroom of the packet. */
|
||||
pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
|
||||
ogs_expect_or_return_val(pkbuf, NULL);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_pkbuf_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
ogs_pkbuf_reserve(pkbuf, OGS_NAS_HEADROOM);
|
||||
ogs_pkbuf_put(pkbuf, OGS_MAX_SDU_LEN-OGS_NAS_HEADROOM);
|
||||
|
||||
|
|
|
@ -913,7 +913,10 @@ f.write("""ogs_pkbuf_t *ogs_nas_emm_encode(ogs_nas_eps_message_t *message)
|
|||
/* The Packet Buffer(ogs_pkbuf_t) for NAS message MUST make a HEADROOM.
|
||||
* When calculating AES_CMAC, we need to use the headroom of the packet. */
|
||||
pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
|
||||
ogs_expect_or_return_val(pkbuf, NULL);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_pkbuf_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
ogs_pkbuf_reserve(pkbuf, OGS_NAS_HEADROOM);
|
||||
ogs_pkbuf_put(pkbuf, OGS_MAX_SDU_LEN-OGS_NAS_HEADROOM);
|
||||
|
||||
|
@ -976,7 +979,10 @@ f.write("""ogs_pkbuf_t *ogs_nas_esm_encode(ogs_nas_eps_message_t *message)
|
|||
/* The Packet Buffer(ogs_pkbuf_t) for NAS message MUST make a HEADROOM.
|
||||
* When calculating AES_CMAC, we need to use the headroom of the packet. */
|
||||
pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
|
||||
ogs_expect_or_return_val(pkbuf, NULL);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_pkbuf_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
ogs_pkbuf_reserve(pkbuf, OGS_NAS_HEADROOM);
|
||||
ogs_pkbuf_put(pkbuf, OGS_MAX_SDU_LEN-OGS_NAS_HEADROOM);
|
||||
|
||||
|
|
|
@ -31,7 +31,10 @@ ogs_pkbuf_t *ogs_ngap_encode(ogs_ngap_message_t *message)
|
|||
asn_fprint(stdout, &asn_DEF_NGAP_NGAP_PDU, message);
|
||||
|
||||
pkbuf = ogs_asn_encode(&asn_DEF_NGAP_NGAP_PDU, message);
|
||||
ogs_expect_or_return_val(pkbuf, NULL);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_asn_encode() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pkbuf;
|
||||
}
|
||||
|
|
|
@ -70,7 +70,10 @@ ogs_pkbuf_t *ogs_pfcp_cp_build_association_setup_request(uint8_t type)
|
|||
ogs_pfcp_self()->pfcp_addr, ogs_pfcp_self()->pfcp_addr6,
|
||||
ogs_app()->parameter.prefer_ipv4,
|
||||
&node_id, &node_id_len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_sockaddr_to_node_id() failed");
|
||||
return NULL;
|
||||
}
|
||||
req->node_id.presence = 1;
|
||||
req->node_id.data = &node_id;
|
||||
req->node_id.len = node_id_len;
|
||||
|
@ -103,7 +106,10 @@ ogs_pkbuf_t *ogs_pfcp_cp_build_association_setup_response(uint8_t type,
|
|||
ogs_pfcp_self()->pfcp_addr, ogs_pfcp_self()->pfcp_addr6,
|
||||
ogs_app()->parameter.prefer_ipv4,
|
||||
&node_id, &node_id_len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_sockaddr_to_node_id() failed");
|
||||
return NULL;
|
||||
}
|
||||
rsp->node_id.presence = 1;
|
||||
rsp->node_id.data = &node_id;
|
||||
rsp->node_id.len = node_id_len;
|
||||
|
@ -143,7 +149,10 @@ ogs_pkbuf_t *ogs_pfcp_up_build_association_setup_request(uint8_t type)
|
|||
ogs_pfcp_self()->pfcp_addr, ogs_pfcp_self()->pfcp_addr6,
|
||||
ogs_app()->parameter.prefer_ipv4,
|
||||
&node_id, &node_id_len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_sockaddr_to_node_id() failed");
|
||||
return NULL;
|
||||
}
|
||||
req->node_id.presence = 1;
|
||||
req->node_id.data = &node_id;
|
||||
req->node_id.len = node_id_len;
|
||||
|
@ -199,7 +208,10 @@ ogs_pkbuf_t *ogs_pfcp_up_build_association_setup_response(uint8_t type,
|
|||
ogs_pfcp_self()->pfcp_addr, ogs_pfcp_self()->pfcp_addr6,
|
||||
ogs_app()->parameter.prefer_ipv4,
|
||||
&node_id, &node_id_len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_sockaddr_to_node_id() failed");
|
||||
return NULL;
|
||||
}
|
||||
rsp->node_id.presence = 1;
|
||||
rsp->node_id.data = &node_id;
|
||||
rsp->node_id.len = node_id_len;
|
||||
|
|
|
@ -766,11 +766,17 @@ int ogs_pfcp_setup_far_gtpu_node(ogs_pfcp_far_t *far)
|
|||
if (!gnode) {
|
||||
gnode = ogs_gtp_node_add_by_ip(
|
||||
&ogs_gtp_self()->gtpu_peer_list, &ip, ogs_gtp_self()->gtpu_port);
|
||||
ogs_expect_or_return_val(gnode, OGS_ERROR);
|
||||
if (!gnode) {
|
||||
ogs_error("ogs_gtp_node_add_by_ip() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_connect(
|
||||
ogs_gtp_self()->gtpu_sock, ogs_gtp_self()->gtpu_sock6, gnode);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_connect() failed");
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
OGS_SETUP_GTP_NODE(far, gnode);
|
||||
|
@ -790,17 +796,26 @@ int ogs_pfcp_setup_pdr_gtpu_node(ogs_pfcp_pdr_t *pdr)
|
|||
if (pdr->f_teid_len == 0) return OGS_DONE;
|
||||
|
||||
rv = ogs_pfcp_f_teid_to_ip(&pdr->f_teid, &ip);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_f_teid_to_ip() failed");
|
||||
return rv;
|
||||
}
|
||||
|
||||
gnode = ogs_gtp_node_find_by_ip(&ogs_gtp_self()->gtpu_peer_list, &ip);
|
||||
if (!gnode) {
|
||||
gnode = ogs_gtp_node_add_by_ip(
|
||||
&ogs_gtp_self()->gtpu_peer_list, &ip, ogs_gtp_self()->gtpu_port);
|
||||
ogs_expect_or_return_val(gnode, OGS_ERROR);
|
||||
if (!gnode) {
|
||||
ogs_error("ogs_gtp_node_add_by_ip() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_connect(
|
||||
ogs_gtp_self()->gtpu_sock, ogs_gtp_self()->gtpu_sock6, gnode);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_connect() failed");
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
OGS_SETUP_GTP_NODE(pdr, gnode);
|
||||
|
|
|
@ -81,12 +81,19 @@ int ogs_pfcp_f_seid_to_sockaddr(
|
|||
ogs_assert(list);
|
||||
|
||||
addr = ogs_calloc(1, sizeof(ogs_sockaddr_t));
|
||||
ogs_expect_or_return_val(addr, OGS_ERROR);
|
||||
if (!addr) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
addr->ogs_sa_family = AF_INET;
|
||||
addr->ogs_sin_port = htobe16(port);
|
||||
|
||||
addr6 = ogs_calloc(1, sizeof(ogs_sockaddr_t));
|
||||
ogs_expect_or_return_val(addr6, OGS_ERROR);
|
||||
if (!addr6) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
ogs_free(addr);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
addr6->ogs_sa_family = AF_INET6;
|
||||
addr6->ogs_sin_port = htobe16(port);
|
||||
|
||||
|
@ -185,8 +192,14 @@ int ogs_pfcp_sockaddr_to_f_teid(
|
|||
{
|
||||
const int hdr_len = 5;
|
||||
|
||||
ogs_expect_or_return_val(addr || addr6, OGS_ERROR);
|
||||
ogs_expect_or_return_val(f_teid, OGS_ERROR);
|
||||
if (!addr && !addr6) {
|
||||
ogs_error("No addr");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
if (!f_teid) {
|
||||
ogs_error("No F-TEID");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
memset(f_teid, 0, sizeof *f_teid);
|
||||
|
||||
if (addr && addr6) {
|
||||
|
@ -226,23 +239,35 @@ int ogs_pfcp_f_teid_to_sockaddr(
|
|||
|
||||
if (f_teid->ipv4 && f_teid->ipv6) {
|
||||
*addr = ogs_calloc(1, sizeof(**addr));
|
||||
ogs_expect_or_return_val(*addr, OGS_ERROR);
|
||||
if (!(*addr)) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
(*addr)->sin.sin_addr.s_addr = f_teid->both.addr;
|
||||
(*addr)->ogs_sa_family = AF_INET;
|
||||
|
||||
*addr6 = ogs_calloc(1, sizeof(**addr6));
|
||||
ogs_expect_or_return_val(*addr6, OGS_ERROR);
|
||||
if (!(*addr6)) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
memcpy((*addr6)->sin6.sin6_addr.s6_addr,
|
||||
f_teid->both.addr6, OGS_IPV6_LEN);
|
||||
(*addr6)->ogs_sa_family = AF_INET6;
|
||||
} else if (f_teid->ipv4) {
|
||||
*addr = ogs_calloc(1, sizeof(**addr));
|
||||
ogs_expect_or_return_val(*addr, OGS_ERROR);
|
||||
if (!(*addr)) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
(*addr)->sin.sin_addr.s_addr = f_teid->addr;
|
||||
(*addr)->ogs_sa_family = AF_INET;
|
||||
} else if (f_teid->ipv6) {
|
||||
*addr6 = ogs_calloc(1, sizeof(**addr6));
|
||||
ogs_expect_or_return_val(*addr6, OGS_ERROR);
|
||||
if (!(*addr6)) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
memcpy((*addr6)->sin6.sin6_addr.s6_addr, f_teid->addr6, OGS_IPV6_LEN);
|
||||
(*addr6)->ogs_sa_family = AF_INET6;
|
||||
} else {
|
||||
|
|
|
@ -27,7 +27,10 @@ bool ogs_pfcp_handle_heartbeat_request(
|
|||
ogs_assert(xact);
|
||||
|
||||
rv = ogs_pfcp_send_heartbeat_response(xact);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, false);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_send_heartbeat_response() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -192,7 +195,10 @@ bool ogs_pfcp_up_handle_pdr(
|
|||
memset(report, 0, sizeof(*report));
|
||||
|
||||
sendbuf = ogs_pkbuf_copy(recvbuf);
|
||||
ogs_expect_or_return_val(sendbuf, false);
|
||||
if (!sendbuf) {
|
||||
ogs_error("ogs_pkbuf_copy() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
buffering = false;
|
||||
|
||||
|
|
|
@ -143,13 +143,22 @@ int ogs_pfcp_send_heartbeat_request(ogs_pfcp_node_t *node,
|
|||
h.seid = 0;
|
||||
|
||||
xact = ogs_pfcp_xact_local_create(node, cb, node);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_pfcp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
pkbuf = ogs_pfcp_build_heartbeat_request(h.type);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_pfcp_build_heartbeat_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, pkbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -170,10 +179,16 @@ int ogs_pfcp_send_heartbeat_response(ogs_pfcp_xact_t *xact)
|
|||
h.seid = 0;
|
||||
|
||||
pkbuf = ogs_pfcp_build_heartbeat_response(h.type);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_pfcp_build_heartbeat_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, pkbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -196,13 +211,22 @@ int ogs_pfcp_cp_send_association_setup_request(ogs_pfcp_node_t *node,
|
|||
h.seid = 0;
|
||||
|
||||
xact = ogs_pfcp_xact_local_create(node, cb, node);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_pfcp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
pkbuf = ogs_pfcp_cp_build_association_setup_request(h.type);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_pfcp_cp_build_association_setup_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, pkbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -224,10 +248,16 @@ int ogs_pfcp_cp_send_association_setup_response(ogs_pfcp_xact_t *xact,
|
|||
h.seid = 0;
|
||||
|
||||
pkbuf = ogs_pfcp_cp_build_association_setup_response(h.type, cause);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_pfcp_cp_build_association_setup_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, pkbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -250,13 +280,22 @@ int ogs_pfcp_up_send_association_setup_request(ogs_pfcp_node_t *node,
|
|||
h.seid = 0;
|
||||
|
||||
xact = ogs_pfcp_xact_local_create(node, cb, node);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_pfcp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
pkbuf = ogs_pfcp_up_build_association_setup_request(h.type);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_pfcp_build_heartbeat_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, pkbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -278,10 +317,16 @@ int ogs_pfcp_up_send_association_setup_response(ogs_pfcp_xact_t *xact,
|
|||
h.seid = 0;
|
||||
|
||||
pkbuf = ogs_pfcp_up_build_association_setup_response(h.type, cause);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_pfcp_up_build_association_setup_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, pkbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -355,7 +400,10 @@ int ogs_pfcp_send_end_marker(ogs_pfcp_pdr_t *pdr)
|
|||
}
|
||||
|
||||
sendbuf = ogs_pkbuf_alloc(NULL, OGS_GTPV1U_5GC_HEADER_LEN);
|
||||
ogs_expect_or_return_val(sendbuf, OGS_ERROR);
|
||||
if (!sendbuf) {
|
||||
ogs_error("ogs_pkbuf_alloc() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_pkbuf_reserve(sendbuf, OGS_GTPV1U_5GC_HEADER_LEN);
|
||||
|
||||
memset(>p_hdesc, 0, sizeof(gtp_hdesc));
|
||||
|
@ -460,10 +508,16 @@ void ogs_pfcp_send_error_message(
|
|||
}
|
||||
|
||||
pkbuf = ogs_pfcp_build_msg(&errmsg);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_pfcp_build_msg() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &errmsg.h, pkbuf);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
|
|
@ -160,7 +160,10 @@ char *ogs_amf_id_to_string(ogs_amf_id_t *amf_id)
|
|||
ogs_assert(amf_id);
|
||||
|
||||
str = ogs_calloc(1, OGS_AMFIDSTRLEN);
|
||||
ogs_expect_or_return_val(str, NULL);
|
||||
if (!str) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ogs_hex_to_ascii(amf_id, sizeof(ogs_amf_id_t), str, OGS_AMFIDSTRLEN);
|
||||
|
||||
|
@ -457,8 +460,14 @@ int ogs_ip_to_sockaddr(ogs_ip_t *ip, uint16_t port, ogs_sockaddr_t **list)
|
|||
int ogs_sockaddr_to_ip(
|
||||
ogs_sockaddr_t *addr, ogs_sockaddr_t *addr6, ogs_ip_t *ip)
|
||||
{
|
||||
ogs_expect_or_return_val(ip, OGS_ERROR);
|
||||
ogs_expect_or_return_val(addr || addr6, OGS_ERROR);
|
||||
if (!ip) {
|
||||
ogs_error("No IP");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
if (!addr && !addr) {
|
||||
ogs_error("No Address");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
memset(ip, 0, sizeof(ogs_ip_t));
|
||||
|
||||
|
@ -487,7 +496,10 @@ char *ogs_ipv4_to_string(uint32_t addr)
|
|||
char *buf = NULL;
|
||||
|
||||
buf = ogs_calloc(1, OGS_ADDRSTRLEN);
|
||||
ogs_expect_or_return_val(buf, NULL);
|
||||
if (!buf) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (char*)OGS_INET_NTOP(&addr, buf);
|
||||
}
|
||||
|
@ -498,7 +510,10 @@ char *ogs_ipv6addr_to_string(uint8_t *addr6)
|
|||
ogs_assert(addr6);
|
||||
|
||||
buf = ogs_calloc(1, OGS_ADDRSTRLEN);
|
||||
ogs_expect_or_return_val(buf, NULL);
|
||||
if (!buf) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (char *)OGS_INET6_NTOP(addr6, buf);
|
||||
}
|
||||
|
@ -513,7 +528,10 @@ char *ogs_ipv6prefix_to_string(uint8_t *addr6, uint8_t prefixlen)
|
|||
memcpy(tmp, addr6, prefixlen >> 3);
|
||||
|
||||
buf = ogs_calloc(1, OGS_ADDRSTRLEN);
|
||||
ogs_expect_or_return_val(buf, NULL);
|
||||
if (!buf) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (OGS_INET6_NTOP(tmp, buf) == NULL) {
|
||||
ogs_fatal("Invalid IPv6 address");
|
||||
|
@ -571,7 +589,10 @@ int ogs_ipv6prefix_from_string(uint8_t *addr6, uint8_t *prefixlen, char *string)
|
|||
ogs_assert(prefixlen);
|
||||
ogs_assert(string);
|
||||
pv = v = ogs_strdup(string);
|
||||
ogs_expect_or_return_val(v, OGS_ERROR);
|
||||
if (!v) {
|
||||
ogs_error("ogs_strdup() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
ipstr = strsep(&v, "/");
|
||||
if (ipstr)
|
||||
|
@ -584,7 +605,10 @@ int ogs_ipv6prefix_from_string(uint8_t *addr6, uint8_t *prefixlen, char *string)
|
|||
}
|
||||
|
||||
rv = ogs_inet_pton(AF_INET6, ipstr, &tmp);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_inet_pton() failed");
|
||||
return rv;
|
||||
}
|
||||
|
||||
memcpy(addr6, tmp.sin6.sin6_addr.s6_addr, OGS_IPV6_LEN);
|
||||
*prefixlen = atoi(mask_or_numbits);
|
||||
|
|
|
@ -31,7 +31,10 @@ ogs_pkbuf_t *ogs_s1ap_encode(ogs_s1ap_message_t *message)
|
|||
asn_fprint(stdout, &asn_DEF_S1AP_S1AP_PDU, message);
|
||||
|
||||
pkbuf = ogs_asn_encode(&asn_DEF_S1AP_S1AP_PDU, message);
|
||||
ogs_expect_or_return_val(pkbuf, NULL);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_asn_encode() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pkbuf;
|
||||
}
|
||||
|
|
|
@ -1798,7 +1798,6 @@ ogs_sbi_xact_t *ogs_sbi_xact_add(
|
|||
ogs_error("ogs_pool_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
ogs_expect_or_return_val(xact, NULL);
|
||||
memset(xact, 0, sizeof(ogs_sbi_xact_t));
|
||||
|
||||
xact->sbi_object = sbi_object;
|
||||
|
|
120
lib/sbi/conv.c
120
lib/sbi/conv.c
|
@ -89,7 +89,10 @@ char *ogs_supi_from_suci(char *suci)
|
|||
|
||||
ogs_assert(suci);
|
||||
tmp = ogs_strdup(suci);
|
||||
ogs_expect_or_return_val(tmp, NULL);
|
||||
if (!tmp) {
|
||||
ogs_error("ogs_strdup() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
p = tmp;
|
||||
i = 0;
|
||||
|
@ -777,7 +780,10 @@ char *ogs_sbi_s_nssai_to_string(ogs_s_nssai_t *s_nssai)
|
|||
sNSSAI.sd = ogs_s_nssai_sd_to_string(s_nssai->sd);
|
||||
|
||||
item = OpenAPI_snssai_convertToJSON(&sNSSAI);
|
||||
ogs_expect_or_return_val(item, NULL);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_snssai_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
if (sNSSAI.sd) ogs_free(sNSSAI.sd);
|
||||
|
||||
v = cJSON_Print(item);
|
||||
|
@ -819,12 +825,23 @@ OpenAPI_plmn_id_t *ogs_sbi_build_plmn_id(ogs_plmn_id_t *plmn_id)
|
|||
ogs_assert(plmn_id);
|
||||
|
||||
PlmnId = ogs_calloc(1, sizeof(*PlmnId));
|
||||
ogs_expect_or_return_val(PlmnId, NULL);
|
||||
if (!PlmnId) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PlmnId->mcc = ogs_plmn_id_mcc_string(plmn_id);
|
||||
ogs_expect_or_return_val(PlmnId->mcc, NULL);
|
||||
if (!PlmnId->mcc) {
|
||||
ogs_error("ogs_plmn_id_mcc_string() failed");
|
||||
ogs_sbi_free_plmn_id(PlmnId);
|
||||
return NULL;
|
||||
}
|
||||
PlmnId->mnc = ogs_plmn_id_mnc_string(plmn_id);
|
||||
ogs_expect_or_return_val(PlmnId->mnc, NULL);
|
||||
if (!PlmnId->mnc) {
|
||||
ogs_error("ogs_plmn_id_mnc_string() failed");
|
||||
ogs_sbi_free_plmn_id(PlmnId);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return PlmnId;
|
||||
}
|
||||
|
@ -862,12 +879,23 @@ OpenAPI_plmn_id_nid_t *ogs_sbi_build_plmn_id_nid(ogs_plmn_id_t *plmn_id)
|
|||
ogs_assert(plmn_id);
|
||||
|
||||
PlmnIdNid = ogs_calloc(1, sizeof(*PlmnIdNid));
|
||||
ogs_expect_or_return_val(PlmnIdNid, NULL);
|
||||
if (!PlmnIdNid) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PlmnIdNid->mcc = ogs_plmn_id_mcc_string(plmn_id);
|
||||
ogs_expect_or_return_val(PlmnIdNid->mcc, NULL);
|
||||
if (!PlmnIdNid->mcc) {
|
||||
ogs_error("ogs_plmn_id_mcc_string() failed");
|
||||
ogs_sbi_free_plmn_id_nid(PlmnIdNid);
|
||||
return NULL;
|
||||
}
|
||||
PlmnIdNid->mnc = ogs_plmn_id_mnc_string(plmn_id);
|
||||
ogs_expect_or_return_val(PlmnIdNid->mnc, NULL);
|
||||
if (!PlmnIdNid->mnc) {
|
||||
ogs_error("ogs_plmn_id_mnc_string() failed");
|
||||
ogs_sbi_free_plmn_id_nid(PlmnIdNid);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return PlmnIdNid;
|
||||
}
|
||||
|
@ -907,12 +935,23 @@ OpenAPI_guami_t *ogs_sbi_build_guami(ogs_guami_t *guami)
|
|||
ogs_assert(guami);
|
||||
|
||||
Guami = ogs_calloc(1, sizeof(*Guami));
|
||||
ogs_assert(Guami);
|
||||
if (!Guami) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Guami->plmn_id = ogs_sbi_build_plmn_id_nid(&guami->plmn_id);
|
||||
ogs_expect_or_return_val(Guami->plmn_id, NULL);
|
||||
if (!Guami->plmn_id) {
|
||||
ogs_error("ogs_sbi_build_plmn_id_nid() failed");
|
||||
ogs_sbi_free_guami(Guami);
|
||||
return NULL;
|
||||
}
|
||||
Guami->amf_id = ogs_amf_id_to_string(&guami->amf_id);
|
||||
ogs_expect_or_return_val(Guami->amf_id, NULL);
|
||||
if (!Guami->amf_id) {
|
||||
ogs_error("ogs_amf_id_to_string() failed");
|
||||
ogs_sbi_free_guami(Guami);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return Guami;
|
||||
}
|
||||
|
@ -951,24 +990,49 @@ OpenAPI_nr_location_t *ogs_sbi_build_nr_location(
|
|||
ogs_assert(tai);
|
||||
ogs_assert(nr_cgi);
|
||||
|
||||
Tai = ogs_calloc(1, sizeof(*Tai));
|
||||
ogs_expect_or_return_val(Tai, NULL);
|
||||
Tai->plmn_id = ogs_sbi_build_plmn_id(&tai->plmn_id);
|
||||
ogs_expect_or_return_val(Tai->plmn_id, NULL);
|
||||
Tai->tac = ogs_uint24_to_0string(tai->tac);
|
||||
ogs_expect_or_return_val(Tai->tac, NULL);
|
||||
|
||||
Ncgi = ogs_calloc(1, sizeof(*Ncgi));
|
||||
ogs_expect_or_return_val(Ncgi, NULL);
|
||||
Ncgi->plmn_id = ogs_sbi_build_plmn_id(&nr_cgi->plmn_id);
|
||||
ogs_expect_or_return_val(Ncgi->plmn_id, NULL);
|
||||
Ncgi->nr_cell_id = ogs_uint36_to_0string(nr_cgi->cell_id);
|
||||
ogs_expect_or_return_val(Ncgi->nr_cell_id, NULL);
|
||||
|
||||
NrLocation = ogs_calloc(1, sizeof(*NrLocation));
|
||||
ogs_expect_or_return_val(NrLocation, NULL);
|
||||
NrLocation->tai = Tai;
|
||||
NrLocation->ncgi = Ncgi;
|
||||
if (!NrLocation) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NrLocation->tai = Tai = ogs_calloc(1, sizeof(*Tai));
|
||||
if (!Tai) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
ogs_sbi_free_nr_location(NrLocation);
|
||||
return NULL;
|
||||
}
|
||||
Tai->plmn_id = ogs_sbi_build_plmn_id(&tai->plmn_id);
|
||||
if (!Tai->plmn_id) {
|
||||
ogs_error("ogs_sbi_build_plmn_id() failed");
|
||||
ogs_sbi_free_nr_location(NrLocation);
|
||||
return NULL;
|
||||
}
|
||||
Tai->tac = ogs_uint24_to_0string(tai->tac);
|
||||
if (!Tai->tac) {
|
||||
ogs_error("ogs_uint24_to_0string() failed");
|
||||
ogs_sbi_free_nr_location(NrLocation);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NrLocation->ncgi = Ncgi = ogs_calloc(1, sizeof(*Ncgi));
|
||||
if (!Ncgi) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
ogs_sbi_free_nr_location(NrLocation);
|
||||
return NULL;
|
||||
}
|
||||
Ncgi->plmn_id = ogs_sbi_build_plmn_id(&nr_cgi->plmn_id);
|
||||
if (!Ncgi->plmn_id) {
|
||||
ogs_error("ogs_sbi_build_plmn_id() failed");
|
||||
ogs_sbi_free_nr_location(NrLocation);
|
||||
return NULL;
|
||||
}
|
||||
Ncgi->nr_cell_id = ogs_uint36_to_0string(nr_cgi->cell_id);
|
||||
if (!Ncgi->nr_cell_id) {
|
||||
ogs_error("ogs_uint36_to_0string() failed");
|
||||
ogs_sbi_free_nr_location(NrLocation);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return NrLocation;
|
||||
}
|
||||
|
|
|
@ -196,13 +196,24 @@ ogs_sbi_request_t *ogs_sbi_request_new(void)
|
|||
ogs_sbi_request_t *request = NULL;
|
||||
|
||||
ogs_pool_alloc(&request_pool, &request);
|
||||
ogs_expect_or_return_val(request, NULL);
|
||||
if (!request) {
|
||||
ogs_error("ogs_pool_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
memset(request, 0, sizeof(ogs_sbi_request_t));
|
||||
|
||||
request->http.params = ogs_hash_make();
|
||||
ogs_expect_or_return_val(request->http.params, NULL);
|
||||
if (!request->http.params) {
|
||||
ogs_error("ogs_hash_make() failed");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
request->http.headers = ogs_hash_make();
|
||||
ogs_expect_or_return_val(request->http.headers, NULL);
|
||||
if (!request->http.headers) {
|
||||
ogs_error("ogs_hash_make() failed");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return request;
|
||||
}
|
||||
|
@ -212,13 +223,24 @@ ogs_sbi_response_t *ogs_sbi_response_new(void)
|
|||
ogs_sbi_response_t *response = NULL;
|
||||
|
||||
ogs_pool_alloc(&response_pool, &response);
|
||||
ogs_expect_or_return_val(response, NULL);
|
||||
if (!response) {
|
||||
ogs_error("ogs_pool_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
memset(response, 0, sizeof(ogs_sbi_response_t));
|
||||
|
||||
response->http.params = ogs_hash_make();
|
||||
ogs_expect_or_return_val(response->http.params, NULL);
|
||||
if (!response->http.params) {
|
||||
ogs_error("ogs_hash_make() failed");
|
||||
ogs_sbi_response_free(response);
|
||||
return NULL;
|
||||
}
|
||||
response->http.headers = ogs_hash_make();
|
||||
ogs_expect_or_return_val(response->http.headers, NULL);
|
||||
if (!response->http.headers) {
|
||||
ogs_error("ogs_hash_make() failed");
|
||||
ogs_sbi_response_free(response);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
@ -260,37 +282,88 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
|
|||
ogs_assert(message);
|
||||
|
||||
request = ogs_sbi_request_new();
|
||||
ogs_expect_or_return_val(request, NULL);
|
||||
if (!request) {
|
||||
ogs_error("ogs_pool_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ogs_expect_or_return_val(message->h.method, NULL);
|
||||
if (!message->h.method) {
|
||||
ogs_error("No Method");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
request->h.method = ogs_strdup(message->h.method);
|
||||
if (!request->h.method) {
|
||||
ogs_error("ogs_strdup() failed");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
if (message->h.uri) {
|
||||
request->h.uri = ogs_strdup(message->h.uri);
|
||||
ogs_expect_or_return_val(request->h.uri, NULL);
|
||||
if (!request->h.uri) {
|
||||
ogs_error("ogs_strdup() failed");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
ogs_expect_or_return_val(message->h.service.name, NULL);
|
||||
if (!message->h.service.name) {
|
||||
ogs_error("No Service Name");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
request->h.service.name = ogs_strdup(message->h.service.name);
|
||||
ogs_expect_or_return_val(message->h.api.version, NULL);
|
||||
if (!request->h.service.name) {
|
||||
ogs_error("ogs_strdup() failed");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
if (!message->h.api.version) {
|
||||
ogs_error("No API Version");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
request->h.api.version = ogs_strdup(message->h.api.version);
|
||||
ogs_expect_or_return_val(request->h.api.version, NULL);
|
||||
if (!request->h.api.version) {
|
||||
ogs_error("ogs_strdup() failed");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ogs_expect_or_return_val(message->h.resource.component[0], NULL);
|
||||
if (!message->h.resource.component[0]) {
|
||||
ogs_error("No Resource");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; i < OGS_SBI_MAX_NUM_OF_RESOURCE_COMPONENT &&
|
||||
message->h.resource.component[i]; i++)
|
||||
message->h.resource.component[i]; i++) {
|
||||
request->h.resource.component[i] = ogs_strdup(
|
||||
message->h.resource.component[i]);
|
||||
if (!request->h.resource.component[i]) {
|
||||
ogs_error("ogs_strdup() failed");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Discovery Parameter */
|
||||
if (message->param.target_nf_type) {
|
||||
char *v = OpenAPI_nf_type_ToString(message->param.target_nf_type);
|
||||
ogs_expect_or_return_val(v, NULL);
|
||||
if (!v) {
|
||||
ogs_error("OpenAPI_nf_type_ToString() failed");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
ogs_sbi_header_set(request->http.params,
|
||||
OGS_SBI_PARAM_TARGET_NF_TYPE, v);
|
||||
}
|
||||
if (message->param.requester_nf_type) {
|
||||
char *v = OpenAPI_nf_type_ToString(message->param.requester_nf_type);
|
||||
ogs_expect_or_return_val(v, NULL);
|
||||
if (!v) {
|
||||
ogs_error("OpenAPI_nf_type_ToString() failed");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
ogs_sbi_header_set(request->http.params,
|
||||
OGS_SBI_PARAM_REQUESTER_NF_TYPE, v);
|
||||
}
|
||||
|
@ -335,12 +408,20 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
|
|||
}
|
||||
if (message->param.nf_type) {
|
||||
char *v = OpenAPI_nf_type_ToString(message->param.nf_type);
|
||||
ogs_expect_or_return_val(v, NULL);
|
||||
if (!v) {
|
||||
ogs_error("OpenAPI_nf_type_ToString() failed");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
ogs_sbi_header_set(request->http.params, OGS_SBI_PARAM_NF_TYPE, v);
|
||||
}
|
||||
if (message->param.limit) {
|
||||
char *v = ogs_msprintf("%d", message->param.limit);
|
||||
ogs_expect_or_return_val(v, NULL);
|
||||
if (!v) {
|
||||
ogs_error("OpenAPI_nf_type_ToString() failed");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
ogs_sbi_header_set(request->http.params, OGS_SBI_PARAM_LIMIT, v);
|
||||
ogs_free(v);
|
||||
}
|
||||
|
@ -359,12 +440,20 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
|
|||
cJSON *item = NULL;
|
||||
|
||||
item = OpenAPI_plmn_id_convertToJSON(&plmn_id);
|
||||
ogs_expect_or_return_val(item, NULL);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_plmn_id_convertToJSON() failed");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
if (plmn_id.mnc) ogs_free(plmn_id.mnc);
|
||||
if (plmn_id.mcc) ogs_free(plmn_id.mcc);
|
||||
|
||||
v = cJSON_Print(item);
|
||||
ogs_expect_or_return_val(v, NULL);
|
||||
if (!v) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
cJSON_Delete(item);
|
||||
|
||||
ogs_sbi_header_set(request->http.params, OGS_SBI_PARAM_PLMN_ID, v);
|
||||
|
@ -373,13 +462,21 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
|
|||
}
|
||||
if (message->param.single_nssai_presence) {
|
||||
char *v = ogs_sbi_s_nssai_to_string(&message->param.s_nssai);
|
||||
ogs_expect_or_return_val(v, NULL);
|
||||
if (!v) {
|
||||
ogs_error("ogs_sbi_s_nssai_to_string() failed");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
ogs_sbi_header_set(request->http.params, OGS_SBI_PARAM_SINGLE_NSSAI, v);
|
||||
ogs_free(v);
|
||||
}
|
||||
if (message->param.snssai_presence) {
|
||||
char *v = ogs_sbi_s_nssai_to_string(&message->param.s_nssai);
|
||||
ogs_expect_or_return_val(v, NULL);
|
||||
if (!v) {
|
||||
ogs_error("ogs_sbi_s_nssai_to_string() failed");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
ogs_sbi_header_set(request->http.params, OGS_SBI_PARAM_SNSSAI, v);
|
||||
ogs_free(v);
|
||||
}
|
||||
|
@ -390,8 +487,16 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
|
|||
char *v = NULL;
|
||||
cJSON *item = NULL;
|
||||
|
||||
ogs_expect_or_return_val(message->param.s_nssai.sst, NULL);
|
||||
ogs_expect_or_return_val(message->param.roaming_indication, NULL);
|
||||
if (!message->param.s_nssai.sst) {
|
||||
ogs_error("No S-NSSAI SST");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
if (!message->param.roaming_indication) {
|
||||
ogs_error("No Roaming Indication");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(&sNSSAI, 0, sizeof(sNSSAI));
|
||||
sNSSAI.sst = message->param.s_nssai.sst;
|
||||
|
@ -405,10 +510,19 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
|
|||
|
||||
item = OpenAPI_slice_info_for_pdu_session_convertToJSON(
|
||||
&SliceInfoForPDUSession);
|
||||
ogs_expect_or_return_val(item, NULL);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_slice_info_for_pdu_session_convertToJSON() "
|
||||
"failed");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
v = cJSON_Print(item);
|
||||
ogs_expect_or_return_val(v, NULL);
|
||||
if (!v) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
cJSON_Delete(item);
|
||||
|
||||
ogs_sbi_header_set(request->http.params,
|
||||
|
@ -427,8 +541,11 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
|
|||
OGS_SBI_PARAM_IPV6PREFIX, message->param.ipv6prefix);
|
||||
}
|
||||
|
||||
ogs_expect_or_return_val(true ==
|
||||
build_content(&request->http, message), NULL);
|
||||
if (build_content(&request->http, message) == false) {
|
||||
ogs_error("build_content() failed");
|
||||
ogs_sbi_request_free(request);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (message->http.accept) {
|
||||
ogs_sbi_header_set(request->http.headers, OGS_SBI_ACCEPT,
|
||||
|
@ -489,13 +606,19 @@ ogs_sbi_response_t *ogs_sbi_build_response(
|
|||
ogs_assert(message);
|
||||
|
||||
response = ogs_sbi_response_new();
|
||||
ogs_expect_or_return_val(response, NULL);
|
||||
if (!response) {
|
||||
ogs_error("ogs_pool_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
response->status = status;
|
||||
|
||||
if (response->status != OGS_SBI_HTTP_STATUS_NO_CONTENT) {
|
||||
ogs_expect_or_return_val(true ==
|
||||
build_content(&response->http, message), NULL);
|
||||
if (build_content(&response->http, message) == false) {
|
||||
ogs_error("build_content() failed");
|
||||
ogs_sbi_response_free(response);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (message->http.location) {
|
||||
|
@ -2013,8 +2136,10 @@ static bool build_content(
|
|||
ogs_assert(http);
|
||||
|
||||
if (message->num_of_part) {
|
||||
ogs_expect_or_return_val(true ==
|
||||
build_multipart(http, message), false);
|
||||
if (build_multipart(http, message) == false) {
|
||||
ogs_error("build_multipart() failed");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
http->content = build_json(message);
|
||||
if (http->content) {
|
||||
|
@ -2229,8 +2354,10 @@ static int parse_multipart(
|
|||
data.part[i].content_type;
|
||||
http->part[http->num_of_part].pkbuf =
|
||||
ogs_pkbuf_alloc(NULL, data.part[i].content_length);
|
||||
ogs_expect_or_return_val(
|
||||
http->part[http->num_of_part].pkbuf, OGS_ERROR);
|
||||
if (!(http->part[http->num_of_part].pkbuf)) {
|
||||
ogs_error("ogs_pkbuf_alloc() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_pkbuf_put_data(http->part[http->num_of_part].pkbuf,
|
||||
data.part[i].content, data.part[i].content_length);
|
||||
|
||||
|
@ -2240,8 +2367,10 @@ static int parse_multipart(
|
|||
http->part[http->num_of_part].content_type;
|
||||
message->part[message->num_of_part].pkbuf =
|
||||
ogs_pkbuf_copy(http->part[http->num_of_part].pkbuf);
|
||||
ogs_expect_or_return_val(
|
||||
message->part[message->num_of_part].pkbuf, OGS_ERROR);
|
||||
if (!(message->part[http->num_of_part].pkbuf)) {
|
||||
ogs_error("ogs_pkbuf_alloc() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
http->num_of_part++;
|
||||
message->num_of_part++;
|
||||
|
@ -2286,7 +2415,10 @@ static bool build_multipart(
|
|||
ogs_base64_encode_binary(boundary + 2, digest, 16);
|
||||
|
||||
p = http->content = ogs_calloc(1, OGS_HUGE_LEN);
|
||||
ogs_expect_or_return_val(p, false);
|
||||
if (!p) {
|
||||
ogs_error("ogs_calloc() failed");
|
||||
return false;
|
||||
}
|
||||
last = p + OGS_HUGE_LEN;
|
||||
|
||||
/* First boundary */
|
||||
|
@ -2294,7 +2426,10 @@ static bool build_multipart(
|
|||
|
||||
/* Encapsulated multipart part (application/json) */
|
||||
json = build_json(message);
|
||||
ogs_expect_or_return_val(json, false);
|
||||
if (!json) {
|
||||
ogs_error("build_json() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
p = ogs_slprintf(p, last, "%s\r\n\r\n%s",
|
||||
OGS_SBI_CONTENT_TYPE ": " OGS_SBI_CONTENT_JSON_TYPE, json);
|
||||
|
@ -2319,7 +2454,10 @@ static bool build_multipart(
|
|||
|
||||
content_type = ogs_msprintf("%s; boundary=\"%s\"",
|
||||
OGS_SBI_CONTENT_MULTIPART_TYPE, boundary);
|
||||
ogs_expect_or_return_val(content_type, false);
|
||||
if (!content_type) {
|
||||
ogs_error("ogs_msprintf() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
ogs_sbi_header_set(http->headers, OGS_SBI_CONTENT_TYPE, content_type);
|
||||
|
||||
|
@ -2428,7 +2566,10 @@ char *ogs_sbi_discovery_option_build_service_names(
|
|||
ogs_assert(discovery_option);
|
||||
|
||||
service_names = ogs_strdup(discovery_option->service_names[0]);
|
||||
ogs_expect_or_return_val(service_names, NULL);
|
||||
if (!service_names) {
|
||||
ogs_error("ogs_strdup() failed");
|
||||
return NULL;;
|
||||
}
|
||||
|
||||
if (discovery_option->num_of_service_names > 1) {
|
||||
for (i = 1; i < discovery_option->num_of_service_names; i++)
|
||||
|
|
|
@ -167,6 +167,7 @@ static int client_discover_cb(
|
|||
|
||||
bool ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact)
|
||||
{
|
||||
bool rc;
|
||||
ogs_sbi_client_t *client = NULL, *scp_client = NULL;
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
||||
|
@ -219,7 +220,6 @@ bool ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact)
|
|||
request->h.service.name, request->h.api.version);
|
||||
}
|
||||
} else {
|
||||
bool rc;
|
||||
OpenAPI_uri_scheme_e scheme = OpenAPI_uri_scheme_NULL;
|
||||
ogs_sockaddr_t *addr = NULL;
|
||||
|
||||
|
@ -252,9 +252,10 @@ bool ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact)
|
|||
|
||||
ogs_free(apiroot);
|
||||
|
||||
ogs_expect_or_return_val(true ==
|
||||
ogs_sbi_client_send_via_scp(
|
||||
scp_client, ogs_sbi_client_handler, request, xact), false);
|
||||
rc = ogs_sbi_client_send_via_scp(
|
||||
scp_client, ogs_sbi_client_handler, request, xact);
|
||||
ogs_expect(rc == true);
|
||||
return rc;
|
||||
|
||||
} else {
|
||||
/*
|
||||
|
@ -273,9 +274,10 @@ bool ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact)
|
|||
nf_instance->id);
|
||||
}
|
||||
|
||||
ogs_expect_or_return_val(true ==
|
||||
ogs_sbi_client_send_via_scp(
|
||||
scp_client, client_discover_cb, request, xact), false);
|
||||
rc = ogs_sbi_client_send_via_scp(
|
||||
scp_client, client_discover_cb, request, xact);
|
||||
ogs_expect(rc == true);
|
||||
return rc;
|
||||
}
|
||||
|
||||
} else if (client) {
|
||||
|
@ -284,9 +286,10 @@ bool ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact)
|
|||
***********************/
|
||||
|
||||
/* If `client` instance is available, use direct communication */
|
||||
ogs_expect_or_return_val(true ==
|
||||
ogs_sbi_client_send_request(
|
||||
client, ogs_sbi_client_handler, request, xact), false);
|
||||
rc = ogs_sbi_client_send_request(
|
||||
client, ogs_sbi_client_handler, request, xact);
|
||||
ogs_expect(rc == true);
|
||||
return rc;
|
||||
|
||||
} else {
|
||||
/**********************************************
|
||||
|
@ -339,11 +342,17 @@ bool ogs_sbi_discover_only(ogs_sbi_xact_t *xact)
|
|||
ogs_sbi_service_type_to_name(service_type));
|
||||
|
||||
client = NF_INSTANCE_CLIENT(nf_instance);
|
||||
ogs_expect_or_return_val(client, false);
|
||||
if (!client) {
|
||||
ogs_error("No Client");
|
||||
return false;
|
||||
}
|
||||
|
||||
request = ogs_nnrf_disc_build_discover(
|
||||
target_nf_type, requester_nf_type, discovery_option);
|
||||
ogs_expect_or_return_val(request, false);
|
||||
if (!request) {
|
||||
ogs_error("ogs_nnrf_disc_build_discover() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
rc = ogs_sbi_client_send_request(
|
||||
client, ogs_sbi_client_handler, request, xact);
|
||||
|
@ -363,6 +372,7 @@ bool ogs_sbi_discover_only(ogs_sbi_xact_t *xact)
|
|||
bool ogs_sbi_send_request_to_nf_instance(
|
||||
ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact)
|
||||
{
|
||||
bool rc;
|
||||
ogs_sbi_request_t *request = NULL;
|
||||
ogs_sbi_client_t *client = NULL;
|
||||
|
||||
|
@ -411,17 +421,18 @@ bool ogs_sbi_send_request_to_nf_instance(
|
|||
ogs_freeaddrinfo(addr);
|
||||
}
|
||||
|
||||
ogs_expect_or_return_val(true ==
|
||||
ogs_sbi_send_request_to_client(
|
||||
client, ogs_sbi_client_handler, request, xact), false);
|
||||
rc = ogs_sbi_send_request_to_client(
|
||||
client, ogs_sbi_client_handler, request, xact);
|
||||
ogs_expect(rc == true);
|
||||
|
||||
return true;
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool ogs_sbi_send_request_to_client(
|
||||
ogs_sbi_client_t *client, ogs_sbi_client_cb_f client_cb,
|
||||
ogs_sbi_request_t *request, void *data)
|
||||
{
|
||||
bool rc;
|
||||
ogs_sbi_client_t *scp_client = NULL;
|
||||
char *apiroot = NULL;
|
||||
|
||||
|
@ -449,9 +460,9 @@ bool ogs_sbi_send_request_to_client(
|
|||
|
||||
ogs_free(apiroot);
|
||||
|
||||
ogs_expect_or_return_val(true ==
|
||||
ogs_sbi_client_send_via_scp(
|
||||
scp_client, client_cb, request, data), false);
|
||||
rc = ogs_sbi_client_send_via_scp(
|
||||
scp_client, client_cb, request, data);
|
||||
ogs_expect(rc == true);
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -460,13 +471,13 @@ bool ogs_sbi_send_request_to_client(
|
|||
***********************/
|
||||
|
||||
/* Direct communication since `client' instance is always avaiable */
|
||||
ogs_expect_or_return_val(true ==
|
||||
ogs_sbi_client_send_request(
|
||||
client, client_cb, request, data), false);
|
||||
rc = ogs_sbi_client_send_request(
|
||||
client, client_cb, request, data);
|
||||
ogs_expect(rc == true);
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool ogs_sbi_send_notification_request(
|
||||
|
@ -474,6 +485,7 @@ bool ogs_sbi_send_notification_request(
|
|||
ogs_sbi_discovery_option_t *discovery_option,
|
||||
ogs_sbi_request_t *request, void *data)
|
||||
{
|
||||
bool rc;
|
||||
ogs_sbi_client_t *client = NULL, *scp_client = NULL;
|
||||
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
|
||||
|
||||
|
@ -498,9 +510,9 @@ bool ogs_sbi_send_notification_request(
|
|||
build_default_discovery_parameter(
|
||||
request, service_type, discovery_option);
|
||||
|
||||
ogs_expect_or_return_val(true ==
|
||||
ogs_sbi_client_send_via_scp(
|
||||
scp_client, ogs_sbi_client_handler, request, data), false);
|
||||
rc = ogs_sbi_client_send_via_scp(
|
||||
scp_client, ogs_sbi_client_handler, request, data);
|
||||
ogs_expect(rc == true);
|
||||
|
||||
} else if (client) {
|
||||
|
||||
|
@ -509,9 +521,9 @@ bool ogs_sbi_send_notification_request(
|
|||
***********************/
|
||||
|
||||
/* NRF is avaiable */
|
||||
ogs_expect_or_return_val(true ==
|
||||
ogs_sbi_client_send_request(
|
||||
client, ogs_sbi_client_handler, request, data), false);
|
||||
rc = ogs_sbi_client_send_request(
|
||||
client, ogs_sbi_client_handler, request, data);
|
||||
ogs_expect(rc == true);
|
||||
|
||||
|
||||
} else {
|
||||
|
@ -520,6 +532,7 @@ bool ogs_sbi_send_notification_request(
|
|||
scp_client ? "SCP" : "No-SCP",
|
||||
ogs_sbi_service_type_to_name(service_type),
|
||||
request->h.service.name, request->h.api.version);
|
||||
rc = false;
|
||||
ogs_assert_if_reached();
|
||||
}
|
||||
|
||||
|
@ -536,7 +549,10 @@ bool ogs_sbi_send_response(ogs_sbi_stream_t *stream, int status)
|
|||
memset(&sendmsg, 0, sizeof(sendmsg));
|
||||
|
||||
response = ogs_sbi_build_response(&sendmsg, status);
|
||||
ogs_expect_or_return_val(response, false);
|
||||
if (!response) {
|
||||
ogs_error("ogs_sbi_build_response() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
return ogs_sbi_server_send_response(stream, response);
|
||||
}
|
||||
|
|
|
@ -229,10 +229,16 @@ bool bsf_sess_set_ipv4addr(bsf_sess_t *sess, char *ipv4addr_string)
|
|||
ogs_free(sess->ipv4addr_string);
|
||||
}
|
||||
rv = ogs_ipv4_from_string(&sess->ipv4addr, ipv4addr_string);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, false);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_ipv4_from_string() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
sess->ipv4addr_string = ogs_strdup(ipv4addr_string);
|
||||
ogs_expect_or_return_val(sess->ipv4addr_string, false);
|
||||
if (!sess->ipv4addr_string) {
|
||||
ogs_error("ogs_strdup() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
ogs_hash_set(self.ipv4addr_hash,
|
||||
&sess->ipv4addr, sizeof(sess->ipv4addr), sess);
|
||||
|
@ -254,12 +260,18 @@ bool bsf_sess_set_ipv6prefix(bsf_sess_t *sess, char *ipv6prefix_string)
|
|||
}
|
||||
rv = ogs_ipv6prefix_from_string(
|
||||
sess->ipv6prefix.addr6, &sess->ipv6prefix.len, ipv6prefix_string);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, false);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_ipv6prefix_from_string() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
ogs_assert(sess->ipv6prefix.len == OGS_IPV6_128_PREFIX_LEN);
|
||||
|
||||
sess->ipv6prefix_string = ogs_strdup(ipv6prefix_string);
|
||||
ogs_expect_or_return_val(sess->ipv6prefix_string, false);
|
||||
if (!sess->ipv6prefix_string) {
|
||||
ogs_error("ogs_strdup() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
ogs_hash_set(self.ipv6prefix_hash,
|
||||
&sess->ipv6prefix, (sess->ipv6prefix.len >> 3) + 1, sess);
|
||||
|
@ -301,7 +313,10 @@ bsf_sess_t *bsf_sess_find_by_ipv4addr(char *ipv4addr_string)
|
|||
ogs_assert(ipv4addr_string);
|
||||
|
||||
rv = ogs_ipv4_from_string(&ipv4addr, ipv4addr_string);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_ipv4_from_string() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ogs_hash_get(self.ipv4addr_hash, &ipv4addr, sizeof(ipv4addr));
|
||||
}
|
||||
|
|
|
@ -255,7 +255,7 @@ bool bsf_nbsf_management_handle_pcf_binding(
|
|||
ogs_assert(sess->pcf_ip[i].addr || sess->pcf_ip[i].addr6);
|
||||
|
||||
PcfIpEndPoint = ogs_calloc(1, sizeof(*PcfIpEndPoint));
|
||||
ogs_expect_or_return_val(PcfIpEndPoint, NULL);
|
||||
ogs_assert(PcfIpEndPoint);
|
||||
PcfIpEndPoint->ipv4_address = sess->pcf_ip[i].addr;
|
||||
PcfIpEndPoint->ipv6_address = sess->pcf_ip[i].addr6;
|
||||
|
||||
|
|
|
@ -1285,13 +1285,28 @@ static void hss_s6a_cla_cb(void *data, struct msg **msg)
|
|||
|
||||
/* Search the session, retrieve its data */
|
||||
ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new);
|
||||
ogs_expect_or_return(ret == 0);
|
||||
ogs_expect_or_return(new == 0);
|
||||
if (ret != 0) {
|
||||
ogs_error("fd_msg_sess_get() failed");
|
||||
return;
|
||||
}
|
||||
if (new != 0) {
|
||||
ogs_error("fd_msg_sess_get() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = fd_sess_state_retrieve(hss_s6a_reg, session, &sess_data);
|
||||
ogs_expect_or_return(ret == 0);
|
||||
ogs_expect_or_return(sess_data);
|
||||
ogs_expect_or_return((void *)sess_data == data);
|
||||
if (ret != 0) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
if (!sess_data) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
if ((void *)sess_data != data) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = fd_msg_free(*msg);
|
||||
ogs_assert(ret == 0);
|
||||
|
@ -1463,13 +1478,28 @@ static void hss_s6a_ida_cb(void *data, struct msg **msg)
|
|||
|
||||
/* Search the session, retrieve its data */
|
||||
ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new);
|
||||
ogs_expect_or_return(ret == 0);
|
||||
ogs_expect_or_return(new == 0);
|
||||
if (ret != 0) {
|
||||
ogs_error("fd_msg_sess_get() failed");
|
||||
return;
|
||||
}
|
||||
if (new != 0) {
|
||||
ogs_error("fd_msg_sess_get() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = fd_sess_state_retrieve(hss_s6a_reg, session, &sess_data);
|
||||
ogs_expect_or_return(ret == 0);
|
||||
ogs_expect_or_return(sess_data);
|
||||
ogs_expect_or_return((void *)sess_data == data);
|
||||
if (ret != 0) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
if (!sess_data) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
if ((void *)sess_data != data) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = fd_msg_free(*msg);
|
||||
ogs_assert(ret == 0);
|
||||
|
|
|
@ -842,13 +842,28 @@ static void mme_s6a_aia_cb(void *data, struct msg **msg)
|
|||
|
||||
/* Search the session, retrieve its data */
|
||||
ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new);
|
||||
ogs_expect_or_return(ret == 0);
|
||||
ogs_expect_or_return(new == 0);
|
||||
if (ret != 0) {
|
||||
ogs_error("fd_msg_sess_get() failed");
|
||||
return;
|
||||
}
|
||||
if (new != 0) {
|
||||
ogs_error("fd_msg_sess_get() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = fd_sess_state_retrieve(mme_s6a_reg, session, &sess_data);
|
||||
ogs_expect_or_return(ret == 0);
|
||||
ogs_expect_or_return(sess_data);
|
||||
ogs_expect_or_return((void *)sess_data == data);
|
||||
if (ret != 0) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
if (!sess_data) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
if ((void *)sess_data != data) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
mme_ue = sess_data->mme_ue;
|
||||
ogs_assert(mme_ue);
|
||||
|
@ -1338,13 +1353,28 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg)
|
|||
|
||||
/* Search the session, retrieve its data */
|
||||
ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new);
|
||||
ogs_expect_or_return(ret == 0);
|
||||
ogs_expect_or_return(new == 0);
|
||||
if (ret != 0) {
|
||||
ogs_error("fd_msg_sess_get() failed");
|
||||
return;
|
||||
}
|
||||
if (new != 0) {
|
||||
ogs_error("fd_msg_sess_get() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = fd_sess_state_retrieve(mme_s6a_reg, session, &sess_data);
|
||||
ogs_expect_or_return(ret == 0);
|
||||
ogs_expect_or_return(sess_data);
|
||||
ogs_expect_or_return((void *)sess_data == data);
|
||||
if (ret != 0) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
if (!sess_data) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
if ((void *)sess_data != data) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
mme_ue = sess_data->mme_ue;
|
||||
ogs_assert(mme_ue);
|
||||
|
@ -1575,13 +1605,28 @@ static void mme_s6a_pua_cb(void *data, struct msg **msg)
|
|||
|
||||
/* Search the session, retrieve its data */
|
||||
ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new);
|
||||
ogs_expect_or_return(ret == 0);
|
||||
ogs_expect_or_return(new == 0);
|
||||
if (ret != 0) {
|
||||
ogs_error("fd_msg_sess_get() failed");
|
||||
return;
|
||||
}
|
||||
if (new != 0) {
|
||||
ogs_error("fd_msg_sess_get() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = fd_sess_state_retrieve(mme_s6a_reg, session, &sess_data);
|
||||
ogs_expect_or_return(ret == 0);
|
||||
ogs_expect_or_return(sess_data);
|
||||
ogs_expect_or_return((void *)sess_data == data);
|
||||
if (ret != 0) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
if (!sess_data) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
if ((void *)sess_data != data) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
mme_ue = sess_data->mme_ue;
|
||||
ogs_assert(mme_ue);
|
||||
|
|
|
@ -225,10 +225,16 @@ int mme_gtp_send_create_session_request(mme_sess_t *sess, int create_action)
|
|||
h.teid = sgw_ue->sgw_s11_teid;
|
||||
|
||||
pkbuf = mme_s11_build_create_session_request(h.type, sess, create_action);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("mme_s11_build_create_session_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact = ogs_gtp_xact_local_create(sgw_ue->gnode, &h, pkbuf, timeout, sess);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_gtp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
xact->create_action = create_action;
|
||||
xact->local_teid = mme_ue->mme_s11_teid;
|
||||
|
||||
|
@ -258,10 +264,16 @@ int mme_gtp_send_modify_bearer_request(
|
|||
h.teid = sgw_ue->sgw_s11_teid;
|
||||
|
||||
pkbuf = mme_s11_build_modify_bearer_request(h.type, mme_ue, uli_presence);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("mme_s11_build_modify_bearer_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact = ogs_gtp_xact_local_create(sgw_ue->gnode, &h, pkbuf, timeout, mme_ue);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_gtp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
xact->modify_action = modify_action;
|
||||
xact->local_teid = mme_ue->mme_s11_teid;
|
||||
|
||||
|
@ -291,10 +303,16 @@ int mme_gtp_send_delete_session_request(
|
|||
h.teid = sgw_ue->sgw_s11_teid;
|
||||
|
||||
s11buf = mme_s11_build_delete_session_request(h.type, sess, action);
|
||||
ogs_expect_or_return_val(s11buf, OGS_ERROR);
|
||||
if (!s11buf) {
|
||||
ogs_error("mme_s11_build_delete_session_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact = ogs_gtp_xact_local_create(sgw_ue->gnode, &h, s11buf, timeout, sess);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_gtp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
xact->delete_action = action;
|
||||
xact->local_teid = mme_ue->mme_s11_teid;
|
||||
|
||||
|
@ -372,10 +390,16 @@ int mme_gtp_send_create_bearer_response(
|
|||
h.teid = sgw_ue->sgw_s11_teid;
|
||||
|
||||
pkbuf = mme_s11_build_create_bearer_response(h.type, bearer, cause_value);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("mme_s11_build_create_bearer_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(xact, &h, pkbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -411,10 +435,16 @@ int mme_gtp_send_update_bearer_response(
|
|||
h.teid = sgw_ue->sgw_s11_teid;
|
||||
|
||||
pkbuf = mme_s11_build_update_bearer_response(h.type, bearer, cause_value);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("mme_s11_build_update_bearer_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(xact, &h, pkbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -450,10 +480,16 @@ int mme_gtp_send_delete_bearer_response(
|
|||
h.teid = sgw_ue->sgw_s11_teid;
|
||||
|
||||
pkbuf = mme_s11_build_delete_bearer_response(h.type, bearer, cause_value);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("mme_s11_build_delete_bearer_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(xact, &h, pkbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -479,10 +515,16 @@ int mme_gtp_send_release_access_bearers_request(mme_ue_t *mme_ue, int action)
|
|||
h.teid = sgw_ue->sgw_s11_teid;
|
||||
|
||||
pkbuf = mme_s11_build_release_access_bearers_request(h.type);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("mme_s11_build_release_access_bearers_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact = ogs_gtp_xact_local_create(sgw_ue->gnode, &h, pkbuf, timeout, mme_ue);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_gtp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
xact->release_action = action;
|
||||
xact->local_teid = mme_ue->mme_s11_teid;
|
||||
|
||||
|
@ -570,10 +612,16 @@ int mme_gtp_send_downlink_data_notification_ack(
|
|||
h.teid = sgw_ue->sgw_s11_teid;
|
||||
|
||||
s11buf = mme_s11_build_downlink_data_notification_ack(h.type, cause_value);
|
||||
ogs_expect_or_return_val(s11buf, OGS_ERROR);
|
||||
if (!s11buf) {
|
||||
ogs_error("mme_s11_build_downlink_data_notification_ack() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(xact, &h, s11buf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -600,10 +648,17 @@ int mme_gtp_send_create_indirect_data_forwarding_tunnel_request(
|
|||
|
||||
pkbuf = mme_s11_build_create_indirect_data_forwarding_tunnel_request(
|
||||
h.type, mme_ue);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("mme_s11_build_create_indirect_data_forwarding_"
|
||||
"tunnel_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact = ogs_gtp_xact_local_create(sgw_ue->gnode, &h, pkbuf, timeout, mme_ue);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_gtp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
xact->local_teid = mme_ue->mme_s11_teid;
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
|
@ -631,11 +686,17 @@ int mme_gtp_send_delete_indirect_data_forwarding_tunnel_request(
|
|||
h.teid = sgw_ue->sgw_s11_teid;
|
||||
|
||||
pkbuf = ogs_pkbuf_alloc(NULL, OGS_TLV_MAX_HEADROOM);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_pkbuf_alloc() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_pkbuf_reserve(pkbuf, OGS_TLV_MAX_HEADROOM);
|
||||
|
||||
xact = ogs_gtp_xact_local_create(sgw_ue->gnode, &h, pkbuf, timeout, mme_ue);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_gtp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
xact->delete_indirect_action = action;
|
||||
xact->local_teid = mme_ue->mme_s11_teid;
|
||||
|
||||
|
@ -667,10 +728,16 @@ int mme_gtp_send_bearer_resource_command(
|
|||
h.teid = sgw_ue->sgw_s11_teid;
|
||||
|
||||
pkbuf = mme_s11_build_bearer_resource_command(h.type, bearer, nas_message);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("mme_s11_build_bearer_resource_command() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact = ogs_gtp_xact_local_create(sgw_ue->gnode, &h, pkbuf, timeout, bearer);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_gtp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
xact->xid |= OGS_GTP_CMD_XACT_ID;
|
||||
xact->local_teid = mme_ue->mme_s11_teid;
|
||||
|
||||
|
|
|
@ -558,7 +558,10 @@ ogs_pkbuf_t *mme_s11_build_create_bearer_response(
|
|||
enb_s1u_teid.interface_type = OGS_GTP2_F_TEID_S1_U_ENODEB_GTP_U;
|
||||
enb_s1u_teid.teid = htobe32(bearer->enb_s1u_teid);
|
||||
rv = ogs_gtp2_ip_to_f_teid(&bearer->enb_s1u_ip, &enb_s1u_teid, &len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp2_ip_to_f_teid() failed");
|
||||
return NULL;
|
||||
}
|
||||
rsp->bearer_contexts.s1_u_enodeb_f_teid.presence = 1;
|
||||
rsp->bearer_contexts.s1_u_enodeb_f_teid.data = &enb_s1u_teid;
|
||||
rsp->bearer_contexts.s1_u_enodeb_f_teid.len = len;
|
||||
|
@ -568,7 +571,10 @@ ogs_pkbuf_t *mme_s11_build_create_bearer_response(
|
|||
sgw_s1u_teid.interface_type = OGS_GTP2_F_TEID_S1_U_SGW_GTP_U;
|
||||
sgw_s1u_teid.teid = htobe32(bearer->sgw_s1u_teid);
|
||||
rv = ogs_gtp2_ip_to_f_teid(&bearer->sgw_s1u_ip, &sgw_s1u_teid, &len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp2_ip_to_f_teid() failed");
|
||||
return NULL;
|
||||
}
|
||||
rsp->bearer_contexts.s4_u_sgsn_f_teid.presence = 1;
|
||||
rsp->bearer_contexts.s4_u_sgsn_f_teid.data = &sgw_s1u_teid;
|
||||
rsp->bearer_contexts.s4_u_sgsn_f_teid.len = OGS_GTP2_F_TEID_IPV4_LEN;
|
||||
|
@ -886,7 +892,10 @@ ogs_pkbuf_t *mme_s11_build_create_indirect_data_forwarding_tunnel_request(
|
|||
dl_teid[i].teid = htobe32(bearer->enb_dl_teid);
|
||||
rv = ogs_gtp2_ip_to_f_teid(
|
||||
&bearer->enb_dl_ip, &dl_teid[i], &len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp2_ip_to_f_teid() failed");
|
||||
return NULL;
|
||||
}
|
||||
req->bearer_contexts[i].s1_u_enodeb_f_teid.presence = 1;
|
||||
req->bearer_contexts[i].s1_u_enodeb_f_teid.data = &dl_teid[i];
|
||||
req->bearer_contexts[i].s1_u_enodeb_f_teid.len = len;
|
||||
|
@ -899,7 +908,10 @@ ogs_pkbuf_t *mme_s11_build_create_indirect_data_forwarding_tunnel_request(
|
|||
ul_teid[i].teid = htobe32(bearer->enb_ul_teid);
|
||||
rv = ogs_gtp2_ip_to_f_teid(
|
||||
&bearer->enb_ul_ip, &ul_teid[i], &len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp2_ip_to_f_teid() failed");
|
||||
return NULL;
|
||||
}
|
||||
req->bearer_contexts[i].s12_rnc_f_teid.presence = 1;
|
||||
req->bearer_contexts[i].s12_rnc_f_teid.data = &ul_teid[i];
|
||||
req->bearer_contexts[i].s12_rnc_f_teid.len = len;
|
||||
|
|
|
@ -125,7 +125,10 @@ void mme_s11_handle_create_session_response(
|
|||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_commit() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
/************************
|
||||
* Getting Cause Value
|
||||
|
@ -461,7 +464,10 @@ void mme_s11_handle_modify_bearer_response(
|
|||
ogs_assert(sgw_ue);
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_commit() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
/************************
|
||||
* Getting Cause Value
|
||||
|
@ -576,7 +582,10 @@ void mme_s11_handle_delete_session_response(
|
|||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_commit() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
/************************
|
||||
* Check MME-UE Context
|
||||
|
@ -627,7 +636,10 @@ void mme_s11_handle_delete_session_response(
|
|||
} else if (action ==
|
||||
OGS_GTP_DELETE_SEND_DEACTIVATE_BEARER_CONTEXT_REQUEST) {
|
||||
mme_bearer_t *bearer = mme_default_bearer_in_sess(sess);
|
||||
ogs_expect_or_return(bearer);
|
||||
if (!bearer) {
|
||||
ogs_error("No Bearer");
|
||||
return;
|
||||
}
|
||||
|
||||
r = nas_eps_send_deactivate_bearer_context_request(bearer);
|
||||
ogs_expect(r == OGS_OK);
|
||||
|
@ -842,9 +854,12 @@ void mme_s11_handle_create_bearer_request(
|
|||
ogs_gtp2_f_teid_to_ip(pgw_s5u_teid, &bearer->pgw_s5u_ip));
|
||||
|
||||
/* Bearer QoS */
|
||||
ogs_expect_or_return(ogs_gtp2_parse_bearer_qos(&bearer_qos,
|
||||
&req->bearer_contexts.bearer_level_qos) ==
|
||||
req->bearer_contexts.bearer_level_qos.len);
|
||||
if (ogs_gtp2_parse_bearer_qos(
|
||||
&bearer_qos, &req->bearer_contexts.bearer_level_qos) !=
|
||||
req->bearer_contexts.bearer_level_qos.len) {
|
||||
ogs_error("ogs_gtp2_parse_bearer_qos() failed");
|
||||
return;
|
||||
}
|
||||
bearer->qos.index = bearer_qos.qci;
|
||||
bearer->qos.arp.priority_level = bearer_qos.priority_level;
|
||||
bearer->qos.arp.pre_emption_capability =
|
||||
|
@ -882,7 +897,10 @@ void mme_s11_handle_create_bearer_request(
|
|||
|
||||
/* Before Activate DEDICATED bearer, check DEFAULT bearer status */
|
||||
default_bearer = mme_default_bearer_in_sess(sess);
|
||||
ogs_expect_or_return(default_bearer);
|
||||
if (!default_bearer) {
|
||||
ogs_error("No Default Bearer");
|
||||
return;
|
||||
}
|
||||
|
||||
if (OGS_FSM_CHECK(&default_bearer->sm, esm_state_active)) {
|
||||
if (ECM_IDLE(mme_ue)) {
|
||||
|
@ -988,9 +1006,12 @@ void mme_s11_handle_update_bearer_request(
|
|||
|
||||
if (req->bearer_contexts.bearer_level_qos.presence == 1) {
|
||||
/* Bearer QoS */
|
||||
ogs_expect_or_return(ogs_gtp2_parse_bearer_qos(&bearer_qos,
|
||||
&req->bearer_contexts.bearer_level_qos) ==
|
||||
req->bearer_contexts.bearer_level_qos.len);
|
||||
if (ogs_gtp2_parse_bearer_qos(
|
||||
&bearer_qos, &req->bearer_contexts.bearer_level_qos) !=
|
||||
req->bearer_contexts.bearer_level_qos.len) {
|
||||
ogs_error("ogs_gtp2_parse_bearer_qos() failed");
|
||||
return;
|
||||
}
|
||||
bearer->qos.index = bearer_qos.qci;
|
||||
bearer->qos.arp.priority_level = bearer_qos.priority_level;
|
||||
bearer->qos.arp.pre_emption_capability =
|
||||
|
@ -1195,7 +1216,10 @@ void mme_s11_handle_release_access_bearers_response(
|
|||
ogs_assert(sgw_ue);
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_commit() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
/***********************
|
||||
* Check MME-UE Context
|
||||
|
@ -1492,7 +1516,10 @@ void mme_s11_handle_create_indirect_data_forwarding_tunnel_response(
|
|||
ogs_assert(sgw_ue);
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_commit() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
/************************
|
||||
* Getting Cause Value
|
||||
|
@ -1562,7 +1589,10 @@ void mme_s11_handle_create_indirect_data_forwarding_tunnel_response(
|
|||
|
||||
bearer = mme_bearer_find_by_ue_ebi(mme_ue,
|
||||
rsp->bearer_contexts[i].eps_bearer_id.u8);
|
||||
ogs_expect_or_return(bearer);
|
||||
if (!bearer) {
|
||||
ogs_error("No Bearer");
|
||||
return;
|
||||
}
|
||||
|
||||
if (rsp->bearer_contexts[i].s4_u_sgsn_f_teid.presence) {
|
||||
teid = rsp->bearer_contexts[i].s4_u_sgsn_f_teid.data;
|
||||
|
@ -1617,7 +1647,10 @@ void mme_s11_handle_delete_indirect_data_forwarding_tunnel_response(
|
|||
ogs_assert(sgw_ue);
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_commit() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
/************************
|
||||
* Getting Cause Value
|
||||
|
@ -1721,7 +1754,10 @@ void mme_s11_handle_bearer_resource_failure_indication(
|
|||
ogs_assert(sgw_ue);
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_commit() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mme_ue_from_teid)
|
||||
ogs_error("No Context in TEID");
|
||||
|
|
|
@ -50,7 +50,7 @@ void sgsap_handle_location_update_accept(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
|
|||
|
||||
root = ogs_tlv_parse_block(pkbuf->len, pkbuf->data, OGS_TLV_MODE_T1_L1);
|
||||
if (!root) {
|
||||
ogs_error("!root");
|
||||
ogs_error("ogs_tlv_parse_block() failed");
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ void sgsap_handle_location_update_reject(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
|
|||
|
||||
root = ogs_tlv_parse_block(pkbuf->len, pkbuf->data, OGS_TLV_MODE_T1_L1);
|
||||
if (!root) {
|
||||
ogs_error("!root");
|
||||
ogs_error("ogs_tlv_parse_block() failed");
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,10 @@ void sgsap_handle_location_update_reject(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
|
|||
goto error;
|
||||
}
|
||||
|
||||
ogs_expect_or_return(mme_ue);
|
||||
if (!mme_ue) {
|
||||
ogs_error("No UE(mme-ue) context");
|
||||
return;
|
||||
}
|
||||
|
||||
ogs_debug(" IMSI[%s] CAUSE[%d]", mme_ue->imsi_bcd, emm_cause);
|
||||
if (lai) {
|
||||
|
@ -239,13 +242,18 @@ void sgsap_handle_detach_ack(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
|
|||
ogs_debug("[SGSAP] EPS-DETACH-ACK");
|
||||
else if (type == SGSAP_IMSI_DETACH_ACK)
|
||||
ogs_debug("[SGSAP] IMSI-DETACH-ACK");
|
||||
else
|
||||
ogs_expect_or_return(0);
|
||||
else {
|
||||
ogs_error("Unknown type [%d]", type);
|
||||
return;
|
||||
}
|
||||
|
||||
ogs_pkbuf_pull(pkbuf, 1);
|
||||
|
||||
root = ogs_tlv_parse_block(pkbuf->len, pkbuf->data, OGS_TLV_MODE_T1_L1);
|
||||
ogs_expect_or_return(root);
|
||||
if (!root) {
|
||||
ogs_error("ogs_tlv_parse_block() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
iter = root;
|
||||
while (iter) {
|
||||
|
@ -263,17 +271,28 @@ void sgsap_handle_detach_ack(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
|
|||
|
||||
ogs_tlv_free_all(root);
|
||||
|
||||
ogs_expect_or_return(nas_mobile_identity_imsi);
|
||||
ogs_expect_or_return(nas_mobile_identity_imsi_len == SGSAP_IE_IMSI_LEN);
|
||||
if (!nas_mobile_identity_imsi) {
|
||||
ogs_error("No IMSI");
|
||||
return;
|
||||
}
|
||||
if (nas_mobile_identity_imsi_len != SGSAP_IE_IMSI_LEN) {
|
||||
ogs_error("Invalid IMSI len [%d]", nas_mobile_identity_imsi_len);
|
||||
return;
|
||||
}
|
||||
|
||||
if (nas_mobile_identity_imsi->type == OGS_NAS_MOBILE_IDENTITY_IMSI) {
|
||||
ogs_nas_eps_imsi_to_bcd(nas_mobile_identity_imsi,
|
||||
nas_mobile_identity_imsi_len, imsi_bcd);
|
||||
mme_ue = mme_ue_find_by_imsi_bcd(imsi_bcd);
|
||||
} else
|
||||
ogs_expect_or_return(0);
|
||||
} else {
|
||||
ogs_error("Unknown type [%d]", nas_mobile_identity_imsi->type);
|
||||
return;
|
||||
}
|
||||
|
||||
ogs_expect_or_return(mme_ue);
|
||||
if (!mme_ue) {
|
||||
ogs_error("No UE(mme-ue) context");
|
||||
return;
|
||||
}
|
||||
|
||||
ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd);
|
||||
|
||||
|
@ -302,7 +321,10 @@ void sgsap_handle_paging_request(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
|
|||
ogs_pkbuf_pull(pkbuf, 1);
|
||||
|
||||
root = ogs_tlv_parse_block(pkbuf->len, pkbuf->data, OGS_TLV_MODE_T1_L1);
|
||||
ogs_expect_or_return(root);
|
||||
if (!root) {
|
||||
ogs_error("ogs_tlv_parse_block() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
iter = root;
|
||||
while (iter) {
|
||||
|
@ -331,16 +353,24 @@ void sgsap_handle_paging_request(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
|
|||
|
||||
ogs_tlv_free_all(root);
|
||||
|
||||
ogs_expect_or_return(nas_mobile_identity_imsi);
|
||||
ogs_expect_or_return(nas_mobile_identity_imsi_len == SGSAP_IE_IMSI_LEN);
|
||||
if (!nas_mobile_identity_imsi) {
|
||||
ogs_error("No IMSI");
|
||||
return;
|
||||
}
|
||||
if (nas_mobile_identity_imsi_len != SGSAP_IE_IMSI_LEN) {
|
||||
ogs_error("Invalid IMSI len [%d]", nas_mobile_identity_imsi_len);
|
||||
return;
|
||||
}
|
||||
|
||||
if (nas_mobile_identity_imsi->type == OGS_NAS_MOBILE_IDENTITY_IMSI) {
|
||||
|
||||
ogs_nas_eps_imsi_to_bcd(nas_mobile_identity_imsi,
|
||||
nas_mobile_identity_imsi_len, imsi_bcd);
|
||||
mme_ue = mme_ue_find_by_imsi_bcd(imsi_bcd);
|
||||
} else
|
||||
ogs_expect_or_return(0);
|
||||
} else {
|
||||
ogs_error("Unknown type [%d]", nas_mobile_identity_imsi->type);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mme_ue) {
|
||||
ogs_assert(service_indicator);
|
||||
|
@ -423,7 +453,10 @@ void sgsap_handle_downlink_unitdata(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
|
|||
ogs_pkbuf_pull(pkbuf, 1);
|
||||
|
||||
root = ogs_tlv_parse_block(pkbuf->len, pkbuf->data, OGS_TLV_MODE_T1_L1);
|
||||
ogs_assert(root);
|
||||
if (!root) {
|
||||
ogs_error("ogs_tlv_parse_block() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
iter = root;
|
||||
while (iter) {
|
||||
|
@ -458,7 +491,10 @@ void sgsap_handle_downlink_unitdata(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
|
|||
} else
|
||||
ogs_assert_if_reached();
|
||||
|
||||
ogs_expect_or_return(mme_ue);
|
||||
if (!mme_ue) {
|
||||
ogs_error("No UE(mme-ue) context");
|
||||
return;
|
||||
}
|
||||
|
||||
ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd);
|
||||
ogs_log_hexdump(OGS_LOG_DEBUG,
|
||||
|
@ -499,7 +535,10 @@ void sgsap_handle_release_request(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
|
|||
ogs_pkbuf_pull(pkbuf, 1);
|
||||
|
||||
root = ogs_tlv_parse_block(pkbuf->len, pkbuf->data, OGS_TLV_MODE_T1_L1);
|
||||
ogs_expect_or_return(root);
|
||||
if (!root) {
|
||||
ogs_error("ogs_tlv_parse_block() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
iter = root;
|
||||
while (iter) {
|
||||
|
@ -517,16 +556,24 @@ void sgsap_handle_release_request(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
|
|||
|
||||
ogs_tlv_free_all(root);
|
||||
|
||||
ogs_expect_or_return(nas_mobile_identity_imsi);
|
||||
ogs_expect_or_return(nas_mobile_identity_imsi_len == SGSAP_IE_IMSI_LEN);
|
||||
if (!nas_mobile_identity_imsi) {
|
||||
ogs_error("No IMSI");
|
||||
return;
|
||||
}
|
||||
if (nas_mobile_identity_imsi_len != SGSAP_IE_IMSI_LEN) {
|
||||
ogs_error("Invalid IMSI len [%d]", nas_mobile_identity_imsi_len);
|
||||
return;
|
||||
}
|
||||
|
||||
if (nas_mobile_identity_imsi->type == OGS_NAS_MOBILE_IDENTITY_IMSI) {
|
||||
|
||||
ogs_nas_eps_imsi_to_bcd(nas_mobile_identity_imsi,
|
||||
nas_mobile_identity_imsi_len, imsi_bcd);
|
||||
mme_ue = mme_ue_find_by_imsi_bcd(imsi_bcd);
|
||||
} else
|
||||
ogs_expect_or_return(0);
|
||||
} else {
|
||||
ogs_error("Unknown type [%d]", nas_mobile_identity_imsi->type);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mme_ue)
|
||||
ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd);
|
||||
|
@ -553,7 +600,10 @@ void sgsap_handle_mm_information_request(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
|
|||
ogs_pkbuf_pull(pkbuf, 1);
|
||||
|
||||
root = ogs_tlv_parse_block(pkbuf->len, pkbuf->data, OGS_TLV_MODE_T1_L1);
|
||||
ogs_expect_or_return(root);
|
||||
if (!root) {
|
||||
ogs_error("ogs_tlv_parse_block() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
iter = root;
|
||||
while (iter) {
|
||||
|
@ -574,16 +624,24 @@ void sgsap_handle_mm_information_request(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
|
|||
|
||||
ogs_tlv_free_all(root);
|
||||
|
||||
ogs_expect_or_return(nas_mobile_identity_imsi);
|
||||
ogs_expect_or_return(nas_mobile_identity_imsi_len == SGSAP_IE_IMSI_LEN);
|
||||
if (!nas_mobile_identity_imsi) {
|
||||
ogs_error("No IMSI");
|
||||
return;
|
||||
}
|
||||
if (nas_mobile_identity_imsi_len != SGSAP_IE_IMSI_LEN) {
|
||||
ogs_error("Invalid IMSI len [%d]", nas_mobile_identity_imsi_len);
|
||||
return;
|
||||
}
|
||||
|
||||
if (nas_mobile_identity_imsi->type == OGS_NAS_MOBILE_IDENTITY_IMSI) {
|
||||
|
||||
ogs_nas_eps_imsi_to_bcd(nas_mobile_identity_imsi,
|
||||
nas_mobile_identity_imsi_len, imsi_bcd);
|
||||
mme_ue = mme_ue_find_by_imsi_bcd(imsi_bcd);
|
||||
} else
|
||||
ogs_expect_or_return(0);
|
||||
} else {
|
||||
ogs_error("Unknown type [%d]", nas_mobile_identity_imsi->type);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mme_ue)
|
||||
ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd);
|
||||
|
|
|
@ -40,7 +40,10 @@ void sgsap_state_initial(ogs_fsm_t *s, mme_event_t *e)
|
|||
|
||||
vlr->t_conn = ogs_timer_add(ogs_app()->timer_mgr,
|
||||
mme_timer_sgs_cli_conn_to_srv, vlr);
|
||||
ogs_expect_or_return(vlr->t_conn);
|
||||
if (!vlr->t_conn) {
|
||||
ogs_error("ogs_timer_add() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
OGS_FSM_TRAN(s, &sgsap_state_will_connect);
|
||||
}
|
||||
|
|
|
@ -205,7 +205,11 @@ bool nrf_nnrf_handle_nf_status_subscribe(
|
|||
if (SubscriptionData->req_nf_instance_id) {
|
||||
subscription_data->req_nf_instance_id =
|
||||
ogs_strdup(SubscriptionData->req_nf_instance_id);
|
||||
ogs_expect_or_return_val(subscription_data->req_nf_instance_id, NULL);
|
||||
if (!subscription_data->req_nf_instance_id) {
|
||||
ogs_error("ogs_strdup() failed");
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (SubscriptionData->subscription_id) {
|
||||
|
@ -214,7 +218,11 @@ bool nrf_nnrf_handle_nf_status_subscribe(
|
|||
ogs_free(SubscriptionData->subscription_id);
|
||||
}
|
||||
SubscriptionData->subscription_id = ogs_strdup(subscription_data->id);
|
||||
ogs_expect_or_return_val(SubscriptionData->subscription_id, NULL);
|
||||
if (!SubscriptionData->subscription_id) {
|
||||
ogs_error("ogs_strdup() failed");
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (SubscriptionData->requester_features) {
|
||||
subscription_data->requester_features =
|
||||
|
@ -231,7 +239,11 @@ bool nrf_nnrf_handle_nf_status_subscribe(
|
|||
OGS_SBI_NNRF_NFM_SERVICE_MAP);
|
||||
SubscriptionData->nrf_supported_features =
|
||||
ogs_uint64_to_string(subscription_data->nrf_supported_features);
|
||||
ogs_expect_or_return_val(SubscriptionData->nrf_supported_features, NULL);
|
||||
if (!SubscriptionData->nrf_supported_features) {
|
||||
ogs_error("ogs_strdup() failed");
|
||||
ogs_sbi_subscription_data_remove(subscription_data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SubscrCond = SubscriptionData->subscr_cond;
|
||||
if (SubscrCond) {
|
||||
|
@ -404,7 +416,10 @@ bool nrf_nnrf_handle_nf_profile_retrieval(
|
|||
OGS_SBI_FEATURES_SET(supported_features, OGS_SBI_NNRF_NFM_SERVICE_MAP);
|
||||
sendmsg.NFProfile = ogs_nnrf_nfm_build_nf_profile(
|
||||
nf_instance, NULL, NULL, supported_features);
|
||||
ogs_expect_or_return_val(sendmsg.NFProfile, NULL);
|
||||
if (!sendmsg.NFProfile) {
|
||||
ogs_error("ogs_nnrf_nfm_build_nf_profile() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
|
||||
ogs_assert(response);
|
||||
|
|
|
@ -367,10 +367,16 @@ bool pcf_sess_set_ipv4addr(pcf_sess_t *sess, char *ipv4addr_string)
|
|||
clear_ipv4addr(sess);
|
||||
|
||||
rv = ogs_ipv4_from_string(&sess->ipv4addr, ipv4addr_string);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, false);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_ipv4_from_string() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
sess->ipv4addr_string = ogs_strdup(ipv4addr_string);
|
||||
ogs_expect_or_return_val(sess->ipv4addr_string, false);
|
||||
if (!sess->ipv4addr_string) {
|
||||
ogs_error("ogs_strdup() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
ogs_hash_set(self.ipv4addr_hash,
|
||||
&sess->ipv4addr, sizeof(sess->ipv4addr), sess);
|
||||
|
@ -389,12 +395,18 @@ bool pcf_sess_set_ipv6prefix(pcf_sess_t *sess, char *ipv6prefix_string)
|
|||
|
||||
rv = ogs_ipv6prefix_from_string(
|
||||
sess->ipv6prefix.addr6, &sess->ipv6prefix.len, ipv6prefix_string);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, false);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_ipv6prefix_from_string() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
ogs_assert(sess->ipv6prefix.len == OGS_IPV6_128_PREFIX_LEN);
|
||||
|
||||
sess->ipv6prefix_string = ogs_strdup(ipv6prefix_string);
|
||||
ogs_expect_or_return_val(sess->ipv6prefix_string, false);
|
||||
if (!sess->ipv6prefix_string) {
|
||||
ogs_error("ogs_strdup() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
ogs_hash_set(self.ipv6prefix_hash,
|
||||
&sess->ipv6prefix, (sess->ipv6prefix.len >> 3) + 1, sess);
|
||||
|
@ -431,7 +443,10 @@ pcf_sess_t *pcf_sess_find_by_ipv4addr(char *ipv4addr_string)
|
|||
ogs_assert(ipv4addr_string);
|
||||
|
||||
rv = ogs_ipv4_from_string(&ipv4addr, ipv4addr_string);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_ipv4_from_string() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ogs_hash_get(self.ipv4addr_hash, &ipv4addr, sizeof(ipv4addr));
|
||||
}
|
||||
|
@ -465,7 +480,10 @@ pcf_sess_t *pcf_sess_find_by_ipv6addr(char *ipv6addr_string)
|
|||
ogs_assert(ipv6addr_string);
|
||||
|
||||
rv = ogs_inet_pton(AF_INET6, ipv6addr_string, &tmp);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_inet_pton() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memcpy(ipv6prefix.addr6, tmp.sin6.sin6_addr.s6_addr, OGS_IPV6_LEN);
|
||||
ipv6prefix.len = OGS_IPV6_128_PREFIX_LEN;
|
||||
|
|
|
@ -71,15 +71,25 @@ static __inline__ struct sess_state *new_state(os0_t sid)
|
|||
|
||||
ogs_thread_mutex_lock(&sess_state_mutex);
|
||||
ogs_pool_alloc(&sess_state_pool, &new);
|
||||
ogs_expect_or_return_val(new, NULL);
|
||||
if (!new) {
|
||||
ogs_error("ogs_pool_alloc() failed");
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
return NULL;
|
||||
}
|
||||
memset(new, 0, sizeof(*new));
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
|
||||
new->sid = (os0_t)ogs_strdup((char *)sid);
|
||||
ogs_expect_or_return_val(new->sid, NULL);
|
||||
if (!new->sid) {
|
||||
ogs_error("ogs_strdup() failed");
|
||||
ogs_pool_free(&sess_state_pool, new);
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ogs_list_init(&new->rx_list);
|
||||
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
|
@ -92,17 +102,27 @@ static struct rx_sess_state *add_rx_state(struct sess_state *gx, os0_t sid)
|
|||
|
||||
ogs_thread_mutex_lock(&sess_state_mutex);
|
||||
ogs_pool_alloc(&rx_sess_state_pool, &new);
|
||||
ogs_expect_or_return_val(new, NULL);
|
||||
if (!new) {
|
||||
ogs_error("ogs_pool_alloc() failed");
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
return NULL;
|
||||
}
|
||||
memset(new, 0, sizeof(*new));
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
|
||||
new->sid = (os0_t)ogs_strdup((char *)sid);
|
||||
ogs_expect_or_return_val(new->sid, NULL);
|
||||
if (!new->sid) {
|
||||
ogs_error("ogs_strdup() failed");
|
||||
ogs_pool_free(&rx_sess_state_pool, new);
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
new->gx = gx;
|
||||
|
||||
ogs_list_add(&gx->rx_list, new);
|
||||
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,12 +51,22 @@ static __inline__ struct sess_state *new_state(os0_t sid)
|
|||
|
||||
ogs_thread_mutex_lock(&sess_state_mutex);
|
||||
ogs_pool_alloc(&sess_state_pool, &new);
|
||||
ogs_expect_or_return_val(new, NULL);
|
||||
if (!new) {
|
||||
ogs_error("ogs_pool_alloc() failed");
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
return NULL;
|
||||
}
|
||||
memset(new, 0, sizeof(*new));
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
|
||||
new->rx_sid = (os0_t)ogs_strdup((char *)sid);
|
||||
ogs_expect_or_return_val(new->rx_sid, NULL);
|
||||
if (!new->rx_sid) {
|
||||
ogs_error("ogs_strdup() failed");
|
||||
ogs_pool_free(&sess_state_pool, new);
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
|
||||
return new;
|
||||
}
|
||||
|
|
|
@ -185,10 +185,16 @@ int sgwc_gtp_send_create_session_response(
|
|||
h.teid = sgwc_ue->mme_s11_teid;
|
||||
|
||||
pkbuf = sgwc_s11_build_create_session_response(h.type, sess);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("sgwc_s11_build_create_session_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(xact, &h, pkbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -226,11 +232,17 @@ int sgwc_gtp_send_downlink_data_notification(
|
|||
h.teid = sgwc_ue->mme_s11_teid;
|
||||
|
||||
pkbuf = sgwc_s11_build_downlink_data_notification(cause_value, bearer);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("sgwc_s11_build_downlink_data_notification() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
gtp_xact = ogs_gtp_xact_local_create(
|
||||
sgwc_ue->gnode, &h, pkbuf, bearer_timeout, bearer);
|
||||
ogs_expect_or_return_val(gtp_xact, OGS_ERROR);
|
||||
if (!gtp_xact) {
|
||||
ogs_error("ogs_gtp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
gtp_xact->local_teid = sgwc_ue->sgw_s11_teid;
|
||||
|
||||
rv = ogs_gtp_xact_commit(gtp_xact);
|
||||
|
|
|
@ -217,10 +217,16 @@ int sgwc_pfcp_send_bearer_to_modify_list(
|
|||
h.seid = sess->sgwu_sxa_seid;
|
||||
|
||||
sxabuf = sgwc_sxa_build_bearer_to_modify_list(h.type, sess, xact);
|
||||
ogs_expect_or_return_val(sxabuf, OGS_ERROR);
|
||||
if (!sxabuf) {
|
||||
ogs_error("sgwc_sxa_build_bearer_to_modify_list() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, sxabuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -239,12 +245,18 @@ int sgwc_pfcp_send_session_establishment_request(
|
|||
ogs_assert(sess);
|
||||
|
||||
xact = ogs_pfcp_xact_local_create(sess->pfcp_node, sess_timeout, sess);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_pfcp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact->assoc_xact = gtp_xact;
|
||||
if (gtpbuf) {
|
||||
xact->gtpbuf = ogs_pkbuf_copy(gtpbuf);
|
||||
ogs_expect_or_return_val(xact->gtpbuf, OGS_ERROR);
|
||||
if (!xact->gtpbuf) {
|
||||
ogs_error("ogs_pkbuf_copy() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
xact->local_seid = sess->sgwc_sxa_seid;
|
||||
|
||||
|
@ -253,10 +265,16 @@ int sgwc_pfcp_send_session_establishment_request(
|
|||
h.seid = sess->sgwu_sxa_seid;
|
||||
|
||||
sxabuf = sgwc_sxa_build_session_establishment_request(h.type, sess);
|
||||
ogs_expect_or_return_val(sxabuf, OGS_ERROR);
|
||||
if (!sxabuf) {
|
||||
ogs_error("sgwc_sxa_build_session_establishment_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, sxabuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -274,13 +292,19 @@ int sgwc_pfcp_send_session_modification_request(
|
|||
ogs_assert(sess);
|
||||
|
||||
xact = ogs_pfcp_xact_local_create(sess->pfcp_node, sess_timeout, sess);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_pfcp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact->assoc_xact = gtp_xact;
|
||||
xact->modify_flags = flags | OGS_PFCP_MODIFY_SESSION;
|
||||
if (gtpbuf) {
|
||||
xact->gtpbuf = ogs_pkbuf_copy(gtpbuf);
|
||||
ogs_expect_or_return_val(xact->gtpbuf, OGS_ERROR);
|
||||
if (!xact->gtpbuf) {
|
||||
ogs_error("ogs_pkbuf_copy() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
xact->local_seid = sess->sgwc_sxa_seid;
|
||||
|
||||
|
@ -305,13 +329,19 @@ int sgwc_pfcp_send_bearer_modification_request(
|
|||
ogs_assert(sess);
|
||||
|
||||
xact = ogs_pfcp_xact_local_create(sess->pfcp_node, bearer_timeout, bearer);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_pfcp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact->assoc_xact = gtp_xact;
|
||||
xact->modify_flags = flags;
|
||||
if (gtpbuf) {
|
||||
xact->gtpbuf = ogs_pkbuf_copy(gtpbuf);
|
||||
ogs_expect_or_return_val(xact->gtpbuf, OGS_ERROR);
|
||||
if (!xact->gtpbuf) {
|
||||
ogs_error("ogs_pkbuf_copy() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
xact->local_seid = sess->sgwc_sxa_seid;
|
||||
|
||||
|
@ -322,10 +352,16 @@ int sgwc_pfcp_send_bearer_modification_request(
|
|||
h.seid = sess->sgwu_sxa_seid;
|
||||
|
||||
sxabuf = sgwc_sxa_build_bearer_to_modify_list(h.type, sess, xact);
|
||||
ogs_expect_or_return_val(sxabuf, OGS_ERROR);
|
||||
if (!sxabuf) {
|
||||
ogs_error("sgwc_sxa_build_bearer_to_modify_list() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, sxabuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -344,12 +380,18 @@ int sgwc_pfcp_send_session_deletion_request(
|
|||
ogs_assert(sess);
|
||||
|
||||
xact = ogs_pfcp_xact_local_create(sess->pfcp_node, sess_timeout, sess);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_pfcp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact->assoc_xact = gtp_xact;
|
||||
if (gtpbuf) {
|
||||
xact->gtpbuf = ogs_pkbuf_copy(gtpbuf);
|
||||
ogs_expect_or_return_val(xact->gtpbuf, OGS_ERROR);
|
||||
if (!xact->gtpbuf) {
|
||||
ogs_error("ogs_pkbuf_copy() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
xact->local_seid = sess->sgwc_sxa_seid;
|
||||
|
||||
|
@ -358,10 +400,16 @@ int sgwc_pfcp_send_session_deletion_request(
|
|||
h.seid = sess->sgwu_sxa_seid;
|
||||
|
||||
sxabuf = sgwc_sxa_build_session_deletion_request(h.type, sess);
|
||||
ogs_expect_or_return_val(sxabuf, OGS_ERROR);
|
||||
if (!sxabuf) {
|
||||
ogs_error("sgwc_sxa_build_session_deletion_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, sxabuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -381,10 +429,16 @@ int sgwc_pfcp_send_session_report_response(
|
|||
h.seid = sess->sgwu_sxa_seid;
|
||||
|
||||
sxabuf = ogs_pfcp_build_session_report_response(h.type, cause);
|
||||
ogs_expect_or_return_val(sxabuf, OGS_ERROR);
|
||||
if (!sxabuf) {
|
||||
ogs_error("ogs_pfcp_build_session_report_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, sxabuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
|
|
@ -656,11 +656,17 @@ void sgwc_s11_handle_delete_session_request(
|
|||
message->h.teid = sess->pgw_s5c_teid;
|
||||
|
||||
gtpbuf = ogs_gtp2_build_msg(message);
|
||||
ogs_expect_or_return(gtpbuf);
|
||||
if (!gtpbuf) {
|
||||
ogs_error("ogs_gtp2_build_msg() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
s5c_xact = ogs_gtp_xact_local_create(
|
||||
sess->gnode, &message->h, gtpbuf, gtp_sess_timeout, sess);
|
||||
ogs_expect_or_return(s5c_xact);
|
||||
if (!s5c_xact) {
|
||||
ogs_error("ogs_gtp_xact_local_create() failed");
|
||||
return;
|
||||
}
|
||||
s5c_xact->local_teid = sess->sgw_s5c_teid;
|
||||
|
||||
ogs_gtp_xact_associate(s11_xact, s5c_xact);
|
||||
|
@ -951,10 +957,16 @@ void sgwc_s11_handle_update_bearer_response(
|
|||
message->h.teid = sess->pgw_s5c_teid;
|
||||
|
||||
pkbuf = ogs_gtp2_build_msg(message);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_gtp2_build_msg() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(s5c_xact, &message->h, pkbuf);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(s5c_xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -1470,11 +1482,17 @@ void sgwc_s11_handle_bearer_resource_command(
|
|||
message->h.teid = sess->pgw_s5c_teid;
|
||||
|
||||
pkbuf = ogs_gtp2_build_msg(message);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_gtp2_build_msg() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
s5c_xact = ogs_gtp_xact_local_create(
|
||||
sess->gnode, &message->h, pkbuf, gtp_bearer_timeout, bearer);
|
||||
ogs_expect_or_return(s5c_xact);
|
||||
if (!s5c_xact) {
|
||||
ogs_error("ogs_gtp_xact_local_create() failed");
|
||||
return;
|
||||
}
|
||||
s5c_xact->local_teid = sess->sgw_s5c_teid;
|
||||
|
||||
ogs_gtp_xact_associate(s11_xact, s5c_xact);
|
||||
|
|
|
@ -423,10 +423,16 @@ void sgwc_s5c_handle_modify_bearer_response(
|
|||
message->h.teid = sgwc_ue->mme_s11_teid;
|
||||
|
||||
pkbuf = ogs_gtp2_build_msg(message);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_gtp2_build_msg() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(s11_xact, &message->h, pkbuf);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(s11_xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -726,19 +732,28 @@ void sgwc_s5c_handle_update_bearer_request(
|
|||
message->h.teid = sgwc_ue->mme_s11_teid;
|
||||
|
||||
pkbuf = ogs_gtp2_build_msg(message);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_gtp2_build_msg() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
s11_xact = s5c_xact->assoc_xact;
|
||||
if (!s11_xact) {
|
||||
s11_xact = ogs_gtp_xact_local_create(
|
||||
sgwc_ue->gnode, &message->h, pkbuf, bearer_timeout, bearer);
|
||||
ogs_expect_or_return(s11_xact);
|
||||
if (!s11_xact) {
|
||||
ogs_error("ogs_gtp_xact_local_create() failed");
|
||||
return;
|
||||
}
|
||||
s11_xact->local_teid = sgwc_ue->sgw_s11_teid;
|
||||
|
||||
ogs_gtp_xact_associate(s5c_xact, s11_xact);
|
||||
} else {
|
||||
rv = ogs_gtp_xact_update_tx(s11_xact, &message->h, pkbuf);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
s11_xact->local_teid = sgwc_ue->sgw_s11_teid;
|
||||
|
||||
|
@ -858,7 +873,10 @@ void sgwc_s5c_handle_delete_bearer_request(
|
|||
message->h.teid = sgwc_ue->mme_s11_teid;
|
||||
|
||||
pkbuf = ogs_gtp2_build_msg(message);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_gtp2_build_msg() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
s11_xact = s5c_xact->assoc_xact;
|
||||
if (!s11_xact) {
|
||||
|
@ -878,7 +896,10 @@ void sgwc_s5c_handle_delete_bearer_request(
|
|||
*/
|
||||
s11_xact = ogs_gtp_xact_local_create(
|
||||
sgwc_ue->gnode, &message->h, pkbuf, bearer_timeout, bearer);
|
||||
ogs_expect_or_return(s11_xact);
|
||||
if (!s11_xact) {
|
||||
ogs_error("ogs_gtp_xact_local_create() failed");
|
||||
return;
|
||||
}
|
||||
s11_xact->local_teid = sgwc_ue->sgw_s11_teid;
|
||||
|
||||
ogs_gtp_xact_associate(s5c_xact, s11_xact);
|
||||
|
@ -889,7 +910,10 @@ void sgwc_s5c_handle_delete_bearer_request(
|
|||
* 3. MME sends Delete Bearer Response(DEDICATED BEARER) to SGW/SMF.
|
||||
*/
|
||||
rv = ogs_gtp_xact_update_tx(s11_xact, &message->h, pkbuf);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
s11_xact->local_teid = sgwc_ue->sgw_s11_teid;
|
||||
|
||||
|
|
|
@ -47,7 +47,10 @@ ogs_pkbuf_t *sgwc_sxa_build_session_establishment_request(
|
|||
ogs_pfcp_self()->pfcp_addr, ogs_pfcp_self()->pfcp_addr6,
|
||||
ogs_app()->parameter.prefer_ipv4,
|
||||
&node_id, &len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_sockaddr_to_node_id() failed");
|
||||
return NULL;
|
||||
}
|
||||
req->node_id.presence = 1;
|
||||
req->node_id.data = &node_id;
|
||||
req->node_id.len = len;
|
||||
|
@ -56,7 +59,10 @@ ogs_pkbuf_t *sgwc_sxa_build_session_establishment_request(
|
|||
rv = ogs_pfcp_sockaddr_to_f_seid(
|
||||
ogs_pfcp_self()->pfcp_addr, ogs_pfcp_self()->pfcp_addr6,
|
||||
&f_seid, &len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_sockaddr_to_f_seid() failed");
|
||||
return NULL;
|
||||
}
|
||||
f_seid.seid = htobe64(sess->sgwc_sxa_seid);
|
||||
req->cp_f_seid.presence = 1;
|
||||
req->cp_f_seid.data = &f_seid;
|
||||
|
|
|
@ -376,12 +376,18 @@ void sgwc_sxa_handle_session_establishment_response(
|
|||
}
|
||||
|
||||
pkbuf = ogs_gtp2_build_msg(&send_message);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_gtp2_build_msg() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
ogs_assert(sess->gnode);
|
||||
s5c_xact = ogs_gtp_xact_local_create(
|
||||
sess->gnode, &send_message.h, pkbuf, sess_timeout, sess);
|
||||
ogs_expect_or_return(s5c_xact);
|
||||
if (!s5c_xact) {
|
||||
ogs_error("ogs_gtp_xact_local_create() failed");
|
||||
return;
|
||||
}
|
||||
s5c_xact->local_teid = sess->sgw_s5c_teid;
|
||||
|
||||
s5c_xact->modify_action = OGS_GTP_MODIFY_IN_PATH_SWITCH_REQUEST;
|
||||
|
@ -414,12 +420,18 @@ void sgwc_sxa_handle_session_establishment_response(
|
|||
}
|
||||
|
||||
pkbuf = ogs_gtp2_build_msg(recv_message);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_gtp2_build_msg() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
ogs_assert(sess->gnode);
|
||||
s5c_xact = ogs_gtp_xact_local_create(
|
||||
sess->gnode, &recv_message->h, pkbuf, sess_timeout, sess);
|
||||
ogs_expect_or_return(s5c_xact);
|
||||
if (!s5c_xact) {
|
||||
ogs_error("ogs_gtp_xact_local_create() failed");
|
||||
return;
|
||||
}
|
||||
s5c_xact->local_teid = sess->sgw_s5c_teid;
|
||||
}
|
||||
|
||||
|
@ -685,10 +697,16 @@ void sgwc_sxa_handle_session_modification_response(
|
|||
send_message.h.teid = sgwc_ue->mme_s11_teid;
|
||||
|
||||
pkbuf = ogs_gtp2_build_msg(&send_message);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_gtp2_build_msg() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(s11_xact, &send_message.h, pkbuf);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(s11_xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -705,10 +723,16 @@ void sgwc_sxa_handle_session_modification_response(
|
|||
recv_message->h.teid = sess->pgw_s5c_teid;
|
||||
|
||||
pkbuf = ogs_gtp2_build_msg(recv_message);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_gtp2_build_msg() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(s5c_xact, &recv_message->h, pkbuf);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(s5c_xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -748,13 +772,19 @@ void sgwc_sxa_handle_session_modification_response(
|
|||
recv_message->h.teid = sgwc_ue->mme_s11_teid;
|
||||
|
||||
pkbuf = ogs_gtp2_build_msg(recv_message);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_gtp2_build_msg() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
ogs_assert(sgwc_ue->gnode);
|
||||
ogs_assert(bearer);
|
||||
s11_xact = ogs_gtp_xact_local_create(sgwc_ue->gnode,
|
||||
&recv_message->h, pkbuf, bearer_timeout, bearer);
|
||||
ogs_expect_or_return(s11_xact);
|
||||
if (!s11_xact) {
|
||||
ogs_error("ogs_gtp_xact_local_create() failed");
|
||||
return;
|
||||
}
|
||||
s11_xact->local_teid = sgwc_ue->sgw_s11_teid;
|
||||
|
||||
ogs_gtp_xact_associate(s5c_xact, s11_xact);
|
||||
|
@ -809,10 +839,16 @@ void sgwc_sxa_handle_session_modification_response(
|
|||
recv_message->h.teid = sess->pgw_s5c_teid;
|
||||
|
||||
pkbuf = ogs_gtp2_build_msg(recv_message);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_gtp2_build_msg() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(s5c_xact, &recv_message->h, pkbuf);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(s5c_xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -929,10 +965,16 @@ void sgwc_sxa_handle_session_modification_response(
|
|||
send_message.h.teid = sgwc_ue->mme_s11_teid;
|
||||
|
||||
pkbuf = ogs_gtp2_build_msg(&send_message);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_gtp2_build_msg() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(s11_xact, &send_message.h, pkbuf);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(s11_xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -1007,10 +1049,16 @@ void sgwc_sxa_handle_session_modification_response(
|
|||
recv_message->h.teid = sgwc_ue->mme_s11_teid;
|
||||
|
||||
pkbuf = ogs_gtp2_build_msg(recv_message);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_gtp2_build_msg() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(s11_xact, &recv_message->h, pkbuf);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(s11_xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -1038,13 +1086,19 @@ void sgwc_sxa_handle_session_modification_response(
|
|||
recv_message->h.teid = sess->pgw_s5c_teid;
|
||||
|
||||
pkbuf = ogs_gtp2_build_msg(recv_message);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_gtp2_build_msg() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
ogs_assert(sess->gnode);
|
||||
s5c_xact = ogs_gtp_xact_local_create(
|
||||
sess->gnode, &recv_message->h, pkbuf,
|
||||
sess_timeout, sess);
|
||||
ogs_expect_or_return(s5c_xact);
|
||||
if (!s5c_xact) {
|
||||
ogs_error("ogs_gtp_xact_local_create() failed");
|
||||
return;
|
||||
}
|
||||
s5c_xact->local_teid = sess->sgw_s5c_teid;
|
||||
|
||||
ogs_gtp_xact_associate(s11_xact, s5c_xact);
|
||||
|
@ -1117,11 +1171,17 @@ void sgwc_sxa_handle_session_modification_response(
|
|||
send_message.h.teid = sgwc_ue->mme_s11_teid;
|
||||
|
||||
pkbuf = ogs_gtp2_build_msg(&send_message);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_gtp2_build_msg() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(
|
||||
s11_xact, &send_message.h, pkbuf);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(s11_xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -1176,10 +1236,16 @@ void sgwc_sxa_handle_session_modification_response(
|
|||
send_message.h.teid = sgwc_ue->mme_s11_teid;
|
||||
|
||||
pkbuf = ogs_gtp2_build_msg(&send_message);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_gtp2_build_msg() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(s11_xact, &send_message.h, pkbuf);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(s11_xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -1298,10 +1364,16 @@ void sgwc_sxa_handle_session_deletion_response(
|
|||
gtp_message->h.teid = teid;
|
||||
|
||||
pkbuf = ogs_gtp2_build_msg(gtp_message);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("ogs_gtp2_build_msg() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(gtp_xact, >p_message->h, pkbuf);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(gtp_xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
|
|
@ -176,10 +176,16 @@ int sgwu_pfcp_send_session_establishment_response(
|
|||
|
||||
sxabuf = sgwu_sxa_build_session_establishment_response(
|
||||
h.type, sess, created_pdr, num_of_created_pdr);
|
||||
ogs_expect_or_return_val(sxabuf, OGS_ERROR);
|
||||
if (!sxabuf) {
|
||||
ogs_error("sgwu_sxa_build_session_establishment_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, sxabuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -204,10 +210,16 @@ int sgwu_pfcp_send_session_modification_response(
|
|||
|
||||
sxabuf = sgwu_sxa_build_session_modification_response(
|
||||
h.type, sess, created_pdr, num_of_created_pdr);
|
||||
ogs_expect_or_return_val(sxabuf, OGS_ERROR);
|
||||
if (!sxabuf) {
|
||||
ogs_error("sgwu_sxa_build_session_modification_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, sxabuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -229,10 +241,16 @@ int sgwu_pfcp_send_session_deletion_response(ogs_pfcp_xact_t *xact,
|
|||
h.seid = sess->sgwc_sxa_f_seid.seid;
|
||||
|
||||
sxabuf = sgwu_sxa_build_session_deletion_response(h.type, sess);
|
||||
ogs_expect_or_return_val(sxabuf, OGS_ERROR);
|
||||
if (!sxabuf) {
|
||||
ogs_error("sgwu_sxa_build_session_deletion_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, sxabuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -273,13 +291,22 @@ int sgwu_pfcp_send_session_report_request(
|
|||
h.seid = sess->sgwc_sxa_f_seid.seid;
|
||||
|
||||
xact = ogs_pfcp_xact_local_create(sess->pfcp_node, sess_timeout, sess);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_pfcp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
sxabuf = ogs_pfcp_build_session_report_request(h.type, report);
|
||||
ogs_expect_or_return_val(sxabuf, OGS_ERROR);
|
||||
if (!sxabuf) {
|
||||
ogs_error("ogs_pfcp_build_session_report_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, sxabuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
|
|
@ -42,7 +42,10 @@ ogs_pkbuf_t *sgwu_sxa_build_session_establishment_response(uint8_t type,
|
|||
ogs_pfcp_self()->pfcp_addr, ogs_pfcp_self()->pfcp_addr6,
|
||||
ogs_app()->parameter.prefer_ipv4,
|
||||
&node_id, &len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_sockaddr_to_node_id() failed");
|
||||
return NULL;
|
||||
}
|
||||
rsp->node_id.presence = 1;
|
||||
rsp->node_id.data = &node_id;
|
||||
rsp->node_id.len = len;
|
||||
|
@ -55,7 +58,10 @@ ogs_pkbuf_t *sgwu_sxa_build_session_establishment_response(uint8_t type,
|
|||
rv = ogs_pfcp_sockaddr_to_f_seid(
|
||||
ogs_pfcp_self()->pfcp_addr, ogs_pfcp_self()->pfcp_addr6,
|
||||
&f_seid, &len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_sockaddr_to_f_seid() failed");
|
||||
return NULL;
|
||||
}
|
||||
f_seid.seid = htobe64(sess->sgwu_sxa_seid);
|
||||
rsp->up_f_seid.presence = 1;
|
||||
rsp->up_f_seid.data = &f_seid;
|
||||
|
|
|
@ -262,8 +262,14 @@ void smf_bearer_binding(smf_sess_t *sess)
|
|||
smf_pf_t *pf = NULL;
|
||||
ogs_flow_t *flow = &pcc_rule->flow[j];
|
||||
|
||||
ogs_expect_or_return(flow);
|
||||
ogs_expect_or_return(flow->description);
|
||||
if (!flow) {
|
||||
ogs_error("No Flow");
|
||||
return;
|
||||
}
|
||||
if (!flow->description) {
|
||||
ogs_error("No Flow-Description");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* To add a flow to an existing tft.
|
||||
|
@ -364,11 +370,17 @@ void smf_bearer_binding(smf_sess_t *sess)
|
|||
OGS_NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED,
|
||||
(ogs_list_count(&bearer->pf_to_add_list) > 0) ?
|
||||
&tft : NULL, qos_presence);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("smf_s5c_build_update_bearer_request() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
xact = ogs_gtp_xact_local_create(
|
||||
sess->gnode, &h, pkbuf, gtp_bearer_timeout, bearer);
|
||||
ogs_expect_or_return(xact);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_gtp_xact_local_create() failed");
|
||||
return;
|
||||
}
|
||||
xact->local_teid = sess->smf_n4_teid;
|
||||
|
||||
if (ogs_list_count(&bearer->pf_to_add_list) > 0)
|
||||
|
@ -434,11 +446,17 @@ int smf_gtp2_send_create_bearer_request(smf_bearer_t *bearer)
|
|||
&tft, bearer, OGS_GTP2_TFT_CODE_CREATE_NEW_TFT);
|
||||
|
||||
pkbuf = smf_s5c_build_create_bearer_request(h.type, bearer, &tft);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("smf_s5c_build_create_bearer_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact = ogs_gtp_xact_local_create(
|
||||
sess->gnode, &h, pkbuf, gtp_bearer_timeout, bearer);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_gtp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
xact->local_teid = sess->smf_n4_teid;
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
|
@ -573,8 +591,14 @@ void smf_qos_flow_binding(smf_sess_t *sess)
|
|||
for (j = 0; j < pcc_rule->num_of_flow; j++) {
|
||||
ogs_flow_t *flow = &pcc_rule->flow[j];
|
||||
|
||||
ogs_expect_or_return(flow);
|
||||
ogs_expect_or_return(flow->description);
|
||||
if (!flow) {
|
||||
ogs_error("No Flow");
|
||||
return;
|
||||
}
|
||||
if (!flow->description) {
|
||||
ogs_error("No Flow-Description");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* To add a flow to an existing tft.
|
||||
|
|
|
@ -966,7 +966,10 @@ smf_gtp_node_t *smf_gtp_node_new(ogs_gtp_node_t *gnode)
|
|||
char addr[OGS_ADDRSTRLEN];
|
||||
|
||||
ogs_pool_alloc(&smf_gtp_node_pool, &smf_gnode);
|
||||
ogs_expect_or_return_val(smf_gnode, NULL);
|
||||
if (!smf_gnode) {
|
||||
ogs_error("ogs_pool_alloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
memset(smf_gnode, 0, sizeof(smf_gtp_node_t));
|
||||
|
||||
addr[0] = '\0';
|
||||
|
|
|
@ -198,26 +198,41 @@ ogs_pkbuf_t *smf_gn_build_create_pdp_context_response(
|
|||
if (sess->sgw_s5c_ip.ipv4) {
|
||||
rv = ogs_gtp1_sockaddr_to_gsn_addr(ogs_gtp_self()->gtpc_addr, NULL,
|
||||
&smf_gnc_gsnaddr, &gsn_len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_sockaddr_to_gsn_addr() failed");
|
||||
return NULL;
|
||||
}
|
||||
rv = ogs_gtp1_sockaddr_to_gsn_addr(NULL, ogs_gtp_self()->gtpc_addr6,
|
||||
&smf_gnc_altgsnaddr, &gsn_altlen);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_sockaddr_to_gsn_addr() failed");
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
rv = ogs_gtp1_sockaddr_to_gsn_addr(NULL, ogs_gtp_self()->gtpc_addr6,
|
||||
&smf_gnc_gsnaddr, &gsn_len);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_sockaddr_to_gsn_addr() failed");
|
||||
return NULL;
|
||||
}
|
||||
rv = ogs_gtp1_sockaddr_to_gsn_addr(ogs_gtp_self()->gtpc_addr, NULL,
|
||||
&smf_gnc_altgsnaddr, &gsn_altlen);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_sockaddr_to_gsn_addr() failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
rsp->alternative_ggsn_address_for_control_plane.presence = 1;
|
||||
rsp->alternative_ggsn_address_for_control_plane.data = &smf_gnc_altgsnaddr;
|
||||
rsp->alternative_ggsn_address_for_control_plane.len = gsn_altlen;
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
} else {
|
||||
rv = ogs_gtp1_sockaddr_to_gsn_addr(
|
||||
ogs_gtp_self()->gtpc_addr, ogs_gtp_self()->gtpc_addr6,
|
||||
&smf_gnc_gsnaddr, &gsn_len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_sockaddr_to_gsn_addr() failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
rsp->ggsn_address_for_control_plane.presence = 1;
|
||||
rsp->ggsn_address_for_control_plane.data = &smf_gnc_gsnaddr;
|
||||
|
@ -229,16 +244,29 @@ ogs_pkbuf_t *smf_gn_build_create_pdp_context_response(
|
|||
if (bearer->sgw_s5u_ip.ipv4) {
|
||||
rv = ogs_gtp1_sockaddr_to_gsn_addr(bearer->pgw_s5u_addr, NULL,
|
||||
&pgw_gnu_gsnaddr, &gsn_len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_sockaddr_to_gsn_addr() failed");
|
||||
return NULL;
|
||||
}
|
||||
rv = ogs_gtp1_sockaddr_to_gsn_addr(NULL, bearer->pgw_s5u_addr6,
|
||||
&pgw_gnu_altgsnaddr, &gsn_altlen);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_sockaddr_to_gsn_addr() failed");
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
rv = ogs_gtp1_sockaddr_to_gsn_addr(NULL, bearer->pgw_s5u_addr6,
|
||||
&pgw_gnu_gsnaddr, &gsn_len);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_sockaddr_to_gsn_addr() failed");
|
||||
return NULL;
|
||||
}
|
||||
rv = ogs_gtp1_sockaddr_to_gsn_addr(bearer->pgw_s5u_addr, NULL,
|
||||
&pgw_gnu_altgsnaddr, &gsn_altlen);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_sockaddr_to_gsn_addr() failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
rsp->alternative_ggsn_address_for_user_traffic.presence = 1;
|
||||
rsp->alternative_ggsn_address_for_user_traffic.data = &pgw_gnu_altgsnaddr;
|
||||
|
@ -247,7 +275,10 @@ ogs_pkbuf_t *smf_gn_build_create_pdp_context_response(
|
|||
rv = ogs_gtp1_sockaddr_to_gsn_addr(
|
||||
bearer->pgw_s5u_addr, bearer->pgw_s5u_addr6,
|
||||
&pgw_gnu_gsnaddr, &gsn_len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_sockaddr_to_gsn_addr() failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
rsp->ggsn_address_for_user_traffic.presence = 1;
|
||||
rsp->ggsn_address_for_user_traffic.data = &pgw_gnu_gsnaddr;
|
||||
|
@ -398,26 +429,41 @@ ogs_pkbuf_t *smf_gn_build_update_pdp_context_response(
|
|||
if (sess->sgw_s5c_ip.ipv4) {
|
||||
rv = ogs_gtp1_sockaddr_to_gsn_addr(ogs_gtp_self()->gtpc_addr, NULL,
|
||||
&smf_gnc_gsnaddr, &gsn_len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_sockaddr_to_gsn_addr() failed");
|
||||
return NULL;
|
||||
}
|
||||
rv = ogs_gtp1_sockaddr_to_gsn_addr(NULL, ogs_gtp_self()->gtpc_addr6,
|
||||
&smf_gnc_altgsnaddr, &gsn_altlen);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_sockaddr_to_gsn_addr() failed");
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
rv = ogs_gtp1_sockaddr_to_gsn_addr(NULL, ogs_gtp_self()->gtpc_addr6,
|
||||
&smf_gnc_gsnaddr, &gsn_len);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_sockaddr_to_gsn_addr() failed");
|
||||
return NULL;
|
||||
}
|
||||
rv = ogs_gtp1_sockaddr_to_gsn_addr(ogs_gtp_self()->gtpc_addr, NULL,
|
||||
&smf_gnc_altgsnaddr, &gsn_altlen);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_sockaddr_to_gsn_addr() failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
rsp->alternative_ggsn_address_for_control_plane.presence = 1;
|
||||
rsp->alternative_ggsn_address_for_control_plane.data = &smf_gnc_altgsnaddr;
|
||||
rsp->alternative_ggsn_address_for_control_plane.len = gsn_altlen;
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
} else {
|
||||
rv = ogs_gtp1_sockaddr_to_gsn_addr(
|
||||
ogs_gtp_self()->gtpc_addr, ogs_gtp_self()->gtpc_addr6,
|
||||
&smf_gnc_gsnaddr, &gsn_len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_sockaddr_to_gsn_addr() failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
rsp->ggsn_address_for_control_plane.presence = 1;
|
||||
rsp->ggsn_address_for_control_plane.data = &smf_gnc_gsnaddr;
|
||||
|
@ -429,16 +475,29 @@ ogs_pkbuf_t *smf_gn_build_update_pdp_context_response(
|
|||
if (bearer->sgw_s5u_ip.ipv4) {
|
||||
rv = ogs_gtp1_sockaddr_to_gsn_addr(bearer->pgw_s5u_addr, NULL,
|
||||
&pgw_gnu_gsnaddr, &gsn_len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_sockaddr_to_gsn_addr() failed");
|
||||
return NULL;
|
||||
}
|
||||
rv = ogs_gtp1_sockaddr_to_gsn_addr(NULL, bearer->pgw_s5u_addr6,
|
||||
&pgw_gnu_altgsnaddr, &gsn_altlen);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_sockaddr_to_gsn_addr() failed");
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
rv = ogs_gtp1_sockaddr_to_gsn_addr(NULL, bearer->pgw_s5u_addr6,
|
||||
&pgw_gnu_gsnaddr, &gsn_len);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_sockaddr_to_gsn_addr() failed");
|
||||
return NULL;
|
||||
}
|
||||
rv = ogs_gtp1_sockaddr_to_gsn_addr(bearer->pgw_s5u_addr, NULL,
|
||||
&pgw_gnu_altgsnaddr, &gsn_altlen);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_sockaddr_to_gsn_addr() failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
rsp->alternative_ggsn_address_for_user_traffic.presence = 1;
|
||||
rsp->alternative_ggsn_address_for_user_traffic.data = &pgw_gnu_altgsnaddr;
|
||||
|
@ -447,7 +506,10 @@ ogs_pkbuf_t *smf_gn_build_update_pdp_context_response(
|
|||
rv = ogs_gtp1_sockaddr_to_gsn_addr(
|
||||
bearer->pgw_s5u_addr, bearer->pgw_s5u_addr6,
|
||||
&pgw_gnu_gsnaddr, &gsn_len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_sockaddr_to_gsn_addr() failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
rsp->ggsn_address_for_user_traffic.presence = 1;
|
||||
rsp->ggsn_address_for_user_traffic.data = &pgw_gnu_gsnaddr;
|
||||
|
|
|
@ -132,8 +132,14 @@ ogs_pkbuf_t *gsm_build_pdu_session_establishment_accept(smf_sess_t *sess)
|
|||
qos_rule[0].flow.identifier = qos_flow->qfi;
|
||||
|
||||
rv = ogs_nas_build_qos_rules(authorized_qos_rules, qos_rule, 1);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
ogs_expect_or_return_val(authorized_qos_rules->length, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_nas_build_qos_rules() failed");
|
||||
return NULL;
|
||||
}
|
||||
if (!authorized_qos_rules->length) {
|
||||
ogs_error("No length");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Session-AMBR */
|
||||
session_ambr->length = 6;
|
||||
|
@ -203,8 +209,14 @@ ogs_pkbuf_t *gsm_build_pdu_session_establishment_accept(smf_sess_t *sess)
|
|||
OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_PRESENT;
|
||||
rv = ogs_nas_build_qos_flow_descriptions(
|
||||
authorized_qos_flow_descriptions, qos_flow_description, 1);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
ogs_expect_or_return_val(authorized_qos_flow_descriptions->length, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_nas_build_qos_flow_descriptions() failed");
|
||||
return NULL;
|
||||
}
|
||||
if (!authorized_qos_flow_descriptions->length) {
|
||||
ogs_error("No length");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Extended protocol configuration options */
|
||||
if (sess->nas.ue_pco.buffer && sess->nas.ue_pco.length) {
|
||||
|
@ -363,8 +375,14 @@ ogs_pkbuf_t *gsm_build_pdu_session_modification_command(
|
|||
}
|
||||
|
||||
rv = ogs_nas_build_qos_rules(authorized_qos_rules, qos_rule, i);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
ogs_expect_or_return_val(authorized_qos_rules->length, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_nas_build_qos_rules() failed");
|
||||
return NULL;
|
||||
}
|
||||
if (!authorized_qos_rules->length) {
|
||||
ogs_error("No length");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pdu_session_modification_command->presencemask |=
|
||||
OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_AUTHORIZED_QOS_RULES_PRESENT;
|
||||
|
@ -447,9 +465,14 @@ ogs_pkbuf_t *gsm_build_pdu_session_modification_command(
|
|||
|
||||
rv = ogs_nas_build_qos_flow_descriptions(
|
||||
authorized_qos_flow_descriptions, qos_flow_description, i);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
ogs_expect_or_return_val(
|
||||
authorized_qos_flow_descriptions->length, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_nas_build_qos_flow_descriptions() failed");
|
||||
return NULL;
|
||||
}
|
||||
if (!authorized_qos_flow_descriptions->length) {
|
||||
ogs_error("No length");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pdu_session_modification_command->presencemask |=
|
||||
OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND_AUTHORIZED_QOS_FLOW_DESCRIPTIONS_PRESENT;
|
||||
|
|
|
@ -331,10 +331,16 @@ int smf_gtp1_send_create_pdp_context_response(
|
|||
h.teid = sess->sgw_s5c_teid;
|
||||
|
||||
pkbuf = smf_gn_build_create_pdp_context_response(h.type, sess);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("smf_gn_build_create_pdp_context_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp1_xact_update_tx(xact, &h, pkbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -357,10 +363,16 @@ int smf_gtp1_send_delete_pdp_context_response(
|
|||
h.teid = sess->sgw_s5c_teid;
|
||||
|
||||
pkbuf = smf_gn_build_delete_pdp_context_response(h.type, sess);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("smf_gn_build_delete_pdp_context_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp1_xact_update_tx(xact, &h, pkbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -390,11 +402,17 @@ int smf_gtp1_send_update_pdp_context_request(
|
|||
|
||||
pkbuf = smf_gn_build_update_pdp_context_request(
|
||||
h.type, bearer, pti, cause_value);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("smf_gn_build_update_pdp_context_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact = ogs_gtp1_xact_local_create(
|
||||
sess->gnode, &h, pkbuf, bearer_timeout, bearer);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_gtp1_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -424,10 +442,16 @@ int smf_gtp1_send_update_pdp_context_response(
|
|||
|
||||
pkbuf = smf_gn_build_update_pdp_context_response(
|
||||
h.type, sess, bearer);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("smf_gn_build_update_pdp_context_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp1_xact_update_tx(xact, &h, pkbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp1_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -450,10 +474,16 @@ int smf_gtp2_send_create_session_response(
|
|||
h.teid = sess->sgw_s5c_teid;
|
||||
|
||||
pkbuf = smf_s5c_build_create_session_response(h.type, sess);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("smf_s5c_build_create_session_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(xact, &h, pkbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -479,10 +509,16 @@ int smf_gtp2_send_modify_bearer_response(
|
|||
|
||||
pkbuf = smf_s5c_build_modify_bearer_response(
|
||||
h.type, sess, req, sgw_relocation);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("smf_s5c_build_modify_bearer_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(xact, &h, pkbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -505,10 +541,16 @@ int smf_gtp2_send_delete_session_response(
|
|||
h.teid = sess->sgw_s5c_teid;
|
||||
|
||||
pkbuf = smf_s5c_build_delete_session_response(h.type, sess);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("smf_s5c_build_delete_session_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(xact, &h, pkbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -537,11 +579,17 @@ int smf_gtp2_send_delete_bearer_request(
|
|||
|
||||
pkbuf = smf_s5c_build_delete_bearer_request(
|
||||
h.type, bearer, pti, cause_value);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("smf_s5c_build_delete_bearer_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact = ogs_gtp_xact_local_create(
|
||||
sess->gnode, &h, pkbuf, bearer_timeout, bearer);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_gtp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
xact->local_teid = sess->smf_n4_teid;
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
|
@ -603,7 +651,10 @@ static void send_router_advertisement(smf_sess_t *sess, uint8_t *ip6_dst)
|
|||
if (ogs_gtp_self()->link_local_addr) {
|
||||
OGS_ADDR(ogs_gtp_self()->link_local_addr, ipstr);
|
||||
rv = ogs_ipsubnet(&src_ipsub, ipstr, NULL);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_ipsubnet() failed");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
/* For the case of loopback used for GTPU link-local address is not
|
||||
* available, hence set the source IP to fe80::1
|
||||
|
|
|
@ -51,12 +51,22 @@ static __inline__ struct sess_state *new_state(os0_t sid)
|
|||
|
||||
ogs_thread_mutex_lock(&sess_state_mutex);
|
||||
ogs_pool_alloc(&sess_state_pool, &new);
|
||||
ogs_expect_or_return_val(new, NULL);
|
||||
if (!new) {
|
||||
ogs_error("ogs_pool_alloc() failed");
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
return NULL;
|
||||
}
|
||||
memset(new, 0, sizeof(*new));
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
|
||||
new->gx_sid = (os0_t)ogs_strdup((char *)sid);
|
||||
ogs_expect_or_return_val(new->gx_sid, NULL);
|
||||
if (!new->gx_sid) {
|
||||
ogs_error("ogs_strdup() failed");
|
||||
ogs_pool_free(&sess_state_pool, new);
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
|
||||
return new;
|
||||
}
|
||||
|
|
|
@ -54,12 +54,22 @@ static __inline__ struct sess_state *new_state(os0_t sid)
|
|||
|
||||
ogs_thread_mutex_lock(&sess_state_mutex);
|
||||
ogs_pool_alloc(&sess_state_pool, &new);
|
||||
ogs_expect_or_return_val(new, NULL);
|
||||
if (!new) {
|
||||
ogs_error("ogs_pool_alloc() failed");
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
return NULL;
|
||||
}
|
||||
memset(new, 0, sizeof(*new));
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
|
||||
new->gy_sid = (os0_t)ogs_strdup((char *)sid);
|
||||
ogs_expect_or_return_val(new->gy_sid, NULL);
|
||||
if (!new->gy_sid) {
|
||||
ogs_error("ogs_strdup() failed");
|
||||
ogs_pool_free(&sess_state_pool, new);
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
|
||||
return new;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,10 @@ ogs_pkbuf_t *smf_n4_build_session_establishment_request(
|
|||
ogs_pfcp_self()->pfcp_addr, ogs_pfcp_self()->pfcp_addr6,
|
||||
ogs_app()->parameter.prefer_ipv4,
|
||||
&node_id, &len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_sockaddr_to_node_id() failed");
|
||||
return NULL;
|
||||
}
|
||||
req->node_id.presence = 1;
|
||||
req->node_id.data = &node_id;
|
||||
req->node_id.len = len;
|
||||
|
@ -64,7 +67,10 @@ ogs_pkbuf_t *smf_n4_build_session_establishment_request(
|
|||
rv = ogs_pfcp_sockaddr_to_f_seid(
|
||||
ogs_pfcp_self()->pfcp_addr, ogs_pfcp_self()->pfcp_addr6,
|
||||
&f_seid, &len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_sockaddr_to_f_seid() failed");
|
||||
return NULL;
|
||||
}
|
||||
f_seid.seid = htobe64(sess->smf_n4_seid);
|
||||
req->cp_f_seid.presence = 1;
|
||||
req->cp_f_seid.data = &f_seid;
|
||||
|
|
|
@ -981,10 +981,16 @@ void smf_epc_n4_handle_session_modification_response(
|
|||
|
||||
pkbuf = smf_s5c_build_delete_bearer_request(
|
||||
h.type, bearer, gtp_pti, gtp_cause);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("smf_s5c_build_delete_bearer_request() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(gtp_xact, &h, pkbuf);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
/* IMPORTANT:
|
||||
*
|
||||
|
|
|
@ -334,10 +334,16 @@ int smf_pfcp_send_modify_list(
|
|||
h.seid = sess->upf_n4_seid;
|
||||
|
||||
n4buf = (*modify_list)(h.type, sess, xact);
|
||||
ogs_expect_or_return_val(n4buf, OGS_ERROR);
|
||||
if (!n4buf) {
|
||||
ogs_error("modify_list() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, n4buf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
if (duration) {
|
||||
ogs_pfcp_xact_delayed_commit(xact, duration);
|
||||
|
@ -363,7 +369,10 @@ int smf_5gc_pfcp_send_session_establishment_request(
|
|||
ogs_assert(stream);
|
||||
|
||||
xact = ogs_pfcp_xact_local_create(sess->pfcp_node, sess_5gc_timeout, sess);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_pfcp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact->assoc_stream = stream;
|
||||
xact->local_seid = sess->smf_n4_seid;
|
||||
|
@ -373,10 +382,16 @@ int smf_5gc_pfcp_send_session_establishment_request(
|
|||
h.seid = sess->upf_n4_seid;
|
||||
|
||||
n4buf = smf_n4_build_session_establishment_request(h.type, sess);
|
||||
ogs_expect_or_return_val(n4buf, OGS_ERROR);
|
||||
if (!n4buf) {
|
||||
ogs_error("smf_n4_build_session_establishment_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, n4buf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -397,7 +412,10 @@ int smf_5gc_pfcp_send_all_pdr_modification_request(
|
|||
ogs_assert(stream);
|
||||
|
||||
xact = ogs_pfcp_xact_local_create(sess->pfcp_node, sess_5gc_timeout, sess);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_pfcp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact->assoc_stream = stream;
|
||||
xact->local_seid = sess->smf_n4_seid;
|
||||
|
@ -424,7 +442,10 @@ int smf_5gc_pfcp_send_qos_flow_list_modification_request(
|
|||
ogs_assert(sess);
|
||||
|
||||
xact = ogs_pfcp_xact_local_create(sess->pfcp_node, sess_5gc_timeout, sess);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_pfcp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact->assoc_stream = stream;
|
||||
xact->local_seid = sess->smf_n4_seid;
|
||||
|
@ -449,7 +470,10 @@ int smf_5gc_pfcp_send_session_deletion_request(
|
|||
ogs_assert(trigger);
|
||||
|
||||
xact = ogs_pfcp_xact_local_create(sess->pfcp_node, sess_5gc_timeout, sess);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_pfcp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact->assoc_stream = stream;
|
||||
xact->delete_trigger = trigger;
|
||||
|
@ -460,10 +484,16 @@ int smf_5gc_pfcp_send_session_deletion_request(
|
|||
h.seid = sess->upf_n4_seid;
|
||||
|
||||
n4buf = smf_n4_build_session_deletion_request(h.type, sess);
|
||||
ogs_expect_or_return_val(n4buf, OGS_ERROR);
|
||||
if (!n4buf) {
|
||||
ogs_error("smf_n4_build_session_deletion_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, n4buf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -482,7 +512,10 @@ int smf_epc_pfcp_send_session_establishment_request(
|
|||
ogs_assert(sess);
|
||||
|
||||
xact = ogs_pfcp_xact_local_create(sess->pfcp_node, sess_epc_timeout, sess);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_pfcp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact->epc = true; /* EPC PFCP transaction */
|
||||
xact->assoc_xact = gtp_xact;
|
||||
|
@ -493,10 +526,16 @@ int smf_epc_pfcp_send_session_establishment_request(
|
|||
h.seid = sess->upf_n4_seid;
|
||||
|
||||
n4buf = smf_n4_build_session_establishment_request(h.type, sess);
|
||||
ogs_expect_or_return_val(n4buf, OGS_ERROR);
|
||||
if (!n4buf) {
|
||||
ogs_error("smf_n4_build_session_establishment_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, n4buf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -515,7 +554,10 @@ int smf_epc_pfcp_send_all_pdr_modification_request(
|
|||
ogs_assert(sess);
|
||||
|
||||
xact = ogs_pfcp_xact_local_create(sess->pfcp_node, sess_epc_timeout, sess);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_pfcp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact->epc = true; /* EPC PFCP transaction */
|
||||
xact->assoc_xact = gtp_xact;
|
||||
|
@ -526,7 +568,10 @@ int smf_epc_pfcp_send_all_pdr_modification_request(
|
|||
xact->gtp_cause = gtp_cause;
|
||||
if (gtpbuf) {
|
||||
xact->gtpbuf = ogs_pkbuf_copy(gtpbuf);
|
||||
ogs_expect_or_return_val(xact->gtpbuf, OGS_ERROR);
|
||||
if (!xact->gtpbuf) {
|
||||
ogs_error("ogs_pkbuf_copy() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
ogs_list_init(&sess->pdr_to_modify_list);
|
||||
|
@ -554,7 +599,10 @@ int smf_epc_pfcp_send_one_bearer_modification_request(
|
|||
|
||||
xact = ogs_pfcp_xact_local_create(
|
||||
sess->pfcp_node, bearer_epc_timeout, bearer);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_pfcp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact->epc = true; /* EPC PFCP transaction */
|
||||
xact->assoc_xact = gtp_xact;
|
||||
|
@ -585,7 +633,10 @@ int smf_epc_pfcp_send_session_deletion_request(
|
|||
ogs_assert(sess);
|
||||
|
||||
xact = ogs_pfcp_xact_local_create(sess->pfcp_node, sess_epc_timeout, sess);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_pfcp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact->epc = true; /* EPC PFCP transaction */
|
||||
|
||||
|
@ -618,10 +669,16 @@ int smf_epc_pfcp_send_session_deletion_request(
|
|||
h.seid = sess->upf_n4_seid;
|
||||
|
||||
n4buf = smf_n4_build_session_deletion_request(h.type, sess);
|
||||
ogs_expect_or_return_val(n4buf, OGS_ERROR);
|
||||
if (!n4buf) {
|
||||
ogs_error("smf_n4_build_session_deletion_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, n4buf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -644,9 +701,14 @@ int smf_epc_pfcp_send_deactivation(smf_sess_t *sess, uint8_t gtp_cause)
|
|||
/* Handover from Non-3GPP to 3GPP */
|
||||
wlan_sess = smf_sess_find_by_apn(
|
||||
smf_ue, sess->session.name, OGS_GTP2_RAT_TYPE_WLAN);
|
||||
ogs_expect_or_return_val(wlan_sess, OGS_ERROR);
|
||||
ogs_expect_or_return_val(
|
||||
ogs_list_first(&wlan_sess->bearer_list), OGS_ERROR);
|
||||
if (!wlan_sess) {
|
||||
ogs_error("smf_sess_find_by_apn() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
if (ogs_list_first(&wlan_sess->bearer_list) == NULL) {
|
||||
ogs_error("No Bearer List in WLAN Session");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
/* Deactivate WLAN Session */
|
||||
rv = smf_epc_pfcp_send_all_pdr_modification_request(
|
||||
|
@ -654,7 +716,11 @@ int smf_epc_pfcp_send_deactivation(smf_sess_t *sess, uint8_t gtp_cause)
|
|||
OGS_PFCP_MODIFY_DL_ONLY|OGS_PFCP_MODIFY_DEACTIVATE,
|
||||
OGS_NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED,
|
||||
OGS_GTP2_CAUSE_ACCESS_CHANGED_FROM_NON_3GPP_TO_3GPP);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("smf_epc_pfcp_send_all_pdr_modification_requestO() "
|
||||
"failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
break;
|
||||
|
||||
case OGS_GTP2_CAUSE_RAT_CHANGED_FROM_3GPP_TO_NON_3GPP:
|
||||
|
@ -662,8 +728,10 @@ int smf_epc_pfcp_send_deactivation(smf_sess_t *sess, uint8_t gtp_cause)
|
|||
eutran_sess = smf_sess_find_by_apn(
|
||||
smf_ue, sess->session.name, OGS_GTP2_RAT_TYPE_EUTRAN);
|
||||
if (eutran_sess) {
|
||||
ogs_expect_or_return_val(
|
||||
ogs_list_first(&eutran_sess->bearer_list), OGS_ERROR);
|
||||
if (ogs_list_first(&eutran_sess->bearer_list) == NULL) {
|
||||
ogs_error("No Bearer List in E-URAN Session");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
/* Deactivate EUTRAN Session */
|
||||
rv = smf_epc_pfcp_send_all_pdr_modification_request(
|
||||
|
@ -671,7 +739,11 @@ int smf_epc_pfcp_send_deactivation(smf_sess_t *sess, uint8_t gtp_cause)
|
|||
OGS_PFCP_MODIFY_DL_ONLY|OGS_PFCP_MODIFY_DEACTIVATE,
|
||||
OGS_NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED,
|
||||
OGS_GTP2_CAUSE_RAT_CHANGED_FROM_3GPP_TO_NON_3GPP);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("smf_epc_pfcp_send_all_pdr_modification_request() "
|
||||
"failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -695,10 +767,16 @@ int smf_pfcp_send_session_report_response(
|
|||
h.seid = sess->upf_n4_seid;
|
||||
|
||||
sxabuf = ogs_pfcp_build_session_report_response(h.type, cause);
|
||||
ogs_expect_or_return_val(sxabuf, OGS_ERROR);
|
||||
if (!sxabuf) {
|
||||
ogs_error("ogs_pfcp_build_session_report_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, sxabuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
|
|
@ -83,7 +83,10 @@ ogs_pkbuf_t *smf_s5c_build_create_session_response(
|
|||
rv = ogs_gtp2_sockaddr_to_f_teid(
|
||||
ogs_gtp_self()->gtpc_addr, ogs_gtp_self()->gtpc_addr6,
|
||||
&smf_s5c_teid, &len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp2_sockaddr_to_f_teid() failed");
|
||||
return NULL;
|
||||
}
|
||||
rsp->pgw_s5_s8__s2a_s2b_f_teid_for_pmip_based_interface_or_for_gtp_based_control_plane_interface.
|
||||
presence = 1;
|
||||
rsp->pgw_s5_s8__s2a_s2b_f_teid_for_pmip_based_interface_or_for_gtp_based_control_plane_interface.
|
||||
|
@ -185,7 +188,10 @@ ogs_pkbuf_t *smf_s5c_build_create_session_response(
|
|||
rv = ogs_gtp2_sockaddr_to_f_teid(
|
||||
bearer->pgw_s5u_addr, bearer->pgw_s5u_addr6,
|
||||
&pgw_s5u_teid[i], &pgw_s5u_len[i]);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp2_sockaddr_to_f_teid() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (sess->gtp_rat_type) {
|
||||
case OGS_GTP2_RAT_TYPE_EUTRAN:
|
||||
|
@ -374,7 +380,10 @@ ogs_pkbuf_t *smf_s5c_build_create_bearer_request(
|
|||
ogs_assert(bearer->pgw_s5u_addr || bearer->pgw_s5u_addr6);
|
||||
rv = ogs_gtp2_sockaddr_to_f_teid(
|
||||
bearer->pgw_s5u_addr, bearer->pgw_s5u_addr6, &pgw_s5u_teid, &len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp2_sockaddr_to_f_teid() failed");
|
||||
return NULL;
|
||||
}
|
||||
req->bearer_contexts.s4_u_sgsn_f_teid.presence = 1;
|
||||
req->bearer_contexts.s4_u_sgsn_f_teid.data = &pgw_s5u_teid;
|
||||
req->bearer_contexts.s4_u_sgsn_f_teid.len = len;
|
||||
|
|
|
@ -739,7 +739,10 @@ void smf_s5c_handle_create_bearer_response(
|
|||
/* Find the Bearer by PGW-S5U-TEID */
|
||||
ogs_assert(pgw_s5u_teid);
|
||||
bearer = smf_bearer_find_by_pgw_s5u_teid(sess, be32toh(pgw_s5u_teid->teid));
|
||||
ogs_expect_or_return(bearer);
|
||||
if (!bearer) {
|
||||
ogs_error("smf_bearer_find_by_pgw_s5u_teid() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set EBI */
|
||||
bearer->ebi = rsp->bearer_contexts.eps_bearer_id.u8;
|
||||
|
@ -1380,10 +1383,16 @@ void smf_s5c_handle_bearer_resource_command(
|
|||
pkbuf = smf_s5c_build_update_bearer_request(
|
||||
h.type, bearer, cmd->procedure_transaction_id.u8,
|
||||
tft_update ? &tft : NULL, qos_update);
|
||||
ogs_expect_or_return(pkbuf);
|
||||
if (!pkbuf) {
|
||||
ogs_error("smf_s5c_build_update_bearer_request() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(xact, &h, pkbuf);
|
||||
ogs_expect_or_return(rv == OGS_OK);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (tft_update)
|
||||
xact->update_flags |= OGS_GTP_MODIFY_TFT_UPDATE;
|
||||
|
|
|
@ -43,11 +43,21 @@ static __inline__ struct sess_state *new_state(os0_t sid)
|
|||
|
||||
ogs_thread_mutex_lock(&sess_state_mutex);
|
||||
ogs_pool_alloc(&sess_state_pool, &new);
|
||||
ogs_expect_or_return_val(new, NULL);
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
if (!new) {
|
||||
ogs_error("ogs_pool_alloc() failed");
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
new->s6b_sid = (os0_t)ogs_strdup((char *)sid);
|
||||
ogs_expect_or_return_val(new->s6b_sid, NULL);
|
||||
if (!new->s6b_sid) {
|
||||
ogs_error("ogs_strdup() failed");
|
||||
ogs_pool_free(&sess_state_pool, new);
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
|
||||
return new;
|
||||
}
|
||||
|
|
|
@ -179,10 +179,16 @@ int upf_pfcp_send_session_establishment_response(
|
|||
|
||||
n4buf = upf_n4_build_session_establishment_response(
|
||||
h.type, sess, created_pdr, num_of_created_pdr);
|
||||
ogs_expect_or_return_val(n4buf, OGS_ERROR);
|
||||
if (!n4buf) {
|
||||
ogs_error("upf_n4_build_session_establishment_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, n4buf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -207,10 +213,16 @@ int upf_pfcp_send_session_modification_response(
|
|||
|
||||
n4buf = upf_n4_build_session_modification_response(
|
||||
h.type, sess, created_pdr, num_of_created_pdr);
|
||||
ogs_expect_or_return_val(n4buf, OGS_ERROR);
|
||||
if (!n4buf) {
|
||||
ogs_error("upf_n4_build_session_modification_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, n4buf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -232,10 +244,16 @@ int upf_pfcp_send_session_deletion_response(ogs_pfcp_xact_t *xact,
|
|||
h.seid = sess->smf_n4_f_seid.seid;
|
||||
|
||||
n4buf = upf_n4_build_session_deletion_response(h.type, sess);
|
||||
ogs_expect_or_return_val(n4buf, OGS_ERROR);
|
||||
if (!n4buf) {
|
||||
ogs_error("upf_n4_build_session_deletion_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, n4buf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -278,13 +296,23 @@ int upf_pfcp_send_session_report_request(
|
|||
h.seid = sess->smf_n4_f_seid.seid;
|
||||
|
||||
xact = ogs_pfcp_xact_local_create(sess->pfcp_node, sess_timeout, sess);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_pfcp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
n4buf = ogs_pfcp_build_session_report_request(h.type, report);
|
||||
ogs_expect_or_return_val(n4buf, OGS_ERROR);
|
||||
if (!n4buf) {
|
||||
ogs_error("ogs_pfcp_build_session_report_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_pfcp_xact_update_tx(xact, &h, n4buf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_pfcp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
|
||||
rv = ogs_pfcp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
|
|
@ -135,7 +135,7 @@ af_sess_t *af_sess_add_by_ue_address(ogs_ip_t *ue_address)
|
|||
ogs_assert(ue_address->ipv4 || ue_address->ipv6);
|
||||
|
||||
ogs_pool_alloc(&af_sess_pool, &sess);
|
||||
ogs_expect_or_return_val(sess, NULL);
|
||||
ogs_assert(sess);
|
||||
memset(sess, 0, sizeof *sess);
|
||||
|
||||
sess->af_app_session_id = ogs_msprintf("%d",
|
||||
|
@ -144,15 +144,15 @@ af_sess_t *af_sess_add_by_ue_address(ogs_ip_t *ue_address)
|
|||
|
||||
if (ue_address->ipv4) {
|
||||
sess->ipv4addr = ogs_ipv4_to_string(ue_address->addr);
|
||||
ogs_expect_or_return_val(sess->ipv4addr, NULL);
|
||||
ogs_assert(sess->ipv4addr);
|
||||
}
|
||||
|
||||
if (ue_address->ipv6) {
|
||||
sess->ipv6addr = ogs_ipv6addr_to_string(ue_address->addr6);
|
||||
ogs_expect_or_return_val(sess->ipv6addr, NULL);
|
||||
ogs_assert(sess->ipv6addr);
|
||||
sess->ipv6prefix = ogs_ipv6prefix_to_string(
|
||||
ue_address->addr6, OGS_IPV6_128_PREFIX_LEN);
|
||||
ogs_expect_or_return_val(sess->ipv6prefix, NULL);
|
||||
ogs_assert(sess->ipv6prefix);
|
||||
}
|
||||
|
||||
OGS_SBI_FEATURES_SET(sess->policyauthorization_features,
|
||||
|
@ -240,7 +240,7 @@ bool af_sess_set_pcf_app_session_id(af_sess_t *sess, char *pcf_app_session_id)
|
|||
clear_pcf_app_session_id(sess);
|
||||
|
||||
sess->pcf_app_session_id = ogs_strdup(pcf_app_session_id);
|
||||
ogs_expect_or_return_val(sess->pcf_app_session_id, false);
|
||||
ogs_assert(sess->pcf_app_session_id);
|
||||
|
||||
ogs_hash_set(self.pcf_app_session_id_hash,
|
||||
&sess->pcf_app_session_id, strlen(sess->pcf_app_session_id), sess);
|
||||
|
|
|
@ -76,7 +76,7 @@ ogs_sbi_request_t *af_npcf_policyauthorization_build_create(
|
|||
memset(&AscReqData, 0, sizeof(AscReqData));
|
||||
|
||||
server = ogs_list_first(&ogs_sbi_self()->server_list);
|
||||
ogs_expect_or_return_val(server, NULL);
|
||||
ogs_assert(server);
|
||||
|
||||
memset(&header, 0, sizeof(header));
|
||||
header.service.name = (char *)OGS_SBI_SERVICE_NAME_NPCF_POLICYAUTHORIZATION;
|
||||
|
@ -84,7 +84,7 @@ ogs_sbi_request_t *af_npcf_policyauthorization_build_create(
|
|||
header.resource.component[0] = (char *)OGS_SBI_RESOURCE_NAME_APP_SESSIONS;
|
||||
header.resource.component[1] = (char *)sess->af_app_session_id;
|
||||
AscReqData.notif_uri = ogs_sbi_server_uri(server, &header);
|
||||
ogs_expect_or_return_val(AscReqData.notif_uri, NULL);
|
||||
ogs_assert(AscReqData.notif_uri);
|
||||
|
||||
AscReqData.supp_feat =
|
||||
ogs_uint64_to_string(sess->policyauthorization_features);
|
||||
|
@ -101,12 +101,12 @@ ogs_sbi_request_t *af_npcf_policyauthorization_build_create(
|
|||
ogs_assert(EventList);
|
||||
|
||||
Event = ogs_calloc(1, sizeof(*Event));
|
||||
ogs_expect_or_return_val(Event, NULL);
|
||||
ogs_assert(Event);
|
||||
Event->event = OpenAPI_af_event_CHARGING_CORRELATION;
|
||||
OpenAPI_list_add(EventList, Event);
|
||||
|
||||
Event = ogs_calloc(1, sizeof(*Event));
|
||||
ogs_expect_or_return_val(Event, NULL);
|
||||
ogs_assert(Event);
|
||||
Event->event = OpenAPI_af_event_ANI_REPORT;
|
||||
Event->notif_method = OpenAPI_af_notif_method_ONE_TIME;
|
||||
OpenAPI_list_add(EventList, Event);
|
||||
|
@ -133,7 +133,7 @@ ogs_sbi_request_t *af_npcf_policyauthorization_build_create(
|
|||
ogs_assert(MediaComponentList);
|
||||
|
||||
MediaComponent = ogs_calloc(1, sizeof(*MediaComponent));
|
||||
ogs_expect_or_return_val(MediaComponent, NULL);
|
||||
ogs_assert(MediaComponent);
|
||||
|
||||
MediaComponent->med_comp_n = (i++);
|
||||
MediaComponent->f_status = OpenAPI_flow_status_ENABLED;
|
||||
|
@ -188,7 +188,7 @@ ogs_sbi_request_t *af_npcf_policyauthorization_build_create(
|
|||
|
||||
/* Sub Component #1 */
|
||||
SubComponent = ogs_calloc(1, sizeof(*SubComponent));
|
||||
ogs_expect_or_return_val(SubComponent, NULL);
|
||||
ogs_assert(SubComponent);
|
||||
|
||||
SubComponent->f_num = (j++);
|
||||
SubComponent->flow_usage = OpenAPI_flow_usage_NO_INFO;
|
||||
|
@ -230,7 +230,7 @@ ogs_sbi_request_t *af_npcf_policyauthorization_build_create(
|
|||
|
||||
/* Sub Component #2 */
|
||||
SubComponent = ogs_calloc(1, sizeof(*SubComponent));
|
||||
ogs_expect_or_return_val(SubComponent, NULL);
|
||||
ogs_assert(SubComponent);
|
||||
|
||||
SubComponent->f_num = (j++);
|
||||
SubComponent->flow_usage = OpenAPI_flow_usage_RTCP;
|
||||
|
@ -411,7 +411,7 @@ ogs_sbi_request_t *af_npcf_policyauthorization_build_update(
|
|||
ogs_assert(MediaComponentList);
|
||||
|
||||
MediaComponent = ogs_calloc(1, sizeof(*MediaComponent));
|
||||
ogs_expect_or_return_val(MediaComponent, NULL);
|
||||
ogs_assert(MediaComponent);
|
||||
|
||||
MediaComponent->med_comp_n = (i++);
|
||||
MediaComponent->f_status = OpenAPI_flow_status_ENABLED;
|
||||
|
@ -466,7 +466,7 @@ ogs_sbi_request_t *af_npcf_policyauthorization_build_update(
|
|||
|
||||
/* Sub Component #1 */
|
||||
SubComponent = ogs_calloc(1, sizeof(*SubComponent));
|
||||
ogs_expect_or_return_val(SubComponent, NULL);
|
||||
ogs_assert(SubComponent);
|
||||
|
||||
SubComponent->f_num = (j++);
|
||||
SubComponent->flow_usage = OpenAPI_flow_usage_NO_INFO;
|
||||
|
@ -503,7 +503,7 @@ ogs_sbi_request_t *af_npcf_policyauthorization_build_update(
|
|||
|
||||
/* Sub Component #2 */
|
||||
SubComponent = ogs_calloc(1, sizeof(*SubComponent));
|
||||
ogs_expect_or_return_val(SubComponent, NULL);
|
||||
ogs_assert(SubComponent);
|
||||
|
||||
SubComponent->f_num = (j++);
|
||||
SubComponent->flow_usage = OpenAPI_flow_usage_RTCP;
|
||||
|
@ -679,7 +679,7 @@ ogs_sbi_request_t *af_npcf_policyauthorization_build_create_video(
|
|||
memset(&AscReqData, 0, sizeof(AscReqData));
|
||||
|
||||
server = ogs_list_first(&ogs_sbi_self()->server_list);
|
||||
ogs_expect_or_return_val(server, NULL);
|
||||
ogs_assert(server);
|
||||
|
||||
memset(&header, 0, sizeof(header));
|
||||
header.service.name = (char *)OGS_SBI_SERVICE_NAME_NPCF_POLICYAUTHORIZATION;
|
||||
|
@ -687,7 +687,7 @@ ogs_sbi_request_t *af_npcf_policyauthorization_build_create_video(
|
|||
header.resource.component[0] = (char *)OGS_SBI_RESOURCE_NAME_APP_SESSIONS;
|
||||
header.resource.component[1] = (char *)sess->af_app_session_id;
|
||||
AscReqData.notif_uri = ogs_sbi_server_uri(server, &header);
|
||||
ogs_expect_or_return_val(AscReqData.notif_uri, NULL);
|
||||
ogs_assert(AscReqData.notif_uri);
|
||||
|
||||
AscReqData.supp_feat =
|
||||
ogs_uint64_to_string(sess->policyauthorization_features);
|
||||
|
@ -704,12 +704,12 @@ ogs_sbi_request_t *af_npcf_policyauthorization_build_create_video(
|
|||
ogs_assert(EventList);
|
||||
|
||||
Event = ogs_calloc(1, sizeof(*Event));
|
||||
ogs_expect_or_return_val(Event, NULL);
|
||||
ogs_assert(Event);
|
||||
Event->event = OpenAPI_af_event_CHARGING_CORRELATION;
|
||||
OpenAPI_list_add(EventList, Event);
|
||||
|
||||
Event = ogs_calloc(1, sizeof(*Event));
|
||||
ogs_expect_or_return_val(Event, NULL);
|
||||
ogs_assert(Event);
|
||||
Event->event = OpenAPI_af_event_ANI_REPORT;
|
||||
Event->notif_method = OpenAPI_af_notif_method_ONE_TIME;
|
||||
OpenAPI_list_add(EventList, Event);
|
||||
|
@ -736,7 +736,7 @@ ogs_sbi_request_t *af_npcf_policyauthorization_build_create_video(
|
|||
ogs_assert(MediaComponentList);
|
||||
|
||||
MediaComponent = ogs_calloc(1, sizeof(*MediaComponent));
|
||||
ogs_expect_or_return_val(MediaComponent, NULL);
|
||||
ogs_assert(MediaComponent);
|
||||
|
||||
MediaComponent->med_comp_n = (i++);
|
||||
MediaComponent->f_status = OpenAPI_flow_status_ENABLED;
|
||||
|
@ -808,7 +808,7 @@ ogs_sbi_request_t *af_npcf_policyauthorization_build_create_video(
|
|||
|
||||
/* Sub Component #1 */
|
||||
SubComponent = ogs_calloc(1, sizeof(*SubComponent));
|
||||
ogs_expect_or_return_val(SubComponent, NULL);
|
||||
ogs_assert(SubComponent);
|
||||
|
||||
SubComponent->f_num = (j++);
|
||||
SubComponent->flow_usage = OpenAPI_flow_usage_NO_INFO;
|
||||
|
@ -834,7 +834,7 @@ ogs_sbi_request_t *af_npcf_policyauthorization_build_create_video(
|
|||
|
||||
/* Sub Component #2 */
|
||||
SubComponent = ogs_calloc(1, sizeof(*SubComponent));
|
||||
ogs_expect_or_return_val(SubComponent, NULL);
|
||||
ogs_assert(SubComponent);
|
||||
|
||||
SubComponent->f_num = (j++);
|
||||
SubComponent->flow_usage = OpenAPI_flow_usage_NO_INFO;
|
||||
|
@ -862,7 +862,7 @@ ogs_sbi_request_t *af_npcf_policyauthorization_build_create_video(
|
|||
MediaComponent->med_sub_comps = SubComponentList;
|
||||
|
||||
MediaComponent = ogs_calloc(1, sizeof(*MediaComponent));
|
||||
ogs_expect_or_return_val(MediaComponent, NULL);
|
||||
ogs_assert(MediaComponent);
|
||||
|
||||
MediaComponent->med_comp_n = (i++);
|
||||
MediaComponent->f_status = OpenAPI_flow_status_ENABLED;
|
||||
|
@ -937,7 +937,7 @@ ogs_sbi_request_t *af_npcf_policyauthorization_build_create_video(
|
|||
|
||||
/* Sub Component #1 */
|
||||
SubComponent = ogs_calloc(1, sizeof(*SubComponent));
|
||||
ogs_expect_or_return_val(SubComponent, NULL);
|
||||
ogs_assert(SubComponent);
|
||||
|
||||
SubComponent->f_num = (j++);
|
||||
SubComponent->flow_usage = OpenAPI_flow_usage_NO_INFO;
|
||||
|
@ -963,7 +963,7 @@ ogs_sbi_request_t *af_npcf_policyauthorization_build_create_video(
|
|||
|
||||
/* Sub Component #2 */
|
||||
SubComponent = ogs_calloc(1, sizeof(*SubComponent));
|
||||
ogs_expect_or_return_val(SubComponent, NULL);
|
||||
ogs_assert(SubComponent);
|
||||
|
||||
SubComponent->f_num = (j++);
|
||||
SubComponent->flow_usage = OpenAPI_flow_usage_NO_INFO;
|
||||
|
|
|
@ -44,12 +44,22 @@ static __inline__ struct sess_state *new_state(os0_t sid)
|
|||
|
||||
ogs_thread_mutex_lock(&sess_state_mutex);
|
||||
ogs_pool_alloc(&sess_state_pool, &new);
|
||||
ogs_expect_or_return_val(new, NULL);
|
||||
if (!new) {
|
||||
ogs_error("ogs_pool_alloc() failed");
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
return NULL;
|
||||
}
|
||||
memset(new, 0, sizeof(*new));
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
|
||||
new->sid = (os0_t)ogs_strdup((char *)sid);
|
||||
ogs_expect_or_return_val(new->sid, NULL);
|
||||
if (!new->sid) {
|
||||
ogs_error("ogs_strdup() failed");
|
||||
ogs_pool_free(&sess_state_pool, new);
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ogs_thread_mutex_unlock(&sess_state_mutex);
|
||||
|
||||
return new;
|
||||
}
|
||||
|
|
|
@ -298,13 +298,28 @@ static void test_swx_maa_cb(void *data, struct msg **msg)
|
|||
|
||||
/* Search the session, retrieve its data */
|
||||
ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new);
|
||||
ogs_expect_or_return(ret == 0);
|
||||
ogs_expect_or_return(new == 0);
|
||||
if (ret != 0) {
|
||||
ogs_error("fd_msg_sess_get() failed");
|
||||
return;
|
||||
}
|
||||
if (new != 0) {
|
||||
ogs_error("fd_msg_sess_get() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = fd_sess_state_retrieve(test_swx_reg, session, &sess_data);
|
||||
ogs_expect_or_return(ret == 0);
|
||||
ogs_expect_or_return(sess_data);
|
||||
ogs_expect_or_return((void *)sess_data == data);
|
||||
if (ret != 0) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
if (!sess_data) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
if ((void *)sess_data != data) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Value of Result Code */
|
||||
ret = fd_msg_search_avp(*msg, ogs_diam_result_code, &avp);
|
||||
|
@ -538,13 +553,28 @@ static void test_swx_saa_cb(void *data, struct msg **msg)
|
|||
|
||||
/* Search the session, retrieve its data */
|
||||
ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new);
|
||||
ogs_expect_or_return(ret == 0);
|
||||
ogs_expect_or_return(new == 0);
|
||||
if (ret != 0) {
|
||||
ogs_error("fd_msg_sess_get() failed");
|
||||
return;
|
||||
}
|
||||
if (new != 0) {
|
||||
ogs_error("fd_msg_sess_get() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = fd_sess_state_retrieve(test_swx_reg, session, &sess_data);
|
||||
ogs_expect_or_return(ret == 0);
|
||||
ogs_expect_or_return(sess_data);
|
||||
ogs_expect_or_return((void *)sess_data == data);
|
||||
if (ret != 0) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
if (!sess_data) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
if ((void *)sess_data != data) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
sess = sess_data->sess;
|
||||
ogs_assert(sess);
|
||||
|
|
|
@ -138,10 +138,16 @@ int test_s2b_send_create_session_request(test_sess_t *sess, bool handover_ind)
|
|||
h.teid = sess->smf_s2b_c_teid;
|
||||
|
||||
pkbuf = test_s2b_build_create_session_request(h.type, sess, handover_ind);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("test_s2b_build_create_session_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact = ogs_gtp_xact_local_create(sess->gnode, &h, pkbuf, NULL, sess);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_gtp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -163,10 +169,16 @@ int test_s2b_send_delete_session_request(test_sess_t *sess)
|
|||
h.teid = sess->smf_s2b_c_teid;
|
||||
|
||||
pkbuf = test_s2b_build_delete_session_request(h.type, sess);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("test_s2b_build_delete_session_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
xact = ogs_gtp_xact_local_create(sess->gnode, &h, pkbuf, NULL, sess);
|
||||
ogs_expect_or_return_val(xact, OGS_ERROR);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_gtp_xact_local_create() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -192,10 +204,16 @@ int test_s2b_send_create_bearer_response(
|
|||
h.teid = sess->smf_s2b_c_teid;
|
||||
|
||||
pkbuf = test_s2b_build_create_bearer_response(h.type, bearer);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("test_s2b_build_create_bearer_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(xact, &h, pkbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -221,10 +239,16 @@ int test_s2b_send_delete_bearer_response(
|
|||
h.teid = sess->smf_s2b_c_teid;
|
||||
|
||||
pkbuf = test_s2b_build_delete_bearer_response(h.type, bearer);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("test_s2b_build_delete_bearer_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_update_tx(xact, &h, pkbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp_xact_update_tx() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ogs_gtp_xact_commit(xact);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
|
|
@ -240,7 +240,10 @@ ogs_pkbuf_t *test_s2b_build_create_bearer_response(
|
|||
ogs_assert(sess->gnode->sock);
|
||||
rv = ogs_gtp2_sockaddr_to_f_teid(
|
||||
&sess->gnode->sock->local_addr, NULL, &epdg_s2b_u_teid, &len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp2_sockaddr_to_f_teid() failed");
|
||||
return NULL;
|
||||
}
|
||||
rsp->bearer_contexts.s2b_u_epdg_f_teid_8.presence = 1;
|
||||
rsp->bearer_contexts.s2b_u_epdg_f_teid_8.data = &epdg_s2b_u_teid;
|
||||
rsp->bearer_contexts.s2b_u_epdg_f_teid_8.len = len;
|
||||
|
@ -250,7 +253,10 @@ ogs_pkbuf_t *test_s2b_build_create_bearer_response(
|
|||
smf_s2b_u_teid.interface_type = OGS_GTP2_F_TEID_S2B_U_PGW_GTP_U;
|
||||
smf_s2b_u_teid.teid = htobe32(bearer->sgw_s1u_teid);
|
||||
rv = ogs_gtp2_ip_to_f_teid(&bearer->sgw_s1u_ip, &smf_s2b_u_teid, &len);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, NULL);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ogs_gtp2_ip_to_f_teid() failed");
|
||||
return NULL;
|
||||
}
|
||||
rsp->bearer_contexts.s2b_u_pgw_f_teid.presence = 1;
|
||||
rsp->bearer_contexts.s2b_u_pgw_f_teid.data = &smf_s2b_u_teid;
|
||||
rsp->bearer_contexts.s2b_u_pgw_f_teid.len = OGS_GTP2_F_TEID_IPV4_LEN;
|
||||
|
|
|
@ -237,13 +237,28 @@ static void test_cx_uaa_cb(void *data, struct msg **msg)
|
|||
|
||||
/* Search the session, retrieve its data */
|
||||
ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new);
|
||||
ogs_expect_or_return(ret == 0);
|
||||
ogs_expect_or_return(new == 0);
|
||||
if (ret != 0) {
|
||||
ogs_error("fd_msg_sess_get() failed");
|
||||
return;
|
||||
}
|
||||
if (new != 0) {
|
||||
ogs_error("fd_msg_sess_get() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = fd_sess_state_retrieve(test_cx_reg, session, &sess_data);
|
||||
ogs_expect_or_return(ret == 0);
|
||||
ogs_expect_or_return(sess_data);
|
||||
ogs_expect_or_return((void *)sess_data == data);
|
||||
if (ret != 0) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
if (!sess_data) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
if ((void *)sess_data != data) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
test_ue = sess_data->test_ue;
|
||||
ogs_assert(test_ue);
|
||||
|
@ -543,13 +558,28 @@ static void test_cx_maa_cb(void *data, struct msg **msg)
|
|||
|
||||
/* Search the session, retrieve its data */
|
||||
ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new);
|
||||
ogs_expect_or_return(ret == 0);
|
||||
ogs_expect_or_return(new == 0);
|
||||
if (ret != 0) {
|
||||
ogs_error("fd_msg_sess_get() failed");
|
||||
return;
|
||||
}
|
||||
if (new != 0) {
|
||||
ogs_error("fd_msg_sess_get() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = fd_sess_state_retrieve(test_cx_reg, session, &sess_data);
|
||||
ogs_expect_or_return(ret == 0);
|
||||
ogs_expect_or_return(sess_data);
|
||||
ogs_expect_or_return((void *)sess_data == data);
|
||||
if (ret != 0) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
if (!sess_data) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
if ((void *)sess_data != data) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
test_ue = sess_data->test_ue;
|
||||
ogs_assert(test_ue);
|
||||
|
@ -811,13 +841,28 @@ static void test_cx_saa_cb(void *data, struct msg **msg)
|
|||
|
||||
/* Search the session, retrieve its data */
|
||||
ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new);
|
||||
ogs_expect_or_return(ret == 0);
|
||||
ogs_expect_or_return(new == 0);
|
||||
if (ret != 0) {
|
||||
ogs_error("fd_msg_sess_get() failed");
|
||||
return;
|
||||
}
|
||||
if (new != 0) {
|
||||
ogs_error("fd_msg_sess_get() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = fd_sess_state_retrieve(test_cx_reg, session, &sess_data);
|
||||
ogs_expect_or_return(ret == 0);
|
||||
ogs_expect_or_return(sess_data);
|
||||
ogs_expect_or_return((void *)sess_data == data);
|
||||
if (ret != 0) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
if (!sess_data) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
if ((void *)sess_data != data) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
test_ue = sess_data->test_ue;
|
||||
ogs_assert(test_ue);
|
||||
|
@ -1040,13 +1085,28 @@ static void test_cx_lia_cb(void *data, struct msg **msg)
|
|||
|
||||
/* Search the session, retrieve its data */
|
||||
ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new);
|
||||
ogs_expect_or_return(ret == 0);
|
||||
ogs_expect_or_return(new == 0);
|
||||
if (ret != 0) {
|
||||
ogs_error("fd_msg_sess_get() failed");
|
||||
return;
|
||||
}
|
||||
if (new != 0) {
|
||||
ogs_error("fd_msg_sess_get() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = fd_sess_state_retrieve(test_cx_reg, session, &sess_data);
|
||||
ogs_expect_or_return(ret == 0);
|
||||
ogs_expect_or_return(sess_data);
|
||||
ogs_expect_or_return((void *)sess_data == data);
|
||||
if (ret != 0) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
if (!sess_data) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
if ((void *)sess_data != data) {
|
||||
ogs_error("fd_sess_state_retrieve() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
test_ue = sess_data->test_ue;
|
||||
ogs_assert(test_ue);
|
||||
|
|
|
@ -42,9 +42,9 @@ static __inline__ struct sess_state *new_state(os0_t sid)
|
|||
struct sess_state *new = NULL;
|
||||
|
||||
new = ogs_calloc(1, sizeof(*new));
|
||||
ogs_expect_or_return_val(new, NULL);
|
||||
ogs_assert(new);
|
||||
new->sid = (os0_t)ogs_strdup((char *)sid);
|
||||
ogs_expect_or_return_val(new->sid, NULL);
|
||||
ogs_assert(new->sid);
|
||||
|
||||
return new;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue