summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorHitoshi Irino <irino@sfc.wide.ad.jp>2019-07-21 15:08:23 +0900
committerHitoshi Irino <irino@sfc.wide.ad.jp>2019-07-21 15:25:50 +0900
commit7284d4cf8b3f9ecd03068dfa3ab3d433860b5089 (patch)
treea3e65926529501e19a33a8181fa4e14cd17d792b /pkg
parent426709893303ecd0ff189cfe0b24eda89edef95e (diff)
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
Diffstat (limited to 'pkg')
-rw-r--r--pkg/server/zclient.go14
1 files changed, 11 insertions, 3 deletions
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)
+ }
}
}
}