diff --git a/common/common.go b/common/common.go index e1444543d..57b61be40 100644 --- a/common/common.go +++ b/common/common.go @@ -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 diff --git a/loxinet/gobgpclient.go b/loxinet/gobgpclient.go index c2ec2c20c..2fdcbbe5f 100644 --- a/loxinet/gobgpclient.go +++ b/loxinet/gobgpclient.go @@ -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 } @@ -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 } @@ -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) } }