Page MenuHomePhabricator

dhcp-server time-offset fails to validate
Open, Requires assessmentPublic

Description

# set service dhcp-server shared-network-name FOO subnet 192.0.2.0/24 time-offset 3600


  usage: validate-value.py [-h] [--regex REGEX] [--exec EXEC] [--value VALUE]
  validate-value.py: error: argument --regex: expected one argument
  
  Invalid time offset value
  Value validation failed
  Set failed

Validator is regex in vyos-1x interface-definitions/dhcp-server.xml:

<leafNode name="time-offset">
  <properties>
    <help>Offset of the client's subnet in seconds from Coordinated Universal Time (UTC)</help>
    <valueHelp>
      <format>[-]N</format>
      <description>Time offset (number, may be negative)</description>
    </valueHelp>
    <constraint>
      <regex>-?[0-9]+</regex>
    </constraint>
    <constraintErrorMessage>Invalid time offset value</constraintErrorMessage>

At first I thought this may be due to my recent commit 377c04cb:

 -                        <regex>^-?[0-9]+$</regex>
+                        <regex>-?[0-9]+</regex>

It was my understanding that ^ and $ are unecessary as they are implied by default. Indeed removing them from other regexes in the same file had no negative effects. But the validator seems to be broken in some other way as it complains about expecting one argument, suggesting it gets 0 or more than 1 arguments.

Details

Difficulty level
Unknown (require assessment)
Version
1.2.0-rolling+201906210337
Why the issue appeared?
Will be filled on close

Event Timeline

jjakob created this task.Sat, Aug 24, 8:56 PM
jjakob created this object in space S1 VyOS Public.
pasik added a subscriber: pasik.Sun, Aug 25, 9:06 PM