Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR - egress hooks enable or disable based on runtime args #363

Merged
merged 2 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)"`
}
Loading