added option to configure netmask (rules out previous commit)

master
Ismael Gomez 7 years ago
parent 9dbbe9731a
commit 05d6a1c829

@ -103,13 +103,13 @@ typedef struct {
}gui_args_t;
typedef struct {
std::string ip_netmask;
phy_args_t phy;
float metrics_period_secs;
bool pregenerate_signals;
std::string ue_cateogry;
bool metrics_csv_enable;
std::string metrics_csv_filename;
std::string ip_netmask;
}expert_args_t;
typedef struct {

@ -57,8 +57,13 @@ public:
// NAS interface
srslte::error_t setup_if_addr(uint32_t ip_addr, char *err_str);
void set_netmask(std::string netmask);
private:
bool default_netmask;
std::string netmask;
static const int GW_THREAD_PRIO = 7;
pdcp_interface_gw *pdcp;

@ -185,6 +185,8 @@ bool ue::init(all_args_t *args_)
nas.init(&usim, &rrc, &gw, &nas_log, 1 /* RB_ID_SRB1 */);
gw.init(&pdcp, &nas, &gw_log, 3 /* RB_ID_DRB1 */);
gw.set_netmask(args->expert.ip_netmask);
rrc.init(&phy, &mac, &rlc, &pdcp, &nas, &usim, &mac, &rrc_log);
rrc.set_ue_category(atoi(args->expert.ue_cateogry.c_str()));

@ -44,6 +44,7 @@ gw::gw()
:if_up(false)
{
current_ip_addr = 0;
default_netmask = true;
}
void gw::init(pdcp_interface_gw *pdcp_, nas_interface_gw *nas_, srslte::log *gw_log_, uint32_t lcid_)
@ -104,6 +105,12 @@ void gw::get_metrics(gw_metrics_t &m)
ul_tput_bytes = 0;
}
void gw::set_netmask(std::string netmask) {
default_netmask = false;
this->netmask = netmask;
}
/*******************************************************************************
PDCP interface
*******************************************************************************/
@ -152,7 +159,11 @@ srslte::error_t gw::setup_if_addr(uint32_t ip_addr, char *err_str)
return(srslte::ERROR_CANT_START);
}
ifr.ifr_netmask.sa_family = AF_INET;
((struct sockaddr_in *)&ifr.ifr_netmask)->sin_addr.s_addr = inet_addr("255.255.255.0");
const char *mask = "255.255.255.0";
if (!default_netmask) {
mask = netmask.c_str();
}
((struct sockaddr_in *)&ifr.ifr_netmask)->sin_addr.s_addr = inet_addr(mask);
if(0 > ioctl(sock, SIOCSIFNETMASK, &ifr))
{
err_str = strerror(errno);

@ -98,7 +98,8 @@ enable = false
#####################################################################
# Expert configuration options
#
# ue_category: Sets UE category (range 1-5). Default: 4
# ip_netmask: Netmask of the tun_srsue device. Default: 255.255.255.0
# ue_category: Sets UE category (range 1-5). Default: 4
#
# prach_gain: PRACH gain (dB). If defined, forces a gain for the tranmsission of PRACH only.,
# Default is to use tx_gain in [rf] section.
@ -138,6 +139,7 @@ enable = false
#
#####################################################################
[expert]
#ip_netmask = 255.255.255.0
#ue_category = 4
#prach_gain = 30
#cqi_max = 15

Loading…
Cancel
Save