[routing-manager] handle deprecated OMR prefix (#7703)

This commit enhances routing-manager to avoid using deprecated
(i.e. P_preferred=false) OMR prefixes as the winning OMR prefix, but
still sends RA RIO for the deprecating OMR prefixes.
This commit is contained in:
Simon Lin
2022-05-24 02:07:40 +08:00
committed by GitHub
parent c319046599
commit 65c6f39300
4 changed files with 36 additions and 15 deletions
@@ -31,6 +31,8 @@ import unittest
import config
import thread_cert
from pktverify.consts import ICMPV6_RA_OPT_TYPE_RIO
from pktverify.packet_verifier import PacketVerifier
# Test description:
# The purpose of this test case is to verify that BR can handle manually added OMR prefixes properly.
@@ -89,6 +91,28 @@ class ManualOmrsPrefix(thread_cert.TestCase):
self._test_manual_omr_prefix('2002::/64', 'pars', expect_withdraw=False)
# Add a smaller but invalid OMR prefix (P_stable = 0). Verify BR_1 does not withdraw its OMR prefix.
self._test_manual_omr_prefix('2003::/64', 'paro', expect_withdraw=False)
# Add a deprecating OMR prefix (P_preferred = 0). Verify BR_1 does not withdraw its OMR prefix.
self._test_manual_omr_prefix('2004::/64', 'aros', expect_withdraw=False)
self.collect_ipaddrs()
self.collect_extra_vars(BR_1_OMR_PREFIX=br1.get_br_omr_prefix())
def verify(self, pv: PacketVerifier):
pkts = pv.pkts
pv.summary.show()
BR_1_ETH = pv.vars['BR_1_ETH']
BR_1_OMR_PREFIX = pv.vars['BR_1_OMR_PREFIX']
assert BR_1_OMR_PREFIX.endswith('::/64')
BR_1_OMR_PREFIX = BR_1_OMR_PREFIX[:-3]
# Filter all ICMPv6 RA messages advertised by BR_1
ra_pkts = pkts.filter_eth_src(BR_1_ETH).filter_icmpv6_nd_ra()
# Verify BR_1 sends RA RIO for both BR OMR prefix and deprecating OMR prefix (i.e. 2004::/64)
ra_pkts.filter(lambda p: ICMPV6_RA_OPT_TYPE_RIO in p.icmpv6.opt.type and '2004::' in p.icmpv6.opt.prefix and
BR_1_OMR_PREFIX in p.icmpv6.opt.prefix).must_next()
def _test_manual_omr_prefix(self, prefix, flags, expect_withdraw, prf='med'):
br1 = self.nodes[BR_1]
@@ -397,6 +397,8 @@ ICMPV6_TYPE_PARAMETER_PROBLEM = 4
ICMPV6_TYPE_ECHO_REQUEST = 128
ICMPV6_TYPE_ECHO_REPLY = 129
ICMPV6_RA_OPT_TYPE_RIO = 24
THREAD_ALLOWED_ICMPV6_TYPES = [
ICMPV6_TYPE_DESTINATION_UNREACHABLE,
ICMPV6_TYPE_PACKET_TO_BIG,
@@ -477,13 +477,7 @@ _LAYER_FIELDS = {
'icmpv6.opt.route_lifetime': _auto,
'icmpv6.opt.route_info.flag.route_preference': _auto,
'icmpv6.opt.route_info.flag.reserved': _auto,
'icmpv6.opt.prefix.valid_lifetime': _auto,
'icmpv6.opt.prefix.preferred_lifetime': _auto,
'icmpv6.opt.prefix.length': _list(_auto),
'icmpv6.opt.prefix.flag.reserved': _auto,
'icmpv6.opt.prefix.flag.r': _auto,
'icmpv6.opt.prefix.flag.l': _auto,
'icmpv6.opt.prefix.flag.a': _auto,
'icmpv6.opt.prefix': _list(_ipv6_addr),
'icmpv6.opt.length': _list(_auto),
'icmpv6.opt.reserved': _str,
'icmpv6.nd.ra.router_lifetime': _auto,