table: Advertise local-pref set by import policy

At importing a path from an external peer, LOCAL_PREF can be set by an
import policy but at exporting a best path to an internal peer, this
learned, calculated LOCAL_PREF is never used and every time overwritten
by a default value 100.

According to RFC 4271 "5.1.5. LOCAL_PREF" and "9.1.1. Phase 1:
Calculation of Degree of Preference", the learned value should be
advertised to other internal peers.

This fixes it by just removing resetting a non-local path's LOCAL_PREF
by the default value.
This commit is contained in:
Tatsushi Demachi
2017-05-10 15:32:44 +09:00
committed by FUJITA Tomonori
parent 0f62519cd7
commit ae1da6974a
+1 -1
View File
@@ -215,7 +215,7 @@ func UpdatePathAttrs(global *config.Global, peer *config.Neighbor, info *PeerInf
// For iBGP peers we are required to send local-pref attribute
// for connected or local prefixes.
// We set default local-pref 100.
if pref := path.getPathAttr(bgp.BGP_ATTR_TYPE_LOCAL_PREF); pref == nil || !path.IsLocal() {
if pref := path.getPathAttr(bgp.BGP_ATTR_TYPE_LOCAL_PREF); pref == nil {
path.setPathAttr(bgp.NewPathAttributeLocalPref(DEFAULT_LOCAL_PREF))
}