【问题标题】:Packets created in UdpBasicApp are not forwarded past the transport (IPv4) layer在 UdpBasicApp 中创建的数据包不会通过传输 (IPv4) 层转发
【发布时间】:2023-12-30 04:37:01
【问题描述】:

按照本教程中的描述,我已经设法创建了许多路由节点:

https://inet.omnetpp.org/docs/tutorials/wireless/doc/step3.html

它们按预期工作(在节点之间转发数据包),但存在这些数据包无法通过传输层的问题。

查看 Packet.h (inet):

//
// Implements the IPv4 protocol. The protocol header is represented
// by the ~Ipv4Header message class.
//
// <b>Interfacing with higher layer protocols</b>
//
// To send a packet over IPv4 from a higher layer protocol, the module should
// fill in an ~L3AddressReq object, attach it to the packet with the Packets's
// addTag() method, then send the packet to the ~Ipv4 module.
//
// When ~Ipv4 sends up a packet to a higher layer protocol, it will also attach
// an ~L3AddressInd to the packet, with the source and destination IPv4 addresses
// of the IPv4 datagram in which the packet arrived.
//
// ~Ipv4 can serve several higher-layer protocols. The higher layer protocols
// should call registerProtocol with their gate towards the ~Ipv4 module,
// for fill up the protocol-to-gateindex map. When delivering packets to them,
// the output gate is determined from the Protocol in the IPv4 header.
//
// <b>Routing and interfacing with lower layers</b>
//
// The routing table is stored in the module ~Ipv4RoutingTable. When a datagram
// needs to be routed, ~Ipv4 queries ~Ipv4RoutingTable for the output interface
// (or "port") and next hop address of the packet. This is done by directly
// calling C++ methods (such as findBestMatchingRoute(destAddress)) of ~Ipv4RoutingTable.
// No message exchange with ~Ipv4RoutingTable takes place.
//
// A routed datagram will be sent to the queueOut, which is expected to be
// connected to ~INetworkInterface modules.
//
// Routing protocol implementations (e.g. OSPF and ISIS) can also query
// and manipulate the route table by calling ~Ipv4RoutingTable's methods in C++.
//
// <b>Working with Arp</b>
//
// Ipv4 module subscribe to arpResolutionCompleted and arpResolutionFailed signals on Arp module.
// The ~Arp module accessed via arpOut gate, should not insert any module between ~Ipv4 and ~Arp.
// Before Ipv4 module send down a packet to lower layer, ask MacAddress of next hop from Arp via
// method call. If MacAddress unspecified, then start address resolution via Arp method call and
// insert packet to a queue specified by next hop addr.
// When received a arpResolutionCompleted, then send packets from queue of next hop addr.
// When received a arpResolutionFailed, then drop packets from queue of next hop addr.
// When Ipv4 module received an ARP packet from Lower Layer on some queueIn gate,
// then send out this packet on arpOut gate. When received a packet on arpIn gate,
// then send out this packet on the specified queueOut gate.
//
// <b>Performance model, QoS</b>
//
// In the current form, ~Ipv4 contains a FIFO which queues up Ipv4 datagrams;
// datagrams are processed in order. The processing time is determined by the
// procDelay module parameter.
//
// The current performance model comes from the QueueBase C++ base class.
// If you need a more sophisticated performance model, you may change the
// module implementation (the Ipv4 class), and: (1) override the startService()
// method which determines processing time for a packet, or (2) use a
// different base class.

线条:

// To send a packet over IPv4 from a higher layer protocol, the module should
// fill in an ~L3AddressReq object, attach it to the packet with the Packets's
// addTag() method, then send the packet to the ~Ipv4 module.
//
// When ~Ipv4 sends up a packet to a higher layer protocol, it will also attach
// an ~L3AddressInd to the packet, with the source and destination IPv4 addresses
// of the IPv4 datagram in which the packet arrived.

但仍不清楚。那么,数据包是否应该已经附加了 L3AddressReq/L3AddressInd ?

【问题讨论】:

  • 你能显示你的 omnetpp.ini 和你的网络的 NED 吗?
  • @Jerzy D. 如果目标地址不是当前节点,则无法将数据包发送到应用层。我已经修补了网络层以发送数据包,无论目标地址如何
  • 您考虑过使用广播还是多播? IPv4 有办法发送一个数据包,网络中的每个主机都接收到该数据包。

标签: simulation omnet++ simulator packet inet


【解决方案1】:

这意味着,在接收端,没有配置应用程序来侦听数据包中设置的 UDP 端口。在这种情况下,传输层只是丢弃数据包。

【讨论】:

  • 错了!即使节点有一个应用程序,如果它的目标地址与当前节点的地址不匹配,数据包也不会被转发到应用程序层。
  • 答案是正确的。您在问题中写道:它们按预期工作(在节点之间转发数据包)。这意味着该节点确实收到了一个数据包。
最近更新 更多