HSS IP address is added. 10.1.35.214.

You need to add ip alias for HSS
This commit is contained in:
Sukchan Lee 2017-07-30 23:08:10 +09:00
parent abf87a0673
commit a30bfa7321
10 changed files with 63 additions and 141 deletions

View file

@ -9,9 +9,6 @@
static struct s6a_config_t g_conf;
struct s6a_config_t *s6a_config;
static char *s6a_hss_conffile = SYSCONFDIR "hss_fd.conf";
static char *s6a_mme_conffile = SYSCONFDIR "mme_fd.conf";
static int s6a_config_apply_internal()
{
struct peer_info fddpi;
@ -40,12 +37,10 @@ static int s6a_config_apply_internal()
ai->ai_addr, ai->ai_addrlen, EP_FL_CONF),
freeaddrinfo(ai);
#if 0
if (s6a_config->cnf_port)
fd_g_config->cnf_port = s6a_config->cnf_port;
if (s6a_config->cnf_port_tls)
fd_g_config->cnf_port_tls = s6a_config->cnf_port_tls;
#endif
memset(&fddpi, 0, sizeof(fddpi));
fddpi.config.pic_flags.persist = PI_PRST_ALWAYS;
@ -100,78 +95,15 @@ status_t s6a_config_apply()
return CORE_OK;
}
#define HSS_IDENTITY "hss.localdomain"
#define HSS_REALM "localdomain"
#define MME_IDENTITY "mme.localdomain"
#define MME_REALM "localdomain"
static int s6a_common_config(void)
int s6a_config_init(void)
{
memset(&g_conf, 0, sizeof(struct s6a_config_t));
s6a_config = &g_conf;
/* Set the default values */
s6a_config->mode = MODE_MME | MODE_HSS;
s6a_config->vendor_id = 10415; /* 3GPP Vendor ID */
s6a_config->appli_id = 16777251; /* 3GPP S6A Application ID */
s6a_config->duration = 10; /* 10 seconds */
return 0;
}
char *s6a_hss_config()
{
status_t rv;
file_info_t file_info;
char *conffile = s6a_hss_conffile;
s6a_common_config();
s6a_config->cnf_diamid = HSS_IDENTITY;
s6a_config->cnf_diamrlm = HSS_REALM;
s6a_config->cnf_addr = "10.1.35.214";
#if 0
s6a_config->cnf_port = DIAMETER_PORT;
s6a_config->cnf_port_tls = DIAMETER_SECURE_PORT;
#endif
s6a_config->pi_diamid = MME_IDENTITY;
s6a_config->pi_addr = "10.1.35.215";
s6a_config->pic_port = DIAMETER_PORT;
rv = file_stat(&file_info, conffile, FILE_INFO_TYPE);
if (rv == CORE_OK && file_info.filetype == FILE_REG)
{
return conffile;
}
return NULL;
}
char *s6a_mme_config()
{
status_t rv;
file_info_t file_info;
char *conffile = s6a_mme_conffile;
s6a_common_config();
s6a_config->cnf_diamid = MME_IDENTITY;
s6a_config->cnf_diamrlm = MME_REALM;
s6a_config->cnf_addr = "10.1.35.215";
#if 0
s6a_config->cnf_port = DIAMETER_PORT;
s6a_config->cnf_port_tls = DIAMETER_SECURE_PORT;
#endif
s6a_config->pi_diamid = HSS_IDENTITY;
s6a_config->pi_addr = "10.1.35.214";
s6a_config->pic_port = DIAMETER_PORT;
rv = file_stat(&file_info, conffile, FILE_INFO_TYPE);
if (rv == CORE_OK && file_info.filetype == FILE_REG)
{
return conffile;
}
return NULL;
}

View file

