Page MenuHomeVyOS Platform

Expected error when deleting vif that has dhcp-server configured
Open, NormalPublicBUG

Description

I am able to remove an interface vif that has an ip-address in a scope that is used by dhcpd. After I commit the configuration is gone but the interface is still there.

Steps to reproduce

  1. Create a DHCP scope
  2. Add interface vif in the same scope
  3. Commit
  4. Remove the interface vif
  5. Commit

Expected result
Getting an error that I cannot remove the interface because it is being used by dhcp server.

Details

Difficulty level
Unknown (require assessment)
Version
1.3-rolling-202005201423
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Feature (new functionality)

Event Timeline

erkin renamed this task from Abel to remove interface vif used by dhcpd to Cannot remove interface vif used by dhcpd.Aug 30 2021, 6:03 AM
erkin set Issue type to Bug (incorrect behavior).
erkin removed a subscriber: Active contributors.

What wrong with it?
As you use some service which belong to some interface
Or what you expected?
Provide please an example of configurations and steps to reproduce.

Viacheslav moved this task from Need Triage to Finished on the VyOS 1.3 Equuleus (1.3.0) board.

Fixed VyOS 1.3.0:

vyos@r4# run show conf com | match dhcp
set interfaces ethernet eth2 vif 35 address 'dhcp'
[edit]
vyos@r4# run show int
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface        IP Address                        S/L  Description
---------        ----------                        ---  -----------
eth0             192.168.122.14/24                 u/u  WAN
eth1             203.0.113.14/24                   u/u  Lan
                 192.0.2.14/24                          
eth2             -                                 u/u  
eth2.35          10.0.2.10/24                      u/u 


vyos@r4# delete interfaces ethernet eth2 vif 
[edit]
vyos@r4# commit
[edit]
vyos@r4#

Re-opened as this task regarding dhcp-server, not dhcp-client

Configuration tested on 1.3 and 1.4 version.

Steps:

  1. Creation on vif and dhcp-server for that vif
set interfaces ethernet eth2 vif 99 address '192.168.99.1/24'
set service dhcp-server shared-network-name LAN subnet 192.168.99.0/24 default-router '192.168.99.1'
set service dhcp-server shared-network-name LAN subnet 192.168.99.0/24 name-server '192.168.99.1'
set service dhcp-server shared-network-name LAN subnet 192.168.99.0/24 range range0 start '192.168.99.100'
set service dhcp-server shared-network-name LAN subnet 192.168.99.0/24 range range0 stop '192.168.99.200'
  1. Commit
  2. Test dhcp-server
vyos@vyos# run show dhcp server statistics 
Pool      Size    Leases    Available  Usage
------  ------  --------  -----------  -------
LAN        101         1          100  1%
  1. Remove vif, commit and observe there's no error/warning. Then validte vif was removed
vyos@vyos# del interfaces ethernet eth2 vif 99 
[edit]
vyos@vyos# commit
[edit]
vyos@vyos# 
vyos@vyos# run show int
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface        IP Address                        S/L  Description
---------        ----------                        ---  -----------
eth0             -                                 u/D  
eth1             -                                 u/D  
eth2             -                                 u/u  
eth3             -                                 u/D  
lo               127.0.0.1/8                       u/u

This behavior seems right to me, and not a bug.
Guess a warning message indicating there's a dhcp-server configured on interface won't harm. In that case, it would be a feature request and not a bug.

Extra: on Mikrotik, vlan can be removed (same as vyos), and when listing dhcp-server, it shows an "I" flag, that stands for Invalid

n.fort renamed this task from Cannot remove interface vif used by dhcpd to Expected error when deleting vif that has dhcp-server configured.Dec 29 2021, 6:15 PM
n.fort added a project: VyOS 1.4 Sagitta.
n.fort changed Issue type from Bug (incorrect behavior) to Feature (new functionality).

It is not only for dhcp, any service can be affected to this
There are no many check when we remove interface

syncer triaged this task as Normal priority.
syncer added a subscriber: syncer.

@Viacheslav can we close this one?
or should it be included in 1.4 ?

@syncer It is affected also and 1.3
It should be a warning if we delete an interface (IP address of Interface) that belongs to some service.