f-41: l3vni: borne à 65535 (RD <VTEP>:<l3vni> sur 16 bits) #41

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-10-12 13:05:14 +02:00
commit 3aa8119335
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
8 changed files with 25 additions and 23 deletions

View file

@ -4,10 +4,10 @@ import (
"fmt"
"net"
"strings"
"git.g3e.fr/syonad/two/internal/netif"
)
const MaxL3VNI = 1<<16 - 1
type Base struct {
ASN uint32
RouterID net.IP
@ -116,8 +116,8 @@ func (v VRF) validate() error {
if err := v.validateName(); err != nil {
return err
}
if v.L3VNI == 0 || v.L3VNI > netif.MaxVNI {
return fmt.Errorf("frr: l3vni %d does not fit in 24 bits", v.L3VNI)
if v.L3VNI == 0 || v.L3VNI > MaxL3VNI {
return fmt.Errorf("frr: l3vni %d out of range 1-%d: the route distinguisher <vtep>:<l3vni> holds 16 bits", v.L3VNI, MaxL3VNI)
}
if v.VTEP.To4() == nil {
return fmt.Errorf("frr: vtep %v is not an IPv4 address", v.VTEP)