f-88: fip: face publique, traduction et routage par source sur l'hôte #88
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
4effb5028a
commit
350a1dd82f
8 changed files with 538 additions and 18 deletions
|
|
@ -10,15 +10,13 @@ import (
|
|||
)
|
||||
|
||||
func TestSourceRule(t *testing.T) {
|
||||
r := sourceRule(net.ParseIP("10.46.1.10"), 170786058, 101, false)
|
||||
if r.Family != netlink.FAMILY_V4 || r.Src.String() != "10.46.1.10/32" || r.Table != 170786058 || r.Priority != 101 {
|
||||
r := sourceRule(net.ParseIP("10.46.1.10"), nil, 170786058, 101)
|
||||
if r.Family != netlink.FAMILY_V4 || r.Src.String() != "10.46.1.10/32" || r.Dst != nil || r.Table != 170786058 || r.Priority != 101 {
|
||||
t.Errorf("règle %+v", r)
|
||||
}
|
||||
if r.SuppressPrefixlen != -1 {
|
||||
t.Errorf("suppress_prefixlength %d sans suppression demandée, -1 attendu", r.SuppressPrefixlen)
|
||||
}
|
||||
main := sourceRule(net.ParseIP("10.46.1.10"), 254, 100, true)
|
||||
if main.SuppressPrefixlen != 0 || main.Table != 254 {
|
||||
t.Errorf("règle de la table main %+v", main)
|
||||
_, vpc, _ := net.ParseCIDR("10.46.0.0/16")
|
||||
toVPC := sourceRule(net.ParseIP("10.46.1.10"), vpc, 254, 100)
|
||||
if toVPC.Dst.String() != "10.46.0.0/16" || toVPC.Table != 254 || toVPC.SuppressPrefixlen != -1 {
|
||||
t.Errorf("règle vers le VPC %+v", toVPC)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue