Skip to content

Commit f9322d2

Browse files
committed
IPv6: add sendRedirects parameter to suppress ICMPv6 Redirects on ad-hoc links
RFC 4861 Section 8.2 has a router send an ICMPv6 Redirect when it forwards a packet back out the interface it arrived on. On a wireless multi-hop / ad-hoc network (e.g. MANET routing over a single shared link) the "better" next hop is a geographic relay the source cannot reach directly, so the Redirect is useless; worse, the Redirects are themselves forwarded multi-hop and trigger further Redirects, causing a storm that congests the medium. Add a bool sendRedirects parameter to Ipv6 (default true, preserving existing behavior) and gate the redirect-on-forward block on it, so it can be disabled on such networks. IPv4 has no redirect-on-forward, so this is IPv6-only.
1 parent eaf82cc commit f9322d2

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/inet/networklayer/ipv6/Ipv6.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ void Ipv6::initialize(int stage)
8888

8989
curFragmentId = 0;
9090
lastCheckTime = SIMTIME_ZERO;
91+
sendRedirects = par("sendRedirects");
9192
fragbuf.init(icmp);
9293

9394
// NetFilter:
@@ -526,8 +527,10 @@ void Ipv6::routePacket(Packet *packet, const NetworkInterface *destIE, const Net
526527
// don't raise error if sent to ND or ICMP!
527528

528529
// RFC 4861 Section 8.2: a router sends a Redirect if it is forwarding a
529-
// packet back out on the same interface it arrived on, to a different next-hop
530-
if (rt->isRouter() && !fromHL && fromIE && interfaceId == fromIE->getInterfaceId()) {
530+
// packet back out on the same interface it arrived on, to a different next-hop.
531+
// Disabled (sendRedirects=false) on wireless multi-hop/ad-hoc networks, where the
532+
// next hop is not directly reachable by the source and redirects cause a storm.
533+
if (sendRedirects && rt->isRouter() && !fromHL && fromIE && interfaceId == fromIE->getInterfaceId()) {
531534
Ipv6Address pktSrcAddr = ipv6Header->getSrcAddress();
532535
if (nextHop != pktSrcAddr && !pktSrcAddr.isUnspecified() && !pktSrcAddr.isMulticast()) {
533536
NetworkInterface *outIe = ift->getInterfaceById(interfaceId);

src/inet/networklayer/ipv6/Ipv6.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class INET_API Ipv6 : public OperationalBase, public NetfilterBase, public INetw
6969
ModuleRefByPar<Icmpv6> icmp;
7070

7171
// working vars
72+
bool sendRedirects = true; // whether to send ICMPv6 Redirects when forwarding back out the arrival interface (RFC 4861 8.2)
7273
unsigned int curFragmentId = -1; // counter, used to assign unique fragmentIds to datagrams
7374
Ipv6FragBuf fragbuf; // fragmentation reassembly buffer
7475
simtime_t lastCheckTime; // when fragbuf was last checked for state fragments

src/inet/networklayer/ipv6/Ipv6.ned

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ simple Ipv6 extends SimpleModule
6767
string ipv6NeighbourDiscoveryModule;
6868
string icmpv6Module;
6969
double procDelay @unit(s) = default(0s);
70+
bool sendRedirects = default(true); // RFC 4861 Section 8.2: when a router forwards a packet back out the interface it arrived on, send the source an ICMPv6 Redirect. Disable on wireless multi-hop / ad-hoc networks (e.g. MANET routing), where the geographic next hop is not directly reachable by the source, so redirects are useless and trigger a storm.
7071
displayStringTextFormat = default("{ipv6StatusText}");
7172
@display("i=block/network2");
7273
@signal[packetDropped](type=inet::Packet);

0 commit comments

Comments
 (0)