Repository navigation
icmpv6: send no RA while the link-local address is tentative - #1340
Open
adamgeorge309 wants to merge 1 commit into
Open
adamgeorge309 wants to merge 1 commit into
adamgeorge309 wants to merge 1 commit into
Conversation
A router sent Router Advertisements (RA) from its link-local address while Duplicate Address Detection (DAD) for that address was running, and before DAD started: start() creates the periodic RA timer whatever the state of the addresses, and createAndSendRaPacket() took the link-local address as the source without checking it. RFC 4861 Section 6.2.2 forbids RAs on an interface that has no unicast address assigned, Section 4.2 makes the assigned link-local address the source, and RFC 4862 Section 5.4 does not count a tentative address as assigned. createAndSendRaPacket() now sends nothing while the link-local address is tentative, which covers periodic RAs, solicited RAs and the unsolicited RA that Pmipv6 sends after a Proxy Binding Acknowledgement. An RA not sent is dropped, not deferred. When sendSolicitedRa() drops one, it points nextScheduledRATime back at the periodic RA, because processRsPacket() ignores every Router Solicitation (RS) that would be answered later than that time, and the dropped RA would otherwise have left the time in the past. sendPeriodicRa() keeps its timer running but does not count an RA it did not send, so the first periodic RA sent after DAD completes counts as the first of the initial advertisements of Section 6.2.4. With a 30-70 ms RA interval, a router sent 24 of its 58 RAs in 3 s before DAD of its link-local address completed; after this commit it sends none before that. tests/module/IPv6_ND_no_router_advertisement_from_tentative_address.test runs that case and checks that no RA comes before DAD completes; it fails before this commit. The fingerprints of examples/manetrouting/dymo IPv6, MultiIPv6 and DynamicIPv6 (RAs every 30-70 ms), examples/ipv6/pmipv6 General (RAs every 1-3 s, and the Proxy Mobile IPv6 RA) and examples/inet/hierarchical99 IPv6 (solicited RAs) change, and this commit records them; their statistical baselines change too. Change: src.networklayer.icmpv6.Ipv6NeighbourDiscovery | behavior.change.fix | test fingerprint statistical whatsnew
This was referenced Oct 15, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A router sent Router Advertisements (RA) from its link-local address while Duplicate Address Detection (DAD) for that address was running, and before DAD started. RFC 4861 Section 6.2.2 allows RAs only on an interface that has a unicast address assigned, Section 4.2 makes the assigned link-local address the source, and RFC 4862 Section 5.4 does not count a tentative address as assigned. The router now sends no RA, periodic, solicited or the unsolicited one of Proxy Mobile IPv6 (PMIPv6), while its link-local address is tentative; such an RA is dropped, not deferred.
Risk: with a periodic RA interval shorter than link-local DAD (about 1 s plus the boot delay), routers advertise only after DAD; with the default 200-600 s interval only the solicited RAs that are due during DAD and the PMIPv6 unsolicited RA are affected. The hosts get the next solicited RA on the link; a PMIPv6 mobile node gets its prefix with the next periodic RA, which the PMIPv6 example sends within seconds, but which comes 200-600 s after start-up with the default interval. Eight fingerprint rows change and are recorded here:
examples/manetrouting/dymoIPv6,MultiIPv6andDynamicIPv6,examples/ipv6/pmipv6Generalandexamples/inet/hierarchical99IPv6(hierarchical99IPv6anddymoIPv6andMultiIPv6in bothexamples.csvandmipv6-refactoring.csv); five statistical baselines need re-recording after the merge.Closes #1339
One commit:
icmpv6: fix: send no RA while the link-local address is tentative.The problem
Ipv6RoutingTableassigns the link-local address as tentative at initialization (src/inet/networklayer/ipv6/Ipv6RoutingTable.cc:264-265); DAD starts afterrouterBootupTime(defaultuniform(0s, 0.3s)).Ipv6NeighbourDiscovery::start()creates the periodic RA timer for every interface whose AdvSendAdvertisements flag is set (src/inet/networklayer/icmpv6/Ipv6NeighbourDiscovery.cc:2652-2655on master), andcreateAndSendRaPacket()(lines 1259-1263) takesgetLinkLocalAddress()as the source, which returns a tentative address too (Ipv6InterfaceData.cc:406-413). Solicited RAs go throughcreateAndSendRaPacket()as well.RFC 4861 Section 4.2, Router Advertisement, Source Address: "MUST be the link-local address assigned to the interface from which this message is sent." Section 6.2.2:
with "advertising interface" defined as one "that has at least one unicast IP address assigned to it and whose corresponding AdvSendAdvertisements flag is TRUE". RFC 4862 Section 5.4: "A tentative address is not considered "assigned to an interface" in the traditional sense."
The fix
createAndSendRaPacket()returns without sending, and logsLink-local address ... is tentative, RA not sentinstead ofCreate and send RA invoked!(sendPeriodicRa()logsperiodic RA not sentbefore it gets there), while the link-local address is tentative. Every RA goes through it:sendPeriodicRa(),sendSolicitedRa()andsendUnsolicitedRa(), whichPmipv6calls after a Proxy Binding Acknowledgement (src/inet/networklayer/pmipv6/Pmipv6.cc:463).sendSolicitedRa(), when the link-local address is still tentative at the time the solicited RA is due, setsnextScheduledRATimeback to the arrival time of the periodic RA timer.processRsPacket()had set it to the solicited RA's time, and it schedules an RA for a later Router Solicitation (RS) only if that RA comes beforenextScheduledRATime; after the dropped RA, the past time would make the router ignore every later RS on the interface, and the host would get no RA until the first periodic one, 200-600 s after start-up with the default interval. A solicited RA that is due after DAD has completed is sent as before, although the RS arrived during DAD.sendPeriodicRa()checks the same condition before sending and incrementsnumRASentonly for an RA it sent, so the MAX_INITIAL_RTR_ADVERTISEMENTS initial advertisements of Section 6.2.4 count from the end of DAD. The timer keeps running with its usual random interval.Not changed: an interface whose link-local address is unspecified (
getLinkLocalAddress()finds none) behaves as before;isTentativeAddress()is false for it. No C++ interface, Network Description (NED) parameter, message field or feature descriptor changes.Verification
Reproduction: a
Router6and aStandardHost6on one 10 Mb/s link (Ipv6FlatNetworkConfigurator), the router's RA interval 30-70 ms (minIntervalBetweenRAs = 0.03s,maxIntervalBetweenRAs = 0.07s), 3 s, the router's Neighbour Discovery log:Create and send RA invoked!DAD completed for address fe80::8aa:ff:fe00:1The first RA with this change leaves at 1.657113533746 s. DAD completes at a different time because all modules draw from one random number generator and the host handles fewer RAs. The test
tests/module/IPv6_ND_no_router_advertisement_from_tentative_address.testruns this network and checks that noCreate and send RA invoked!comes before the router's link-localDAD completedline and that one comes after it; it fails on master and passes with this change.The shipped examples whose fingerprints change, run on master and with this change:
examples/manetrouting/dymoIPv6, 10 s, Neighbour Discovery logexamples/ipv6/pmipv6General, 60 smag1's unsolicited RA after the Proxy Binding Acknowledgement at 0.816 s and 4 periodic RAs oflmaandmag2(interval 1-3 s) held back during DADexamples/inet/hierarchical99IPv6(networklayer.ini), 10000 s for the pings, 30 s for the Neighbour Discovery logRelease build (
make MODE=releasein the root andtests/module/lib), each suite run on master41eee1d619and with this change:tests/fingerprint: ./fingerprinttest -s -F tyfhierarchical99IPv6inexamples.csvandmipv6-refactoring.csv,dymoIPv6andMultiIPv6in both,dymoDynamicIPv6andpmipv6Generalinexamples.csv); with them, the 21 rows of these three directories pass with every ingredient includingtyf(command below)tests/module: inet_run_module_tests -m release --no-build -l ERRORIeee80211BlockAckVariant_1and the test that is not on this branch; the new test passesIeee80211BlockAckVariant_1fails and passes on master too (it passed in 7 runs after failing in 2, one of them with master'sIpv6NeighbourDiscovery.cc), so its result here does not come from this change. With the recorded values,./fingerprinttest -s -m 'dymo|hierarchical99|pmipv6'passes its 21 rows. The 5 fingerprint failures are rows ofmipv6-refactoring.csvwhose recorded~tNlbfingerprints are stale on master; the 62 errors are configurations whose optional features are not built. Of the 290 module failures on master, 274 aretcp_*tests, one is a test that is not on this branch (IPv6_ND_solicitation_ends_address_resolution, #1337), and 15 areConvolutionalCoder12,ConvolutionalCoder34,DimensionalMediumAnalogModel_PrintAttenuation_1,EtherHost_lifecycle,ExternalProcess_3,Ieee80211BitDomain,Ieee80211BlockAckVariant_1,Ieee80211SymbolDomain,Ieee8021d-Rstp,Ieee8021d-Stp,IPv6_packet_too_big,LogNormalShadowing_Correlated_4,MIPv6_tcp_handover,PacketGate_1,UDPSocket_1; all of them exceptIeee80211BlockAckVariant_1fail with this change as well.Debug build (
make MODE=debugin the root andtests/module/lib, exit 0, no compiler warning inIpv6NeighbourDiscovery.cc):inet_run_module_tests -m debug --no-build -l ERRORpasses the new test andIPv6_NUD_stale_to_probe.Statistical baselines (the separate
statisticsrepository at8fdf7f5): the scalars ofpmipv6General,hierarchical99IPv6anddymoIPv6computed on master all equal the baseline scalar at the same position (840, 13414 and 2300 scalars; the baselines record more); with this change part of them differ in each. These three anddymoMultiIPv6andDynamicIPv6belong in a commit to the statistics repository after this merges, naming this one. Not verified by a test: the solicited and the PMIPv6 paths; the examples above exercise them.Gates:
check-pull-request.sh --base origin/master(commits, classification, includes, NED parameters, description),check-source-seals.sh --base origin/masterandcheck-architecture.sh src/inet/networklayer/icmpv6pass.Relationship to other pull requests
#1181 makes the interface an advertising interface at the end of link-local DAD for the initial-interval clamp of Section 6.2.4, in
makeTentativeAddressPermanent(); this change makes sending follow the same rule. The two edit different lines ofIpv6NeighbourDiscovery.cc. Other open pull requests change the same fingerprint rows, so that whichever merges later re-records them; among the Neighbour Discovery ones: #1139, #1162, #1181, #1183 and #1260 (hierarchical99IPv6, and in #1183 and #1260 alsodymoandpmipv6rows) and #1285 (dymo,pmipv6);pmipv6Generalis also changed by Proxy Mobile IPv6 and Mobile IPv6 pull requests such as #1243, #1262 and #1322. #1139 adds the samenextScheduledRATimeassignment tosendSolicitedRa()for every solicited RA (#1138), so the two conflict there; whichever merges second keeps the assignment unconditional. #1297 exempts Neighbour Discovery messages from its hold of datagrams with a tentative source; after this change no RA has one. #1322, #1324, #1326, #1328, #1334 and #1337 also add an entry under "Notable bug fixes" inWHATSNEW; whichever merges later renumbers. #1337 also changesexamples.csv, in other rows.