Skip to content

Commit

Permalink
gh-787 Removed unnecessary logs clutter
Browse files Browse the repository at this point in the history
  • Loading branch information
TrekkieCoder committed Sep 4, 2024
1 parent c2bc554 commit 44b2eeb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
22 changes: 11 additions & 11 deletions api/loxinlp/nlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func NlpRegister(hook cmn.NetHookInterface) {
hooks = hook
}

func iSBlackListedIntf(name string, masterIdx int) bool {
func NlpIsBlackListedIntf(name string, masterIdx int) bool {
if nNl.WhiteList != "none" {
filter := nNl.WLRgx.MatchString(name)
return !filter
Expand Down Expand Up @@ -1296,7 +1296,7 @@ func DelRoute(route nlp.Route) int {
func LUWorkSingle(m nlp.LinkUpdate) int {
var ret int

if iSBlackListedIntf(m.Link.Attrs().Name, m.Link.Attrs().MasterIndex) {
if NlpIsBlackListedIntf(m.Link.Attrs().Name, m.Link.Attrs().MasterIndex) {
return -1
}

Expand Down Expand Up @@ -1349,7 +1349,7 @@ func NUWorkSingle(m nlp.NeighUpdate) int {
return -1
}

if iSBlackListedIntf(link.Attrs().Name, link.Attrs().MasterIndex) {
if NlpIsBlackListedIntf(link.Attrs().Name, link.Attrs().MasterIndex) {
return -1
}

Expand All @@ -1370,22 +1370,22 @@ func RUWorkSingle(m nlp.RouteUpdate) int {
if len(m.MultiPath) <= 0 {
link, err := nlp.LinkByIndex(m.LinkIndex)
if err != nil {
tk.LogIt(tk.LogError, "RUWorkSingle: link find error %s", err)
tk.LogIt(tk.LogError, "RUWorkSingle: link find error %s\n", err)
return -1
}

if iSBlackListedIntf(link.Attrs().Name, link.Attrs().MasterIndex) {
if NlpIsBlackListedIntf(link.Attrs().Name, link.Attrs().MasterIndex) {
return -1
}
} else {
for _, path := range m.MultiPath {
link, err := nlp.LinkByIndex(path.LinkIndex)
if err != nil {
tk.LogIt(tk.LogError, "RUWorkSingle: link find error %s", err)
tk.LogIt(tk.LogError, "RUWorkSingle: link find error %s\n", err)
return -1
}

if iSBlackListedIntf(link.Attrs().Name, link.Attrs().MasterIndex) {
if NlpIsBlackListedIntf(link.Attrs().Name, link.Attrs().MasterIndex) {
return -1
}
}
Expand Down Expand Up @@ -1461,7 +1461,7 @@ func NLWorker(nNl *NlH, bgpPeerMode bool, ch chan bool, wch chan bool) {

defer func() {
if e := recover(); e != nil {
tk.LogIt(tk.LogCritical, "%s: %s", e, debug.Stack())
tk.LogIt(tk.LogCritical, "%s: %s\n", e, debug.Stack())
}
hooks.NetHandlePanic()
os.Exit(1)
Expand Down Expand Up @@ -1489,7 +1489,7 @@ func GetBridges() {
return
}
for _, link := range links {
if iSBlackListedIntf(link.Attrs().Name, link.Attrs().MasterIndex) {
if NlpIsBlackListedIntf(link.Attrs().Name, link.Attrs().MasterIndex) {
continue
}
switch link.(type) {
Expand All @@ -1515,7 +1515,7 @@ func NlpGet(ch chan bool) int {

for _, link := range links {

if iSBlackListedIntf(link.Attrs().Name, link.Attrs().MasterIndex) {
if NlpIsBlackListedIntf(link.Attrs().Name, link.Attrs().MasterIndex) {
continue
}

Expand All @@ -1527,7 +1527,7 @@ func NlpGet(ch chan bool) int {

for _, link := range links {

if iSBlackListedIntf(link.Attrs().Name, link.Attrs().MasterIndex) {
if NlpIsBlackListedIntf(link.Attrs().Name, link.Attrs().MasterIndex) {
// Need addresss to work with
addrs, err := nlp.AddrList(link, nlp.FAMILY_ALL)
if err != nil {
Expand Down
11 changes: 5 additions & 6 deletions pkg/loxinet/layer3.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ package loxinet
import (
"errors"
"fmt"
nlp "github.com/loxilb-io/loxilb/api/loxinlp"
cmn "github.com/loxilb-io/loxilb/common"
tk "github.com/loxilb-io/loxilib"
"net"
"strings"

tk "github.com/loxilb-io/loxilib"

cmn "github.com/loxilb-io/loxilb/common"
)

// constants
Expand Down Expand Up @@ -533,10 +532,10 @@ func (l3 *L3H) IfasTicker() {

canSync := false
for _, ifaEnt := range ifa.Ifas {
canSync = true
if ifaEnt.Secondary {
if nlp.NlpIsBlackListedIntf(ifa.Key.Obj, 0) || ifaEnt.Secondary {
continue
}
canSync = true
}

if canSync && ifa.Sync != 0 {
Expand Down

0 comments on commit 44b2eeb

Please sign in to comment.