f-28: add vpc cidr field

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-05-18 22:47:28 +02:00
commit 76a840b80a
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
8 changed files with 98 additions and 17 deletions

View file

@ -11,14 +11,15 @@ import (
)
type subnetData struct {
vpc string
subnetID string
bridge string
mode string
vxlanID int
localIface string
vpc string
subnetID string
bridge string
mode string
vxlanID int
localIface string
interfaceIP net.IP
cidr *net.IPNet
cidr *net.IPNet
vpcCIDR *net.IPNet
}
func loadSubnet(db *badger.DB, name string) (subnetData, error) {
@ -77,5 +78,15 @@ func loadSubnet(db *badger.DB, name string) (subnetData, error) {
}
d.cidr = ipNet
vpcCIDRStr, err := kv.GetFromDB(db, "vpc/"+d.vpc+"/cidr")
if err != nil {
return d, fmt.Errorf("get vpc cidr: %w", err)
}
_, vpcIPNet, err := net.ParseCIDR(vpcCIDRStr)
if err != nil {
return d, fmt.Errorf("parse vpc cidr: %w", err)
}
d.vpcCIDR = vpcIPNet
return d, nil
}