f-76: nft: règles de pont en nftables, ebtables retiré #76
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>
This commit is contained in:
parent
da6295baf1
commit
d98e42e0a8
27 changed files with 823 additions and 341 deletions
35
internal/subnet/fabric.go
Normal file
35
internal/subnet/fabric.go
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
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)},
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue