modernize backfire 10.03 so it can be operational again
[openwrt-10.03/.git] / package / quagga / not-patches / patches-pgbgp / 162-pgbgp-bgp_table_wrapper.patch
diff --git a/package/quagga/not-patches/patches-pgbgp/162-pgbgp-bgp_table_wrapper.patch b/package/quagga/not-patches/patches-pgbgp/162-pgbgp-bgp_table_wrapper.patch
new file mode 100644 (file)
index 0000000..b5a508e
--- /dev/null
@@ -0,0 +1,120 @@
+--- a/bgpd/bgp_pgbgp.c
++++ b/bgpd/bgp_pgbgp.c
+@@ -694,7 +694,7 @@ findSuper (struct bgp_table *table, stru
+   struct bgp_node *matched;
+   matched = NULL;
+-  node = table->top;
++  node = bgp_table_top_nolock (table);
+   while (node && node->p.prefixlen < p->prefixlen &&
+          prefix_match (&node->p, p))
+@@ -874,7 +874,7 @@ bgp_pgbgp_clean (struct bgp_table *table
+       if (changed && rn->info)
+         {
+           struct bgp_info *ri = rn->info;
+-          bgp_process (ri->peer->bgp, rn, rn->table->afi, rn->table->safi);
++          bgp_process (ri->peer->bgp, rn, table->afi, table->safi);
+         }
+     }
+@@ -1166,7 +1166,8 @@ bgp_pgbgp_rib_updated (struct bgp_node *
+                   struct bgp_info *ri = cur->sub->info;
+                   if (ri && ri->peer && ri->peer->bgp)
+                     bgp_process (ri->peer->bgp, cur->sub,
+-                                 cur->sub->table->afi, cur->sub->table->safi);
++                                 bgp_node_table (cur->sub)->afi, 
++                                      bgp_node_table (cur->sub)->safi);
+                 }
+@@ -1200,7 +1201,8 @@ bgp_pgbgp_rib_updated (struct bgp_node *
+                   struct bgp_info *ri = cur->sub->info;
+                   if (ri && ri->peer && ri->peer->bgp)
+                     bgp_process (ri->peer->bgp, cur->sub,
+-                                 cur->sub->table->afi, cur->sub->table->safi);
++                                 bgp_node_table (cur->sub)->afi, 
++                                      bgp_node_table (cur->sub)->safi);
+                 }
+             }
+         }
+@@ -1270,7 +1272,7 @@ bgp_pgbgp_update (struct bgp_info *binfo
+   struct bgp_node *superhn = NULL;
+   // implicit lock from node_get
+-  superhn = findSuper (rn->table, &rn->p, t_now);
++  superhn = findSuper (bgp_node_table (rn), &rn->p, t_now);
+   int newPeer = bgp_pgbgp_updatePeer (binfo, t_now);
+   bgp_pgbgp_updateOrigin (rn->hist, binfo, at, rn, t_now, newPeer);
+@@ -1287,13 +1289,13 @@ bgp_pgbgp_update (struct bgp_info *binfo
+   // Make sure you don't collect anything that might be in use!
+   if (t_now >= pgbgp->lastgc + PGBGP_GC_DELTA)
+     {
+-      bgp_pgbgp_gc (rn->table);
++      bgp_pgbgp_gc (bgp_node_table (rn));
+       pgbgp->lastgc = t_now;
+     }
+   if (t_now >= pgbgp->lastStore + PGBGP_STORE_DELTA)
+     {
+-      bgp_pgbgp_store (rn->table);
++      bgp_pgbgp_store (bgp_node_table (rn));
+       pgbgp->lastStore = t_now;
+     }
+@@ -1682,8 +1684,8 @@ bgp_pgbgp_reuseOrigin (struct bgp_pgbgp_
+   // Rerun the decision process?
+   if (numChanged > 0)
+-    bgp_process (ri->peer->bgp, data.rn, data.rn->table->afi,
+-                 data.rn->table->safi);
++    bgp_process (ri->peer->bgp, data.rn, bgp_node_table (data.rn)->afi,
++                 bgp_node_table (data.rn)->safi);
+   /*
+@@ -1962,8 +1964,8 @@ UPP_IGNORE:
+   if (changed)
+     {
+       struct bgp_info *ri = supernode->info;
+-      bgp_process (ri->peer->bgp, supernode, supernode->table->afi,
+-                   supernode->table->safi);
++      bgp_process (ri->peer->bgp, supernode, bgp_node_table (supernode)->afi,
++                   bgp_node_table (supernode)->safi);
+     }
+ UPP_DONE:
+@@ -1986,8 +1988,8 @@ bgp_pgbgp_reusePrefix (struct bgp_pgbgp_
+   // Rerun the decision process
+   if (ri != NULL)
+-    bgp_process (ri->peer->bgp, data.rn, data.rn->table->afi,
+-                 data.rn->table->safi);
++    bgp_process (ri->peer->bgp, data.rn, bgp_node_table (data.rn)->afi,
++                 bgp_node_table (data.rn)->safi);
+   // Remove the avoid nodes from the super
+@@ -2021,8 +2023,8 @@ bgp_pgbgp_reusePrefix (struct bgp_pgbgp_
+               if (numChanged > 0 && ri != NULL)
+                 bgp_process (ri->peer->bgp, data.rnsuper,
+-                             data.rnsuper->table->afi,
+-                             data.rnsuper->table->safi);
++                             bgp_node_table (data.rnsuper)->afi,
++                             bgp_node_table (data.rnsuper)->safi);
+               bgp_unlock_node (del->sub);
+               XFREE (MTYPE_BGP_PGBGP_AVOID, del);
+             }
+@@ -2419,8 +2421,8 @@ bgp_pgbgp_reuseEdge (struct bgp_pgbgp_r_
+     }
+   struct bgp_info *ri = data.rn->info;
+   if (numChanged > 0 && ri)
+-    bgp_process (ri->peer->bgp, data.rn, data.rn->table->afi,
+-                 data.rn->table->safi);
++    bgp_process (ri->peer->bgp, data.rn, bgp_node_table (data.rn)->afi,
++                 bgp_node_table (data.rn)->safi);
+   struct bgp_pgbgp_hist *hist = data.rn->hist;
+   hist->pEdgeReuse = NULL;