diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-08-13 14:48:17 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-08-13 15:08:26 +0900 |
commit | 97aefa5089c71f15ef942538b200d03df035b8aa (patch) | |
tree | fd5487e9c051757faf5807c2e42aa3e6ee98ba3d | |
parent | 16bd6a794245dd45cf9688a05bb6c868623cb05d (diff) |
packet/cli: don't put nexthop in flowspec mp_reach_nlri path attribute
Reported-by: KATO Junya <kato.junya@lab.ntt.co.jp>
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
-rw-r--r-- | gobgp/neighbor.go | 7 | ||||
-rw-r--r-- | packet/bgp.go | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/gobgp/neighbor.go b/gobgp/neighbor.go index 4b3b8425..401714fe 100644 --- a/gobgp/neighbor.go +++ b/gobgp/neighbor.go @@ -286,7 +286,12 @@ func showRoute(pathList []*Path, showAge bool, showBest bool, isMonitor bool) { case bgp.BGP_ATTR_TYPE_NEXT_HOP: nexthop = a.(*bgp.PathAttributeNextHop).Value.String() case bgp.BGP_ATTR_TYPE_MP_REACH_NLRI: - nexthop = a.(*bgp.PathAttributeMpReachNLRI).Nexthop.String() + n := a.(*bgp.PathAttributeMpReachNLRI).Nexthop + if n != nil { + nexthop = n.String() + } else { + nexthop = "fictitious" + } case bgp.BGP_ATTR_TYPE_AS_PATH: aspathstr = aspath(a) case bgp.BGP_ATTR_TYPE_AS4_PATH: diff --git a/packet/bgp.go b/packet/bgp.go index 3c477ae4..a38f4bca 100644 --- a/packet/bgp.go +++ b/packet/bgp.go @@ -3638,9 +3638,12 @@ func (p *PathAttributeMpReachNLRI) Serialize() ([]byte, error) { nexthoplen = 16 } offset := 0 - if safi == SAFI_MPLS_VPN { + switch safi { + case SAFI_MPLS_VPN: offset = 8 nexthoplen += 8 + case SAFI_FLOW_SPEC_VPN, SAFI_FLOW_SPEC_UNICAST: + nexthoplen = 0 } buf := make([]byte, 4+nexthoplen) binary.BigEndian.PutUint16(buf[0:], afi) |