-
Notifications
You must be signed in to change notification settings - Fork 51
/
datapath_linux.go
42 lines (34 loc) · 1.1 KB
/
datapath_linux.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// +build linux
package nfqdatapath
import (
"context"
"os/exec"
"go.aporeto.io/trireme-lib/buildflags"
"go.aporeto.io/trireme-lib/controller/constants"
"go.aporeto.io/trireme-lib/controller/pkg/packet"
"go.uber.org/zap"
)
func adjustConntrack(mode constants.ModeType) {
sysctlCmd, err := exec.LookPath("sysctl")
if err != nil {
zap.L().Fatal("sysctl command must be installed", zap.Error(err))
}
cmd := exec.Command(sysctlCmd, "-w", "net.netfilter.nf_conntrack_tcp_be_liberal=1")
if err := cmd.Run(); err != nil {
zap.L().Fatal("Failed to set conntrack options", zap.Error(err))
}
if mode == constants.LocalServer && !buildflags.IsLegacyKernel() {
cmd = exec.Command(sysctlCmd, "-w", "net.ipv4.ip_early_demux=0")
if err := cmd.Run(); err != nil {
zap.L().Fatal("Failed to set early demux options", zap.Error(err))
}
}
}
// ignoreFlow is for Windows. use flowtracking interface for Linux.
func (d *Datapath) ignoreFlow(pkt *packet.Packet) error {
return nil
}
func (d *Datapath) startInterceptors(ctx context.Context) {
d.startApplicationInterceptor(ctx)
d.startNetworkInterceptor(ctx)
}