summaryrefslogtreecommitdiffhomepage
path: root/table/destination.go
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-05-31 04:46:20 +0000
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-06-06 12:43:20 +0900
commit222d4dba8e2c97f0edc2b1e97c0afa1d25f44822 (patch)
tree1215cac150845010040f3722e9a6fb886f794d89 /table/destination.go
parentb63e1c1fc3c40b58ba798bbae4e122f0eedaf55d (diff)
table: return default value(100) when local-pref attr doesn't exist
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table/destination.go')
-rw-r--r--table/destination.go12
1 files changed, 2 insertions, 10 deletions
diff --git a/table/destination.go b/table/destination.go
index f695f6be..8b80f29b 100644
--- a/table/destination.go
+++ b/table/destination.go
@@ -557,16 +557,8 @@ func compareByLocalPref(path1, path2 *Path) *Path {
//
// # Default local-pref values is 100
log.Debugf("enter compareByLocalPref")
- attribute1 := path1.getPathAttr(bgp.BGP_ATTR_TYPE_LOCAL_PREF)
- attribute2 := path2.getPathAttr(bgp.BGP_ATTR_TYPE_LOCAL_PREF)
-
- if attribute1 == nil || attribute2 == nil {
- return nil
- }
-
- localPref1 := attribute1.(*bgp.PathAttributeLocalPref).Value
- localPref2 := attribute2.(*bgp.PathAttributeLocalPref).Value
-
+ localPref1, _ := path1.GetLocalPref()
+ localPref2, _ := path2.GetLocalPref()
// Highest local-preference value is preferred.
if localPref1 > localPref2 {
return path1