Closed marsluca closed 9 months ago
Your XML is syntactically incorrect, there's an extra quote character at the end of several lines.
For example: Ipv4Header.destAddress.str() == \"10.0.1.254\"' \
You are totally right! Thanks a lot for your help. I suggest in the future to add the function xmldoc
, so external XML file can be passed without making the .ini file to complex.
Currently it returns this error:
<!> Error: std::runtime_error: syntax error -- in module (omnetpp::cModule) MyNetwork (id=1), during network initialization
You should be able to use xmldoc anywhere where you can use xml (i.e. for any xml parameter).
You should be able to use xmldoc anywhere where you can use xml (i.e. for any xml parameter).
Thanks for your reply. If I try, I get the mentioned error. This is my XML file:
<config>
<entry type='prerouting' packetFilter='has(Ipv4Header) && Ipv4Header.destAddress.str() == \"10.0.1.254\" && has(TcpHeader) && TcpHeader.destPort == 5002' srcAddress='192.168.0.1' destAddress='192.168.0.2'/>
<entry type='prerouting' packetFilter='has(Ipv4Header) && Ipv4Header.destAddress.str() == \"10.0.1.254\" && has(TcpHeader) && TcpHeader.destPort == 5003' srcAddress='192.168.0.1' destAddress='192.168.0.3'/>
<entry type='prerouting' packetFilter='has(Ipv4Header) && Ipv4Header.destAddress.str() == \"10.0.2.254\" && has(TcpHeader) && TcpHeader.destPort == 5001' srcAddress='192.168.0.2' destAddress='192.168.0.1'/>
<entry type='prerouting' packetFilter='has(Ipv4Header) && Ipv4Header.destAddress.str() == \"10.0.2.254\" && has(TcpHeader) && TcpHeader.destPort == 5002' srcAddress='192.168.0.2' destAddress='192.168.0.2'/>
</config>
You don't need the \ before the quotes. Unfortunately, the parse can't tell you in this case where the problem is, because the attribute itself is parsed separately from a string.
According to the official documentation:
This is the implementation of the mentioned example:
Can a proper network address translation be implemented? In that way, more complex scenarios can be implemented, and more hosts will be allowed to talk. Without this, only communication between two hosts will be allowed.
I tried something like this, but it didn't work. There are no available examples beyond that specified or documentation regarding the possible accepted values.
Error:
<!> Error: Cannot assign parameter 'config': xml(): Parse error: Syntax error at string-content:1 -- at /sirius-dev/omnetpp.ini:77 -- in module (inet::Ipv4NatTable) SiriusNetwork.router1.ipv4.natTable (id=240), during network setup
This error can be easily fixed by removing the line&& has(TcpHeader) && TcpHeader.destPort == 5002' \
, but losing the possibility of discriminating the port.Topology: