fix the default SBI port (#997, #1008)

This commit is contained in:
Sukchan Lee 2021-05-30 10:35:01 +09:00
parent 5d460b0577
commit ef07ccfb88
6 changed files with 16 additions and 16 deletions

View File

@ -96,8 +96,7 @@ ogs_sbi_context_t *ogs_sbi_self(void)
static int ogs_sbi_context_prepare(void)
{
self.http_port = OGS_SBI_HTTP_PORT;
self.https_port = OGS_SBI_HTTPS_PORT;
self.sbi_port = OGS_SBI_HTTP_PORT;
self.content_encoding = "gzip";
@ -153,7 +152,7 @@ int ogs_sbi_context_parse_config(const char *local, const char *remote)
const char *key = NULL;
const char *pem = NULL;
uint16_t port = self.http_port;
uint16_t port = self.sbi_port;
const char *dev = NULL;
ogs_sockaddr_t *addr = NULL;
@ -233,10 +232,8 @@ int ogs_sbi_context_parse_config(const char *local, const char *remote)
YAML_SEQUENCE_NODE);
} else if (!strcmp(sbi_key, "port")) {
const char *v = ogs_yaml_iter_value(&sbi_iter);
if (v) {
if (v)
port = atoi(v);
self.http_port = port;
}
} else if (!strcmp(sbi_key, "dev")) {
dev = ogs_yaml_iter_value(&sbi_iter);
} else if (!strcmp(sbi_key, "tls")) {
@ -335,7 +332,7 @@ int ogs_sbi_context_parse_config(const char *local, const char *remote)
rv = ogs_socknode_probe(
ogs_app()->parameter.no_ipv4 ? NULL : &list,
ogs_app()->parameter.no_ipv6 ? NULL : &list6,
NULL, self.http_port);
NULL, self.sbi_port);
ogs_assert(rv == OGS_OK);
node = ogs_list_first(&list);
@ -364,7 +361,7 @@ int ogs_sbi_context_parse_config(const char *local, const char *remote)
int family = AF_UNSPEC;
int i, num = 0;
const char *hostname[OGS_MAX_NUM_OF_HOSTNAME];
uint16_t port = self.http_port;
uint16_t port = self.sbi_port;
const char *key = NULL;
const char *pem = NULL;
@ -942,7 +939,7 @@ static ogs_sbi_client_t *find_client_by_fqdn(char *fqdn, int port)
ogs_sbi_client_t *client = NULL;
rv = ogs_getaddrinfo(&addr, AF_UNSPEC, fqdn,
port ? port : OGS_SBI_HTTPS_PORT, 0);
port ? port : ogs_sbi_self()->sbi_port, 0);
if (rv != OGS_OK) {
ogs_error("Invalid NFProfile.fqdn");
return NULL;

View File

@ -36,8 +36,7 @@ typedef struct ogs_sbi_client_s ogs_sbi_client_t;
typedef struct ogs_sbi_smf_info_s ogs_sbi_smf_info_t;
typedef struct ogs_sbi_context_s {
uint32_t http_port; /* SBI HTTP local port */
uint32_t https_port; /* SBI HTTPS local port */
uint32_t sbi_port; /* SBI local port */
ogs_list_t server_list;
ogs_list_t client_list;

View File

@ -46,7 +46,11 @@ char *ogs_uridup(bool https, ogs_sockaddr_t *addr, ogs_sbi_header_t *h)
p = ogs_slprintf(p, last, "%s", OGS_ADDR(addr, buf));
/* Port number */
if (OGS_PORT(addr) != OGS_SBI_HTTP_PORT) {
if ((https == true && OGS_PORT(addr) == OGS_SBI_HTTPS_PORT)) {
/* No Port in URI */
} else if (OGS_PORT(addr) == OGS_SBI_HTTP_PORT) {
/* No Port in URI */
} else {
p = ogs_slprintf(p, last, ":%d", OGS_PORT(addr));
}

View File

@ -248,7 +248,7 @@ bool ogs_sbi_nnrf_handle_nf_profile(ogs_sbi_nf_instance_t *nf_instance,
if (nf_instance->num_of_ipv4 < OGS_SBI_MAX_NUM_OF_IP_ADDRESS) {
rv = ogs_getaddrinfo(&addr, AF_UNSPEC,
node->data, OGS_SBI_HTTPS_PORT, 0);
node->data, ogs_sbi_self()->sbi_port, 0);
if (rv != OGS_OK) continue;
nf_instance->ipv4[nf_instance->num_of_ipv4] = addr;
@ -263,7 +263,7 @@ bool ogs_sbi_nnrf_handle_nf_profile(ogs_sbi_nf_instance_t *nf_instance,
if (nf_instance->num_of_ipv6 < OGS_SBI_MAX_NUM_OF_IP_ADDRESS) {
rv = ogs_getaddrinfo(&addr, AF_UNSPEC,
node->data, OGS_SBI_HTTPS_PORT, 0);
node->data, ogs_sbi_self()->sbi_port, 0);
if (rv != OGS_OK) continue;
nf_instance->ipv6[nf_instance->num_of_ipv6] = addr;

View File

@ -108,7 +108,7 @@ int nssf_context_parse_config(void)
int family = AF_UNSPEC;
int i, num = 0;
const char *hostname[OGS_MAX_NUM_OF_HOSTNAME];
uint16_t port = ogs_sbi_self()->http_port;
uint16_t port = ogs_sbi_self()->sbi_port;
const char *dev = NULL;
ogs_sockaddr_t *addr = NULL;
const char *key = NULL, *pem = NULL;

View File

@ -267,7 +267,7 @@ static ogs_sbi_client_t *find_client_by_fqdn(char *fqdn, int port)
ogs_sbi_client_t *client = NULL;
rv = ogs_getaddrinfo(&addr, AF_UNSPEC, fqdn,
port ? port : OGS_SBI_HTTPS_PORT, 0);
port ? port : ogs_sbi_self()->sbi_port, 0);
if (rv != OGS_OK) {
ogs_error("Invalid NFProfile.fqdn");
return NULL;