Page MenuHomeVyOS Platform

DHCP statistics not matching, conf-mode generates incorrect pool name with dash
Closed, ResolvedPublicBUG

Description

DHCP pool statistics seem to be replacing any "_" in the pool name with a "-" which throws off the reporting.

Configuration shows pool name as: v0302-RLS2_Guest:

litz-guest-dhcp1# sh service dhcp-server shared-network-name v0302-RLS2_Guest
 authoritative
 domain-name z.com
 domain-search z.com
 name-server x.x.x.x
 name-server y.y.y.y
 name-server 9.9.9.9
 name-server 1.1.1.1
 ping-check
 subnet 10.192.16.0/21 {
     default-router 10.192.16.1
     domain-name z.com
     domain-search z.com
     enable-failover
     lease 86400
     name-server x.x.x.x
     name-server y.y.y.y
     name-server 9.9.9.9
     name-server 1.1.1.1
     ping-check
     range 100 {
         start 10.192.16.21
         stop 10.192.23.254
     }
 }

DHCP leases table showing active leases:

litz-guest-dhcp1:~$ sh dhcp server leases
IP address    Hardware address    State    Lease start          Lease expiration     Remaining    Pool              Hostname
------------  ------------------  -------  -------------------  -------------------  -----------  ----------------  ------------
10.192.20.4   5e:40:3b:87:1a:b9   active   2022/04/05 09:30:23  2022/04/06 09:30:23  19:30:08     v0302-RLS2-Guest
10.192.20.5   3c:06:30:4e:e6:21   active   2022/04/05 09:00:02  2022/04/06 09:00:02  18:59:47     v0302-RLS2-Guest  Erics-MBP-2
10.192.20.12  30:24:a9:61:a0:5f   active   2022/04/05 10:17:49  2022/04/06 04:35:11  14:34:56     v0302-RLS2-Guest
10.192.20.14  de:e4:f4:8e:86:bb   active   2022/04/05 09:25:05  2022/04/06 09:25:05  19:24:50     v0302-RLS2-Guest
10.192.20.15  a0:78:17:63:e5:ec   active   2022/04/05 09:44:37  2022/04/06 09:44:37  19:44:22     v0302-RLS2-Guest  Brannans-MBP

Statistics showing 0 issued leases:

litz-guest-dhcp1:~$ sh dhcp server statistics
Pool                     Size    Leases    Available  Usage
---------------------  ------  --------  -----------  -------
v0302-RLS2_Guest         2026         0         2026  0%

Specific pool showing 0 leases:

litz-guest-dhcp1:~$ sh dhcp server leases pool
Possible completions:
  v0302-RLS2_Guest
                Show DHCP server leases for a specific pool


litz-guest-dhcp1:~$ sh dhcp server leases pool v0302-RLS2_Guest
IP address    Hardware address    State    Lease start    Lease expiration    Remaining    Pool    Hostname
------------  ------------------  -------  -------------  ------------------  -----------  ------  ----------

Details

Difficulty level
Unknown (require assessment)
Version
1.3.0
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

Viacheslav changed the task status from Open to In progress.Apr 8 2022, 11:54 AM
Viacheslav claimed this task.

The root cause it generates incorrect pool name (conf mode) with a dash instead of an underscore

vyos@vyos:~$ show conf com | match dhcp
set service dhcp-server shared-network-name NET_01 authoritative
set service dhcp-server shared-network-name NET_01 name-server '1.1.1.1'
set service dhcp-server shared-network-name NET_01 subnet 192.0.2.0/24 range R1 start '192.0.2.21'
set service dhcp-server shared-network-name NET_01 subnet 192.0.2.0/24 range R1 stop '192.0.2.254'
vyos@vyos:~$

dhcp.conf

...
    on commit {
        set shared-networkname = "NET-01";
    }
Viacheslav renamed this task from DHCP statistics not matching to DHCP statistics not matching, conf-mode generates incorrect poll name with dash.Apr 8 2022, 12:07 PM
Viacheslav added a project: VyOS 1.4 Sagitta.

PR https://github.com/vyos/vyos-1x/pull/1278

vyos@vyos:~$ show dhcp server leases pool NET_01 
IP address    Hardware address    State    Lease start          Lease expiration     Remaining    Pool    Hostname
------------  ------------------  -------  -------------------  -------------------  -----------  ------  ----------
192.0.2.30    00:50:79:66:68:04   active   2022/04/08 12:53:34  2022/04/09 12:53:34  22:42:54     NET_01  VPCS1
192.0.2.34    ee:a4:f8:10:33:4f   active   2022/04/08 13:04:08  2022/04/09 13:04:08  22:53:28     NET_01  vyos
192.0.2.35    00:50:79:66:68:02   active   2022/04/08 14:06:26  2022/04/09 14:06:26  23:55:46     NET_01  VPCS1
192.0.2.36    00:50:79:66:68:03   active   2022/04/08 14:06:33  2022/04/09 14:06:33  23:55:53     NET_01  VPCS1
192.0.2.37    00:50:79:66:68:04   active   2022/04/08 14:09:55  2022/04/09 14:09:55  23:59:15     NET_01  VPCS1
192.0.2.38    00:50:79:66:68:03   active   2022/04/08 14:09:58  2022/04/09 14:09:58  23:59:18     NET_01  VPCS1
192.0.2.39    00:50:79:66:68:02   active   2022/04/08 14:10:00  2022/04/09 14:10:00  23:59:20     NET_01  VPCS1
vyos@vyos:~$ 
vyos@vyos:~$ show dhcp server statistics 
Pool      Size    Leases    Available  Usage
------  ------  --------  -----------  -------
NET_01     234         7          227  3%
vyos@vyos:~$
Viacheslav renamed this task from DHCP statistics not matching, conf-mode generates incorrect poll name with dash to DHCP statistics not matching, conf-mode generates incorrect pool name with dash.Apr 8 2022, 11:04 PM
Viacheslav moved this task from Need Triage to Finished on the VyOS 1.3 Equuleus board.

Fixed

vyos@vyos:~$ show conf com | match dhcp
set service dhcp-server shared-network-name NET_01 authoritative
set service dhcp-server shared-network-name NET_01 name-server '1.1.1.1'
set service dhcp-server shared-network-name NET_01 subnet 192.0.2.0/24 range R1 start '192.0.2.21'
set service dhcp-server shared-network-name NET_01 subnet 192.0.2.0/24 range R1 stop '192.0.2.254'
vyos@vyos:~$ 
vyos@vyos:~$ show dhcp server leases 
IP address    Hardware address    State    Lease start          Lease expiration     Remaining    Pool    Hostname
------------  ------------------  -------  -------------------  -------------------  -----------  ------  ----------
192.0.2.27    50:08:00:06:00:02   active   2022/04/19 12:04:19  2022/04/20 12:04:19  23:59:27     NET_01  vyos
vyos@vyos:~$ 
vyos@vyos:~$ show dhcp server statistics 
Pool      Size    Leases    Available  Usage
------  ------  --------  -----------  -------
NET_01     234         1          233  0%
vyos@vyos:~$