f-41: api, vpc: champ l3vni des VPC #41

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-10-11 20:05:20 +02:00
commit 3dd94f35dd
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
11 changed files with 295 additions and 10 deletions

15
internal/vpc/l3vni.go Normal file
View file

@ -0,0 +1,15 @@
package vpc
import "fmt"
const maxL3VNI = 1<<24 - 1
func ValidL3VNI(id uint32) error {
if id == 0 || id > maxL3VNI {
return fmt.Errorf("l3vni %d does not fit in 24 bits (1-%d)", id, maxL3VNI)
}
if id >= 253 && id <= 255 {
return fmt.Errorf("l3vni %d is reserved: it is also the routing table id, and tables 253-255 belong to the kernel", id)
}
return nil
}