[netdiag] require 'RD:' prefix for vendor name on reference devices (#12233)

When `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is active, this
change mandates that the vendor name string MUST begin with the "RD:"
prefix. This ensures that reference devices are clearly and
consistently identifiable through network diagnostic queries.

The enforcement is applied at two levels:

- A compile-time `static_assert` is added to validate the default
  `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_NAME` at build time. This uses a
  new `constexpr` helper utility `CheckConstStringPrefix()`.

- A runtime check is added to `otThreadSetVendorName()`, which will
  now return `OT_ERROR_INVALID_ARGS` if an invalid name is provided
  on a reference device build.

All related test configurations (`scan-build`, `toranj`, `nexus`) and
CLI tests are updated to reflect this new requirement and validate
it.
This commit is contained in:
Abtin Keshavarzian
2026-01-16 10:20:13 -08:00
committed by GitHub
parent 5fd62a9acf
commit b3d3b5c3c7
13 changed files with 96 additions and 21 deletions
+2 -2
View File
@@ -353,8 +353,8 @@ class TestOTCI(unittest.TestCase):
logging.info('dataset active -x: %r', leader.get_dataset_bytes('active'))
logging.info('dataset pending -x: %r', leader.get_dataset_bytes('pending'))
leader.set_vendor_name('OpenThread')
self.assertEqual('OpenThread', leader.get_vendor_name())
leader.set_vendor_name('RD:OpenThread')
self.assertEqual('RD:OpenThread', leader.get_vendor_name())
leader.set_vendor_model('some_model')
self.assertEqual('some_model', leader.get_vendor_model())
leader.set_vendor_sw_version('1.0.0')