Page MenuHomeVyOS Platform

DHCP Server Static-Mapping Validation Error
Closed, ResolvedPublicBUG

Description

When creating a static-mapping on DHCP Server in VyOS, the MAC Address must be entered as XX:XX:XX:XX:XX:XX. If you enter the MAC Address as XX-XX-XX-XX-XX-XX then the DHCP service will crash and not recover until you alter the configuration to the prior.

Some validation in the setting of the config, or the script which deals with the config to DHCP service config to change to the correct format would be good.

Broken Configuration

dickins@gateway# show service dhcp-server shared-network-name LAN
 authoritative
 subnet 10.242.0.0/24 {
     default-router 10.242.0.254
     dns-server 10.242.0.254
     domain-name dickins.dev
     domain-search dickins.dev
     lease 28800
     range 10.242.0.0/25 {
         start 10.242.0.1
         stop 10.242.0.128
     }
     static-mapping AlexPC {
         ip-address 10.242.0.17
         mac-address 00-d8-61-9e-78-2b
     }
     static-mapping EpsonPrinter {
         ip-address 10.242.0.252
         mac-address 9c:ae:d3:be:5f:8c
     }
 }
[edit]
root@gateway:/home/dickins# systemctl status isc-dhcp-server.service
● isc-dhcp-server.service - ISC DHCP IPv4 server
   Loaded: loaded (/lib/systemd/system/isc-dhcp-server.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2021-01-21 16:23:39 UTC; 8s ago
     Docs: man:dhcpd(8)
  Process: 51984 ExecStartPre=/bin/sh -ec  touch ${LEASE_FILE};  chown dhcpd:nogroup ${LEASE_FILE}* ;  chmod 664 ${LEASE

Jan 21 16:23:39 gateway systemd[1]: isc-dhcp-server.service: Service RestartSec=100ms expired, scheduling restart.
Jan 21 16:23:39 gateway systemd[1]: isc-dhcp-server.service: Scheduled restart job, restart counter is at 5.
Jan 21 16:23:39 gateway systemd[1]: Stopped ISC DHCP IPv4 server.
Jan 21 16:23:39 gateway systemd[1]: isc-dhcp-server.service: Start request repeated too quickly.
Jan 21 16:23:39 gateway systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.
Jan 21 16:23:39 gateway systemd[1]: Failed to start ISC DHCP IPv4 server.
root@gateway:/home/dickins# service isc-dhcp-server start
Job for isc-dhcp-server.service failed because the control process exited with error code.
See "systemctl status isc-dhcp-server.service" and "journalctl -xe" for details.
root@gateway:/home/dickins# systemctl status isc-dhcp-server.service
● isc-dhcp-server.service - ISC DHCP IPv4 server
   Loaded: loaded (/lib/systemd/system/isc-dhcp-server.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2021-01-21 16:24:05 UTC; 371ms ago
     Docs: man:dhcpd(8)
  Process: 52050 ExecStartPre=/bin/sh -ec  touch ${LEASE_FILE};  chown dhcpd:nogroup ${LEASE_FILE}* ;  chmod 664 ${LEASE

Jan 21 16:24:05 gateway systemd[1]: isc-dhcp-server.service: Service RestartSec=100ms expired, scheduling restart.
Jan 21 16:24:05 gateway systemd[1]: isc-dhcp-server.service: Scheduled restart job, restart counter is at 5.
Jan 21 16:24:05 gateway systemd[1]: Stopped ISC DHCP IPv4 server.
Jan 21 16:24:05 gateway systemd[1]: isc-dhcp-server.service: Start request repeated too quickly.
Jan 21 16:24:05 gateway systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.
Jan 21 16:24:05 gateway systemd[1]: Failed to start ISC DHCP IPv4 server.

Working Configuration

dickins@gateway# set service dhcp-server shared-network-name LAN subnet 10.242.0.0/24 static-mapping AlexPC mac-address 00:d8:61:9e:78:2b
[edit]
dickins@gateway# commit
save
[edit]
dickins@gateway# save
Saving configuration to '/config/config.boot'...
Done
[edit]
root@gateway:/home/dickins# systemctl status isc-dhcp-server.service
● isc-dhcp-server.service - ISC DHCP IPv4 server
   Loaded: loaded (/lib/systemd/system/isc-dhcp-server.service; disabled; vendor preset: enabled)
   Active: active (running) since Thu 2021-01-21 16:24:56 UTC; 9s ago
     Docs: man:dhcpd(8)
  Process: 52411 ExecStartPre=/bin/sh -ec  touch ${LEASE_FILE};  chown dhcpd:nogroup ${LEASE_FILE}* ;  chmod 664 ${LEASE
  Process: 52416 ExecStart=/usr/sbin/dhcpd -4 -q -user dhcpd -group nogroup -pf ${PID_FILE} -cf ${CONFIG_FILE} -lf ${LEA
 Main PID: 52417 (dhcpd)
    Tasks: 1 (limit: 817)
   Memory: 7.2M
   CGroup: /system.slice/isc-dhcp-server.service
           └─52417 /usr/sbin/dhcpd -4 -q -user dhcpd -group nogroup -pf /run/dhcp-server/dhcpd.pid -cf /run/dhcp-server/

Jan 21 16:24:56 gateway dhcpd[52417]: No subnet declaration for eth0 (no IPv4 addresses).
Jan 21 16:24:56 gateway dhcpd[52417]: ** Ignoring requests on eth0.  If this is not what
Jan 21 16:24:56 gateway dhcpd[52417]:    you want, please write a subnet declaration
Jan 21 16:24:56 gateway dhcpd[52417]:    in your dhcpd.conf file for the network segment
Jan 21 16:24:56 gateway dhcpd[52417]:    to which interface eth0 is attached. **
Jan 21 16:24:56 gateway dhcpd[52417]:
Jan 21 16:24:56 gateway dhcpd[52417]: Server starting service.
Jan 21 16:24:56 gateway systemd[1]: Started ISC DHCP IPv4 server.
Jan 21 16:25:02 gateway dhcpd[52417]: DHCPREQUEST for 10.242.0.3 from 70:7c:69:03:e2:83 (AVX03E283) via eth1
Jan 21 16:25:02 gateway dhcpd[52417]: DHCPACK on 10.242.0.3 to 70:7c:69:03:e2:83 (AVX03E283) via eth1

Details

Difficulty level
Easy (less than an hour)
Version
VyOS 1.4-rolling-202101160747
Why the issue appeared?
Design mistake
Is it a breaking change?
Stricter validation
Issue type
Bug (incorrect behavior)

Event Timeline

c-po changed the task status from Open to In progress.Jan 21 2021, 4:46 PM
c-po claimed this task.
c-po edited projects, added VyOS 1.3 Equuleus; removed vyatta-cfg-dhcp-server.
c-po changed Difficulty level from Unknown (require assessment) to Easy (less than an hour).
c-po changed Why the issue appeared? from Will be filled on close to Implementation mistake.
c-po changed Is it a breaking change? from Unspecified (possibly destroys the router) to Stricter validation.

The problem is that there is no input validator for the mac address. Thank you for reporting this!

vyos@vyos# set service dhcp-server shared-network-name LAN subnet 10.242.0.0/24   static-mapping AlexPC  mac-address 00-d8-61-9e-78-2a

  Invalid value
  Value validation failed
  Set failed

vyos@vyos# set service dhcp-server shared-network-name LAN subnet 10.242.0.0/24   static-mapping AlexPC  mac-address 00:d8:61:9e:78:2a
c-po triaged this task as Normal priority.
c-po moved this task from Needs Triage to Finished on the VyOS 1.2 Crux (VyOS 1.2.7) board.
c-po moved this task from Need Triage to Finished on the VyOS 1.3 Equuleus board.
c-po changed Why the issue appeared? from Implementation mistake to Design mistake.
SrividyaA set Issue type to Bug (incorrect behavior).Aug 30 2021, 5:32 PM