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.
This commit is contained in:
@@ -33,9 +33,7 @@
|
|||||||
//default values according to the examples,
|
//default values according to the examples,
|
||||||
|
|
||||||
char *baseNetAddress ;
|
char *baseNetAddress ;
|
||||||
char *netMask ;
|
|
||||||
#define NASHLP_NETPREFIX "<NAS network prefix, two first bytes of network addresses>\n"
|
#define NASHLP_NETPREFIX "<NAS network prefix, two first bytes of network addresses>\n"
|
||||||
#define NASHLP_NETMASK "<NAS network mask>\n"
|
|
||||||
void nas_getparams(void) {
|
void nas_getparams(void) {
|
||||||
// this datamodel require this static because we partially keep data like baseNetAddress (malloc on a global)
|
// 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 !
|
// 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 */
|
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||||
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
{"NetworkPrefix", NASHLP_NETPREFIX, 0, .strptr=&baseNetAddress, .defstrval="10.0", TYPE_STRING, 0 },
|
{"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
|
// clang-format on
|
||||||
config_get(config_get_if(), nasoptions, sizeofArray(nasoptions), "nas.noS1");
|
config_get(config_get_if(), nasoptions, sizeofArray(nasoptions), "nas.noS1");
|
||||||
@@ -56,9 +53,6 @@ void setBaseNetAddress (char *baseAddr) {
|
|||||||
strcpy(baseNetAddress,baseAddr);
|
strcpy(baseNetAddress,baseAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setNetMask (char *baseAddr) {
|
|
||||||
strcpy(netMask,baseAddr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// sets a genneric interface parameter
|
// sets a genneric interface parameter
|
||||||
// (SIOCSIFADDR, SIOCSIFNETMASK, SIOCSIFBRDADDR, SIOCSIFFLAGS)
|
// (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);
|
returnValue= setInterfaceParameter(interfaceName, ipAddress,SIOCSIFADDR);
|
||||||
|
|
||||||
// sets the machine network mask
|
// sets the machine network mask
|
||||||
if(!returnValue)
|
if (!returnValue)
|
||||||
returnValue= setInterfaceParameter(interfaceName, netMask,SIOCSIFNETMASK);
|
returnValue = setInterfaceParameter(interfaceName, "255.255.255.0", SIOCSIFNETMASK);
|
||||||
|
|
||||||
if(!returnValue)
|
if(!returnValue)
|
||||||
returnValue=bringInterfaceUp(interfaceName, 1);
|
returnValue=bringInterfaceUp(interfaceName, 1);
|
||||||
|
|
||||||
if(!returnValue)
|
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
|
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;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,12 +59,4 @@ int nas_config(int interface_id, int thirdOctet, int fourthOctet, const char *if
|
|||||||
*/
|
*/
|
||||||
void setBaseNetAddress(char *baseAddr);
|
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_*/
|
#endif /*NAS_CONFIG_H_*/
|
||||||
|
|||||||
Reference in New Issue
Block a user