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:
parent
35d6985826
commit
c9d0002041
8 changed files with 25 additions and 23 deletions
|
|
@ -3,12 +3,12 @@ package l3vni
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"git.g3e.fr/syonad/two/internal/netif"
|
||||
"git.g3e.fr/syonad/two/internal/frr"
|
||||
)
|
||||
|
||||
func Valid(id uint32) error {
|
||||
if id == 0 || id > netif.MaxVNI {
|
||||
return fmt.Errorf("l3vni %d does not fit in 24 bits (1-%d)", id, netif.MaxVNI)
|
||||
if id == 0 || id > frr.MaxL3VNI {
|
||||
return fmt.Errorf("l3vni %d out of range 1-%d: the route distinguisher <vtep>:<l3vni> holds 16 bits", id, frr.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)
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ import (
|
|||
"testing"
|
||||
)
|
||||
|
||||
func TestValid_AcceptsEvery24BitValueOutsideTheKernelTables(t *testing.T) {
|
||||
for _, id := range []uint32{1, 252, 256, 4001, 16777215} {
|
||||
func TestValid_AcceptsEvery16BitValueOutsideTheKernelTables(t *testing.T) {
|
||||
for _, id := range []uint32{1, 252, 256, 4001, 65535} {
|
||||
if err := Valid(id); err != nil {
|
||||
t.Errorf("Valid(%d) = %v", id, err)
|
||||
}
|
||||
|
|
@ -15,8 +15,9 @@ func TestValid_AcceptsEvery24BitValueOutsideTheKernelTables(t *testing.T) {
|
|||
|
||||
func TestValid_RejectsOutOfRangeAndReservedTables(t *testing.T) {
|
||||
cases := map[uint32]string{
|
||||
0: "does not fit in 24 bits",
|
||||
16777216: "does not fit in 24 bits",
|
||||
0: "out of range 1-65535",
|
||||
65536: "out of range 1-65535",
|
||||
16777215: "out of range 1-65535",
|
||||
253: "is reserved",
|
||||
254: "is reserved",
|
||||
255: "is reserved",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue