From 0a75224174c91e13a942215717f1d9d806284a44 Mon Sep 17 00:00:00 2001 From: Trekkie Coder Date: Mon, 12 Jun 2023 23:45:01 +0900 Subject: [PATCH 1/2] Enhancements to debug logs --- loxilb-ebpf | 2 +- loxinet/dpebpf_linux.go | 7 ++++++- loxinet/loxinet.go | 6 +++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/loxilb-ebpf b/loxilb-ebpf index 80f647aa..273655ec 160000 --- a/loxilb-ebpf +++ b/loxilb-ebpf @@ -1 +1 @@ -Subproject commit 80f647aaef0b2c7c1a593a1eaf849b5723999da5 +Subproject commit 273655ec587e1942d3897dff755d3a2158df4549 diff --git a/loxinet/dpebpf_linux.go b/loxinet/dpebpf_linux.go index ce03bb71..f1e8f803 100644 --- a/loxinet/dpebpf_linux.go +++ b/loxinet/dpebpf_linux.go @@ -193,7 +193,7 @@ func dpEbpfTicker() { } // DpEbpfInit - initialize the ebpf dp subsystem -func DpEbpfInit(clusterEn bool, nodeNum int) *DpEbpfH { +func DpEbpfInit(clusterEn bool, nodeNum int, debug bool) *DpEbpfH { var cfg C.struct_ebpfcfg if clusterEn { @@ -202,6 +202,11 @@ func DpEbpfInit(clusterEn bool, nodeNum int) *DpEbpfH { cfg.have_mtrace = 0 } cfg.nodenum = C.int(nodeNum) + cfg.loglevel = 1 + + if debug { + cfg.loglevel = 0 + } C.loxilb_main(&cfg) diff --git a/loxinet/loxinet.go b/loxinet/loxinet.go index 79715df1..cd7e38d3 100644 --- a/loxinet/loxinet.go +++ b/loxinet/loxinet.go @@ -157,8 +157,12 @@ func loxiNetInit() { } // Initialize logger and specify the log file + do_debug := false logfile := fmt.Sprintf("%s%s.log", "/var/log/loxilb", os.Getenv("HOSTNAME")) logLevel := LogString2Level(opts.Opts.LogLevel) + if logLevel == tk.LogDebug { + do_debug = true + } mh.logger = tk.LogItInit(logfile, logLevel, true) // Stack trace logger @@ -198,7 +202,7 @@ func loxiNetInit() { } // Initialize the ebpf datapath subsystem - mh.dpEbpf = DpEbpfInit(clusterMode, mh.self) + mh.dpEbpf = DpEbpfInit(clusterMode, mh.self, do_debug) mh.dp = DpBrokerInit(mh.dpEbpf) // Initialize the security zone subsystem From 0c52a4e527b8b21829779de8043e555de63d4fbd Mon Sep 17 00:00:00 2001 From: Trekkie Coder Date: Tue, 13 Jun 2023 01:41:38 +0900 Subject: [PATCH 2/2] Fixed an issue with max rule inactive timeout --- loxinet/rules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loxinet/rules.go b/loxinet/rules.go index 7e5c2e61..d1501ebd 100644 --- a/loxinet/rules.go +++ b/loxinet/rules.go @@ -81,7 +81,7 @@ const ( InitHostProbeTimeout = 15 // Initial probe timeout for end-point host MaxHostProbeTime = 24 * 3600 // Max possible host health check duration LbDefaultInactiveTimeout = 4 * 60 // Default inactive timeout for established sessions - LbMaxInactiveTimeout = 24 * 60 // Maximum inactive timeout for established sessions + LbMaxInactiveTimeout = 24 * 3600 // Maximum inactive timeout for established sessions MaxEndPointCheckers = 4 // Maximum helpers to check endpoint health EndPointCheckerDuration = 2 // Duration at which ep-helpers will run MaxEndPointSweeps = 20 // Maximum end-point sweeps per round