summaryrefslogtreecommitdiff
path: root/bgpd/bgp_route.c
diff options
context:
space:
mode:
authorPaul Jakma <paul.jakma@sun.com>2006-10-22 19:13:07 +0000
committerPaul Jakma <paul.jakma@sun.com>2006-10-22 19:13:07 +0000
commit6f58544db526b4dfb09d45f8507926b0ae5fe12b (patch)
treef73d22b4ff92eaef337a6d9af8a1923d730e9a21 /bgpd/bgp_route.c
parented3ebfa36b45fe487015e1918e848f0ff4500bff (diff)
[bgpd] struct peer must have bgp field valid (redistribute crash)
2006-10-19 Paul Jakma <paul.jakma@sun.com> * bgpd.c: (peer_new) bgp element of peer absolutely must be filled in, make peer_new() require it as argument and update all callers. Fixes a crash reported by Jan 'yanek' Bortl and Andrew Schorr where bgpd would crash in bgp_pcount_adjust trying to dereference the bgp member of bgp->peer_self, triggered through redistribution. * bgp_route.c: (bgp_pcount_adjust) assert sanity of arguments.
Diffstat (limited to 'bgpd/bgp_route.c')
-rw-r--r--bgpd/bgp_route.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 7b369748..3584b21a 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -196,6 +196,9 @@ bgp_info_delete (struct bgp_node *rn, struct bgp_info *ri)
static void
bgp_pcount_adjust (struct bgp_node *rn, struct bgp_info *ri)
{
+ assert (rn && rn->table);
+ assert (ri && ri->peer && ri->peer->bgp);
+
/* Ignore 'pcount' for RS-client tables */
if (rn->table->type != BGP_TABLE_MAIN
|| ri->peer == ri->peer->bgp->peer_self)