mirror of https://github.com/jetkvm/kvm.git
fix: ignore DHCP lease if not in DHCP mode
This commit is contained in:
parent
c1f1da2640
commit
6a2a33b00a
|
|
@ -90,6 +90,11 @@ func NewInterfaceManager(ctx context.Context, ifaceName string, config *types.Ne
|
||||||
|
|
||||||
// Set up DHCP client callbacks
|
// Set up DHCP client callbacks
|
||||||
im.dhcpClient.SetOnLeaseChange(func(lease *types.DHCPLease) {
|
im.dhcpClient.SetOnLeaseChange(func(lease *types.DHCPLease) {
|
||||||
|
if im.config.IPv4Mode.String != "dhcp" {
|
||||||
|
im.logger.Warn().Str("mode", im.config.IPv4Mode.String).Msg("ignoring DHCP lease, current mode is not DHCP")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if err := im.applyDHCPLease(lease); err != nil {
|
if err := im.applyDHCPLease(lease); err != nil {
|
||||||
im.logger.Error().Err(err).Msg("failed to apply DHCP lease")
|
im.logger.Error().Err(err).Msg("failed to apply DHCP lease")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue