|
INET Framework for OMNeT++/OMNEST
|
Implements RFC 2461 Neighbor Discovery for Ipv6.
More...
#include <Ipv6NeighbourDiscovery.h>
|
| virtual int | numInitStages () const override |
| |
| virtual void | initialize (int stage) override |
| |
| virtual void | handleMessage (cMessage *msg) override |
| |
| virtual void | processNDMessage (Packet *packet, const Icmpv6Header *msg) |
| |
| virtual void | finish () override |
| |
| virtual void | processIpv6Datagram (Packet *packet) |
| |
| virtual Ipv6NeighbourDiscovery::AdvIfEntry * | fetchAdvIfEntry (NetworkInterface *ie) |
| |
| virtual Ipv6NeighbourDiscovery::RdEntry * | fetchRdEntry (NetworkInterface *ie) |
| |
| virtual Ipv6Address | determineNextHop (const Ipv6Address &destAddr, int &outIfID) |
| | This function accepts the datagram's destination address and attempts to determine the destination's next hop address and interface ID by: (1) looking up the destination cache, (2)looking up the routing table, or (3) selecting a default router. More...
|
| |
| virtual void | initiateNeighbourUnreachabilityDetection (Neighbour *neighbour) |
| |
| virtual void | processNudTimeout (cMessage *timeoutMsg) |
| |
| virtual Ipv6Address | selectDefaultRouter (int &outIfID) |
| |
| virtual void | timeoutPrefixEntry (const Ipv6Address &destPrefix, int prefixLength) |
| | RFC 2461: Section 6.3.5 Whenever the invalidation timer expires for a Prefix List entry, that entry is discarded. More...
|
| |
| virtual void | timeoutDefaultRouter (const Ipv6Address &addr, int interfaceID) |
| | RFC 2461: Section 6.3.5 Whenever the Lifetime of an entry in the Default Router List expires, that entry is discarded. More...
|
| |
| virtual void | initiateAddressResolution (const Ipv6Address &dgSrcAddr, Neighbour *nce) |
| | This method attempts to resolve the given neighbour's link-layer address. More...
|
| |
| virtual void | processArTimeout (cMessage *arTimeoutMsg) |
| | Resends a NS packet to the address intended for address resolution. More...
|
| |
| virtual void | dropQueuedPacketsAwaitingAr (Neighbour *nce) |
| | Drops specific queued packets for a specific NCE AR-timeout. More...
|
| |
| virtual void | sendPacketToIpv6Module (Packet *msg, const Ipv6Address &destAddr, const Ipv6Address &srcAddr, int interfaceId) |
| | Create control info and assigns it to a msg. More...
|
| |
| virtual void | sendQueuedPacketsToIpv6Module (Neighbour *nce) |
| | Send off any queued packets within the Neighbour Discovery module awaiting address resolution. More...
|
| |
| virtual void | initiateDad (const Ipv6Address &tentativeAddr, NetworkInterface *ie) |
| | Initiating DAD means to send off a Neighbour Solicitation with its target address set as this node's tentative link-local address. More...
|
| |
| virtual void | processDadTimeout (cMessage *msg) |
| | Sends a scheduled DAD NS packet. More...
|
| |
| virtual void | makeTentativeAddressPermanent (const Ipv6Address &tentativeAddr, NetworkInterface *ie) |
| | Permanently assign the given address for the given interface entry. More...
|
| |
| virtual void | assignLinkLocalAddress (cMessage *timerMsg) |
| | as it is not possbile to explicitly define RFC 2462. More...
|
| |
| virtual void | createAndSendRsPacket (NetworkInterface *ie) |
| |
| virtual void | initiateRouterDiscovery (cMessage *msg) |
| |
| virtual void | cancelRouterDiscovery (NetworkInterface *ie) |
| | RFC 2461: Section 6.3.7 4th paragraph Once the host sends a Router Solicitation, and receives a valid Router Advertisement with a non-zero Router Lifetime, the host MUST desist from sending additional solicitations on that interface,. More...
|
| |
| virtual void | processRdTimeout (cMessage *msg) |
| |
| virtual void | processRsPacket (Packet *packet, const Ipv6RouterSolicitation *rs) |
| |
| virtual bool | validateRsPacket (Packet *packet, const Ipv6RouterSolicitation *rs) |
| |
| virtual void | createAndSendRaPacket (const Ipv6Address &destAddr, NetworkInterface *ie) |
| |
| virtual void | processRaPacket (Packet *packet, const Ipv6RouterAdvertisement *ra) |
| |
| virtual void | processRaForRouterUpdates (Packet *packet, const Ipv6RouterAdvertisement *ra) |
| |
| virtual void | processRaPrefixInfo (const Ipv6RouterAdvertisement *ra, NetworkInterface *ie) |
| |
| virtual void | processRaPrefixInfoForAddrAutoConf (const Ipv6NdPrefixInformation &prefixInfo, NetworkInterface *ie) |
| |
| virtual void | createRaTimer (NetworkInterface *ie) |
| | Create a timer for the given interface entry that sends periodic Router Advertisements. More...
|
| |
| virtual void | resetRaTimer (NetworkInterface *ie) |
| | Reset the given interface entry's Router Advertisement timer. More...
|
| |
| virtual void | sendPeriodicRa (cMessage *msg) |
| |
| virtual void | sendSolicitedRa (cMessage *msg) |
| |
| virtual bool | validateRaPacket (Packet *packet, const Ipv6RouterAdvertisement *ra) |
| |
| virtual void | createAndSendNsPacket (const Ipv6Address &nsTargetAddr, const Ipv6Address &dgDestAddr, const Ipv6Address &dgSrcAddr, NetworkInterface *ie) |
| |
| virtual void | processNsPacket (Packet *packet, const Ipv6NeighbourSolicitation *ns) |
| |
| virtual bool | validateNsPacket (Packet *packet, const Ipv6NeighbourSolicitation *ns) |
| |
| virtual void | processNsForTentativeAddress (Packet *packet, const Ipv6NeighbourSolicitation *ns) |
| |
| virtual void | processNsForNonTentativeAddress (Packet *packet, const Ipv6NeighbourSolicitation *ns, NetworkInterface *ie) |
| |
| virtual void | processNsWithSpecifiedSrcAddr (Packet *packet, const Ipv6NeighbourSolicitation *ns, NetworkInterface *ie) |
| |
| virtual void | sendSolicitedNa (Packet *packet, const Ipv6NeighbourSolicitation *ns, NetworkInterface *ie) |
| |
| virtual void | sendUnsolicitedNa (NetworkInterface *ie) |
| |
| virtual void | processNaPacket (Packet *packet, const Ipv6NeighbourAdvertisement *na) |
| |
| virtual bool | validateNaPacket (Packet *packet, const Ipv6NeighbourAdvertisement *na) |
| |
| virtual void | processNaForIncompleteNceState (const Ipv6NeighbourAdvertisement *na, Ipv6NeighbourCache::Neighbour *nce) |
| |
| virtual void | processNaForOtherNceStates (const Ipv6NeighbourAdvertisement *na, Ipv6NeighbourCache::Neighbour *nce) |
| |
| virtual void | createAndSendRedirectPacket (NetworkInterface *ie) |
| |
| virtual void | processRedirectPacket (const Ipv6Redirect *redirect) |
| |
Implements RFC 2461 Neighbor Discovery for Ipv6.
◆ AdvIfList
◆ DadList
◆ DefaultRouterList
◆ Key
◆ MsgPtrVector
◆ Neighbour
◆ RaTimerList
◆ RdList
◆ Ipv6NeighbourDiscovery()
| inet::Ipv6NeighbourDiscovery::Ipv6NeighbourDiscovery |
( |
| ) |
|
◆ ~Ipv6NeighbourDiscovery()
| inet::Ipv6NeighbourDiscovery::~Ipv6NeighbourDiscovery |
( |
| ) |
|
|
virtual |
54 cancelAndDelete(elem);
59 for (
const auto& elem :
dadList) {
60 cancelAndDelete((elem)->timeoutMsg);
65 for (
const auto& elem :
rdList) {
66 cancelAndDelete((elem)->timeoutMsg);
72 cancelAndDelete((elem)->raTimeoutMsg);
◆ assignLinkLocalAddress()
| void inet::Ipv6NeighbourDiscovery::assignLinkLocalAddress |
( |
cMessage * |
timerMsg | ) |
|
|
protectedvirtual |
as it is not possbile to explicitly define RFC 2462.
ND is the next best place to do this.
RFC 2462-Ipv6 Stateless Address Autoconfiguration: Section 1 The autoconfiguration process specified in this document applies only to hosts and not routers. Since host autoconfiguration uses information advertised by routers, routers will need to be configured by some other means. However, it is expected that routers will generate link-local addresses using the mechanism described in this document. In addition, routers are expected to successfully pass the Duplicate Address Detection procedure described in this document on all addresses prior to assigning them to an interface.
771 for (
int i = 0; i <
ift->getNumInterfaces(); i++) {
772 NetworkInterface *ie =
ift->getInterface(i);
775 if (ie->isLoopback())
778 Ipv6Address linkLocalAddr = ie->getProtocolData<Ipv6InterfaceData>()->getLinkLocalAddress();
779 if (linkLocalAddr.isUnspecified()) {
781 EV_INFO <<
"No link local address exists. Forming one" << endl;
782 linkLocalAddr = Ipv6Address().formLinkLocalAddress(ie->getInterfaceToken());
783 ie->getProtocolDataForUpdate<Ipv6InterfaceData>()->assignAddress(linkLocalAddr,
true, SIMTIME_ZERO, SIMTIME_ZERO);
787 if (ie->getProtocolData<Ipv6InterfaceData>()->isTentativeAddress(linkLocalAddr)) {
788 if (ie->getProtocolData<Ipv6InterfaceData>()->getDupAddrDetectTransmits() > 0)
Referenced by handleMessage().
◆ cancelRouterDiscovery()
| void inet::Ipv6NeighbourDiscovery::cancelRouterDiscovery |
( |
NetworkInterface * |
ie | ) |
|
|
protectedvirtual |
RFC 2461: Section 6.3.7 4th paragraph Once the host sends a Router Solicitation, and receives a valid Router Advertisement with a non-zero Router Lifetime, the host MUST desist from sending additional solicitations on that interface,.
Cancel Router Discovery on the Interface where a RA was received with the given Interface Entry.
1020 if (rdEntry !=
nullptr) {
1021 EV_DETAIL <<
"rdEntry is not nullptr, RD cancelled!" << endl;
1022 cancelAndDelete(rdEntry->timeoutMsg);
1027 EV_DETAIL <<
"rdEntry is nullptr, not cancelling RD!" << endl;
Referenced by processRaPacket().
◆ createAndSendNsPacket()
1812 #ifdef INET_WITH_xMIPv6
1816 MacAddress myMacAddr = ie->getMacAddress();
1819 auto ns = makeShared<Ipv6NeighbourSolicitation>();
1822 ns->setTargetAddress(nsTargetAddr);
1827 if (dgDestAddr.matches(Ipv6Address(
"FF02::1:FF00:0"), 104) &&
1828 !dgSrcAddr.isUnspecified())
1830 auto sla =
new Ipv6NdSourceLinkLayerAddress();
1831 sla->setLinkLayerAddress(myMacAddr);
1832 ns->getOptionsForUpdate().appendOption(sla);
1835 auto packet =
new Packet(
"NSpacket");
1837 packet->insertAtFront(
ns);
Referenced by initiateAddressResolution(), initiateDad(), processArTimeout(), processDadTimeout(), and processNudTimeout().
◆ createAndSendRaPacket()
1177 EV_INFO <<
"Create and send RA invoked!\n";
1179 Ipv6Address sourceAddr = ie->getProtocolData<Ipv6InterfaceData>()->getLinkLocalAddress();
1182 if (ie->getProtocolData<Ipv6InterfaceData>()->getAdvSendAdvertisements()) {
1184 auto ra = makeShared<Ipv6RouterAdvertisement>();
1193 ra->setRouterLifetime(SIMTIME_DBL(ie->getProtocolData<Ipv6InterfaceData>()->getAdvDefaultLifetime()));
1197 ra->setManagedAddrConfFlag(ie->getProtocolData<Ipv6InterfaceData>()->getAdvManagedFlag());
1198 ra->setOtherStatefulConfFlag(ie->getProtocolData<Ipv6InterfaceData>()->getAdvOtherConfigFlag());
1200 #ifdef INET_WITH_xMIPv6
1202 if (
rt6->isHomeAgent())
1203 ra->setHomeAgentFlag(
true);
1205 ra->setHomeAgentFlag(ie->getProtocolData<Ipv6InterfaceData>()->getAdvHomeAgentFlag());
1209 ra->setCurHopLimit(ie->getProtocolData<Ipv6InterfaceData>()->getAdvCurHopLimit());
1212 ra->setReachableTime(ie->getProtocolData<Ipv6InterfaceData>()->getAdvReachableTime());
1215 ra->setRetransTimer(ie->getProtocolData<Ipv6InterfaceData>()->getAdvRetransTimer());
1220 auto sla =
new Ipv6NdSourceLinkLayerAddress();
1221 sla->setLinkLayerAddress(ie->getMacAddress());
1222 ra->getOptionsForUpdate().appendOption(sla);
1226 auto mtu =
new Ipv6NdMtu();
1227 mtu->setMtu(ie->getProtocolData<Ipv6InterfaceData>()->getAdvLinkMtu());
1228 ra->getOptionsForUpdate().appendOption(mtu);
1232 int numAdvPrefixes = ie->getProtocolData<Ipv6InterfaceData>()->getNumAdvPrefixes();
1233 EV_DETAIL <<
"Number of Adv Prefixes: " << numAdvPrefixes << endl;
1234 for (
int i = 0; i < numAdvPrefixes; i++) {
1235 Ipv6InterfaceData::AdvPrefix advPrefix = ie->getProtocolData<Ipv6InterfaceData>()->getAdvPrefix(i);
1236 auto prefixInfo =
new Ipv6NdPrefixInformation();
1238 #ifndef INET_WITH_xMIPv6
1239 prefixInfo->setPrefix(advPrefix.prefix);
1241 EV_DETAIL <<
"\n+=+=+=+= Appendign Prefix Info Option to RA +=+=+=+=\n";
1242 EV_DETAIL <<
"Prefix Value: " << advPrefix.prefix << endl;
1243 EV_DETAIL <<
"Prefix Length: " << advPrefix.prefixLength << endl;
1244 EV_DETAIL <<
"L-Flag: " << advPrefix.advOnLinkFlag << endl;
1245 EV_DETAIL <<
"A-Flag: " << advPrefix.advAutonomousFlag << endl;
1246 EV_DETAIL <<
"R-Flag: " << advPrefix.advRtrAddr << endl;
1247 EV_DETAIL <<
"Global Address from Prefix: " << advPrefix.rtrAddress << endl;
1249 if (
rt6->isHomeAgent() && advPrefix.advRtrAddr ==
true)
1250 prefixInfo->setPrefix(advPrefix.rtrAddress);
1252 prefixInfo->setPrefix(advPrefix.prefix);
1255 prefixInfo->setPrefixLength(advPrefix.prefixLength);
1258 prefixInfo->setOnlinkFlag(advPrefix.advOnLinkFlag);
1260 prefixInfo->setValidLifetime(SIMTIME_DBL(advPrefix.advValidLifetime));
1263 prefixInfo->setAutoAddressConfFlag(advPrefix.advAutonomousFlag);
1265 #ifdef INET_WITH_xMIPv6
1266 if (
rt6->isHomeAgent())
1267 prefixInfo->setRouterAddressFlag(
true);
1270 prefixInfo->setValidLifetime(SIMTIME_DBL(advPrefix.advValidLifetime));
1274 prefixInfo->setPreferredLifetime(SIMTIME_DBL(advPrefix.advPreferredLifetime));
1276 ra->getOptionsForUpdate().appendOption(prefixInfo);
1280 auto packet =
new Packet(
"RApacket");
1282 packet->insertAtFront(ra);
Referenced by sendPeriodicRa(), and sendSolicitedRa().
◆ createAndSendRedirectPacket()
| void inet::Ipv6NeighbourDiscovery::createAndSendRedirectPacket |
( |
NetworkInterface * |
ie | ) |
|
|
protectedvirtual |
2408 auto redirect = makeShared<Ipv6Redirect>();
2413 redirect->setTargetAddress();
2414 redirect->setDestinationAddress();
2417 redirect->setTargetLinkLayerAddress();
◆ createAndSendRsPacket()
| void inet::Ipv6NeighbourDiscovery::createAndSendRsPacket |
( |
NetworkInterface * |
ie | ) |
|
|
protectedvirtual |
949 ASSERT(ie->getProtocolData<Ipv6InterfaceData>()->getAdvSendAdvertisements() ==
false);
954 Ipv6Address myIPv6Address = ie->getProtocolData<Ipv6InterfaceData>()->getPreferredAddress();
956 if (myIPv6Address.isUnspecified())
957 myIPv6Address = ie->getProtocolData<Ipv6InterfaceData>()->getLinkLocalAddress();
959 if (ie->getProtocolData<Ipv6InterfaceData>()->isTentativeAddress(myIPv6Address))
963 auto rs = makeShared<Ipv6RouterSolicitation>();
967 if (!myIPv6Address.isUnspecified()) {
968 auto sla =
new Ipv6NdSourceLinkLayerAddress();
969 sla->setLinkLayerAddress(ie->getMacAddress());
970 rs->getOptionsForUpdate().insertUniqueOption(sla);
975 auto packet =
new Packet(
"RSpacket");
977 packet->insertAtFront(rs);
Referenced by initiateRouterDiscovery(), and processRdTimeout().
◆ createRaTimer()
Create a timer for the given interface entry that sends periodic Router Advertisements.
1639 msg->setContextPointer(ie);
1640 AdvIfEntry *advIfEntry =
new AdvIfEntry();
1641 advIfEntry->interfaceId = ie->getInterfaceId();
1642 advIfEntry->numRASent = 0;
1644 #ifdef INET_WITH_xMIPv6
1653 if (canServeWirelessNodes(ie)) {
1654 EV_INFO <<
"This Interface is connected to a WLAN AP, hence using MIPv6 Default Values" << endl;
1655 simtime_t minRAInterval = par(
"minIntervalBetweenRAs");
1656 simtime_t maxRAInterval = par(
"maxIntervalBetweenRAs");
1657 ie->getProtocolDataForUpdate<Ipv6InterfaceData>()->setMinRtrAdvInterval(minRAInterval);
1658 ie->getProtocolDataForUpdate<Ipv6InterfaceData>()->setMaxRtrAdvInterval(maxRAInterval);
1661 EV_INFO <<
"This Interface is not connected to a WLAN AP, hence using default values" << endl;
1668 simtime_t interval = uniform(ie->getProtocolData<Ipv6InterfaceData>()->getMinRtrAdvInterval(), ie->getProtocolData<Ipv6InterfaceData>()->getMaxRtrAdvInterval());
1669 advIfEntry->raTimeoutMsg = msg;
1671 simtime_t nextScheduledTime = simTime() + interval;
1672 advIfEntry->nextScheduledRATime = nextScheduledTime;
1674 EV_DETAIL <<
"Interval: " << interval << endl;
1675 EV_DETAIL <<
"Next scheduled time: " << nextScheduledTime << endl;
1677 scheduleAfter(interval, msg);
Referenced by initialize().
◆ determineNextHop()
This function accepts the datagram's destination address and attempts to determine the destination's next hop address and interface ID by: (1) looking up the destination cache, (2)looking up the routing table, or (3) selecting a default router.
It then updates the destination cache. If no default router can be selected than we assume the destination address to be onlink and simply return any available interface.
424 Ipv6Address nextHopAddr;
425 simtime_t expiryTime;
432 EV_INFO <<
"Find out if supplied dest addr is on-link or off-link.\n";
433 const Ipv6Route *route =
rt6->doLongestPrefixMatch(destAddr);
435 if (route !=
nullptr) {
436 expiryTime = route->getExpiryTime();
437 outIfID = route->getInterface() ? route->getInterface()->getInterfaceId() : -1;
441 if (route->getNextHop().isUnspecified()) {
442 EV_INFO <<
"Dest is on-link, next-hop addr is same as dest addr.\n";
443 nextHopAddr = destAddr;
446 EV_INFO <<
"A next-hop address was found with the route, dest is off-link\n";
447 EV_INFO <<
"Assume next-hop address as the selected default router.\n";
448 nextHopAddr = route->getNextHop();
455 EV_INFO <<
"No routes were found, Dest addr is off-link.\n";
460 EV_INFO <<
"No Default Routers were found.";
462 EV_INFO <<
"Default router found.\n";
467 rt6->updateDestCache(destAddr, nextHopAddr, outIfID, expiryTime);
Referenced by processIpv6Datagram().
◆ dropQueuedPacketsAwaitingAr()
| void inet::Ipv6NeighbourDiscovery::dropQueuedPacketsAwaitingAr |
( |
Neighbour * |
nce | ) |
|
|
protectedvirtual |
Drops specific queued packets for a specific NCE AR-timeout.
TODO Not implemented yet!
709 const Key *nceKey = nce->nceKey;
716 EV_INFO <<
"Pending Packets empty:" << pendingPackets.empty() << endl;
718 while (!pendingPackets.empty()) {
719 auto i = pendingPackets.begin();
723 EV_INFO <<
"Sending ICMP unreachable destination." << endl;
724 pendingPackets.erase(i);
733 EV_INFO <<
"Removing neighbour cache entry" << endl;
Referenced by processArTimeout().
◆ fetchAdvIfEntry()
◆ fetchRdEntry()
◆ finish()
| void inet::Ipv6NeighbourDiscovery::finish |
( |
| ) |
|
|
overrideprotectedvirtual |
◆ handleMessage()
| void inet::Ipv6NeighbourDiscovery::handleMessage |
( |
cMessage * |
msg | ) |
|
|
overrideprotectedvirtual |
136 if (msg->isSelfMessage()) {
137 EV_TRACE <<
"Self message received!\n";
140 EV_INFO <<
"Sending periodic RA\n";
144 EV_INFO <<
"Sending solicited RA\n";
148 EV_INFO <<
"Assigning Link Local Address\n";
152 EV_INFO <<
"DAD Timeout message received\n";
156 EV_INFO <<
"Router Discovery message received\n";
160 EV_INFO <<
"initiate router discovery.\n";
164 EV_INFO <<
"NUD Timeout message received\n";
168 EV_INFO <<
"Address Resolution Timeout message received\n";
172 throw cRuntimeError(
"Unrecognized Timer");
174 else if (
auto packet =
dynamic_cast<Packet *
>(msg)) {
178 const auto& ndMsg = packet->peekAtFront<Icmpv6Header>();
186 throw cRuntimeError(
"Unknown message type received.\n");
◆ initialize()
| void inet::Ipv6NeighbourDiscovery::initialize |
( |
int |
stage | ) |
|
|
overrideprotectedvirtual |
79 cSimpleModule::initialize(stage);
82 const char *crcModeString = par(
"crcMode");
87 NodeStatus *nodeStatus = node ? check_and_cast_nullable<NodeStatus *>(node->getSubmodule(
"status")) : nullptr;
88 bool isOperational = (!nodeStatus) || nodeStatus->getState() ==
NodeStatus::UP;
90 throw cRuntimeError(
"This module doesn't support starting in node DOWN state");
91 ift.reference(
this,
"interfaceTableModule",
true);
92 rt6.reference(
this,
"routingTableModule",
true);
93 icmpv6.reference(
this,
"icmpv6Module",
true);
95 #ifdef INET_WITH_xMIPv6
96 if (
rt6->isMobileNode())
97 mipv6.reference(
this,
"xmipv6Module",
true);
102 #ifdef INET_WITH_xMIPv6
114 for (
int i = 0; i <
ift->getNumInterfaces(); i++) {
115 NetworkInterface *ie =
ift->getInterface(i);
117 if (ie->getProtocolData<Ipv6InterfaceData>()->getAdvSendAdvertisements() && !(ie->isLoopback())) {
128 scheduleAfter(uniform(0, 0.3), msg);
130 scheduleAfter(uniform(0.4, 1), msg);
◆ initiateAddressResolution()
| void inet::Ipv6NeighbourDiscovery::initiateAddressResolution |
( |
const Ipv6Address & |
dgSrcAddr, |
|
|
Neighbour * |
nce |
|
) |
| |
|
protectedvirtual |
This method attempts to resolve the given neighbour's link-layer address.
The source address of the packet prompting address resolution is also given in order to decide the source address of the NS to be sent. nceKey stores 2 pieces of information (Neighbour address and Interface ID) which is needed for addr resolution and access to the corresponding nce.
633 const Key *nceKey = nce->nceKey;
634 NetworkInterface *ie =
ift->getInterfaceById(nceKey->interfaceID);
635 Ipv6Address neighbourAddr = nceKey->address;
636 int ifID = nceKey->interfaceID;
650 EV_INFO <<
"Preparing to send NS to solicited-node multicast group\n";
651 EV_INFO <<
"on the next hop interface\n";
652 Ipv6Address nsDestAddr = neighbourAddr.formSolicitedNodeMulticastAddress();
653 Ipv6Address nsTargetAddr = neighbourAddr;
654 Ipv6Address nsSrcAddr;
658 if (ie->getProtocolData<Ipv6InterfaceData>()->hasAddress(dgSrcAddr))
661 nsSrcAddr = dgSrcAddr;
665 nsSrcAddr = ie->getProtocolData<Ipv6InterfaceData>()->getPreferredAddress();
669 nce->numOfARNSSent = 1;
670 nce->nsSrcAddr = nsSrcAddr;
678 msg->setContextPointer(nce);
679 scheduleAfter(ie->getProtocolData<Ipv6InterfaceData>()->_getRetransTimer(), msg);
Referenced by processIpv6Datagram().
◆ initiateDad()
Initiating DAD means to send off a Neighbour Solicitation with its target address set as this node's tentative link-local address.
799 #ifdef INET_WITH_xMIPv6
801 EV_INFO <<
"----------INITIATING DUPLICATE ADDRESS DISCOVERY----------" << endl;
802 ie->getProtocolDataForUpdate<Ipv6InterfaceData>()->setDadInProgress(
true);
805 DadEntry *dadEntry =
new DadEntry();
806 dadEntry->interfaceId = ie->getInterfaceId();
807 dadEntry->address = tentativeAddr;
808 dadEntry->numNSSent = 0;
818 Ipv6Address destAddr = tentativeAddr.formSolicitedNodeMulticastAddress();
822 dadEntry->numNSSent++;
825 msg->setContextPointer(dadEntry);
827 #ifndef INET_WITH_xMIPv6
828 scheduleAfter(ie->getProtocolData<Ipv6InterfaceData>()->getRetransTimer(), msg);
Referenced by assignLinkLocalAddress().
◆ initiateNeighbourUnreachabilityDetection()
| void inet::Ipv6NeighbourDiscovery::initiateNeighbourUnreachabilityDetection |
( |
Neighbour * |
neighbour | ) |
|
|
protectedvirtual |
474 ASSERT(nce->nudTimeoutEvent ==
nullptr);
475 const Key *nceKey = nce->nceKey;
476 EV_INFO <<
"Initiating Neighbour Unreachability Detection";
477 NetworkInterface *ie =
ift->getInterfaceById(nceKey->interfaceID);
478 EV_INFO <<
"Setting NCE state to DELAY.\n";
485 msg->setContextPointer(nce);
486 nce->nudTimeoutEvent = msg;
487 scheduleAfter(ie->getProtocolData<Ipv6InterfaceData>()->_getDelayFirstProbeTime(), msg);
Referenced by processIpv6Datagram(), and resolveNeighbour().
◆ initiateRouterDiscovery()
| void inet::Ipv6NeighbourDiscovery::initiateRouterDiscovery |
( |
cMessage * |
msg | ) |
|
|
protectedvirtual |
983 EV_INFO <<
"Initiating Router Discovery" << endl;
984 NetworkInterface *ie = (NetworkInterface *)msg->getContextPointer();
993 RdEntry *rdEntry =
new RdEntry();
994 rdEntry->interfaceId = ie->getInterfaceId();
995 rdEntry->numRSSent = 0;
997 rdEntry->numRSSent++;
1000 cMessage *rdTimeoutMsg =
new cMessage(
"processRDTimeout",
MK_RD_TIMEOUT);
1001 rdTimeoutMsg->setContextPointer(ie);
1002 rdEntry->timeoutMsg = rdTimeoutMsg;
1013 scheduleAfter(ie->getProtocolData<Ipv6InterfaceData>()->_getRtrSolicitationInterval(), rdTimeoutMsg);
Referenced by handleMessage().
◆ makeTentativeAddressPermanent()
Permanently assign the given address for the given interface entry.
To be called after successful DAD.
869 ie->getProtocolDataForUpdate<Ipv6InterfaceData>()->permanentlyAssign(tentativeAddr);
871 #ifdef INET_WITH_xMIPv6
872 ie->getProtocolDataForUpdate<Ipv6InterfaceData>()->setDadInProgress(
false);
878 auto it = dadGlobalList.find(ie);
879 if (it != dadGlobalList.end()) {
880 DadGlobalEntry& entry = it->second;
882 ie->getProtocolDataForUpdate<Ipv6InterfaceData>()->assignAddress(entry.addr,
false, simTime() + entry.validLifetime,
883 simTime() + entry.preferredLifetime, entry.hFlag);
887 if (!entry.CoA.isUnspecified())
888 ie->getProtocolDataForUpdate<Ipv6InterfaceData>()->removeAddress(entry.CoA);
891 for (
int i = 0; i < ie->getProtocolData<Ipv6InterfaceData>()->getNumAddresses(); i++) {
894 Ipv6Address addr = ie->getProtocolData<Ipv6InterfaceData>()->getAddress(i);
895 ie->getProtocolDataForUpdate<Ipv6InterfaceData>()->permanentlyAssign(addr);
900 if (
rt6->isMobileNode()) {
901 if (entry.hFlag ==
false)
902 mipv6->initiateMipv6Protocol(ie, tentativeAddr);
911 dadGlobalList.erase(it->first);
920 if (
rt6->isRouter() && !(ie->isLoopback())) {
921 for (
int i = 0; i < ie->getProtocolData<Ipv6InterfaceData>()->getNumAdvPrefixes(); i++) {
922 Ipv6Address globalAddress = ie->getProtocolDataForUpdate<Ipv6InterfaceData>()->autoConfRouterGlobalScopeAddress(i);
923 ie->getProtocolDataForUpdate<Ipv6InterfaceData>()->assignAddress(globalAddress,
false, 0, 0);
938 if (ie->getProtocolData<Ipv6InterfaceData>()->getAdvSendAdvertisements() ==
false) {
939 EV_INFO <<
"creating router discovery message timer\n";
941 rtrDisMsg->setContextPointer(ie);
942 simtime_t interval = uniform(0, ie->getProtocolData<Ipv6InterfaceData>()->_getMaxRtrSolicitationDelay());
943 scheduleAfter(interval, rtrDisMsg);
Referenced by assignLinkLocalAddress(), and processDadTimeout().
◆ numInitStages()
| virtual int inet::Ipv6NeighbourDiscovery::numInitStages |
( |
| ) |
const |
|
inlineoverrideprotectedvirtual |
◆ processArTimeout()
| void inet::Ipv6NeighbourDiscovery::processArTimeout |
( |
cMessage * |
arTimeoutMsg | ) |
|
|
protectedvirtual |
Resends a NS packet to the address intended for address resolution.
TODO Not implemented yet!
686 const Key *nceKey = nce->nceKey;
687 Ipv6Address nsTargetAddr = nceKey->
address;
688 NetworkInterface *ie =
ift->getInterfaceById(nceKey->interfaceID);
689 EV_INFO <<
"Num Of NS Sent:" << nce->numOfARNSSent << endl;
690 EV_INFO <<
"Max Multicast Solicitation:" << ie->getProtocolData<Ipv6InterfaceData>()->_getMaxMulticastSolicit() << endl;
692 if (nce->numOfARNSSent < ie->getProtocolData<Ipv6InterfaceData>()->_getMaxMulticastSolicit()) {
693 EV_INFO <<
"Sending another Address Resolution NS message" << endl;
694 Ipv6Address nsDestAddr = nsTargetAddr.formSolicitedNodeMulticastAddress();
696 nce->numOfARNSSent++;
697 scheduleAfter(ie->getProtocolData<Ipv6InterfaceData>()->_getRetransTimer(), arTimeoutMsg);
701 EV_WARN <<
"Address Resolution has failed." << endl;
703 EV_INFO <<
"Deleting AR timeout msg\n";
Referenced by handleMessage().
◆ processDadTimeout()
| void inet::Ipv6NeighbourDiscovery::processDadTimeout |
( |
cMessage * |
msg | ) |
|
|
protectedvirtual |
Sends a scheduled DAD NS packet.
If number of sends is equals or more than dupAddrDetectTransmits, then permantly assign target link local address as permanent address for given interface entry.
840 DadEntry *dadEntry = (DadEntry *)msg->getContextPointer();
841 NetworkInterface *ie =
ift->getInterfaceById(dadEntry->interfaceId);
842 Ipv6Address tentativeAddr = dadEntry->address;
845 EV_DETAIL <<
"numOfDADMessagesSent is: " << dadEntry->numNSSent << endl;
846 EV_DETAIL <<
"dupAddrDetectTrans is: " << ie->getProtocolData<Ipv6InterfaceData>()->getDupAddrDetectTransmits() << endl;
848 if (dadEntry->numNSSent < ie->getProtocolData<Ipv6InterfaceData>()->getDupAddrDetectTransmits()) {
849 bubble(
"Sending another DAD NS message.");
850 Ipv6Address destAddr = tentativeAddr.formSolicitedNodeMulticastAddress();
852 dadEntry->numNSSent++;
854 scheduleAfter(ie->getProtocolData<Ipv6InterfaceData>()->getRetransTimer(), msg);
857 bubble(
"Max number of DAD messages for interface sent. Address is unique.");
859 EV_DETAIL <<
"delete dadEntry and msg\n";
Referenced by handleMessage().
◆ processIpv6Datagram()
| void inet::Ipv6NeighbourDiscovery::processIpv6Datagram |
( |
Packet * |
packet | ) |
|
|
protectedvirtual |
217 const auto& msg = packet->peekAtFront<Ipv6Header>();
218 EV_INFO <<
"Packet " << packet <<
" arrived from Ipv6 module.\n";
220 Ipv6NdControlInfo *
ctrl = check_and_cast<Ipv6NdControlInfo *>(packet->getControlInfo());
221 int nextHopIfID =
ctrl->getInterfaceId();
222 Ipv6Address nextHopAddr =
ctrl->getNextHop();
225 if (nextHopIfID == -1 || nextHopAddr.isUnspecified()) {
226 EV_INFO <<
"Determining Next Hop" << endl;
228 ctrl->setInterfaceId(nextHopIfID);
229 ctrl->setNextHop(nextHopAddr);
232 if (nextHopIfID == -1) {
235 delete packet->removeControlInfo();
241 EV_INFO <<
"Next Hop Address is: " << nextHopAddr <<
" on interface: " << nextHopIfID << endl;
248 if (nce ==
nullptr) {
249 EV_INFO <<
"No Entry exists in the Neighbour Cache.\n";
250 NetworkInterface *ie =
ift->getInterfaceById(nextHopIfID);
251 if (ie->isPointToPoint()) {
253 EV_DETAIL <<
"Creating an STALE entry in the neighbour cache.\n";
258 EV_DETAIL <<
"Creating an INCOMPLETE entry in the neighbour cache.\n";
262 EV_DETAIL <<
"Initiating Address Resolution for:" << nextHopAddr
263 <<
" on Interface:" << nextHopIfID << endl;
273 switch (nce->reachabilityState) {
275 EV_INFO <<
"Reachability State is INCOMPLETE. Address Resolution already initiated.\n";
276 EV_INFO <<
"Add packet to entry's queue until Address Resolution is complete.\n";
277 bubble(
"Packet added to queue until Address Resolution is complete.");
278 nce->pendingPackets.push_back(packet);
282 EV_INFO <<
"Reachability State is STALE.\n";
283 send(packet,
"ipv6Out");
287 EV_INFO <<
"Next hop is REACHABLE, sending packet to next-hop address.";
288 send(packet,
"ipv6Out");
291 EV_INFO <<
"Next hop is in DELAY state, sending packet to next-hop address.";
292 send(packet,
"ipv6Out");
295 EV_INFO <<
"Next hop is in PROBE state, sending packet to next-hop address.";
296 send(packet,
"ipv6Out");
299 throw cRuntimeError(
"Unknown Neighbour cache entry state.");
Referenced by handleMessage().
◆ processNaForIncompleteNceState()
2255 MacAddress naMacAddr;
2257 naMacAddr = tla->getLinkLayerAddress();
2258 bool naRouterFlag = na->getRouterFlag();
2259 bool naSolicitedFlag = na->getSolicitedFlag();
2260 const Key *nceKey = nce->nceKey;
2261 NetworkInterface *ie =
ift->getInterfaceById(nceKey->interfaceID);
2265 if (naMacAddr.isUnspecified()) {
2269 EV_INFO <<
"No MAC Address specified in NA. Ignoring NA\n";
2275 EV_INFO <<
"ND is updating Neighbour Cache Entry.\n";
2276 nce->macAddress = naMacAddr;
2280 if (naSolicitedFlag ==
true) {
2282 EV_INFO <<
"Reachability confirmed through successful Addr Resolution.\n";
2283 nce->reachabilityExpires = simTime() + ie->getProtocolData<Ipv6InterfaceData>()->_getReachableTime();
2290 nce->isRouter = naRouterFlag;
2291 if (nce->isDefaultRouter() && !nce->isRouter)
2297 cancelAndDelete(nce->arTimer);
2298 nce->arTimer =
nullptr;
Referenced by processNaPacket().
◆ processNaForOtherNceStates()
2304 bool naRouterFlag = na->getRouterFlag();
2305 bool naSolicitedFlag = na->getSolicitedFlag();
2306 bool naOverrideFlag = na->getOverrideFlag();
2307 MacAddress naMacAddr;
2309 naMacAddr = tla->getLinkLayerAddress();
2310 const Key *nceKey = nce->nceKey;
2311 NetworkInterface *ie =
ift->getInterfaceById(nceKey->interfaceID);
2318 if (naOverrideFlag ==
false && !(naMacAddr.equals(nce->macAddress))
2319 && !(naMacAddr.isUnspecified()))
2321 EV_INFO <<
"NA override is FALSE and NA MAC addr is different.\n";
2328 EV_INFO <<
"NA mac is different. Change NCE state from REACHABLE to STALE\n";
2335 EV_INFO <<
"NCE is not in REACHABLE state. Ignore NA.\n";
2337 else if (naOverrideFlag ==
true || naMacAddr.equals(nce->macAddress)
2338 || naMacAddr.isUnspecified())
2340 EV_INFO <<
"NA override flag is TRUE. or Advertised MAC is same as NCE's. or"
2341 <<
" NA MAC is not specified.\n";
2350 if (!(naMacAddr.isUnspecified()) && !(naMacAddr.equals(nce->macAddress))) {
2351 EV_INFO <<
"Updating NCE's MAC addr with NA's.\n";
2352 nce->macAddress = naMacAddr;
2356 if (naSolicitedFlag ==
true) {
2357 EV_INFO <<
"Solicited Flag is TRUE. Set NCE state to REACHABLE.\n";
2362 cMessage *msg = nce->nudTimeoutEvent;
2363 if (msg !=
nullptr) {
2364 EV_INFO <<
"NUD in progress. Cancelling NUD Timer\n";
2365 bubble(
"Reachability Confirmed via NUD.");
2366 nce->reachabilityExpires = simTime() + ie->getProtocolData<Ipv6InterfaceData>()->_getReachableTime();
2367 cancelAndDelete(msg);
2368 nce->nudTimeoutEvent =
nullptr;
2373 EV_INFO <<
"Solicited Flag is FALSE.\n";
2376 if (!(naMacAddr.equals(nce->macAddress))) {
2377 EV_INFO <<
"NA's MAC is different from NCE's.Set NCE state to STALE\n";
2383 EV_INFO <<
"NA's MAC is the same as NCE's. State remains unchanged.\n";
2389 EV_INFO <<
"Updating NCE's router flag to " << naRouterFlag << endl;
2390 nce->isRouter = naRouterFlag;
2398 if (nce->isDefaultRouter() && !nce->isRouter)
Referenced by processNaPacket().
◆ processNaPacket()
2187 Ipv6Address naTargetAddr = na->getTargetAddress();
2191 NetworkInterface *ie =
ift->getInterfaceById(packet->getTag<InterfaceInd>()->getInterfaceId());
2192 if (ie->getProtocolData<Ipv6InterfaceData>()->isTentativeAddress(naTargetAddr)) {
2193 throw cRuntimeError(
"Duplicate Address Detected! Manual attention needed!");
2198 if (neighbourEntry ==
nullptr) {
2199 EV_INFO <<
"NA received. Target Address not found in Neighbour Cache\n";
2200 EV_INFO <<
"Dropping NA packet.\n";
2206 EV_INFO <<
"NA received. Target Address found in Neighbour Cache\n";
Referenced by processNDMessage().
◆ processNDMessage()
| void inet::Ipv6NeighbourDiscovery::processNDMessage |
( |
Packet * |
packet, |
|
|
const Icmpv6Header * |
msg |
|
) |
| |
|
protectedvirtual |
191 if (
auto rs =
dynamic_cast<const Ipv6RouterSolicitation *
>(icmpv6Header)) {
194 else if (
auto ra =
dynamic_cast<const Ipv6RouterAdvertisement *
>(icmpv6Header)) {
197 else if (
auto ns =
dynamic_cast<const Ipv6NeighbourSolicitation *
>(icmpv6Header)) {
200 else if (
auto na =
dynamic_cast<const Ipv6NeighbourAdvertisement *
>(icmpv6Header)) {
203 else if (
auto redirect =
dynamic_cast<const Ipv6Redirect *
>(icmpv6Header)) {
207 throw cRuntimeError(
"Unrecognized ND message!");
Referenced by handleMessage().
◆ processNsForNonTentativeAddress()
1954 if (packet->getTag<
L3AddressInd>()->getSrcAddress().toIpv6().isUnspecified()) {
1955 EV_INFO <<
"Address is duplicate! Inform Sender of duplicate address!\n";
Referenced by processNsPacket().
◆ processNsForTentativeAddress()
1923 Ipv6Address nsSrcAddr = packet->getTag<
L3AddressInd>()->getSrcAddress().toIpv6();
1926 ASSERT(nsSrcAddr.isUnicast() || nsSrcAddr.isUnspecified());
1929 if (nsSrcAddr.isUnspecified()) {
1930 EV_INFO <<
"Source Address is UNSPECIFIED. Sender is performing DAD\n";
1933 if (
rt6->isLocalAddress(nsSrcAddr))
1934 EV_INFO <<
"NS comes from myself. Ignoring NS\n";
1936 EV_INFO <<
"NS comes from another node. Address is duplicate!\n";
1937 throw cRuntimeError(
"Duplicate Address Detected! Manual Attention Required!");
1940 else if (nsSrcAddr.isUnicast()) {
1942 EV_INFO <<
"Sender is performing Address Resolution\n";
1943 EV_INFO <<
"Target Address is tentative. Ignoring NS.\n";
Referenced by processNsPacket().
◆ processNsPacket()
1845 NetworkInterface *ie =
ift->getInterfaceById(packet->getTag<InterfaceInd>()->getInterfaceId());
1847 Ipv6Address nsTargetAddr =
ns->getTargetAddress();
1853 || ie->getProtocolData<Ipv6InterfaceData>()->hasAddress(nsTargetAddr) ==
false)
1855 bubble(
"NS validation failed\n");
1860 bubble(
"NS validation passed.\n");
1862 if (ie->getProtocolData<Ipv6InterfaceData>()->isTentativeAddress(nsTargetAddr)) {
1865 EV_INFO <<
"Process NS for Tentative target address.\n";
1870 EV_INFO <<
"Process NS for Non-Tentative target address.\n";
Referenced by processNDMessage().
◆ processNsWithSpecifiedSrcAddr()
1972 MacAddress nsMacAddr;
1974 nsMacAddr = sla->getLinkLayerAddress();
1975 Ipv6Address nsL3SrcAddr = packet->getTag<
L3AddressInd>()->getSrcAddress().toIpv6();
1977 int ifID = ie->getInterfaceId();
1982 if (entry ==
nullptr) {
1985 EV_INFO <<
"Neighbour Entry not found. Create a Neighbour Cache Entry.\n";
1991 if (!(entry->macAddress.equals(nsMacAddr)) && !nsMacAddr.isUnspecified()) {
Referenced by processNsForNonTentativeAddress().
◆ processNudTimeout()
| void inet::Ipv6NeighbourDiscovery::processNudTimeout |
( |
cMessage * |
timeoutMsg | ) |
|
|
protectedvirtual |
492 EV_INFO <<
"NUD has timed out\n";
495 const Key *nceKey = nce->nceKey;
496 if (nceKey ==
nullptr)
497 throw cRuntimeError(
"The nceKey is nullptr at nce->MAC=%s, isRouter=%d",
498 nce->macAddress.str().c_str(), nce->isRouter);
500 NetworkInterface *ie =
ift->getInterfaceById(nceKey->interfaceID);
506 EV_DETAIL <<
"Neighbour Entry is still in DELAY state.\n";
507 EV_DETAIL <<
"Entering PROBE state. Sending NS probe.\n";
509 nce->numProbesSent = 0;
516 if (nce->numProbesSent == (
int)ie->getProtocolData<Ipv6InterfaceData>()->_getMaxUnicastSolicit()) {
517 EV_DETAIL <<
"Max number of probes have been sent." << endl;
518 EV_DETAIL <<
"Neighbour is Unreachable, removing NCE." << endl;
526 ie->getProtocolData<Ipv6InterfaceData>()->getPreferredAddress(), ie);
527 nce->numProbesSent++;
532 scheduleAfter(ie->getProtocolData<Ipv6InterfaceData>()->_getRetransTimer(), timeoutMsg);
Referenced by handleMessage().
◆ processRaForRouterUpdates()
1351 EV_INFO <<
"Processing RA for Router Updates\n";
1357 Ipv6Address raSrcAddr = packet->getTag<
L3AddressInd>()->getSrcAddress().toIpv6();
1358 NetworkInterface *ie =
ift->getInterfaceById(packet->getTag<InterfaceInd>()->getInterfaceId());
1359 int ifID = ie->getInterfaceId();
1361 MacAddress sourceLinkLayerAddress;
1363 sourceLinkLayerAddress = sla->getLinkLayerAddress();
1371 #ifdef INET_WITH_xMIPv6
1375 if (neighbour ==
nullptr) {
1376 EV_INFO <<
"Neighbour Cache Entry does not contain RA's source address\n";
1377 if (ra->getRouterLifetime() != 0) {
1378 EV_INFO <<
"RA's router lifetime is non-zero, creating an entry in the "
1379 <<
"Host's default router list with lifetime=" << ra->getRouterLifetime() <<
"\n";
1381 #ifdef INET_WITH_xMIPv6
1384 routersUnreachabilityDetection(ie);
1390 sourceLinkLayerAddress, simTime() + ra->getRouterLifetime()
1392 , ra->getHomeAgentFlag()
1396 rt6->addDefaultRoute(raSrcAddr, ifID, simTime() + ra->getRouterLifetime());
1399 EV_INFO <<
"Router Lifetime is 0, adding NON-default router.\n";
1401 if (sourceLinkLayerAddress.isUnspecified())
1405 sourceLinkLayerAddress);
1412 neighbour->isRouter =
true;
1416 if (sourceLinkLayerAddress.isUnspecified() ==
false &&
1417 neighbour->macAddress.equals(sourceLinkLayerAddress) ==
false)
1418 neighbour->macAddress = sourceLinkLayerAddress;
1423 neighbour->routerExpiryTime = simTime() + ra->getRouterLifetime();
1428 if (ra->getRouterLifetime() == 0) {
1429 EV_INFO <<
"RA's router lifetime is ZERO. Timing-out entry.\n";
1438 if (ra->getCurHopLimit() != 0) {
1439 EV_INFO <<
"RA's Cur Hop Limit is non-zero. Setting host's Cur Hop Limit to "
1440 <<
"received value.\n";
1441 ie->getProtocolDataForUpdate<Ipv6InterfaceData>()->setCurHopLimit(ra->getCurHopLimit());
1446 if (ra->getReachableTime() != 0) {
1447 EV_INFO <<
"RA's reachable time is non-zero ";
1449 if (ra->getReachableTime() != SIMTIME_DBL(ie->getProtocolData<Ipv6InterfaceData>()->getReachableTime())) {
1450 EV_INFO <<
" and RA's and Host's reachable time differ, \nsetting host's base"
1451 <<
" reachable time to received value.\n";
1452 ie->getProtocolDataForUpdate<Ipv6InterfaceData>()->setBaseReachableTime(ra->getReachableTime());
1455 ie->getProtocolDataForUpdate<Ipv6InterfaceData>()->setReachableTime(ie->getProtocolDataForUpdate<Ipv6InterfaceData>()->generateReachableTime());
1463 if (ra->getRetransTimer() != 0) {
1464 EV_INFO <<
"RA's retrans timer is non-zero, copying retrans timer variable.\n";
1465 ie->getProtocolDataForUpdate<Ipv6InterfaceData>()->setRetransTimer(ra->getRetransTimer());
Referenced by processRaPacket().
◆ processRaPacket()
1289 NetworkInterface *ie =
ift->getInterfaceById(packet->getTag<InterfaceInd>()->getInterfaceId());
1290 if (ie->getProtocolData<Ipv6InterfaceData>()->getAdvSendAdvertisements()) {
1291 EV_INFO <<
"Interface is an advertising interface, dropping RA message.\n";
1301 #ifdef INET_WITH_xMIPv6
1302 if (ie->getProtocolDataForUpdate<Ipv6InterfaceData>()->isDadInProgress()) {
1312 EV_INFO <<
"Interface is a host, processing RA.\n";
1319 for (
int i = 0; i < (int)ra->getOptions().getOptionArraySize(); i++) {
1320 auto option = ra->getOptions().getOption(i);
1323 const Ipv6NdPrefixInformation& prefixInfo = *check_and_cast<const Ipv6NdPrefixInformation *>(option);
1324 if (prefixInfo.getAutoAddressConfFlag() ==
true) {
1325 #ifndef INET_WITH_xMIPv6
1332 #ifdef INET_WITH_xMIPv6
1334 if (ra->getHomeAgentFlag() && (prefixInfo.getRouterAddressFlag() ==
true)) {
1337 Ipv6Address HoA = ie->getProtocolData<Ipv6InterfaceData>()->getGlobalAddress();
1338 Ipv6Address HA = packet->getTag<
L3AddressInd>()->getSrcAddress().toIpv6().setPrefix(prefixInfo.getPrefix(), prefixInfo.getPrefixLength());
1339 EV_DETAIL <<
"The HoA of MN is: " << HoA <<
", MN's HA Address is: " << HA
1340 <<
" and the home prefix is " << prefixInfo.getPrefix() << endl;
1341 ie->getProtocolDataForUpdate<Ipv6InterfaceData>()->updateHomeNetworkInfo(HoA, HA, prefixInfo.getPrefix(), prefixInfo.getPrefixLength());
Referenced by processNDMessage().
◆ processRaPrefixInfo()
1494 Ipv6NdPrefixInformation prefixInfo;
1496 for (
int i = 0; i < (int)ra->getOptions().getOptionArraySize(); i++) {
1497 auto option = ra->getOptions().getOption(i);
1500 const Ipv6NdPrefixInformation& prefixInfo = *check_and_cast<const Ipv6NdPrefixInformation *>(option);
1501 if (!prefixInfo.getOnlinkFlag())
1505 EV_INFO <<
"Fetching Prefix Information: option " << i + 1 <<
" of "
1506 << ra->getOptions().getOptionArraySize() << endl;
1507 uint prefixLength = prefixInfo.getPrefixLength();
1508 simtime_t validLifetime = prefixInfo.getValidLifetime();
1510 Ipv6Address prefix = prefixInfo.getPrefix();
1514 if (prefix.isLinkLocal()) {
1515 EV_INFO <<
"Prefix is link-local, ignoring prefix.\n";
1520 if (!
rt6->isPrefixPresent(prefix)) {
1522 if (validLifetime != 0) {
1525 rt6->addOrUpdateOnLinkPrefix(prefix, prefixLength, ie->getInterfaceId(),
1526 simTime() + validLifetime);
1535 if (validLifetime == 0) {
1536 EV_INFO <<
"Prefix Info's valid lifetime is 0, time-out prefix\n";
1537 rt6->deleteOnLinkPrefix(prefix, prefixLength);
1545 rt6->addOrUpdateOnLinkPrefix(prefix, prefixLength, ie->getInterfaceId(),
1546 simTime() + validLifetime);
Referenced by processRaForRouterUpdates().
◆ processRaPrefixInfoForAddrAutoConf()
1563 EV_INFO <<
"Processing Prefix Info for address auto-configuration.\n";
1564 Ipv6Address prefix = prefixInfo.getPrefix();
1565 uint prefixLength = prefixInfo.getPrefixLength();
1566 simtime_t preferredLifetime = prefixInfo.getPreferredLifetime();
1567 simtime_t validLifetime = prefixInfo.getValidLifetime();
1574 if (prefixInfo.getPrefix().isLinkLocal() ==
true) {
1575 EV_INFO <<
"Prefix is link-local, ignore Prefix Information Option\n";
1582 if (preferredLifetime > validLifetime) {
1583 EV_INFO <<
"Preferred lifetime is greater than valid lifetime, ignore Prefix Information\n";
1587 bool isPrefixAssignedToInterface =
false;
1588 for (
int i = 0; i < ie->getProtocolData<Ipv6InterfaceData>()->getNumAddresses(); i++) {
1589 if (ie->getProtocolData<Ipv6InterfaceData>()->getAddress(i).matches(prefix, prefixLength) ==
true)
1590 isPrefixAssignedToInterface =
true;
1597 if (isPrefixAssignedToInterface ==
false && validLifetime != 0) {
1598 Ipv6Address linkLocalAddress = ie->getProtocolData<Ipv6InterfaceData>()->getLinkLocalAddress();
1599 ASSERT(linkLocalAddress.isUnspecified() ==
false);
1600 Ipv6Address newAddr = linkLocalAddress.setPrefix(prefix, prefixLength);
1603 EV_INFO <<
"Assigning new address to: " << ie->getInterfaceName() << endl;
1604 ie->getProtocolDataForUpdate<Ipv6InterfaceData>()->assignAddress(newAddr,
false, simTime() + validLifetime,
1605 simTime() + preferredLifetime);
Referenced by processRaPacket().
◆ processRdTimeout()
| void inet::Ipv6NeighbourDiscovery::processRdTimeout |
( |
cMessage * |
msg | ) |
|
|
protectedvirtual |
1032 NetworkInterface *ie = (NetworkInterface *)msg->getContextPointer();
1035 if (rdEntry->numRSSent < ie->getProtocolData<Ipv6InterfaceData>()->_getMaxRtrSolicitations()) {
1036 bubble(
"Sending another RS message.");
1038 rdEntry->numRSSent++;
1041 if (rdEntry->numRSSent == ie->getProtocolData<Ipv6InterfaceData>()->_getMaxRtrSolicitations())
1042 scheduleAfter(ie->getProtocolData<Ipv6InterfaceData>()->_getMaxRtrSolicitationDelay(), msg);
1044 scheduleAfter(ie->getProtocolData<Ipv6InterfaceData>()->_getRtrSolicitationInterval(), msg);
1054 bubble(
"Max number of RS messages sent");
1055 EV_INFO <<
"No RA messages were received. Assume no routers are on-link";
Referenced by handleMessage().
◆ processRedirectPacket()
| void inet::Ipv6NeighbourDiscovery::processRedirectPacket |
( |
const Ipv6Redirect * |
redirect | ) |
|
|
protectedvirtual |
2427 Ipv6Address targetAddr = redirect->getTargetAddress();
2428 Ipv6Address destAddr = redirect->getDestinationAddress();
2431 MacAddress macAddr = redirect->getTargetLinkLayerAddress();
Referenced by processNDMessage().
◆ processRsPacket()
1070 NetworkInterface *ie =
ift->getInterfaceById(packet->getTag<InterfaceInd>()->getInterfaceId());
1075 if (ie->getProtocolData<Ipv6InterfaceData>()->getAdvSendAdvertisements()) {
1076 EV_INFO <<
"This is an advertising interface, processing RS\n";
1083 EV_INFO <<
"RS message validated\n";
1088 macAddr = sla->getLinkLayerAddress();
1089 EV_INFO <<
"MAC Address '" << macAddr <<
"' extracted\n";
1113 msg->setContextPointer(ie);
1114 simtime_t interval = uniform(0, ie->getProtocolData<Ipv6InterfaceData>()->_getMaxRaDelayTime());
1115 if (interval < advIfEntry->nextScheduledRATime) {
1116 scheduleAfter(interval, msg);
1117 advIfEntry->nextScheduledRATime = simTime() + interval;
1134 EV_INFO <<
"This interface is a host, discarding RA message\n";
Referenced by processNDMessage().
◆ reachabilityConfirmed()
| void inet::Ipv6NeighbourDiscovery::reachabilityConfirmed |
( |
const Ipv6Address & |
neighbour, |
|
|
int |
interfaceId |
|
) |
| |
|
virtual |
Public method, it can be invoked from the Ipv6 module or any other module to let Neighbour Discovery know that the reachability of the given neighbor has just been confirmed (e.g.
TCP received ACK of new data from it). Neighbour Discovery can then update the neighbour cache with this information, and cancel the Neighbour Unreachability Detection procedure if it is currently running.
356 Enter_Method(
"reachabilityConfirmed(%s,if=%d)", neighbour.str().c_str(), interfaceId);
362 throw cRuntimeError(
"Model error: not found in cache");
364 cMessage *msg = nce->nudTimeoutEvent;
365 if (msg !=
nullptr) {
366 EV_INFO <<
"NUD in progress. Cancelling NUD Timer\n";
367 bubble(
"Reachability Confirmed via NUD.");
368 cancelAndDelete(msg);
369 nce->nudTimeoutEvent =
nullptr;
◆ resetRaTimer()
Reset the given interface entry's Router Advertisement timer.
This is usually done when a router interface responds (by replying with a Router Advertisement sent to the All-Node multicast group)to a router solicitation Also see: RFC 2461, Section 6.2.6
◆ resolveNeighbour()
| const MacAddress & inet::Ipv6NeighbourDiscovery::resolveNeighbour |
( |
const Ipv6Address & |
nextHop, |
|
|
int |
interfaceId |
|
) |
| |
Public method, to be invoked from the Ipv6 module to determine link-layer address and the output interface of the next hop.
If the neighbor cache does not contain this address or it's in the state INCOMPLETE, this method will return the nullptr address, and the Ipv6 module should then send the datagram here to Ipv6NeighbourDiscovery where it will be stored until neighbour resolution completes.
If the neighbour cache entry is STALE (or REACHABLE but more than reachableTime elapsed since reachability was last confirmed), the link-layer address is still returned and Ipv6 can send the datagram, but simultaneously, this call should trigger the Neighbour Unreachability Detection procedure to start in the Ipv6NeighbourDiscovery module.
326 Enter_Method(
"resolveNeighbor(%s,if=%d)", nextHop.str().c_str(), interfaceId);
338 simTime() > nce->reachabilityExpires)
347 EV_INFO <<
"NUD in progress.\n";
351 return nce->macAddress;
◆ selectDefaultRouter()
| Ipv6Address inet::Ipv6NeighbourDiscovery::selectDefaultRouter |
( |
int & |
outIfID | ) |
|
|
protectedvirtual |
537 EV_INFO <<
"Selecting default router...\n";
561 for (
auto it = defaultRouters.begin(); it != defaultRouters.end();) {
563 if (simTime() > nce.routerExpiryTime) {
564 EV_INFO <<
"Found an expired default router. Deleting entry...\n";
570 EV_INFO <<
"Found a probably reachable router in the default router list.\n";
571 defaultRouters.setHead(*nce.nextDefaultRouter);
572 outIfID = nce.nceKey->interfaceID;
573 return nce.nceKey->address;
588 Neighbour *defaultRouter = defaultRouters.getHead();
589 if (defaultRouter !=
nullptr) {
590 EV_INFO <<
"Found a router in the neighbour cache (default router list).\n";
591 defaultRouters.setHead(*defaultRouter->nextDefaultRouter);
593 return defaultRouter->nceKey->address;
596 EV_INFO <<
"No suitable routers found.\n";
Referenced by determineNextHop().
◆ sendPacketToIpv6Module()
| void inet::Ipv6NeighbourDiscovery::sendPacketToIpv6Module |
( |
Packet * |
msg, |
|
|
const Ipv6Address & |
destAddr, |
|
|
const Ipv6Address & |
srcAddr, |
|
|
int |
interfaceId |
|
) |
| |
|
protectedvirtual |
◆ sendPeriodicRa()
| void inet::Ipv6NeighbourDiscovery::sendPeriodicRa |
( |
cMessage * |
msg | ) |
|
|
protectedvirtual |
1703 NetworkInterface *ie = (NetworkInterface *)msg->getContextPointer();
1705 Ipv6Address destAddr = Ipv6Address(
"FF02::1");
1707 advIfEntry->numRASent++;
1715 #ifdef INET_WITH_xMIPv6
1716 EV_DEBUG <<
"\n+=+=+= MIPv6 Feature: " <<
rt6->hasMipv6Support() <<
" +=+=+=\n";
1719 simtime_t interval = uniform(ie->getProtocolData<Ipv6InterfaceData>()->getMinRtrAdvInterval(), ie->getProtocolData<Ipv6InterfaceData>()->getMaxRtrAdvInterval());
1721 #ifdef INET_WITH_xMIPv6
1722 EV_DETAIL <<
"\n +=+=+= The random calculated interval is: " << interval <<
" +=+=+=\n";
1727 EV_DETAIL <<
"Num RA sent is: " << advIfEntry->numRASent << endl;
1728 EV_DETAIL <<
"maxInitialRtrAdvertisements is: " << ie->getProtocolData<Ipv6InterfaceData>()->_getMaxInitialRtrAdvertisements() << endl;
1730 if (advIfEntry->numRASent <= ie->getProtocolData<Ipv6InterfaceData>()->_getMaxInitialRtrAdvertisements()) {
1731 if (interval > ie->getProtocolData<Ipv6InterfaceData>()->_getMaxInitialRtrAdvertInterval()) {
1734 interval = ie->getProtocolData<Ipv6InterfaceData>()->_getMaxInitialRtrAdvertInterval();
1735 EV_INFO <<
"Sending initial RA but interval is too long. Using default value." << endl;
1738 EV_INFO <<
"Sending initial RA. Using randomly generated interval." << endl;
1741 simtime_t nextScheduledTime = simTime() + interval;
1742 EV_DETAIL <<
"Next scheduled time: " << nextScheduledTime << endl;
1743 advIfEntry->nextScheduledRATime = nextScheduledTime;
1744 ASSERT(nextScheduledTime > simTime());
1745 scheduleAfter(interval, msg);
Referenced by handleMessage().
◆ sendQueuedPacketsToIpv6Module()
| void inet::Ipv6NeighbourDiscovery::sendQueuedPacketsToIpv6Module |
( |
Neighbour * |
nce | ) |
|
|
protectedvirtual |
Send off any queued packets within the Neighbour Discovery module awaiting address resolution.
Not used yet-unsure if we really need it.
–DELETED, Andras
757 while (!pendingPackets.empty()) {
758 auto i = pendingPackets.begin();
759 cMessage *msg = (*i);
760 pendingPackets.erase(i);
762 EV_INFO <<
"Sending queued packet " << msg << endl;
763 send(msg,
"ipv6Out");
Referenced by processNaForIncompleteNceState().
◆ sendSolicitedNa()
2006 auto na = makeShared<Ipv6NeighbourAdvertisement>();
2013 na->setTargetAddress(
ns->getTargetAddress());
2020 auto tla =
new Ipv6NdTargetLinkLayerAddress();
2021 tla->setLinkLayerAddress(ie->getMacAddress());
2022 na->getOptionsForUpdate().appendOption(tla);
2027 na->setRouterFlag(
rt6->isRouter());
2034 MacAddress sourceLinkLayerAddress;
2036 sourceLinkLayerAddress = sla->getLinkLayerAddress();
2038 if (sourceLinkLayerAddress.isUnspecified())
2040 na->setOverrideFlag(
false);
2043 na->setOverrideFlag(
true);
2049 Ipv6Address naDestAddr;
2051 if (packet->getTag<
L3AddressInd>()->getSrcAddress().toIpv6().isUnspecified()) {
2054 na->setSolicitedFlag(
false);
2060 na->setSolicitedFlag(
true);
2061 naDestAddr = packet->getTag<
L3AddressInd>()->getSrcAddress().toIpv6();
2083 Ipv6Address myIPv6Addr = ie->getProtocolData<Ipv6InterfaceData>()->getPreferredAddress();
2085 auto naPacket =
new Packet(
"NApacket");
2087 naPacket->insertAtFront(na);
Referenced by processNsForNonTentativeAddress(), and processNsWithSpecifiedSrcAddr().
◆ sendSolicitedRa()
| void inet::Ipv6NeighbourDiscovery::sendSolicitedRa |
( |
cMessage * |
msg | ) |
|
|
protectedvirtual |
1750 EV_INFO <<
"Send Solicited RA invoked!\n";
1751 NetworkInterface *ie = (NetworkInterface *)msg->getContextPointer();
1752 Ipv6Address destAddr = Ipv6Address(
"FF02::1");
1753 EV_DETAIL <<
"Testing condition!\n";
Referenced by handleMessage().
◆ sendUnsolicitedNa()
2095 #ifdef INET_WITH_xMIPv6
2099 #ifndef INET_WITH_xMIPv6
2108 auto na = makeShared<Ipv6NeighbourAdvertisement>();
2109 Ipv6Address myIPv6Addr = ie->getProtocolData<Ipv6InterfaceData>()->getPreferredAddress();
2115 #ifdef INET_WITH_xMIPv6
2116 na->setTargetAddress(myIPv6Addr);
2117 auto sla =
new Ipv6NdTargetLinkLayerAddress();
2118 sla->setLinkLayerAddress(ie->getMacAddress());
2119 na->getOptionsForUpdate().appendOption(sla);
2125 #ifdef INET_WITH_xMIPv6
2126 na->setSolicitedFlag(
false);
2131 #ifdef INET_WITH_xMIPv6
2132 na->setRouterFlag(
rt6->isRouter());
2142 #ifdef INET_WITH_xMIPv6
2143 na->setOverrideFlag(
true);
2171 #ifdef INET_WITH_xMIPv6
2172 auto packet =
new Packet(
"NApacket");
2174 packet->insertAtFront(na);
◆ timeoutDefaultRouter()
| void inet::Ipv6NeighbourDiscovery::timeoutDefaultRouter |
( |
const Ipv6Address & |
addr, |
|
|
int |
interfaceID |
|
) |
| |
|
protectedvirtual |
RFC 2461: Section 6.3.5 Whenever the Lifetime of an entry in the Default Router List expires, that entry is discarded.
When removing a router from the Default Router list, the node MUST update the Destination Cache in such a way that all entries using the router perform next-hop determination again rather than continue sending traffic to the (deleted) router.
627 rt6->purgeDestCacheEntriesToNeighbour(addr, interfaceID);
Referenced by processRaForRouterUpdates().
◆ timeoutPrefixEntry()
| void inet::Ipv6NeighbourDiscovery::timeoutPrefixEntry |
( |
const Ipv6Address & |
destPrefix, |
|
|
int |
prefixLength |
|
) |
| |
|
protectedvirtual |
RFC 2461: Section 6.3.5 Whenever the invalidation timer expires for a Prefix List entry, that entry is discarded.
No existing Destination Cache entries need be updated, however. Should a reachability problem arise with an existing Neighbor Cache entry, Neighbor Unreachability Detection will perform any needed recovery.
606 rt6->deleteOnLinkPrefix(destPrefix, prefixLength);
◆ validateNaPacket()
2225 if (packet->getTag<HopLimitInd>()->getHopLimit() != 255) {
2226 EV_WARN <<
"Hop Limit is not 255! NA validation failed!\n";
2231 if (na->getTargetAddress().isMulticast() ==
true) {
2232 EV_WARN <<
"Target Address is a multicast address! NA validation failed!\n";
2238 if (packet->getTag<
L3AddressInd>()->getDestAddress().toIpv6().isMulticast()) {
2239 if (na->getSolicitedFlag() ==
true) {
2240 EV_WARN <<
"Dest Address is multicast address but solicited flag is 0!\n";
2246 bubble(
"NA validation passed.");
2248 bubble(
"NA validation failed.");
Referenced by processNaPacket().
◆ validateNsPacket()
1885 if (packet->getTag<HopLimitInd>()->getHopLimit() != 255) {
1886 EV_WARN <<
"Hop limit is not 255! NS validation failed!\n";
1891 if (
ns->getTargetAddress().isMulticast() ==
true) {
1892 EV_WARN <<
"Target address is a multicast address! NS validation failed!\n";
1897 if (packet->getTag<
L3AddressInd>()->getSrcAddress().toIpv6().isUnspecified()) {
1898 EV_WARN <<
"Source Address is unspecified\n";
1902 EV_WARN <<
" but IP dest address is not a solicited-node multicast address! NS validation failed!\n";
1907 MacAddress sourceLinkLayerAddress;
1909 sourceLinkLayerAddress = sla->getLinkLayerAddress();
1910 if (sourceLinkLayerAddress.isUnspecified() ==
false) {
1911 EV_WARN <<
" but Source link-layer address is not empty! NS validation failed!\n";
Referenced by processNsPacket().
◆ validateRaPacket()
1765 Ipv6Address srcAddr = packet->getTag<
L3AddressInd>()->getSrcAddress().toIpv6();
1771 if (srcAddr.isLinkLocal() ==
false) {
1772 EV_WARN <<
"RA source address is not link-local. RA validation failed!\n";
1778 if (packet->getTag<HopLimitInd>()->getHopLimit() != 255) {
1779 EV_WARN <<
"Hop limit is not 255! RA validation failed!\n";
1785 EV_WARN <<
"ICMP Code is not 0! RA validation failed!\n";
1789 #ifdef INET_WITH_xMIPv6
1792 bool prefixInfoFound =
false;
1793 for (
int i = 0; i < (int)ra->getOptions().getOptionArraySize(); i++) {
1794 auto option = ra->getOptions().getOption(i);
1796 prefixInfoFound =
true;
1800 if (!prefixInfoFound) {
1801 EV_WARN <<
"No prefix information available! RA validation failed\n";
Referenced by processRaPacket().
◆ validateRsPacket()
1148 if (packet->getTag<HopLimitInd>()->getHopLimit() != 255) {
1149 EV_WARN <<
"Hop limit is not 255! RS validation failed!\n";
1155 EV_WARN <<
"ICMP Code is not 0! RS validation failed!\n";
1161 if (packet->getTag<
L3AddressInd>()->getSrcAddress().toIpv6().isUnspecified()) {
1162 EV_WARN <<
"IP source address is unspecified\n";
1166 macAddr = sla->getLinkLayerAddress();
1167 if (macAddr.isUnspecified() ==
false) {
1168 EV_WARN <<
" but source link layer address is provided. RS validation failed!\n";
Referenced by processRsPacket().
◆ advIfList
| AdvIfList inet::Ipv6NeighbourDiscovery::advIfList |
|
protected |
◆ crcMode
◆ dadList
| DadList inet::Ipv6NeighbourDiscovery::dadList |
|
protected |
◆ icmpv6
◆ ift
Referenced by assignLinkLocalAddress(), initialize(), initiateAddressResolution(), initiateNeighbourUnreachabilityDetection(), processArTimeout(), processDadTimeout(), processIpv6Datagram(), processNaForIncompleteNceState(), processNaForOtherNceStates(), processNaPacket(), processNsPacket(), processNudTimeout(), processRaForRouterUpdates(), processRaPacket(), and processRsPacket().
◆ neighbourCache
Referenced by dropQueuedPacketsAwaitingAr(), processIpv6Datagram(), processNaForIncompleteNceState(), processNaForOtherNceStates(), processNaPacket(), processNsWithSpecifiedSrcAddr(), processNudTimeout(), processRaForRouterUpdates(), reachabilityConfirmed(), resolveNeighbour(), selectDefaultRouter(), and timeoutDefaultRouter().
◆ pendingQueue
| cQueue inet::Ipv6NeighbourDiscovery::pendingQueue |
|
protected |
◆ raTimerList
◆ rdList
| RdList inet::Ipv6NeighbourDiscovery::rdList |
|
protected |
◆ rt6
Referenced by createAndSendRaPacket(), determineNextHop(), initialize(), makeTentativeAddressPermanent(), processNsForTentativeAddress(), processRaForRouterUpdates(), processRaPrefixInfo(), sendPeriodicRa(), sendSolicitedNa(), sendUnsolicitedNa(), timeoutDefaultRouter(), and timeoutPrefixEntry().
◆ startDadSignal
| simsignal_t inet::Ipv6NeighbourDiscovery::startDadSignal = registerSignal("startDad") |
|
staticprivate |
The documentation for this class was generated from the following files:
int interfaceID
Definition: Ipv6NeighbourCache.h:50
static simsignal_t startDadSignal
Definition: Ipv6NeighbourDiscovery.h:52
cModule * findContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:31
virtual void initiateAddressResolution(const Ipv6Address &dgSrcAddr, Neighbour *nce)
This method attempts to resolve the given neighbour's link-layer address.
Definition: Ipv6NeighbourDiscovery.cc:630
static const Ipv6Address ALL_ROUTERS_2
All-routers multicast address, scope 2 (link-local)
Definition: Ipv6Address.h:69
AdvIfList advIfList
Definition: Ipv6NeighbourDiscovery.h:138
Ipv6NeighbourCache::Key Key
Definition: Ipv6NeighbourDiscovery.h:43
virtual void processNsPacket(Packet *packet, const Ipv6NeighbourSolicitation *ns)
Definition: Ipv6NeighbourDiscovery.cc:1842
virtual void processRaPacket(Packet *packet, const Ipv6RouterAdvertisement *ra)
Definition: Ipv6NeighbourDiscovery.cc:1287
Ipv6NeighbourCache::DefaultRouterList DefaultRouterList
Definition: Ipv6NeighbourDiscovery.h:45
static void insertCrc(CrcMode crcMode, const Ptr< Icmpv6Header > &icmpHeader, Packet *packet)
Definition: Icmpv6.cc:333
virtual void sendPacketToIpv6Module(Packet *msg, const Ipv6Address &destAddr, const Ipv6Address &srcAddr, int interfaceId)
Create control info and assigns it to a msg.
Definition: Ipv6NeighbourDiscovery.cc:737
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down protocol
Definition: IUdp-gates.txt:25
#define MK_DAD_TIMEOUT
Definition: Ipv6NeighbourDiscovery.cc:32
virtual Neighbour * addRouter(const Ipv6Address &addr, int interfaceID, MacAddress macAddress, simtime_t expiryTime, bool isHomeAgent=false)
Creates and initializes a router entry (isRouter=isDefaultRouter=true), MAC address and state=STALE.
Definition: Ipv6NeighbourCache.cc:121
virtual void timeoutDefaultRouter(const Ipv6Address &addr, int interfaceID)
RFC 2461: Section 6.3.5 Whenever the Lifetime of an entry in the Default Router List expires,...
Definition: Ipv6NeighbourDiscovery.cc:615
virtual void initiateNeighbourUnreachabilityDetection(Neighbour *neighbour)
Definition: Ipv6NeighbourDiscovery.cc:471
ModuleRefByPar< Icmpv6 > icmpv6
Definition: Ipv6NeighbourDiscovery.h:91
const B ICMPv6_HEADER_BYTES
Definition: Icmpv6Header_m.h:55
const Key * nceKey
Definition: Ipv6NeighbourCache.h:61
virtual void processRdTimeout(cMessage *msg)
Definition: Ipv6NeighbourDiscovery.cc:1030
virtual Ipv6Address determineNextHop(const Ipv6Address &destAddr, int &outIfID)
This function accepts the datagram's destination address and attempts to determine the destination's ...
Definition: Ipv6NeighbourDiscovery.cc:422
#define INET_WITH_xMIPv6
Definition: features.h:221
const B IPv6ND_LINK_LAYER_ADDRESS_OPTION_LENGTH
Definition: Ipv6NdMessage_m.h:64
virtual void processRaPrefixInfo(const Ipv6RouterAdvertisement *ra, NetworkInterface *ie)
Definition: Ipv6NeighbourDiscovery.cc:1477
virtual void assignLinkLocalAddress(cMessage *timerMsg)
as it is not possbile to explicitly define RFC 2462.
Definition: Ipv6NeighbourDiscovery.cc:767
virtual void processArTimeout(cMessage *arTimeoutMsg)
Resends a NS packet to the address intended for address resolution.
Definition: Ipv6NeighbourDiscovery.cc:682
virtual bool validateRaPacket(Packet *packet, const Ipv6RouterAdvertisement *ra)
Definition: Ipv6NeighbourDiscovery.cc:1758
virtual Ipv6Address selectDefaultRouter(int &outIfID)
Definition: Ipv6NeighbourDiscovery.cc:535
virtual void processNudTimeout(cMessage *timeoutMsg)
Definition: Ipv6NeighbourDiscovery.cc:490
static const Ipv6Address ALL_NODES_2
All-nodes multicast address, scope 2 (link-local)
Definition: Ipv6Address.h:63
#define MK_NUD_TIMEOUT
Definition: Ipv6NeighbourDiscovery.cc:34
virtual void sendSolicitedNa(Packet *packet, const Ipv6NeighbourSolicitation *ns, NetworkInterface *ie)
Definition: Ipv6NeighbourDiscovery.cc:2004
@ INCOMPLETE
Definition: Ipv6NeighbourCache.h:41
ModuleRefByPar< Ipv6RoutingTable > rt6
Definition: Ipv6NeighbourDiscovery.h:90
Ipv6Address address
Definition: Ipv6NeighbourCache.h:49
@ PROBE
Definition: Ipv6NeighbourCache.h:41
virtual void sendPeriodicRa(cMessage *msg)
Definition: Ipv6NeighbourDiscovery.cc:1701
removed InterfaceReq
Definition: IUdp-gates.txt:11
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down DispatchProtocolReq
Definition: IUdp-gates.txt:25
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd L3AddressInd
Definition: IUdp-gates.txt:20
virtual void createAndSendRsPacket(NetworkInterface *ie)
Definition: Ipv6NeighbourDiscovery.cc:947
CrcMode parseCrcMode(const char *crcModeString, bool allowDisable)
Definition: CrcMode.cc:14
virtual void processNaForOtherNceStates(const Ipv6NeighbourAdvertisement *na, Ipv6NeighbourCache::Neighbour *nce)
Definition: Ipv6NeighbourDiscovery.cc:2302
DadList dadList
Definition: Ipv6NeighbourDiscovery.h:132
@ IPv6ND_PREFIX_INFORMATION
Definition: Ipv6NdMessage_m.h:91
Ipv6NeighbourCache::Neighbour Neighbour
Definition: Ipv6NeighbourDiscovery.h:44
const B IPv6ND_PREFIX_INFORMATION_OPTION_LENGTH
Definition: Ipv6NdMessage_m.h:65
virtual void initiateRouterDiscovery(cMessage *msg)
Definition: Ipv6NeighbourDiscovery.cc:981
#define MK_AR_TIMEOUT
Definition: Ipv6NeighbourDiscovery.cc:35
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down PacketProtocolTag
Definition: IUdp-gates.txt:25
virtual void remove(const Ipv6Address &addr, int interfaceID)
Deletes the given neighbour from the cache.
Definition: Ipv6NeighbourCache.cc:140
virtual void processRedirectPacket(const Ipv6Redirect *redirect)
Definition: Ipv6NeighbourDiscovery.cc:2422
std::vector< Packet * > MsgPtrVector
Definition: Ipv6NeighbourDiscovery.h:42
virtual void processRaPrefixInfoForAddrAutoConf(const Ipv6NdPrefixInformation &prefixInfo, NetworkInterface *ie)
Definition: Ipv6NeighbourDiscovery.cc:1561
removed ctrl
Definition: IUdp-gates.txt:7
#define MK_RD_TIMEOUT
Definition: Ipv6NeighbourDiscovery.cc:33
virtual void initiateDad(const Ipv6Address &tentativeAddr, NetworkInterface *ie)
Initiating DAD means to send off a Neighbour Solicitation with its target address set as this node's ...
Definition: Ipv6NeighbourDiscovery.cc:797
virtual void processDadTimeout(cMessage *msg)
Sends a scheduled DAD NS packet.
Definition: Ipv6NeighbourDiscovery.cc:838
static const Ipv6Address UNSPECIFIED_ADDRESS
The unspecified address.
Definition: Ipv6Address.h:54
virtual void sendQueuedPacketsToIpv6Module(Neighbour *nce)
Send off any queued packets within the Neighbour Discovery module awaiting address resolution.
Definition: Ipv6NeighbourDiscovery.cc:753
@ STALE
Definition: Ipv6NeighbourCache.h:41
virtual void createRaTimer(NetworkInterface *ie)
Create a timer for the given interface entry that sends periodic Router Advertisements.
Definition: Ipv6NeighbourDiscovery.cc:1636
removed HopLimitReq
Definition: IUdp-gates.txt:11
virtual void dropQueuedPacketsAwaitingAr(Neighbour *nce)
Drops specific queued packets for a specific NCE AR-timeout.
Definition: Ipv6NeighbourDiscovery.cc:707
@ ADDRESS_UNREACHABLE
Definition: Icmpv6Header_m.h:125
RdList rdList
Definition: Ipv6NeighbourDiscovery.h:135
@ REACHABLE
Definition: Ipv6NeighbourCache.h:41
virtual bool validateNsPacket(Packet *packet, const Ipv6NeighbourSolicitation *ns)
Definition: Ipv6NeighbourDiscovery.cc:1876
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
virtual void createAndSendNsPacket(const Ipv6Address &nsTargetAddr, const Ipv6Address &dgDestAddr, const Ipv6Address &dgSrcAddr, NetworkInterface *ie)
Definition: Ipv6NeighbourDiscovery.cc:1809
DefaultRouterList & getDefaultRouterList()
Definition: Ipv6NeighbourCache.h:159
virtual void processNsWithSpecifiedSrcAddr(Packet *packet, const Ipv6NeighbourSolicitation *ns, NetworkInterface *ie)
Definition: Ipv6NeighbourDiscovery.cc:1963
@ NO_ROUTE_TO_DEST
Definition: Icmpv6Header_m.h:123
#define NUM_INIT_STAGES
Definition: InitStageRegistry.h:73
bool isRouter
Definition: Ipv6NeighbourCache.h:63
#define MK_ASSIGN_LINKLOCAL_ADDRESS
Definition: Ipv6NeighbourDiscovery.cc:28
virtual Neighbour * lookup(const Ipv6Address &addr, int interfaceID)
Returns a neighbour entry, or nullptr.
Definition: Ipv6NeighbourCache.cc:76
@ DELAY
Definition: Ipv6NeighbourCache.h:41
virtual bool validateNaPacket(Packet *packet, const Ipv6NeighbourAdvertisement *na)
Definition: Ipv6NeighbourDiscovery.cc:2215
void remove(Neighbour &router)
Definition: Ipv6NeighbourCache.cc:32
virtual void processRaForRouterUpdates(Packet *packet, const Ipv6RouterAdvertisement *ra)
Definition: Ipv6NeighbourDiscovery.cc:1349
static const Protocol icmpv6
Definition: Protocol.h:72
cQueue pendingQueue
Definition: Ipv6NeighbourDiscovery.h:87
virtual void createAndSendRaPacket(const Ipv6Address &destAddr, NetworkInterface *ie)
Definition: Ipv6NeighbourDiscovery.cc:1175
@ UP
Definition: NodeStatus.h:28
virtual void processNaPacket(Packet *packet, const Ipv6NeighbourAdvertisement *na)
Definition: Ipv6NeighbourDiscovery.cc:2179
CrcMode crcMode
Definition: Ipv6NeighbourDiscovery.h:92
virtual Ipv6NeighbourDiscovery::RdEntry * fetchRdEntry(NetworkInterface *ie)
Definition: Ipv6NeighbourDiscovery.cc:314
#define Enter_Method(...)
Definition: SelfDoc.h:71
virtual Ipv6NeighbourDiscovery::AdvIfEntry * fetchAdvIfEntry(NetworkInterface *ie)
Definition: Ipv6NeighbourDiscovery.cc:304
virtual Neighbour * addNeighbour(const Ipv6Address &addr, int interfaceID)
Creates and initializes a neighbour entry with isRouter=false, state=INCOMPLETE.
Definition: Ipv6NeighbourCache.cc:89
@ IPv6ND_TARGET_LINK_LAYER_ADDR_OPTION
Definition: Ipv6NdMessage_m.h:90
#define MK_SEND_PERIODIC_RTRADV
Definition: Ipv6NeighbourDiscovery.cc:29
virtual void processNsForTentativeAddress(Packet *packet, const Ipv6NeighbourSolicitation *ns)
Definition: Ipv6NeighbourDiscovery.cc:1920
virtual void cancelRouterDiscovery(NetworkInterface *ie)
RFC 2461: Section 6.3.7 4th paragraph Once the host sends a Router Solicitation, and receives a valid...
Definition: Ipv6NeighbourDiscovery.cc:1016
static const MacAddress UNSPECIFIED_ADDRESS
The unspecified MAC address, 00:00:00:00:00:00.
Definition: MacAddress.h:31
#define IPv6_MAX_RTR_SOLICITATION_DELAY
Definition: Ipv6InterfaceData.h:48
virtual void sendSolicitedRa(cMessage *msg)
Definition: Ipv6NeighbourDiscovery.cc:1748
virtual void makeTentativeAddressPermanent(const Ipv6Address &tentativeAddr, NetworkInterface *ie)
Permanently assign the given address for the given interface entry.
Definition: Ipv6NeighbourDiscovery.cc:867
#define MK_INITIATE_RTRDIS
Definition: Ipv6NeighbourDiscovery.cc:31
virtual void processIpv6Datagram(Packet *packet)
Definition: Ipv6NeighbourDiscovery.cc:215
unsigned int uint
Definition: INETDefs.h:55
virtual void processNDMessage(Packet *packet, const Icmpv6Header *msg)
Definition: Ipv6NeighbourDiscovery.cc:189
#define MK_SEND_SOL_RTRADV
Definition: Ipv6NeighbourDiscovery.cc:30
virtual bool validateRsPacket(Packet *packet, const Ipv6RouterSolicitation *rs)
Definition: Ipv6NeighbourDiscovery.cc:1139
RaTimerList raTimerList
Definition: Ipv6NeighbourDiscovery.h:129
static const Ipv6Address SOLICITED_NODE_PREFIX
The solicited-node multicast address prefix (prefix length = 104)
Definition: Ipv6Address.h:75
virtual void processNsForNonTentativeAddress(Packet *packet, const Ipv6NeighbourSolicitation *ns, NetworkInterface *ie)
Definition: Ipv6NeighbourDiscovery.cc:1947
@ ICMPv6_DESTINATION_UNREACHABLE
Definition: Icmpv6Header_m.h:85
INET_API InitStage INITSTAGE_NETWORK_LAYER_PROTOCOLS
Initialization of network layer protocols over IP.
virtual void processRsPacket(Packet *packet, const Ipv6RouterSolicitation *rs)
Definition: Ipv6NeighbourDiscovery.cc:1062
MacAddress macAddress
Definition: Ipv6NeighbourCache.h:62
nano< s >::type ns
Definition: Units.h:1074
virtual void processNaForIncompleteNceState(const Ipv6NeighbourAdvertisement *na, Ipv6NeighbourCache::Neighbour *nce)
Definition: Ipv6NeighbourDiscovery.cc:2253
@ IPv6ND_SOURCE_LINK_LAYER_ADDR_OPTION
Definition: Ipv6NdMessage_m.h:89
ModuleRefByPar< IInterfaceTable > ift
Definition: Ipv6NeighbourDiscovery.h:89
Ipv6NeighbourCache neighbourCache
Definition: Ipv6NeighbourDiscovery.h:98
const B IPv6ND_MTU_OPTION_LENGTH
Definition: Ipv6NdMessage_m.h:68