diff --git a/loxilb-ebpf b/loxilb-ebpf index c7ebc0fbd..82fff7db3 160000 --- a/loxilb-ebpf +++ b/loxilb-ebpf @@ -1 +1 @@ -Subproject commit c7ebc0fbdab631451a390a895a382dac4f988d6a +Subproject commit 82fff7db34b1b61ee90509a7d97142961eb49706 diff --git a/loxinet/dpebpf_linux.go b/loxinet/dpebpf_linux.go index 640a2a69c..55dcf34f0 100644 --- a/loxinet/dpebpf_linux.go +++ b/loxinet/dpebpf_linux.go @@ -232,7 +232,7 @@ func DpEbpfSetLogLevel(logLevel tk.LogLevelT) { } // DpEbpfInit - initialize the ebpf dp subsystem -func DpEbpfInit(clusterEn bool, nodeNum int, rssEn bool, logLevel tk.LogLevelT) *DpEbpfH { +func DpEbpfInit(clusterEn bool, nodeNum int, rssEn bool, egrHooks bool, logLevel tk.LogLevelT) *DpEbpfH { var cfg C.struct_ebpfcfg if clusterEn { @@ -240,6 +240,12 @@ func DpEbpfInit(clusterEn bool, nodeNum int, rssEn bool, logLevel tk.LogLevelT) } else { cfg.have_mtrace = 0 } + if egrHooks { + cfg.egr_hooks = 1 + } else { + cfg.egr_hooks = 0 + } + cfg.nodenum = C.int(nodeNum) cfg.loglevel = 1 cfg.no_loader = 0 diff --git a/loxinet/loxinet.go b/loxinet/loxinet.go index 0dd671e24..8d7164f4f 100644 --- a/loxinet/loxinet.go +++ b/loxinet/loxinet.go @@ -76,6 +76,7 @@ type loxiNetH struct { ready bool self int rssEn bool + eHooks bool pFile *os.File } @@ -226,6 +227,7 @@ func loxiNetInit() { mh.self = opts.Opts.ClusterSelf mh.rssEn = opts.Opts.RssEnable + mh.eHooks = opts.Opts.EgrHooks mh.sumDis = opts.Opts.CSumDisable mh.pProbe = opts.Opts.PassiveEPProbe mh.sigCh = make(chan os.Signal, 5) @@ -247,7 +249,7 @@ func loxiNetInit() { } // Initialize the ebpf datapath subsystem - mh.dpEbpf = DpEbpfInit(clusterMode, mh.self, mh.rssEn, -1) + mh.dpEbpf = DpEbpfInit(clusterMode, mh.self, mh.rssEn, mh.eHooks, -1) mh.dp = DpBrokerInit(mh.dpEbpf) // Initialize the security zone subsystem diff --git a/options/options.go b/options/options.go index 60ebae36b..ec94e937d 100644 --- a/options/options.go +++ b/options/options.go @@ -24,4 +24,5 @@ var Opts struct { CSumDisable bool `long:"disable-csum" description:"Disable checksum update(experimental)"` PassiveEPProbe bool `long:"passive-probe" description:"Enable passive liveness probes(experimental)"` RssEnable bool `long:"rss-enable" description:"Enable rss optimization(experimental)"` + EgrHooks bool `long:"egr-hooks" description:"Enable eBPF egress hooks(experimental)"` }