Support site to site traffic for network flows in kernel mode

This commit is contained in:
Viktor Liu
2025-03-25 00:28:13 +01:00
parent 9cbcf7531f
commit 13ec9ea0e7
3 changed files with 46 additions and 4 deletions
@@ -176,7 +176,7 @@ func (c *ConnTrack) handleEvent(event nfct.Event) {
srcIP := flow.TupleOrig.IP.SourceAddress
dstIP := flow.TupleOrig.IP.DestinationAddress
if !c.relevantFlow(srcIP, dstIP) {
if !c.relevantFlow(flow.Zone, srcIP, dstIP) {
return
}
@@ -224,8 +224,10 @@ func (c *ConnTrack) handleEvent(event nfct.Event) {
}
// relevantFlow checks if the flow is related to the specified interface
func (c *ConnTrack) relevantFlow(srcIP, dstIP netip.Addr) bool {
// TODO: filter traffic by interface
func (c *ConnTrack) relevantFlow(zone uint16, srcIP, dstIP netip.Addr) bool {
if zone == nftypes.ZoneID {
return true
}
wgnet := c.iface.Address().Network
if !wgnet.Contains(srcIP.AsSlice()) && !wgnet.Contains(dstIP.AsSlice()) {
+2
View File
@@ -10,6 +10,8 @@ import (
"github.com/netbirdio/netbird/client/iface/wgaddr"
)
const ZoneID = 0x1BD0
type Protocol uint8
const (