diff --git a/loxinet/dpebpf_linux.go b/loxinet/dpebpf_linux.go index 82c89f9d..b0313359 100644 --- a/loxinet/dpebpf_linux.go +++ b/loxinet/dpebpf_linux.go @@ -317,7 +317,7 @@ func (e *DpEbpfH) DpEbpfUnInit() { e.ToFinCh[i] <- 1 } - tk.LogIt(tk.LogInfo, "ebpf uninit \n") + tk.LogIt(tk.LogInfo, "ebpf uninit : %s\n", debug.Stack()) // Make sure to unload eBPF programs ifList, err := net.Interfaces() diff --git a/loxinet/loxinet.go b/loxinet/loxinet.go index 29e45aed..5c06ceaf 100644 --- a/loxinet/loxinet.go +++ b/loxinet/loxinet.go @@ -193,17 +193,6 @@ func loxiNetInit() { logLevel := LogString2Level(opts.Opts.LogLevel) mh.logger = tk.LogItInit(logfile, logLevel, true) - // Stack trace logger - defer func() { - if e := recover(); e != nil { - tk.LogIt(tk.LogCritical, "%s: %s", e, debug.Stack()) - } - if mh.dp != nil { - mh.dp.DpHooks.DpEbpfUnInit() - } - os.Exit(1) - }() - // It is important to make sure loxilb's eBPF filesystem // is in place and mounted to make sure maps are pinned properly if !FileExists(BpfFsCheckFile) { @@ -327,6 +316,16 @@ func loxiNetInit() { // loxiNetRun - This routine will not return func loxiNetRun() { + // Stack trace logger + defer func() { + if e := recover(); e != nil { + tk.LogIt(tk.LogCritical, "%s: %s", e, debug.Stack()) + } + if mh.dp != nil { + mh.dp.DpHooks.DpEbpfUnInit() + } + os.Exit(1) + }() mh.wg.Wait() }