
jorge at dti2
May 7, 2012, 9:17 AM
Post #1 of 1
(66 views)
Permalink
|
|
[PATCH] bgpd: fix crash with vpnv4 soft-reconfiguration
|
|
From: "Jorge Boncompte [DTI2]" <jorge [at] dti2> bgp_afi_node_get() expects a non-NULL prd for a SAFI_MPLS_VPN prefix. * bgp_route.c: pass down the struct prefix_rd from bgp_soft_reconfig_in() and bgp_soft_reconfig_rsclient(). Signed-off-by: Jorge Boncompte [DTI2] <jorge [at] dti2> --- bgpd/bgp_route.c | 36 ++++++++++++++++++++++++++++-------- 1 files changed, 28 insertions(+), 8 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index c0255b1..8dc28c8 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -2618,7 +2618,7 @@ bgp_announce_route_all (struct peer *peer) static void bgp_soft_reconfig_table_rsclient (struct peer *rsclient, afi_t afi, - safi_t safi, struct bgp_table *table) + safi_t safi, struct bgp_table *table, struct prefix_rd *prd) { struct bgp_node *rn; struct bgp_adj_in *ain; @@ -2629,8 +2629,11 @@ bgp_soft_reconfig_table_rsclient (struct peer *rsclient, afi_t afi, for (rn = bgp_table_top (table); rn; rn = bgp_route_next (rn)) for (ain = rn->adj_in; ain; ain = ain->next) { + struct bgp_info *ri = rn->info; + bgp_update_rsclient (rsclient, afi, safi, ain->attr, ain->peer, - &rn->p, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, NULL, NULL); + &rn->p, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, prd, + (bgp_info_extra_get (ri))->tag); } } @@ -2641,18 +2644,25 @@ bgp_soft_reconfig_rsclient (struct peer *rsclient, afi_t afi, safi_t safi) struct bgp_node *rn; if (safi != SAFI_MPLS_VPN) - bgp_soft_reconfig_table_rsclient (rsclient, afi, safi, NULL); + bgp_soft_reconfig_table_rsclient (rsclient, afi, safi, NULL, NULL); else for (rn = bgp_table_top (rsclient->bgp->rib[afi][safi]); rn; rn = bgp_route_next (rn)) if ((table = rn->info) != NULL) - bgp_soft_reconfig_table_rsclient (rsclient, afi, safi, table); + { + struct prefix_rd prd; + prd.family = AF_UNSPEC; + prd.prefixlen = 64; + memcpy(&prd.val, rn->p.u.val, 8); + + bgp_soft_reconfig_table_rsclient (rsclient, afi, safi, table, &prd); + } } static void bgp_soft_reconfig_table (struct peer *peer, afi_t afi, safi_t safi, - struct bgp_table *table) + struct bgp_table *table, struct prefix_rd *prd) { int ret; struct bgp_node *rn; @@ -2666,9 +2676,12 @@ bgp_soft_reconfig_table (struct peer *peer, afi_t afi, safi_t safi, { if (ain->peer == peer) { + struct bgp_info *ri = rn->info; + ret = bgp_update (peer, &rn->p, ain->attr, afi, safi, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, - NULL, NULL, 1); + prd, (bgp_info_extra_get (ri))->tag, 1); + if (ret < 0) { bgp_unlock_node (rn); @@ -2689,12 +2702,19 @@ bgp_soft_reconfig_in (struct peer *peer, afi_t afi, safi_t safi) return; if (safi != SAFI_MPLS_VPN) - bgp_soft_reconfig_table (peer, afi, safi, NULL); + bgp_soft_reconfig_table (peer, afi, safi, NULL, NULL); else for (rn = bgp_table_top (peer->bgp->rib[afi][safi]); rn; rn = bgp_route_next (rn)) if ((table = rn->info) != NULL) - bgp_soft_reconfig_table (peer, afi, safi, table); + { + struct prefix_rd prd; + prd.family = AF_UNSPEC; + prd.prefixlen = 64; + memcpy(&prd.val, rn->p.u.val, 8); + + bgp_soft_reconfig_table (peer, afi, safi, table, &prd); + } } -- 1.7.8.3 _______________________________________________ Quagga-dev mailing list Quagga-dev [at] lists http://lists.quagga.net/mailman/listinfo/quagga-dev
|