From 01cf00700ac9c9be1e8d22ad61381e2d4ce964e7 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Tue, 6 Mar 2018 10:55:22 +0000 Subject: [PATCH] Adding DNS config options --- srsepc/hdr/mme/s1ap_common.h | 1 + srsepc/src/main.cc | 4 +++- srsepc/src/mme/s1ap_nas_transport.cc | 15 ++++++++++----- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/srsepc/hdr/mme/s1ap_common.h b/srsepc/hdr/mme/s1ap_common.h index c69eb05d1..145a94225 100644 --- a/srsepc/hdr/mme/s1ap_common.h +++ b/srsepc/hdr/mme/s1ap_common.h @@ -90,6 +90,7 @@ typedef struct{ uint16_t mnc; // BCD-coded with 0xF filler std::string mme_bind_addr; std::string mme_name; + std::string dns_addr; } s1ap_args_t; typedef struct{ diff --git a/srsepc/src/main.cc b/srsepc/src/main.cc index 3a931ddd2..c7c9e6057 100644 --- a/srsepc/src/main.cc +++ b/srsepc/src/main.cc @@ -52,7 +52,6 @@ typedef struct { int spgw_hex_limit; std::string hss_level; int hss_hex_limit; - std::string all_level; int all_hex_limit; std::string filename; @@ -83,6 +82,7 @@ parse_args(all_args_t *args, int argc, char* argv[]) { string mme_bind_addr; string spgw_bind_addr; string sgi_if_addr; + string dns_addr; string hss_db_file; string hss_auth_algo; string log_filename; @@ -105,6 +105,7 @@ parse_args(all_args_t *args, int argc, char* argv[]) { ("mme.mcc", bpo::value(&mcc)->default_value("001"), "Mobile Country Code") ("mme.mnc", bpo::value(&mnc)->default_value("01"), "Mobile Network Code") ("mme.mme_bind_addr", bpo::value(&mme_bind_addr)->default_value("127.0.0.1"),"IP address of MME for S1 connnection") + ("mme.dns_addr", bpo::value(&dns_addr)->default_value("8.8.8.8"),"IP address of the DNS server for the UEs") ("hss.db_file", bpo::value(&hss_db_file)->default_value("ue_db.csv"),".csv file that stores UE's keys") ("hss.auth_algo", bpo::value(&hss_auth_algo)->default_value("milenage"),"HSS uthentication algorithm.") ("spgw.gtpu_bind_addr", bpo::value(&spgw_bind_addr)->default_value("127.0.0.1"),"IP address of SP-GW for the S1-U connection") @@ -205,6 +206,7 @@ parse_args(all_args_t *args, int argc, char* argv[]) { args->mme_args.s1ap_args.mme_bind_addr = mme_bind_addr; args->mme_args.s1ap_args.mme_name = mme_name; + args->mme_args.s1ap_args.dns_addr = dns_addr; args->spgw_args.gtpu_bind_addr = spgw_bind_addr; args->spgw_args.sgi_if_addr = sgi_if_addr; args->hss_args.db_file = hss_db_file; diff --git a/srsepc/src/mme/s1ap_nas_transport.cc b/srsepc/src/mme/s1ap_nas_transport.cc index f0767292c..ab119041e 100644 --- a/srsepc/src/mme/s1ap_nas_transport.cc +++ b/srsepc/src/mme/s1ap_nas_transport.cc @@ -650,7 +650,7 @@ s1ap_nas_transport::handle_nas_service_request(uint32_t m_tmsi, //Delete eNB context and connect. m_s1ap_log->console("Service Request -- User has ECM context already\n"); m_s1ap_log->info("Service Request -- User has ECM context already\n"); - m_s1ap->m_s1ap_ctx_mngmt_proc->send_ue_context_release_command(ecm_ctx,reply_buffer); + //m_s1ap->m_s1ap_ctx_mngmt_proc->send_ue_context_release_command(ecm_ctx,reply_buffer); int default_bearer_id = 5; m_s1ap->m_s1ap_ctx_mngmt_proc->send_initial_context_setup_request(ue_emm_ctx, ecm_ctx, &ecm_ctx->erabs_ctx[default_bearer_id],false); } @@ -1622,10 +1622,15 @@ s1ap_nas_transport::pack_attach_accept(ue_emm_ctx_t *ue_emm_ctx, ue_ecm_ctx_t *u act_def_eps_bearer_context_req.protocol_cnfg_opts.N_opts = 1; act_def_eps_bearer_context_req.protocol_cnfg_opts.opt[0].id = 0x0d; act_def_eps_bearer_context_req.protocol_cnfg_opts.opt[0].len = 4; - act_def_eps_bearer_context_req.protocol_cnfg_opts.opt[0].contents[0] = 8; - act_def_eps_bearer_context_req.protocol_cnfg_opts.opt[0].contents[1] = 8; - act_def_eps_bearer_context_req.protocol_cnfg_opts.opt[0].contents[2] = 8; - act_def_eps_bearer_context_req.protocol_cnfg_opts.opt[0].contents[3] = 8; + + struct sockaddr_in dns_addr; + inet_pton(AF_INET, m_s1ap->m_s1ap_args.dns_addr.c_str(), &(dns_addr.sin_addr)); + + memcpy(act_def_eps_bearer_context_req.protocol_cnfg_opts.opt[0].contents,&dns_addr.sin_addr.s_addr, 4); + //act_def_eps_bearer_context_req.protocol_cnfg_opts.opt[0].contents[0] = 8; + //act_def_eps_bearer_context_req.protocol_cnfg_opts.opt[0].contents[1] = 8; + //act_def_eps_bearer_context_req.protocol_cnfg_opts.opt[0].contents[2] = 8; + //act_def_eps_bearer_context_req.protocol_cnfg_opts.opt[0].contents[3] = 8; //Make sure all unused options are set to false act_def_eps_bearer_context_req.negotiated_qos_present = false;