From 7284d4cf8b3f9ecd03068dfa3ab3d433860b5089 Mon Sep 17 00:00:00 2001 From: Hitoshi Irino Date: Sun, 21 Jul 2019 15:08:23 +0900 Subject: Avoid panic by receiving vpnv6 prefixes with zebra reported in issue #2113 - Additionally bug fix which avoid panic caused by displaying vpnv6 prefixes using gobgp vrf rib - Supporting FRRouting 7.1.x --- pkg/server/zclient.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'pkg') diff --git a/pkg/server/zclient.go b/pkg/server/zclient.go index 6bfdc895..1c315a6c 100644 --- a/pkg/server/zclient.go +++ b/pkg/server/zclient.go @@ -121,9 +121,17 @@ func addMessageLabelToIPRouteBody(path *table.Path, vrfId uint32, z *zebraClient rf := path.GetRouteFamily() if v > 4 && (rf == bgp.RF_IPv4_VPN || rf == bgp.RF_IPv6_VPN) { *msgFlags |= zebra.FRR_ZAPI5_MESSAGE_LABEL - for _, label := range path.GetNlri().(*bgp.LabeledVPNIPAddrPrefix).Labels.Labels { - nexthop.LabelNum++ - nexthop.MplsLabels = append(nexthop.MplsLabels, label) + switch rf { + case bgp.RF_IPv4_VPN: + for _, label := range path.GetNlri().(*bgp.LabeledVPNIPAddrPrefix).Labels.Labels { + nexthop.LabelNum++ + nexthop.MplsLabels = append(nexthop.MplsLabels, label) + } + case bgp.RF_IPv6_VPN: + for _, label := range path.GetNlri().(*bgp.LabeledVPNIPv6AddrPrefix).Labels.Labels { + nexthop.LabelNum++ + nexthop.MplsLabels = append(nexthop.MplsLabels, label) + } } } } -- cgit v1.2.3