Refactor tun_if.h

Use a common function for generating interface name. Use full interface
name in tun_if.h functions.
This commit is contained in:
Bartosz Podrygajlo
2025-02-07 12:25:35 +01:00
parent 0053a3d0f4
commit e61bf5132d
8 changed files with 123 additions and 94 deletions
+3 -1
View File
@@ -777,7 +777,9 @@ rrc_ue_establish_drb(
"10.0.%d.%d",
UE_NAS_USE_TUN ? 1 : (ip_addr_offset3 + ue_mod_idP + 1),
ip_addr_offset4 + ue_mod_idP + 1);
oip_ifup = tun_config(ip_addr_offset3 + ue_mod_idP + 1, ip, NULL, "oaitun_ue");
char ifname[IFNAMSIZ];
tun_generate_ifname(ifname, "oaitun_ue", ip_addr_offset3 + ue_mod_idP);
oip_ifup = tun_config(ifname, ip, NULL);
if (oip_ifup == 0 && (!UE_NAS_USE_TUN)) { // interface is up --> send a config the DRB
LOG_I(OIP,"[UE %d] Config the ue net interface %d to send/receive pkt on DRB %ld to/from the protocol stack\n",
+3 -1
View File
@@ -5250,7 +5250,9 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
ctxt_pP->module_id);
char ip[20];
snprintf(ip, sizeof(ip), "10.0.%d.%d", ctxt_pP->module_id + 1, ctxt_pP->module_id + 1);
oip_ifup = tun_config(ctxt_pP->module_id, ip, NULL, "oaitun_oai");
char ifname[IFNAMSIZ];
tun_generate_ifname(ifname, "oaitun_oai", ctxt_pP->module_id);
oip_ifup = tun_config(ifname, ip, NULL);
if (oip_ifup == 0) { // interface is up --> send a config the DRB
module_id_t ue_module_id;