Commit 64b395c6 authored by yoshio.inoue's avatar yoshio.inoue

Fixed overflow related to oip generation

parent 3ec3a1af
...@@ -800,9 +800,9 @@ pdcp_data_ind( ...@@ -800,9 +800,9 @@ pdcp_data_ind(
*/ */
if (nfapi_mode == 3) { if (nfapi_mode == 3) {
#ifdef UESIM_EXPANSION #ifdef UESIM_EXPANSION
((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 1; ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 0;
#else #else
((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id + 1; ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id;
#endif #endif
} else { } else {
((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 1; ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 1;
......
...@@ -938,7 +938,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) ...@@ -938,7 +938,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
#ifdef UESIM_EXPANSION #ifdef UESIM_EXPANSION
ctxt.module_id = inst_pdcp_list[pdcp_read_header_g.inst]; ctxt.module_id = inst_pdcp_list[pdcp_read_header_g.inst];
#else #else
ctxt.module_id = pdcp_read_header_g.inst - 1; ctxt.module_id = pdcp_read_header_g.inst;
#endif #endif
} else { } else {
ctxt.module_id = 0; ctxt.module_id = 0;
......
...@@ -306,10 +306,10 @@ ue_ip_common_ip2wireless( ...@@ -306,10 +306,10 @@ ue_ip_common_ip2wireless(
} }
// modify inst by IP address for the U-Plane of multiple UEs while L2 fapi simulator start // modify inst by IP address for the U-Plane of multiple UEs while L2 fapi simulator start
#ifdef UESIM_EXPANSION #ifdef UESIM_EXPANSION
if ((src_addr[3] - 1)> instP) { if ((src_addr[3] - 2)> instP) {
pdcph.inst = src_addr[3] - 1; pdcph.inst = src_addr[3] - 2;
printk("[UE_IP_DRV] change INST from %d to %d\n",instP, pdcph.inst); printk("[UE_IP_DRV] change INST from %d to %d\n",instP, pdcph.inst);
instP = src_addr[3] - 1; instP = src_addr[3] - 2;
priv_p=netdev_priv(ue_ip_dev[instP]); priv_p=netdev_priv(ue_ip_dev[instP]);
} }
#endif #endif
......
...@@ -61,7 +61,7 @@ int ue_ip_find_inst(struct net_device *dev_pP) ...@@ -61,7 +61,7 @@ int ue_ip_find_inst(struct net_device *dev_pP)
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int i; int i;
for (i=1; i<=UE_IP_NB_INSTANCES_MAX; i++) for (i=0; i<UE_IP_NB_INSTANCES_MAX; i++)
if (ue_ip_dev[i] == dev_pP) { if (ue_ip_dev[i] == dev_pP) {
return(i); return(i);
} }
...@@ -194,7 +194,7 @@ void ue_ip_teardown(struct net_device *dev_pP) ...@@ -194,7 +194,7 @@ void ue_ip_teardown(struct net_device *dev_pP)
priv_p = netdev_priv(dev_pP); priv_p = netdev_priv(dev_pP);
inst = ue_ip_find_inst(dev_pP); inst = ue_ip_find_inst(dev_pP);
if ((inst<=0) || (inst>UE_IP_NB_INSTANCES_MAX)) { if ((inst<0) || (inst>=UE_IP_NB_INSTANCES_MAX)) {
printk("[UE_IP_DRV][%s] ERROR, couldn't find instance\n", __FUNCTION__); printk("[UE_IP_DRV][%s] ERROR, couldn't find instance\n", __FUNCTION__);
return; return;
} }
...@@ -243,7 +243,7 @@ int ue_ip_hard_start_xmit(struct sk_buff *skb_pP, struct net_device *dev_pP) ...@@ -243,7 +243,7 @@ int ue_ip_hard_start_xmit(struct sk_buff *skb_pP, struct net_device *dev_pP)
return -1; return -1;
} }
if ((inst>0) && (inst<=UE_IP_NB_INSTANCES_MAX)) { if ((inst>=0) && (inst<UE_IP_NB_INSTANCES_MAX)) {
#ifdef OAI_DRV_OAI_DRV_DEBUG_DEVICE #ifdef OAI_DRV_OAI_DRV_DEBUG_DEVICE
printk("[UE_IP_DRV][%s] inst %d, begin\n", __FUNCTION__,inst); printk("[UE_IP_DRV][%s] inst %d, begin\n", __FUNCTION__,inst);
#endif #endif
...@@ -392,9 +392,9 @@ int init_module (void) ...@@ -392,9 +392,9 @@ int init_module (void)
// Initialize parameters shared with RRC // Initialize parameters shared with RRC
printk("[UE_IP_DRV][%s] Starting OAI IP driver", __FUNCTION__); printk("[UE_IP_DRV][%s] Starting OAI IP driver", __FUNCTION__);
for (inst=1; inst<=UE_IP_NB_INSTANCES_MAX; inst++) { for (inst=0; inst<UE_IP_NB_INSTANCES_MAX; inst++) {
printk("[UE_IP_DRV][%s] begin init instance %d\n", __FUNCTION__,inst); printk("[UE_IP_DRV][%s] begin init instance %d\n", __FUNCTION__,inst);
sprintf(devicename,"oip%d",inst); sprintf(devicename,"oip%d",inst+1);
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
ue_ip_dev[inst] = alloc_netdev(sizeof(ue_ip_priv_t),devicename, ue_ip_init); ue_ip_dev[inst] = alloc_netdev(sizeof(ue_ip_priv_t),devicename, ue_ip_init);
#else #else
...@@ -434,7 +434,7 @@ void cleanup_module(void) ...@@ -434,7 +434,7 @@ void cleanup_module(void)
printk("[UE_IP_DRV][CLEANUP] begin\n"); printk("[UE_IP_DRV][CLEANUP] begin\n");
for (inst=1; inst<=UE_IP_NB_INSTANCES_MAX; inst++) { for (inst=0; inst<UE_IP_NB_INSTANCES_MAX; inst++) {
#ifdef OAI_DRV_DEBUG_DEVICE #ifdef OAI_DRV_DEBUG_DEVICE
printk("[UE_IP_DRV][CLEANUP] unregister and free net device instance %d\n",inst); printk("[UE_IP_DRV][CLEANUP] unregister and free net device instance %d\n",inst);
#endif #endif
......
...@@ -284,16 +284,16 @@ int esm_ebr_context_create( ...@@ -284,16 +284,16 @@ int esm_ebr_context_create(
// if it's made too many tables , OS may crush so we use one table. // if it's made too many tables , OS may crush so we use one table.
#ifdef PDCP_USE_NETLINK #ifdef PDCP_USE_NETLINK
#ifdef UESIM_EXPANSION #ifdef UESIM_EXPANSION
uint16_t inst_nic = (pdn->ip_addr[3] & 0x000000FF) - 1; uint16_t inst_nic = (pdn->ip_addr[3] & 0x000000FF) - 2;
res = sprintf(command_line, res = sprintf(command_line,
"ifconfig oip%d %s netmask %s broadcast %s up && " "ifconfig oip%d %s netmask %s broadcast %s up && "
"ip rule add from %s/24 table %d && " "ip rule add from %s/24 table %d && "
"ip rule add to %s/24 table %d && " "ip rule add to %s/24 table %d && "
"ip route add default dev oip%d table %d", "ip route add default dev oip%d table %d",
inst_nic, ipv4_addr, netmask, broadcast, inst_nic + 1, ipv4_addr, netmask, broadcast,
ipv4_addr, 201, ipv4_addr, 201,
ipv4_addr, 201, ipv4_addr, 201,
inst_nic, 201); inst_nic + 1, 201);
inst_pdcp_list[inst_nic] = ueid; inst_pdcp_list[inst_nic] = ueid;
#else #else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment