table: use a local configured med/local-pref path-attr if exists

If a path is generated locally and it has a med/local-pref path attribute,
don't remove or alter that.

Signed-off-by: ISHIDA Wataru <[email protected]>
This commit is contained in:
ISHIDA Wataru
2015-11-08 05:05:36 -08:00
committed by FUJITA Tomonori
parent b10be2ffd0
commit 2db916a4d3
+2 -2
View File
@@ -96,7 +96,7 @@ func (path *Path) UpdatePathAttrs(global *config.Global, peer *config.Neighbor)
// MED Handling
idx, _ := path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
if idx >= 0 {
if idx >= 0 && !path.IsLocal() {
path.pathAttrs = append(path.pathAttrs[:idx], path.pathAttrs[idx+1:]...)
}
} else if peer.NeighborConfig.PeerType == config.PEER_TYPE_INTERNAL {
@@ -124,7 +124,7 @@ func (path *Path) UpdatePathAttrs(global *config.Global, peer *config.Neighbor)
idx, _ = path.getPathAttr(bgp.BGP_ATTR_TYPE_LOCAL_PREF)
if idx < 0 {
path.pathAttrs = append(path.pathAttrs, p)
} else {
} else if !path.IsLocal() {
path.pathAttrs[idx] = p
}