Page MenuHomeVyOS Platform

DHCP server should validate configuration before applying it
Closed, ResolvedPublicFEATURE REQUEST

Description

The current DHCP server implementation comes with options (see below) which allow the user to pass in any arbitrary option(s) in a verbatim way which will manifest in dhcpd.conf.

The options are:

  • set service dhcp-server global-parameters
  • set service dhcp-server shared-network-name foo shared-network-parameters
  • set service dhcp-server shared-network-name foo subnet 192.0.2.0/25 subnet-parameters
  • set service dhcp-server shared-network-name foo subnet 192.0.2.0/25 static-mapping ff static-mapping-parameters

Those options can not be validated and are simply taken "as is" which can also badly go wrong by breaking DHCPd.

In order to avoid this the idea is to "test" the newly rendered configuration with the building test-mode of dhcpd and only on pass, continue.

dhcpd [ -p port ] [ -f ] [ -d ] [ -q ] [ -t | -T ] [ -4 | -6 ] [ -4o6 port ] [ -s server ] [ -cf config-file ] [ -lf lease-file ] [ -pf pid-file ] [ --no-pid ] [ -user user ] [ -group group ] [ -chroot dir ] [ -tf trace-output-file ] [ -play trace-playback-file ] [ if0 [ ...ifN ] ]

-t Test the configuration file. The server tests the configuration file for correct syntax, but will not attempt to perform any network operations. This can be used to test a new configuration file automatically before installing it.
cpo@LR1.wue3# show service dhcp-server
 global-parameters sadf
 global-parameters ff
+global-parameters ff5
 shared-network-name foo {
     subnet 172.18.201.0/24 {
         default-router 172.18.201.1
         range 0 {
             start 172.18.201.10
             stop 172.18.201.20
         }
     }
 }
cpo@LR1.wue3# commit
[ service dhcp-server ]
Configuration file errors encountered - check your options!

[[service dhcp-server]] failed

Details

Difficulty level
Normal (likely a few hours)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Stricter validation
Issue type
Improvement (missing useful functionality)

Event Timeline

c-po changed the task status from Open to In progress.May 13 2021, 3:21 PM
c-po claimed this task.
c-po triaged this task as Normal priority.
c-po created this task.
c-po changed Difficulty level from Unknown (require assessment) to Normal (likely a few hours).
c-po changed Is it a breaking change? from Unspecified (possibly destroys the router) to Stricter validation.
c-po moved this task from Need Triage to Finished on the VyOS 1.4 Sagitta board.
c-po moved this task from Need Triage to Finished on the VyOS 1.3 Equuleus board.
SrividyaA set Issue type to Improvement (missing useful functionality).Aug 31 2021, 5:46 PM