@@ -168,7 +168,7 @@ void Ipv6NeighbourDiscovery::handleMessageWhenUp(cMessage *msg)
168168 processArTimeout (msg);
169169 }
170170 else
171- throw cRuntimeError (" Unrecognized Timer " ); // stops sim w/ error msg.
171+ throw cRuntimeError (" Unrecognized self-message kind %d (%s) " , msg-> getKind (), msg-> getName ());
172172 }
173173 else if (auto packet = dynamic_cast <Packet *>(msg)) {
174174 auto protocol = packet->getTag <PacketProtocolTag>()->getProtocol ();
@@ -183,7 +183,7 @@ void Ipv6NeighbourDiscovery::handleMessageWhenUp(cMessage *msg)
183183 }
184184 }
185185 else
186- throw cRuntimeError (" Unknown message type received. \n " );
186+ throw cRuntimeError (" Received message '%s' (%s) with unexpected type " , msg-> getName (), msg-> getClassName () );
187187}
188188
189189void Ipv6NeighbourDiscovery::processNDMessage (Packet *packet, const Icmpv6Header *icmpv6Header)
@@ -210,7 +210,7 @@ void Ipv6NeighbourDiscovery::processNDMessage(Packet *packet, const Icmpv6Header
210210 break ;
211211
212212 default :
213- throw cRuntimeError (" Unrecognized ND message! " );
213+ throw cRuntimeError (" Unrecognized ND message type %d " , ( int )icmpv6Header-> getType () );
214214 }
215215}
216216
@@ -226,7 +226,6 @@ void Ipv6NeighbourDiscovery::processIpv6Datagram(Packet *packet)
226226 Ipv6NdControlInfo *ctrl = check_and_cast<Ipv6NdControlInfo *>(packet->getControlInfo ());
227227 int nextHopIfID = ctrl->getInterfaceId ();
228228 Ipv6Address nextHopAddr = ctrl->getNextHop ();
229- // bool fromHL = ctrl->getFromHL();
230229
231230 if (nextHopIfID == -1 || nextHopAddr.isUnspecified ()) {
232231 EV_INFO << " Determining Next Hop" << endl;
@@ -316,7 +315,7 @@ void Ipv6NeighbourDiscovery::processIpv6Datagram(Packet *packet)
316315 }
317316 break ;
318317 default :
319- throw cRuntimeError (" Unknown Neighbour cache entry state. " );
318+ throw cRuntimeError (" Unknown neighbour cache entry state %d " , ( int )nce-> reachabilityState );
320319 break ;
321320 }
322321}
@@ -346,7 +345,6 @@ const MacAddress& Ipv6NeighbourDiscovery::resolveNeighbour(const Ipv6Address& ne
346345 Enter_Method (" resolveNeighbor(%s,if=%d)" , nextHop.str ().c_str (), interfaceId);
347346
348347 Neighbour *nce = neighbourCache.lookup (nextHop, interfaceId);
349- // NetworkInterface *ie = ift->getInterfaceById(interfaceId);
350348
351349 if (!nce || nce->reachabilityState == Ipv6NeighbourCache::INCOMPLETE )
352350 return MacAddress::UNSPECIFIED_ADDRESS ;
@@ -379,7 +377,7 @@ void Ipv6NeighbourDiscovery::reachabilityConfirmed(const Ipv6Address& neighbour,
379377
380378 Neighbour *nce = neighbourCache.lookup (neighbour, interfaceId);
381379 if (!nce)
382- throw cRuntimeError (" Model error: not found in cache" );
380+ throw cRuntimeError (" Model error: neighbour %s (if=%d) not found in cache" , neighbour. str (). c_str (), interfaceId );
383381
384382 cMessage *msg = nce->nudTimeoutEvent ;
385383 if (msg != nullptr ) {
@@ -536,7 +534,7 @@ void Ipv6NeighbourDiscovery::processNudTimeout(cMessage *timeoutMsg)
536534 if (nce->numProbesSent == (int )ie->getProtocolData <Ipv6InterfaceData>()->_getMaxUnicastSolicit ()) {
537535 EV_DETAIL << " Max number of probes have been sent." << endl;
538536 EV_DETAIL << " Neighbour is Unreachable, removing NCE." << endl;
539- neighbourCache.remove (nceKey->address , nceKey->interfaceID ); // remove nce from cache, cancel and delete timeoutMsg;
537+ neighbourCache.remove (nceKey->address , nceKey->interfaceID );
540538 return ;
541539 }
542540
@@ -996,7 +994,7 @@ void Ipv6NeighbourDiscovery::createAndSendRsPacket(NetworkInterface *ie)
996994 myIPv6Address = ie->getProtocolData <Ipv6InterfaceData>()->getLinkLocalAddress (); // so we use the link local address instead
997995
998996 if (ie->getProtocolData <Ipv6InterfaceData>()->isTentativeAddress (myIPv6Address))
999- myIPv6Address = Ipv6Address::UNSPECIFIED_ADDRESS ; // set my Ipv6 address to unspecified.
997+ myIPv6Address = Ipv6Address::UNSPECIFIED_ADDRESS ;
1000998
1001999 Ipv6Address destAddr = Ipv6Address::ALL_ROUTERS_2 ; // all_routers multicast
10021000 auto rs = makeShared<Ipv6RouterSolicitation>();
@@ -1070,7 +1068,6 @@ void Ipv6NeighbourDiscovery::startRouterDiscovery(NetworkInterface *ie)
10701068 a random delay since the interface became (re)enabled (e.g., as part
10711069 of Duplicate Address Detection [ADDRCONF]) there is no need to delay
10721070 again before sending the first Router Solicitation message.*/
1073- // simtime_t rndInterval = uniform(0, ie->getProtocolData<Ipv6InterfaceData>()->_getMaxRtrSolicitationDelay());
10741071 scheduleAfter (ie->getProtocolData <Ipv6InterfaceData>()->_getRtrSolicitationInterval (), rdTimeoutMsg);
10751072}
10761073
@@ -1294,7 +1291,7 @@ void Ipv6NeighbourDiscovery::createAndSendRaPacket(const Ipv6Address& destAddr,
12941291 Ipv6InterfaceData::AdvPrefix advPrefix = ie->getProtocolData <Ipv6InterfaceData>()->getAdvPrefix (i);
12951292 auto prefixInfo = new Ipv6NdPrefixInformation ();
12961293
1297- EV_DETAIL << " \n +=+=+=+= Appendign Prefix Info Option to RA +=+=+=+= \n " ;
1294+ EV_DETAIL << " Appending prefix info option to RA" << endl ;
12981295 EV_DETAIL << " Prefix Value: " << advPrefix.prefix << endl;
12991296 EV_DETAIL << " Prefix Length: " << advPrefix.prefixLength << endl;
13001297 EV_DETAIL << " L-Flag: " << advPrefix.advOnLinkFlag << endl;
@@ -1318,11 +1315,10 @@ void Ipv6NeighbourDiscovery::createAndSendRaPacket(const Ipv6Address& destAddr,
13181315 prefixInfo->setAutoAddressConfFlag (advPrefix.advAutonomousFlag );
13191316
13201317 if (rt6->isHomeAgent ())
1321- prefixInfo->setRouterAddressFlag (true ); // set the R-bit if the node is a HA
1318+ prefixInfo->setRouterAddressFlag (true );
13221319
13231320 // - In the Preferred Lifetime field: the entry's AdvPreferredLifetime.
13241321 prefixInfo->setPreferredLifetime (SIMTIME_DBL (advPrefix.advPreferredLifetime ));
1325- // Now we pop the prefix info into the RA.
13261322 ra->getOptionsForUpdate ().appendOption (prefixInfo);
13271323 ra->addChunkLength (IPv6ND_PREFIX_INFORMATION_OPTION_LENGTH);
13281324 }
@@ -1362,8 +1358,6 @@ void Ipv6NeighbourDiscovery::processRaPacket(Packet *packet, const Ipv6RouterAdv
13621358 processRaForRouterUpdates (packet, ra); // See RFC2461: Section 6.3.4
13631359
13641360 // Possible options
1365- // MacAddress macAddress = ra->getSourceLinkLayerAddress();
1366- // uint mtu = ra->getMTU();
13671361 for (size_t i = 0 ; i < ra->getOptions ().getOptionArraySize (); i++) {
13681362 auto option = ra->getOptions ().getOption (i);
13691363 if (option->getType () != IPv6ND_PREFIX_INFORMATION)
@@ -1548,7 +1542,6 @@ void Ipv6NeighbourDiscovery::processRaPrefixInfo(const Ipv6RouterAdvertisement *
15481542 << ra->getOptions ().getOptionArraySize () << endl;
15491543 uint prefixLength = prefixInfo.getPrefixLength ();
15501544 simtime_t validLifetime = prefixInfo.getValidLifetime ();
1551- // uint preferredLifetime = prefixInfo.getPreferredLifetime();
15521545 Ipv6Address prefix = prefixInfo.getPrefix ();
15531546
15541547 // - If the prefix is the link-local prefix, silently ignore the Prefix
@@ -1865,7 +1858,6 @@ void Ipv6NeighbourDiscovery::processNsForTentativeAddress(Packet *packet, const
18651858{
18661859 // Control Information
18671860 Ipv6Address nsSrcAddr = packet->getTag <L3AddressInd>()->getSrcAddress ().toIpv6 ();
1868- // Ipv6Address nsDestAddr = nsCtrlInfo->getDestAddr();
18691861
18701862 ASSERT (nsSrcAddr.isUnicast () || nsSrcAddr.isUnspecified ());
18711863 // solicitation is processed as described in RFC2462:section 5.4.3
@@ -1891,9 +1883,6 @@ void Ipv6NeighbourDiscovery::processNsForTentativeAddress(Packet *packet, const
18911883
18921884void Ipv6NeighbourDiscovery::processNsForNonTentativeAddress (Packet *packet, const Ipv6NeighbourSolicitation *ns, NetworkInterface *ie)
18931885{
1894- // Neighbour Solicitation Information
1895- // MacAddress nsMacAddr = ns->getSourceLinkLayerAddress();
1896-
18971886 // target addr is not tentative addr
18981887 // solicitation processed as described in RFC2461:section 7.2.3
18991888 if (packet->getTag <L3AddressInd>()->getSrcAddress ().toIpv6 ().isUnspecified ()) {
@@ -1977,7 +1966,7 @@ void Ipv6NeighbourDiscovery::sendSolicitedNa(Packet *packet, const Ipv6Neighbour
19771966 /* If the (NS)Target Address is either an anycast address or a unicast
19781967 address for which the node is providing proxy service, or the Target
19791968 Link-Layer Address option is not included,*/
1980- // TODOANYCAST will not be implemented here!
1969+ // TODO: anycast target address handling is not implemented
19811970
19821971 MacAddress sourceLinkLayerAddress;
19831972 if (auto sla = check_and_cast_nullable<const Ipv6NdSourceLinkLayerAddress *>(ns->getOptions ().findOption (IPv6ND_SOURCE_LINK_LAYER_ADDR_OPTION)))
@@ -2447,8 +2436,6 @@ void Ipv6NeighbourDiscovery::processRaPrefixInfoForAddrAutoConf(const Ipv6NdPref
24472436 simtime_t preferredLifetime = prefixInfo.getPreferredLifetime ();
24482437 simtime_t validLifetime = prefixInfo.getValidLifetime ();
24492438
2450- // EV << "/// prefix: " << prefix << std::endl; // CB
2451-
24522439 // RFC 2461: Section 5.5.3
24532440 // First condition tested, the autonomous flag is already set
24542441
@@ -2518,9 +2505,7 @@ void Ipv6NeighbourDiscovery::processRaPrefixInfoForAddrAutoConf(const Ipv6NdPref
25182505 EV_INFO << " Assigning new address to: " << ie->getInterfaceName () << endl;
25192506
25202507 // we are for sure either in the home network or in a new foreign network
2521- // -> remove CoA
2522- // CoA = ie->ipv6()->removeCoAAddr();
2523- // moved code from above to processDADTimeout()
2508+ // -> remove CoA; moved code from above to processDADTimeout()
25242509
25252510 // 27.9.07 - CB
25262511 if (returnedHome) {
@@ -2571,7 +2556,6 @@ void Ipv6NeighbourDiscovery::processRaPrefixInfoForAddrAutoConf(const Ipv6NdPref
25712556 dadGlobalList[ie->getInterfaceId ()].validLifetime = validLifetime;
25722557 dadGlobalList[ie->getInterfaceId ()].preferredLifetime = preferredLifetime;
25732558 dadGlobalList[ie->getInterfaceId ()].addr = newAddr;
2574- // dadGlobalList[ie->getInterfaceId()].returnedHome = returnedHome;
25752559 dadGlobalList[ie->getInterfaceId ()].CoA = CoA;
25762560 }
25772561 }
@@ -2580,10 +2564,6 @@ void Ipv6NeighbourDiscovery::processRaPrefixInfoForAddrAutoConf(const Ipv6NdPref
25802564
25812565void Ipv6NeighbourDiscovery::routersUnreachabilityDetection (const NetworkInterface *ie)
25822566{
2583- // remove all entries from the destination cache for this interface
2584- // rt6->purgeDestCacheForInterfaceID( ie->interfaceId() );
2585- // invalidate entries in the destination cache for this interface
2586- // neighbourCache.invalidateEntriesForInterfaceID( ie->interfaceId() );
25872567 // remove default routes on this interface
25882568 rt6->deleteDefaultRoutes (ie->getInterfaceId ());
25892569 rt6->deletePrefixes (ie->getInterfaceId ());
@@ -2596,13 +2576,7 @@ void Ipv6NeighbourDiscovery::routersUnreachabilityDetection(const NetworkInterfa
25962576 << (*it).first .interfaceID << " ) to unreachable" << endl;
25972577 ++it;
25982578
2599- // if (rtrLnkAddress.isLinkLocal())
26002579 timeoutDefaultRouter (rtrLnkAddress, ie->getInterfaceId ());
2601-
2602- // reset reachability state of this router
2603- // Neighbour* nbor = neighbourCache.lookup( (*it).first.address, (*it).first.interfaceID );
2604- // nbor->reachabilityState = Ipv6NeighbourCache::STALE;
2605- // initiateNeighbourUnreachabilityDetection(nbor);
26062580 }
26072581 else
26082582 ++it;
@@ -2611,7 +2585,6 @@ void Ipv6NeighbourDiscovery::routersUnreachabilityDetection(const NetworkInterfa
26112585
26122586void Ipv6NeighbourDiscovery::invalidateNeigbourCache ()
26132587{
2614- // Enter_Method("Invalidating Neigbour Cache Entries");
26152588 neighbourCache.invalidateAllEntries ();
26162589}
26172590
0 commit comments