diff options
-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) |