From 8bcb14a8af85a17e19f2806bdcc0cb51c3924f5c Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Sat, 5 Oct 2024 18:04:28 -0600 Subject: [PATCH] fix validator for type not being inverted --- ipv4/reservation/reservation.go | 2 +- lib/validators/types/types.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ipv4/reservation/reservation.go b/ipv4/reservation/reservation.go index cb4854c..ee5301c 100644 --- a/ipv4/reservation/reservation.go +++ b/ipv4/reservation/reservation.go @@ -36,7 +36,7 @@ func ReserveV4MacAddr(identifierType string, identifier string, addr string, hos // This does not validate against the database, just validates that the written configuration // is correct func (r *ReservationV4) Validate() bool { - if typeValidator.IsValid(r.typeName) { + if !typeValidator.IsValid(r.typeName) { slog.Error("validate", slog.Any("reservationV4.type", "invalid")) return false } diff --git a/lib/validators/types/types.go b/lib/validators/types/types.go index 3c8dee4..5d1bedb 100644 --- a/lib/validators/types/types.go +++ b/lib/validators/types/types.go @@ -3,5 +3,5 @@ package types import "git.staur.ca/stobbsm/kea-manage/lib/types" func IsValid(identifierType string) bool { - return types.LookupIdentifier(identifierType) != 255 + return types.LookupIdentifier(identifierType) != types.Invalid }