@ -9,17 +9,11 @@ static pthread_t s6a_stats_th = (pthread_t)NULL;
int s6a_fd_init(const char *conffile);
void s6a_fd_final();
char *s6a_hss_config();
char *s6a_mme_config();
int s6a_dict_init(void);
static void s6a_config_dump(void)
{
d_trace(1, "------- s6a configuration dump: ---------\n");
d_trace(1, " Mode ............... : %s%s\n",
s6a_config->mode == MODE_MME ? "MME" : "",
s6a_config->mode == MODE_HSS ? "HSS" : "");
d_trace(1, " Vendor Id .......... : %u\n", s6a_config->vendor_id);
d_trace(1, " Application Id ..... : %u\n", s6a_config->appli_id);
d_trace(1, " Duration ........... : %d(sec)\n", s6a_config->duration);
@ -63,24 +57,18 @@ static void * s6a_stats(void * arg)
(long)(now.tv_nsec + 1000000000 - start.tv_nsec) / 1000);
}
if (s6a_config->mode == MODE_HSS)
{
d_trace(1, " HSS: %llu message(s) echoed\n",
copy.nb_echoed);
}
else if (s6a_config->mode == MODE_MME)
{
d_trace(1, " MME:\n");
d_trace(1, " %llu message(s) sent\n", copy.nb_sent);
d_trace(1, " %llu error(s) received\n", copy.nb_errs);
d_trace(1, " %llu answer(s) received\n", copy.nb_recv);
d_trace(1, " fastest: %ld.%06ld sec.\n",
copy.shortest / 1000000, copy.shortest % 1000000);
d_trace(1, " slowest: %ld.%06ld sec.\n",
copy.longest / 1000000, copy.longest % 1000000);
d_trace(1, " Average: %ld.%06ld sec.\n",
copy.avg / 1000000, copy.avg % 1000000);
}
d_trace(1, " Local: %llu message(s) echoed\n",
copy.nb_echoed);
d_trace(1, " Remote:\n");
d_trace(1, " %llu message(s) sent\n", copy.nb_sent);
d_trace(1, " %llu error(s) received\n", copy.nb_errs);
d_trace(1, " %llu answer(s) received\n", copy.nb_recv);
d_trace(1, " fastest: %ld.%06ld sec.\n",
copy.shortest / 1000000, copy.shortest % 1000000);
d_trace(1, " slowest: %ld.%06ld sec.\n",
copy.longest / 1000000, copy.longest % 1000000);
d_trace(1, " Average: %ld.%06ld sec.\n",
copy.avg / 1000000, copy.avg % 1000000);
d_trace(1, "-------------------------------------\n");
}
@ -88,18 +76,10 @@ static void * s6a_stats(void * arg)
}
/* entry point */
int s6a_init(int mode)
int s6a_init(const char *conffile)
{
/* Configure Application Mode(MME, HSS) */
if (mode == MODE_HSS)
{
CHECK_FCT( s6a_fd_init(s6a_hss_config()) );
}
else if (mode == MODE_MME)
{
CHECK_FCT( s6a_fd_init(s6a_mme_config()) );
}
s6a_config->mode = mode;
CHECK_FCT( s6a_fd_init(conffile) );
/* Initialize the mutex */
CHECK_POSIX( pthread_mutex_init(&s6a_config->stats_lock, NULL) );

View file

@ -11,9 +11,9 @@
extern "C" {
#endif /* __cplusplus */
/* Mode for the extension */
#define MODE_MME 0x1
#define MODE_HSS 0x2
#define S6A_REALM "localdomain" /* Default Relam */
#define MME_IDENTITY "mme.localdomain" /* Default MME Identity */
#define HSS_IDENTITY "hss.localdomain" /* Default HSS Identity */
#define S6A_RAT_TYPE_WLAN 0
#define S6A_RAT_TYPE_VIRTUAL 1
@ -46,6 +46,8 @@ extern "C" {
#define AVP_CODE_ALL_APN_CONFIG_INC_IND (1428)
#define AVP_CODE_APN_CONFIGURATION (1430)
/* This is default diameter configuration if there is no config file
* The Configuration : No TLS, Only TCP */
struct s6a_config_t {
/* Diameter Identity of the local peer (FQDN -- ASCII) */
char *cnf_diamid;
@ -157,9 +159,11 @@ extern struct dict_object *s6a_pre_emption_capability;
extern struct dict_object *s6a_pre_emption_vulnerability;
extern struct dict_object *s6a_served_party_ip_addr;
CORE_DECLARE(int) s6a_init(int mode);
CORE_DECLARE(int) s6a_init(const char *conffile);
CORE_DECLARE(void) s6a_final(void);
CORE_DECLARE(int) s6a_config_init(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View file

@ -52,9 +52,7 @@ status_t hss_context_final(void)
static status_t hss_context_prepare()
{
self.mme_s6a_port = DIAMETER_PORT;
self.mme_s6a_tls_port = DIAMETER_SECURE_PORT;
self.hss_s6a_port = DIAMETER_PORT;
self.hss_s6a_tls_port = DIAMETER_SECURE_PORT;
return CORE_OK;
}
@ -183,12 +181,6 @@ status_t hss_context_parse_config()
char *v = jsmntok_to_string(json, t+m+1);
if (v) self.hss_s6a_port = atoi(v);
}
else if (jsmntok_equal(
json, t+m, "S6A_TLS_PORT") == 0)
{
char *v = jsmntok_to_string(json, t+m+1);
if (v) self.hss_s6a_tls_port = atoi(v);
}
}
}
}
@ -236,12 +228,6 @@ status_t hss_context_parse_config()
char *v = jsmntok_to_string(json, t+m+1);
if (v) self.mme_s6a_port = atoi(v);
}
else if (jsmntok_equal(
json, t+m, "S6A_TLS_PORT") == 0)
{
char *v = jsmntok_to_string(json, t+m+1);
if (v) self.mme_s6a_tls_port = atoi(v);
}
}
}
}

View file

@ -50,10 +50,8 @@ typedef struct _hss_context_t {
char* s6a_config_path; /* HSS S6A Configuration File Path */
char* hss_s6a_addr; /* HSS S6A local address (STIRNG)*/
c_uint16_t hss_s6a_port; /* HSS S6A local port */
c_uint16_t hss_s6a_tls_port; /* HSS S6A local TLS port */
char* mme_s6a_addr; /* HSS S6A local address (STIRNG)*/
c_uint16_t mme_s6a_port; /* HSS S6A local port */
c_uint16_t mme_s6a_tls_port; /* HSS S6A local TLS port */
void *subscriberCollection;
mutex_id db_lock;

View file

@ -488,7 +488,23 @@ status_t hss_s6a_init(void)
struct disp_when data;
int ret;
ret = s6a_init(MODE_HSS);
if (hss_self()->s6a_config_path == NULL)
{
/* This is default diameter configuration if there is no config file
* The Configuration : No TLS, Only TCP */
s6a_config_init();
s6a_config->cnf_diamid = HSS_IDENTITY;
s6a_config->cnf_diamrlm = S6A_REALM;
s6a_config->cnf_addr = hss_self()->hss_s6a_addr;
s6a_config->cnf_port = hss_self()->hss_s6a_port;
s6a_config->pi_diamid = MME_IDENTITY;
s6a_config->pi_addr = hss_self()->mme_s6a_addr;
s6a_config->pic_port = hss_self()->mme_s6a_port;
}
ret = s6a_init(hss_self()->s6a_config_path);
if (ret != 0) return CORE_ERROR;
memset(&data, 0, sizeof(data));

View file

@ -105,9 +105,7 @@ static status_t mme_context_prepare()
self.relative_capacity = 0xff;
self.mme_s6a_port = DIAMETER_PORT;
self.mme_s6a_tls_port = DIAMETER_SECURE_PORT;
self.hss_s6a_port = DIAMETER_PORT;
self.hss_s6a_tls_port = DIAMETER_SECURE_PORT;
self.s1ap_port = S1AP_SCTP_PORT;
self.s11_port = GTPV2_C_UDP_PORT;
@ -318,12 +316,6 @@ status_t mme_context_parse_config()
char *v = jsmntok_to_string(json, t+m+1);
if (v) self.hss_s6a_port = atoi(v);
}
else if (jsmntok_equal(
json, t+m, "S6A_TLS_PORT") == 0)
{
char *v = jsmntok_to_string(json, t+m+1);
if (v) self.hss_s6a_tls_port = atoi(v);
}
}
}
}
@ -380,12 +372,6 @@ status_t mme_context_parse_config()
char *v = jsmntok_to_string(json, t+m+1);
if (v) self.mme_s6a_port = atoi(v);
}
else if (jsmntok_equal(
json, t+m, "S6A_TLS_PORT") == 0)
{
char *v = jsmntok_to_string(json, t+m+1);
if (v) self.mme_s6a_tls_port = atoi(v);
}
else if (jsmntok_equal(json, t+m, "S1AP_ADDR") == 0)
{
char *v = jsmntok_to_string(json, t+m+1);

View file

@ -43,10 +43,8 @@ typedef struct _mme_context_t {
char* s6a_config_path; /* MME S6A Configuration File Path */
char* mme_s6a_addr; /* MME S6A local address (STIRNG)*/
c_uint16_t mme_s6a_port; /* MME S6A local port */
c_uint16_t mme_s6a_tls_port; /* MME S6A local TLS port */
char* hss_s6a_addr; /* HSS S6A local address (STIRNG)*/
c_uint16_t hss_s6a_port; /* HSS S6A local port */
c_uint16_t hss_s6a_tls_port; /* HSS S6A local TLS port */
c_uint32_t s1ap_addr; /* MME S1AP local address */
c_uint16_t s1ap_port; /* MME S1AP local port */

View file

@ -573,7 +573,23 @@ status_t mme_s6a_init(void)
{
status_t rv;
rv = s6a_init(MODE_MME);
if (mme_self()->s6a_config_path == NULL)
{
/* This is default diameter configuration if there is no config file
* The Configuration : No TLS, Only TCP */
s6a_config_init();
s6a_config->cnf_diamid = MME_IDENTITY;
s6a_config->cnf_diamrlm = S6A_REALM;
s6a_config->cnf_addr = mme_self()->mme_s6a_addr;
s6a_config->cnf_port = mme_self()->mme_s6a_port;
s6a_config->pi_diamid = HSS_IDENTITY;
s6a_config->pi_addr = mme_self()->hss_s6a_addr;
s6a_config->pic_port = mme_self()->hss_s6a_port;
}
rv = s6a_init(mme_self()->s6a_config_path);
if (rv != CORE_OK) return rv;
pool_init(&sess_state_pool, MAX_NUM_SESSION_STATE);

View file

@ -149,6 +149,8 @@ static void nas_sm_test1(abts_case *tc, void *data)
MONGOC_INSERT_NONE, doc, NULL, &error));
bson_destroy(doc);
core_sleep(time_from_msec(1000));
d_log_set_level(D_MSG_TO_STDOUT, D_LOG_LEVEL_ERROR);
/* eNB connects to MME */
@ -419,6 +421,8 @@ static void nas_sm_test2(abts_case *tc, void *data)
MONGOC_INSERT_NONE, doc, NULL, &error));
bson_destroy(doc);
core_sleep(time_from_msec(1000));
d_log_set_level(D_MSG_TO_STDOUT, D_LOG_LEVEL_ERROR);
c_uint8_t tmp[MAX_SDU_LEN];
@ -665,6 +669,8 @@ static void nas_sm_test3(abts_case *tc, void *data)
mme_self()->mme_ue_s1ap_id = 33554631;
mme_self()->m_tmsi = 2;
core_sleep(time_from_msec(1000));
d_log_set_level(D_MSG_TO_STDOUT, D_LOG_LEVEL_ERROR);
/* eNB connects to MME */