inet icon indicating copy to clipboard operation
inet copied to clipboard

IpAddresses are not assigned name of Ipv4 module is not "ipv4" - fails silently

Open edlongman opened this issue 5 years ago • 1 comments

IpAddresses are not assigned to interfaces unless the module of the type Ipv4 is named "ipv4".

Reproduce

Create a node where the ipv4 submodule is not called ipv4. All interfaces are then not assigned an ip address.

Modified Example from https://inet.omnetpp.org/docs/users-guide/ch-network-nodes.html#custom-network-nodes

//NetworkNodeExample.ned
module NetworkNodeExample
{
    parameters:
    	@networkNode;
        *.interfaceTableModule = default(absPath(".interfaceTable"));
    gates:
        inout ethg; // ethernet interface connector
        input radioIn @directIn; // incoming radio frames from physical medium
    submodules:
        app: <> like IApp; // configurable application
        tcp: Tcp; // standard TCP protocol
        ip: Ipv4NetworkLayer; // standard IP protocol
        md: MessageDispatcher; // connects multiple interfaces to IP
        //wlan: Ieee80211Interface; // standard wifi interface
        eth: EthernetInterface; // standard ethernet interface
        interfaceTable: InterfaceTable;
    connections allowunconnected: // network node internal connections
        app.socketOut --> tcp.appIn; // application sends data stream
        app.socketIn <-- tcp.appOut; // application receives data stream
        tcp.ipOut --> ip.transportIn; // TCP sends segments
        tcp.ipIn <-- ip.transportOut; // TCP receives segments
        ip.ifOut --> md.in++; // IP sends datagrams
        ip.ifIn <-- md.out++; // IP receives datagrams
        //md.out++ --> wlan.upperLayerIn;
        //md.in++ <-- wlan.upperLayerOut;
        md.out++ --> eth.upperLayerIn;
        md.in++ <-- eth.upperLayerOut;
        eth.phys <--> ethg; // Ethernet sends frames to cable
        //radioIn --> wlan.radioIn; // IEEE 802.11 sends frames to medium
}
//SimplePing.ned
network SimplePing
{
    parameters:
    	@display("bgb=522,282");
        *.**.networkConfiguratorModule = absPath(".configurator");
    submodules:
        networkNodeExample: NetworkNodeExample {
            @display("p=42,56");
        }
        networkNodeExample1: NetworkNodeExample {
            @display("p=333,56");
        }
        networkNodeExample2: NetworkNodeExample {
            @display("p=86,194");
        }
        networkNodeExample3: NetworkNodeExample {
            @display("p=383,213");
        }
        radioMedium: Ieee80211RadioMedium {
            @display("p=469,34");
        }
        configurator: Ipv4NetworkConfigurator {
            @display("p=469,194");
        }
        visualizer: IntegratedCanvasVisualizer {
            @display("p=457,108");
        }
    connections:
        networkNodeExample3.ethg <--> Eth100M <--> networkNodeExample1.ethg;
        networkNodeExample2.ethg <--> Eth100M <--> networkNodeExample.ethg;
}
[General]
network = SimplePing
**.app.typename = "PingApp"
**.app.destAddr = "*"

Possible [Cause]

The NetworkConfiguratorBase::extractTopology function calls findRoutingTable https://github.com/inet-framework/inet/blob/master/src/inet/networklayer/configurator/base/NetworkConfiguratorBase.cc#L109 which in turn calls L3AddressResolver::findIpv4RoutingTableOf https://github.com/inet-framework/inet/blob/master/src/inet/networklayer/common/L3AddressResolver.cc#L480 which tries to get the routing table based on the default module name of ipv4. There is no check to see if it was successful in finding the routing table.

Possible Improvement

Use the L3AddressResolver::getIpv4RoutingTableOf to include a check so that it doesn't fail silently but instead throws a runtime error.

I'm not exactly sure why not having the routing table means it doesn't correctly apply ip addresses to interface but the main problem surely is that it fails silently if the module is not called ipv4

edlongman avatar Nov 08 '19 18:11 edlongman

L3AddressResolver::findIpv4RoutingTableOf() search the ipv4 routing table on the path "<node>.ipv4.routingTable". For fix it, should redesign access the interface table and routing tables of node.

ZoltanBojthe avatar Nov 30 '20 15:11 ZoltanBojthe