Skip to content

Commit

Permalink
Fixed duplicate adv for lb-rules
Browse files Browse the repository at this point in the history
  • Loading branch information
TrekkieCoder committed Aug 14, 2023
1 parent 30c693f commit 6bfe63b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const (

const (
// HighLocalPref - High local preference for advertising BGP route(Default or Master)
HighLocalPref = 101
HighLocalPref = 5000
// LowLocalPref - Low local preference for advertising BGP route(Backup)
LowLocalPref = 100
// HighMed - Low metric means higher probability for selection outiside AS
Expand Down
7 changes: 6 additions & 1 deletion loxinet/gobgpclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ func (gbh *GoBgpH) AdvertiseRoute(rtPrefix string, pLen int, nh string, pref uin
tk.LogIt(tk.LogCritical, "[GoBGP] Advertised Route add %s/%d via %s failed: %v\n", rtPrefix, pLen, nh, err)
return -1
}
tk.LogIt(tk.LogDebug, "[GoBGP] Advertised Route [OK]: %s/%d via %s\n", rtPrefix, pLen, nh)
tk.LogIt(tk.LogDebug, "[GoBGP] Advertised Route [OK]: %s/%d via %s pref(%v):med(%v)\n", rtPrefix, pLen, nh, pref, med)
return 0
}

Expand Down Expand Up @@ -401,6 +401,8 @@ func (gbh *GoBgpH) DelAdvertiseRoute(rtPrefix string, pLen int, nh string, pref
if err != nil {
tk.LogIt(tk.LogCritical, "Advertised Route del failed: %v\n", err)
return -1
} else {
tk.LogIt(tk.LogDebug, "[GoBGP] Withdraw Route [OK]: %s/%d via %s pref(%v):med(%v)\n", rtPrefix, pLen, nh, pref, med)
}
return 0
}
Expand Down Expand Up @@ -573,6 +575,9 @@ func (gbh *GoBgpH) DelBGPRule(instance string, IP []string) {
} else {
gbh.DelAdvertiseRoute(ip, 128, "::", pref, med)
}
if ci.rules[ip] == 0 {
delete(ci.rules, ip)
}
tk.LogIt(tk.LogDebug, "[GoBGP] Del BGP Rule %s\n", ip)
}
}
Expand Down

0 comments on commit 6bfe63b

Please sign in to comment.