[packages] quagga: Fix vpnv4 soft-reconfiguration crashes
[openwrt/svn-archive/archive.git] / net / quagga / patches / 009-bgpd-fix-vpn4-soft-reconfiguration.patch
1 Index: quagga-0.99.21/bgpd/bgp_route.c
2 ===================================================================
3 --- quagga-0.99.21.orig/bgpd/bgp_route.c
4 +++ quagga-0.99.21/bgpd/bgp_route.c
5 @@ -2616,7 +2616,7 @@ bgp_announce_route_all (struct peer *pee
6 \f
7 static void
8 bgp_soft_reconfig_table_rsclient (struct peer *rsclient, afi_t afi,
9 - safi_t safi, struct bgp_table *table)
10 + safi_t safi, struct bgp_table *table, struct prefix_rd *prd)
11 {
12 struct bgp_node *rn;
13 struct bgp_adj_in *ain;
14 @@ -2627,8 +2627,11 @@ bgp_soft_reconfig_table_rsclient (struct
15 for (rn = bgp_table_top (table); rn; rn = bgp_route_next (rn))
16 for (ain = rn->adj_in; ain; ain = ain->next)
17 {
18 + struct bgp_info *ri = rn->info;
19 +
20 bgp_update_rsclient (rsclient, afi, safi, ain->attr, ain->peer,
21 - &rn->p, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, NULL, NULL);
22 + &rn->p, ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL, prd,
23 + (bgp_info_extra_get (ri))->tag);
24 }
25 }
26
27 @@ -2639,18 +2642,25 @@ bgp_soft_reconfig_rsclient (struct peer
28 struct bgp_node *rn;
29
30 if (safi != SAFI_MPLS_VPN)
31 - bgp_soft_reconfig_table_rsclient (rsclient, afi, safi, NULL);
32 + bgp_soft_reconfig_table_rsclient (rsclient, afi, safi, NULL, NULL);
33
34 else
35 for (rn = bgp_table_top (rsclient->bgp->rib[afi][safi]); rn;
36 rn = bgp_route_next (rn))
37 if ((table = rn->info) != NULL)
38 - bgp_soft_reconfig_table_rsclient (rsclient, afi, safi, table);
39 + {
40 + struct prefix_rd prd;
41 + prd.family = AF_UNSPEC;
42 + prd.prefixlen = 64;
43 + memcpy(&prd.val, rn->p.u.val, 8);
44 +
45 + bgp_soft_reconfig_table_rsclient (rsclient, afi, safi, table, &prd);
46 + }
47 }
48 \f
49 static void
50 bgp_soft_reconfig_table (struct peer *peer, afi_t afi, safi_t safi,
51 - struct bgp_table *table)
52 + struct bgp_table *table, struct prefix_rd *prd)
53 {
54 int ret;
55 struct bgp_node *rn;
56 @@ -2664,9 +2674,12 @@ bgp_soft_reconfig_table (struct peer *pe
57 {
58 if (ain->peer == peer)
59 {
60 + struct bgp_info *ri = rn->info;
61 +
62 ret = bgp_update (peer, &rn->p, ain->attr, afi, safi,
63 ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL,
64 - NULL, NULL, 1);
65 + prd, (bgp_info_extra_get (ri))->tag, 1);
66 +
67 if (ret < 0)
68 {
69 bgp_unlock_node (rn);
70 @@ -2687,12 +2700,19 @@ bgp_soft_reconfig_in (struct peer *peer,
71 return;
72
73 if (safi != SAFI_MPLS_VPN)
74 - bgp_soft_reconfig_table (peer, afi, safi, NULL);
75 + bgp_soft_reconfig_table (peer, afi, safi, NULL, NULL);
76 else
77 for (rn = bgp_table_top (peer->bgp->rib[afi][safi]); rn;
78 rn = bgp_route_next (rn))
79 if ((table = rn->info) != NULL)
80 - bgp_soft_reconfig_table (peer, afi, safi, table);
81 + {
82 + struct prefix_rd prd;
83 + prd.family = AF_UNSPEC;
84 + prd.prefixlen = 64;
85 + memcpy(&prd.val, rn->p.u.val, 8);
86 +
87 + bgp_soft_reconfig_table (peer, afi, safi, table, &prd);
88 + }
89 }
90 \f
91