From e2163ba312d7ff9d0bec7691ceac0ee4619d89b9 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 8 Jul 2024 17:44:31 +0200 Subject: [PATCH] Remove netmask configuration and hardcode instead I initially planned to entirely remove the netmask configuration. However, in specific configurations, e.g. in 4G Rfsim with feMBMS, routing does not seem to work anymore using these commands: iperf -B 10.0.2.2 -s -u -i1 iperf -c 10.0.2.2 -B 10.0.2.1 -u -t 30 -b 2.00M -i1 Therefore, we simplify by hardcoding the netmask to /24, which allows the above to work. --- openair2/RRC/NAS/nas_config.c | 14 ++++---------- openair2/RRC/NAS/nas_config.h | 8 -------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/openair2/RRC/NAS/nas_config.c b/openair2/RRC/NAS/nas_config.c index 19811ed1d3..de48117e2f 100644 --- a/openair2/RRC/NAS/nas_config.c +++ b/openair2/RRC/NAS/nas_config.c @@ -33,9 +33,7 @@ //default values according to the examples, char *baseNetAddress ; -char *netMask ; #define NASHLP_NETPREFIX "\n" -#define NASHLP_NETMASK "\n" void nas_getparams(void) { // this datamodel require this static because we partially keep data like baseNetAddress (malloc on a global) // but we loose the opther attributes in nasoptions between two calls if is is not static ! @@ -46,7 +44,6 @@ void nas_getparams(void) { /* optname helpstr paramflags XXXptr defXXXval type numelt */ /*--------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ {"NetworkPrefix", NASHLP_NETPREFIX, 0, .strptr=&baseNetAddress, .defstrval="10.0", TYPE_STRING, 0 }, - {"NetworkMask", NASHLP_NETMASK, 0, .strptr=&netMask, .defstrval="255.255.255.0", TYPE_STRING, 0 }, }; // clang-format on config_get(config_get_if(), nasoptions, sizeofArray(nasoptions), "nas.noS1"); @@ -56,9 +53,6 @@ void setBaseNetAddress (char *baseAddr) { strcpy(baseNetAddress,baseAddr); } -void setNetMask (char *baseAddr) { - strcpy(netMask,baseAddr); -} // sets a genneric interface parameter // (SIOCSIFADDR, SIOCSIFNETMASK, SIOCSIFBRDADDR, SIOCSIFFLAGS) @@ -145,16 +139,16 @@ int nas_config(int interface_id, int thirdOctet, int fourthOctet, const char *if returnValue= setInterfaceParameter(interfaceName, ipAddress,SIOCSIFADDR); // sets the machine network mask - if(!returnValue) - returnValue= setInterfaceParameter(interfaceName, netMask,SIOCSIFNETMASK); + if (!returnValue) + returnValue = setInterfaceParameter(interfaceName, "255.255.255.0", SIOCSIFNETMASK); if(!returnValue) returnValue=bringInterfaceUp(interfaceName, 1); if(!returnValue) - LOG_I(OIP, "Interface %s successfully configured, ip address %s, mask %s\n", interfaceName, ipAddress, netMask); + LOG_I(OIP, "Interface %s successfully configured, ip address %s\n", interfaceName, ipAddress); else - LOG_E(OIP, "Interface %s couldn't be configured (ip address %s, mask %s)\n", interfaceName, ipAddress, netMask); + LOG_E(OIP, "Interface %s couldn't be configured (ip address %s)\n", interfaceName, ipAddress); return returnValue; } diff --git a/openair2/RRC/NAS/nas_config.h b/openair2/RRC/NAS/nas_config.h index fc6dda11dd..fefb12f937 100644 --- a/openair2/RRC/NAS/nas_config.h +++ b/openair2/RRC/NAS/nas_config.h @@ -59,12 +59,4 @@ int nas_config(int interface_id, int thirdOctet, int fourthOctet, const char *if */ void setBaseNetAddress(char *baseAddr); -/*! \fn void setNetMask(char*) - * \brief This function sets the new default network mask used - * \param[in] newNetworkMask, the new network mask e.g.for 255.255.0.0 - * \note - * @ingroup _nas - */ -void setNetMask(char *baseAddr); - #endif /*NAS_CONFIG_H_*/