internal/nft pose les règles d'un port en une transaction, dans une table bridge two par netns de VPC. Subnets, gateway anycast et watchdog l'utilisent, même filtrage qu'avec ebtables. bootstrap_kvm.sh et le lab installent nftables ; helpers e2e, doc et notes 0.3.0 suivent. Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
35 lines
903 B
Go
35 lines
903 B
Go
package subnet
|
|
|
|
import (
|
|
"git.g3e.fr/syonad/two/internal/nft"
|
|
)
|
|
|
|
func VxlanFabricPort(vethI, gatewayIP string) nft.Port {
|
|
return nft.Port{
|
|
Name: vethI,
|
|
Forward: []string{nft.DropARPRequestTo(gatewayIP), nft.DropDHCPFrom(gatewayIP)},
|
|
}
|
|
}
|
|
|
|
func AnycastFabricPort(vethI, mac, gatewayIP, relayIP string) nft.Port {
|
|
return nft.Port{
|
|
Name: vethI,
|
|
Prerouting: []string{nft.DropSourceMAC(mac)},
|
|
Forward: []string{
|
|
nft.DropSourceMAC(mac),
|
|
nft.DropARPRequestTo(gatewayIP),
|
|
nft.DropARPRequestTo(relayIP),
|
|
nft.DropDHCPFrom(gatewayIP),
|
|
nft.DropDHCPFrom(relayIP),
|
|
},
|
|
Output: []string{nft.DropSourceMAC(mac)},
|
|
}
|
|
}
|
|
|
|
func BridgeFabricPort(vethI, gatewayIP string) nft.Port {
|
|
return nft.Port{
|
|
Name: vethI,
|
|
Forward: []string{nft.DropARPRequestTo(gatewayIP), nft.DropDHCPFrom(gatewayIP)},
|
|
Output: []string{nft.DropARPFrom(gatewayIP), nft.DropDHCPFrom(gatewayIP)},
|
|
}
|
|
}
|