nas_config_mbms/netlink_init_mbms_tun(): use entire interface prefix
Does the same change in the _mbms() functions as in the previous commit. Also, simplify logic in netlink_init_mbms_tun(): directly use the id in the interface. This requires a slight ID change in the users, which is also done in this commit.
This commit is contained in:
@@ -93,24 +93,19 @@ int netlink_init_mbms_tun(char *ifprefix, int id) {//for UE, id = 1, 2, ...,
|
||||
int ret;
|
||||
char ifname[64];
|
||||
|
||||
if (id > 0) {
|
||||
sprintf(ifname, "oaitun_%.3s%d", ifprefix, id-1);
|
||||
}
|
||||
else {
|
||||
sprintf(ifname, "oaitun_%.3s1", ifprefix); // added "1": for historical reasons
|
||||
}
|
||||
nas_sock_mbms_fd = tun_alloc(ifname);
|
||||
sprintf(ifname, "%s%d", ifprefix, id);
|
||||
nas_sock_mbms_fd = tun_alloc(ifname);
|
||||
|
||||
if (nas_sock_mbms_fd == -1) {
|
||||
printf("[NETLINK] Error opening mbms socket %s (%d:%s)\n",ifname,errno, strerror(errno));
|
||||
exit(1);
|
||||
if (nas_sock_mbms_fd == -1) {
|
||||
LOG_E(PDCP, "[NETLINK] Error opening mbms socket %s (%d:%s)\n", ifname, errno, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
printf("[NETLINK]Opened socket %s with fd %d\n",ifname,nas_sock_mbms_fd);
|
||||
ret = fcntl(nas_sock_mbms_fd,F_SETFL,O_NONBLOCK);
|
||||
|
||||
if (ret == -1) {
|
||||
printf("[NETLINK] Error fcntl (%d:%s)\n",errno, strerror(errno));
|
||||
LOG_E(PDCP, "[NETLINK] Error fcntl (%d:%s)\n",errno, strerror(errno));
|
||||
|
||||
if (LINK_ENB_PDCP_TO_IP_DRIVER) {
|
||||
exit(1);
|
||||
|
||||
@@ -2303,21 +2303,21 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask, int id) {
|
||||
netlink_init_tun("oaitun_ue", num_if, id);
|
||||
if (IS_SOFTMODEM_NOS1)
|
||||
nas_config(1, 1, 2, "oaitun_ue");
|
||||
netlink_init_mbms_tun("uem", id);
|
||||
nas_config_mbms(1, 2, 2, "uem");
|
||||
netlink_init_mbms_tun("oaitun_uem", id + 1);
|
||||
nas_config_mbms(1, 2, 2, "oaitun_uem");
|
||||
LOG_I(PDCP, "UE pdcp will use tun interface\n");
|
||||
} else if (ENB_NAS_USE_TUN) {
|
||||
netlink_init_tun("oaitun_enb", 1, 0);
|
||||
nas_config(1, 1, 1, "oaitun_enb");
|
||||
if (pdcp_optmask & ENB_NAS_USE_TUN_W_MBMS_BIT) {
|
||||
netlink_init_mbms_tun("enm", 0);
|
||||
nas_config_mbms(1, 2, 1, "enm");
|
||||
netlink_init_mbms_tun("oaitun_enm", 1);
|
||||
nas_config_mbms(1, 2, 1, "oaitun_enm");
|
||||
LOG_I(PDCP, "ENB pdcp will use mbms tun interface\n");
|
||||
}
|
||||
LOG_I(PDCP, "ENB pdcp will use tun interface\n");
|
||||
} else if (pdcp_optmask & ENB_NAS_USE_TUN_W_MBMS_BIT) {
|
||||
netlink_init_mbms_tun("enm", 0);
|
||||
nas_config_mbms(1, 2, 1, "enm");
|
||||
netlink_init_mbms_tun("oaitun_enm", 0);
|
||||
nas_config_mbms(1, 2, 1, "oaitun_enm");
|
||||
LOG_I(PDCP, "ENB pdcp will use mbms tun interface\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -149,7 +149,8 @@ static int bringInterfaceUp(char *interfaceName, int up)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nas_config_mbms(int interface_id, int thirdOctet, int fourthOctet, char *ifname) {
|
||||
int nas_config_mbms(int interface_id, int thirdOctet, int fourthOctet, const char *ifname)
|
||||
{
|
||||
//char buf[5];
|
||||
char ipAddress[20];
|
||||
char broadcastAddress[20];
|
||||
@@ -161,8 +162,7 @@ int nas_config_mbms(int interface_id, int thirdOctet, int fourthOctet, char *ifn
|
||||
sprintf(ipAddress, "%s.%d.%d",baseNetAddress,thirdOctet,fourthOctet);
|
||||
|
||||
sprintf(broadcastAddress, "%s.%d.255",baseNetAddress, thirdOctet);
|
||||
sprintf(interfaceName, "%s%s%d", (UE_NAS_USE_TUN || ENB_NAS_USE_TUN)?"oaitun_":ifname,
|
||||
UE_NAS_USE_TUN?ifname/*"ue"*/: (ENB_NAS_USE_TUN?ifname/*"enb"*/:""),interface_id);
|
||||
sprintf(interfaceName, "%s%d", ifname, interface_id);
|
||||
bringInterfaceUp(interfaceName, 0);
|
||||
// sets the machine address
|
||||
returnValue= setInterfaceParameter(interfaceName, ipAddress,SIOCSIFADDR);
|
||||
|
||||
@@ -62,7 +62,7 @@ int nas_config(int interface_id, int thirdOctet, int fourthOctet, const char *if
|
||||
* \note
|
||||
* @ingroup _nas
|
||||
*/
|
||||
int nas_config_mbms(int interface_id, int thirdOctet, int fourthOctet, char *ifsuffix);
|
||||
int nas_config_mbms(int interface_id, int thirdOctet, int fourthOctet, const char *ifname);
|
||||
|
||||
/*! \fn void setBaseNetAddress(char*)
|
||||
* \brief This function sets the basic network address used
|
||||
|
||||
Reference in New Issue
Block a user