summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIWASE Yusuke <iwase.yusuke0@gmail.com>2018-01-16 09:33:53 +0900
committerIWASE Yusuke <iwase.yusuke0@gmail.com>2018-01-16 09:38:01 +0900
commit87125d842e688b95b2ac66ba046a10670c45e0dd (patch)
tree9c83209caddf939c1cc9f53bbe30d95ea785f318
parentc6b44ccd8a73bd0caf715bbabe7e7a8fd0685f39 (diff)
gobgp/cmd/mrt: Avoid if statement always true
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
-rw-r--r--gobgp/cmd/mrt.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/gobgp/cmd/mrt.go b/gobgp/cmd/mrt.go
index a1723841..336b9616 100644
--- a/gobgp/cmd/mrt.go
+++ b/gobgp/cmd/mrt.go
@@ -22,10 +22,11 @@ import (
"strconv"
"time"
+ "github.com/spf13/cobra"
+
"github.com/osrg/gobgp/packet/bgp"
"github.com/osrg/gobgp/packet/mrt"
"github.com/osrg/gobgp/table"
- "github.com/spf13/cobra"
)
func injectMrt() error {
@@ -118,7 +119,10 @@ func injectMrt() error {
}
t := time.Unix(int64(e.OriginatedTime), 0)
- if subType != mrt.RIB_IPV4_UNICAST || subType != mrt.RIB_IPV4_UNICAST_ADDPATH {
+ switch subType {
+ case mrt.RIB_IPV4_UNICAST, mrt.RIB_IPV4_UNICAST_ADDPATH:
+ paths = append(paths, table.NewPath(source, nlri, false, e.PathAttributes, t, false))
+ default:
attrs := make([]bgp.PathAttributeInterface, 0, len(e.PathAttributes))
for _, attr := range e.PathAttributes {
if attr.GetType() != bgp.BGP_ATTR_TYPE_MP_REACH_NLRI {
@@ -129,8 +133,6 @@ func injectMrt() error {
}
}
paths = append(paths, table.NewPath(source, nlri, false, attrs, t, false))
- } else {
- paths = append(paths, table.NewPath(source, nlri, false, e.PathAttributes, t, false))
}
}
if mrtOpts.NextHop != nil {