Page MenuHomeVyOS Platform

SNMP community regex is incompatible with PCRE2
Closed, ResolvedPublicBUG

Description

The SNMP smoketst fails

 DEBUG - Running Testcase: /usr/libexec/vyos/tests/smoke/cli/test_service_snmp.py
DEBUG - test_snmp_basic (__main__.TestSNMPService.test_snmp_basic) ... ERROR
DEBUG - test_snmp_basic (__main__.TestSNMPService.test_snmp_basic) ... FAIL
DEBUG - test_snmp_script_extensions (__main__.TestSNMPService.test_snmp_script_extensions) ... ok
DEBUG - test_snmpv3_md5 (__main__.TestSNMPService.test_snmpv3_md5) ... ok
DEBUG - test_snmpv3_sha (__main__.TestSNMPService.test_snmpv3_sha) ... ok
DEBUG - test_snmpv3_view_exclude (__main__.TestSNMPService.test_snmpv3_view_exclude) ... ok
DEBUG - 
DEBUG - ======================================================================
DEBUG - ERROR: test_snmp_basic (__main__.TestSNMPService.test_snmp_basic)
DEBUG - ----------------------------------------------------------------------
DEBUG - Traceback (most recent call last):
DEBUG -   File "/usr/libexec/vyos/tests/smoke/cli/test_service_snmp.py", line 85, in test_snmp_basic
DEBUG -     self.cli_set(base_path + ['community', community, 'authorization', auth])
DEBUG -   File "/usr/libexec/vyos/tests/smoke/cli/base_vyostest_shim.py", line 82, in cli_set
DEBUG -     self._session.set(path, value)
DEBUG -   File "/usr/lib/python3/dist-packages/vyos/configsession.py", line 222, in set
DEBUG -     self.__run_command([SET] + path + value)
DEBUG -   File "/usr/lib/python3/dist-packages/vyos/configsession.py", line 210, in __run_command
DEBUG -     raise ConfigSessionError(output)
DEBUG - vyos.configsession.ConfigSessionError: Fatal error: exception Pcre2.Error(Pcre2.BadPattern("invalid range in character class\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", pos=11))
DEBUG - 
DEBUG - Community string is limited to alphanumerical characters, -, _, !, @, *, and # with a total lenght of 100
DEBUG - Value validation failed
DEBUG - Set failed
DEBUG - 
DEBUG - 
DEBUG - ======================================================================
DEBUG - FAIL: test_snmp_basic (__main__.TestSNMPService.test_snmp_basic)
DEBUG - ----------------------------------------------------------------------
DEBUG - Traceback (most recent call last):
DEBUG -   File "/usr/libexec/vyos/tests/smoke/cli/test_service_snmp.py", line 60, in tearDown
DEBUG -     self.assertTrue(process_named_running(PROCESS_NAME))
DEBUG - AssertionError: None is not true
DEBUG - 
DEBUG - ----------------------------------------------------------------------
DEBUG - Ran 5 tests in 21.712s

The configuration is simple:

vyos@r14# compare 
[service]
+ snmp {
+     community public {
+         client "127.0.0.1"
+     }
+ }

[edit]
vyos@r14# commit
[ service snmp community public ]
Fatal error: exception Pcre2.Error(Pcre2.BadPattern("invalid range in character class\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", pos=11))

[ service snmp community public ]
Community string is limited to alphanumerical characters, -, _, !, @, *, and # with a total lenght of 100

[[service snmp]] failed
Commit failed
[edit]
vyos@r14#

Details

Version
VyOS 2025.05.20-0020-rolling
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Event Timeline

Viacheslav triaged this task as High priority.
Viacheslav moved this task from Need Triage to Completed on the VyOS Rolling board.
dmbaturin renamed this task from SNMP smoketest fails exception Pcre2.Error to SNMP community regex is incompatible with PCRE2.May 28 2025, 10:31 PM
dmbaturin changed Is it a breaking change? from Unspecified (possibly destroys the router) to Perfectly compatible.
dmbaturin moved this task from Open to Finished on the VyOS 1.5 Circinus (1.5-stream-2025-Q2) board.