From bb6183ded8bf4306b97dd964b7ad5dc5dd6b2885 Mon Sep 17 00:00:00 2001 From: Tommaso Pecorella Date: Wed, 5 Mar 2025 21:12:37 +0100 Subject: [PATCH] internet-apps: (fixes #1195) RADVD announcing prefixes without autoconfiguration --- CHANGES.md | 2 ++ src/internet-apps/helper/radvd-helper.cc | 4 +++- src/internet-apps/helper/radvd-helper.h | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 46a66422c..47010f5ff 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -18,6 +18,8 @@ This file is a best-effort approach to solving this issue; we will do our best b ### Changes to existing API +* (internet-apps) Added a parameter to the RADVD helper to announce a prefix without the autoconfiguration flag. + ### Changes to build system ### Changed behavior diff --git a/src/internet-apps/helper/radvd-helper.cc b/src/internet-apps/helper/radvd-helper.cc index 3030ce33a..15ca41beb 100644 --- a/src/internet-apps/helper/radvd-helper.cc +++ b/src/internet-apps/helper/radvd-helper.cc @@ -27,7 +27,8 @@ RadvdHelper::RadvdHelper() void RadvdHelper::AddAnnouncedPrefix(uint32_t interface, const Ipv6Address& prefix, - uint32_t prefixLength) + uint32_t prefixLength, + bool slaac) { NS_LOG_FUNCTION(this << int(interface) << prefix << int(prefixLength)); if (prefixLength != 64) @@ -59,6 +60,7 @@ RadvdHelper::AddAnnouncedPrefix(uint32_t interface, if (!prefixFound) { Ptr routerPrefix = Create(prefix, prefixLength); + routerPrefix->SetAutonomousFlag(slaac); m_radvdInterfaces[interface]->AddPrefix(routerPrefix); } } diff --git a/src/internet-apps/helper/radvd-helper.h b/src/internet-apps/helper/radvd-helper.h index b82c69daa..09166f0d7 100644 --- a/src/internet-apps/helper/radvd-helper.h +++ b/src/internet-apps/helper/radvd-helper.h @@ -35,8 +35,12 @@ class RadvdHelper : public ApplicationHelper * @param interface outgoing interface * @param prefix announced IPv6 prefix * @param prefixLength announced IPv6 prefix length + * @param slaac available for autoconfiguration */ - void AddAnnouncedPrefix(uint32_t interface, const Ipv6Address& prefix, uint32_t prefixLength); + void AddAnnouncedPrefix(uint32_t interface, + const Ipv6Address& prefix, + uint32_t prefixLength, + bool slaac = true); /** * @brief Enable the router as default router for the interface.