Skip to content

Commit

Permalink
Merge pull request #363 from TrekkieCoder/main
Browse files Browse the repository at this point in the history
PR - egress hooks enable or disable based on runtime args
  • Loading branch information
UltraInstinct14 authored Jul 26, 2023
2 parents f0438f8 + e1ed228 commit 1bb014d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
8 changes: 7 additions & 1 deletion loxinet/dpebpf_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,20 @@ 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 {
cfg.have_mtrace = 1
} 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
Expand Down
4 changes: 3 additions & 1 deletion loxinet/loxinet.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ type loxiNetH struct {
ready bool
self int
rssEn bool
eHooks bool
pFile *os.File
}

Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)"`
}

0 comments on commit 1bb014d

Please sign in to comment.