diff options
| author | Ruben Herold <ruben@puettmann.net> | 2026-09-04 11:17:26 +0200 |
|---|---|---|
| committer | Viacheslav Hletenko <seversss265@gmail.com> | 2026-10-15 16:05:57 +0300 |
| commit | 46e06d8fd1f1dd378c128fe87549bdba165f640a (patch) | |
| tree | bcdc5e8b15a3bbe20e57f66a340483d5b85be973 /interface-definitions/include | |
| parent | da0bea0d10020bfd76d2f763965947db905cab9b (diff) | |
| download | vyos-1x-46e06d8fd1f1dd378c128fe87549bdba165f640a.tar.gz vyos-1x-46e06d8fd1f1dd378c128fe87549bdba165f640a.zip | |
dhcp-server: T9267: make client-class substring matching contains-anywhere
The Mikrotik configuration referenced by T9267 uses
matching-type=substring, documented to match the value anywhere within
the option string. This PR's "substring" match instead compared a
fixed-length slice at a fixed byte offset (default 0) for exact
equality - effectively an anchored prefix match, not a substring
search - which does not reliably reproduce the ticket's own use case
of picking a device model string (e.g. "T42S") out of a longer,
variably-formatted hostname.
Rebuild "hostname substring"/"vendor-class-id substring" on Kea's
match()+lcase() instead of substring()==, so a configured value now
matches anywhere in the option content and case-insensitively (options
like vendor-class-id are not guaranteed to arrive in a fixed case).
Drop the "offset" leaf together with it, since it has no remaining
purpose once matching is no longer anchored to a fixed position, and
there is no released behavior to preserve.
Raw hex input and values containing a literal single quote are
rejected for substring matching in verify(), since neither can be
safely embedded into the generated Kea regular expression; exact
"value" matching is unaffected and still accepts both.
Reported by alexk37 in review of PR #5436.
Diffstat (limited to 'interface-definitions/include')
| -rw-r--r-- | interface-definitions/include/dhcp/dhcp-server-common-config.xml.i | 44 |
1 files changed, 6 insertions, 38 deletions
diff --git a/interface-definitions/include/dhcp/dhcp-server-common-config.xml.i b/interface-definitions/include/dhcp/dhcp-server-common-config.xml.i index e909adca3..f49f69856 100644 --- a/interface-definitions/include/dhcp/dhcp-server-common-config.xml.i +++ b/interface-definitions/include/dhcp/dhcp-server-common-config.xml.i @@ -62,31 +62,15 @@ </leafNode> <node name="substring"> <properties> - <help>Filters on part of the option contents</help> + <help>Filters on whether the option contents contain this text (case-insensitive)</help> </properties> <children> - <leafNode name="offset"> - <properties> - <help>Byte offset from the start of the option value (default: 0)</help> - <valueHelp> - <format>u32:0-255</format> - <description>Byte offset</description> - </valueHelp> - <constraint> - <validator name="numeric" argument="--range 0-255"/> - </constraint> - </properties> - </leafNode> <leafNode name="value"> <properties> - <help>Filters on part of the option contents</help> - <valueHelp> - <format>hex</format> - <description>Values that start with 0x are interpreted as raw hex. This must only be hexadecimal characters e.g. 0x1234567890ABCDEF</description> - </valueHelp> + <help>Text that must appear anywhere in the option contents (case-insensitive)</help> <valueHelp> <format>txt</format> - <description>Any other text string is interpreted as ASCII text</description> + <description>ASCII text to search for; must not contain a single quote (')</description> </valueHelp> </properties> </leafNode> @@ -114,31 +98,15 @@ </leafNode> <node name="substring"> <properties> - <help>Filters on part of the option contents</help> + <help>Filters on whether the option contents contain this text (case-insensitive)</help> </properties> <children> - <leafNode name="offset"> - <properties> - <help>Byte offset from the start of the option value (default: 0)</help> - <valueHelp> - <format>u32:0-255</format> - <description>Byte offset</description> - </valueHelp> - <constraint> - <validator name="numeric" argument="--range 0-255"/> - </constraint> - </properties> - </leafNode> <leafNode name="value"> <properties> - <help>Filters on part of the option contents</help> - <valueHelp> - <format>hex</format> - <description>Values that start with 0x are interpreted as raw hex. This must only be hexadecimal characters e.g. 0x1234567890ABCDEF</description> - </valueHelp> + <help>Text that must appear anywhere in the option contents (case-insensitive)</help> <valueHelp> <format>txt</format> - <description>Any other text string is interpreted as ASCII text</description> + <description>ASCII text to search for; must not contain a single quote (')</description> </valueHelp> </properties> </leafNode> |
