Mercurial > oi > oi-build
view components/quagga/patches/55-bgpd-rm-assert.patch @ 417:7c10b5cba79b
7066915 Move Quagga to Userland
PSARC 2008/038 Move quagga files from /usr/sfw to /usr
6636788 quagga files should move from /usr/sfw
6610234 Pre-quagga start/stop scripts in /usr/sfw/sbin (bgpdstart,ospfdstart,etc..) should be removed
7064040 quagga smf start method no longer needs to worry about upgrade from SUNWzerbra
7027236 ospfd should allow the -a option to be set in smf
7066821 quaggaadm usage message gives program name as quaggaadm_usage instead of quaggaadm.
6933282 quagga manual pages need to be adjusted for the new IPS package names.
6615038 quaagadm: there is no usage info for the -e option
7002951 quagga pkg should deliver headers to allow users to build OSPF-API client programs
author | Brian Utterback <Brian.Utterback@Oracle.COM> |
---|---|
date | Mon, 18 Jul 2011 12:08:25 -0700 |
parents | |
children |
line wrap: on
line source
commit 9eda90ce8094683a5315007fbd0f9249a284f36f Author: Paul Jakma <paul.jakma@sun.com> Date: Thu Aug 30 13:36:17 2007 +0000 [bgpd] bug #398 Bogus free on out route-map, and assert() with rsclients 2007-08-27 Paul Jakma <paul.jakma@sun.com> * bgp_route.c: (bgp_announce_check) Fix bug #398, slight modification of Vladimir Ivanov's suggested fix - to keep memory alloc conditional. (bgp_process_announce_selected) Don't take struct attr as argument, none of the callers need it and it needlessly distances allocation from use. Free the extended attr, the attr itself is on the stack. Fix bad indentation. * bgp_attr.c: (bgp_packet_attribute) Remove incorrect assert, and adjust conditional to test attr->extra, diagnosis by Vladimir Ivanov in bug #398. 2007-08-27 Vladimir Ivanov <wawa@yandex-team.ru> * bgp_route.c: (bgp_announce_check_rsclient) copy of ri->attr is no longer deep enough, due to addition of attr->extra. It should use bgp_attr_dup, as bgp_announce_check() does. diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 23d9586..ee17b6d 100644 --- bgpd/bgp_attr.c +++ bgpd/bgp_attr.c @@ -1625,8 +1625,6 @@ && from && peer_sort (from) == BGP_PEER_IBGP) { - assert (attr->extra); - /* Originator ID. */ stream_putc (s, BGP_ATTR_FLAG_OPTIONAL); stream_putc (s, BGP_ATTR_ORIGINATOR_ID); @@ -1641,7 +1639,7 @@ stream_putc (s, BGP_ATTR_FLAG_OPTIONAL); stream_putc (s, BGP_ATTR_CLUSTER_LIST); - if (attr->extra->cluster) + if (attr->extra && attr->extra->cluster) { stream_putc (s, attr->extra->cluster->length + 4); /* If this peer configuration's parent BGP has cluster_id. */ diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 0f4da98..9ddeca5 100644 --- bgpd/bgp_route.c +++ bgpd/bgp_route.c @@ -999,11 +999,10 @@ || (ri->extra && ri->extra->suppress) ) { struct bgp_info info; - struct attr dummy_attr; + struct attr dummy_attr = { 0 }; info.peer = peer; info.attr = attr; - /* The route reflector is not allowed to modify the attributes of the reflected IBGP routes. */ @@ -1010,9 +1009,8 @@ if (peer_sort (from) == BGP_PEER_IBGP && peer_sort (peer) == BGP_PEER_IBGP) { - dummy_attr.extra = NULL; bgp_attr_dup (&dummy_attr, attr); - info.attr = &dummy_attr; + info.attr = &dummy_attr; } SET_FLAG (peer->rmap_type, PEER_RMAP_TYPE_OUT); @@ -1024,7 +1022,8 @@ peer->rmap_type = 0; - bgp_attr_extra_free (&dummy_attr); + if (dummy_attr.extra) + bgp_attr_extra_free (&dummy_attr); if (ret == RMAP_DENYMATCH) { @@ -1127,7 +1126,7 @@ #endif /* BGP_SEND_ASPATH_CHECK */ /* For modify attribute, copy it to temporary structure. */ - *attr = *ri->attr; + bgp_attr_dup (attr, ri->attr); /* next-hop-set */ if ((p->family == AF_INET && attr->nexthop.s_addr == 0) @@ -1329,21 +1328,22 @@ static int bgp_process_announce_selected (struct peer *peer, struct bgp_info *selected, - struct bgp_node *rn, struct attr *attr, afi_t afi, safi_t safi) - { + struct bgp_node *rn, afi_t afi, safi_t safi) +{ struct prefix *p; + struct attr attr = { 0 }; p = &rn->p; - /* Announce route to Established peer. */ - if (peer->status != Established) + /* Announce route to Established peer. */ + if (peer->status != Established) return 0; - /* Address family configuration check. */ - if (! peer->afc_nego[afi][safi]) + /* Address family configuration check. */ + if (! peer->afc_nego[afi][safi]) return 0; - /* First update is deferred until ORF or ROUTE-REFRESH is received */ + /* First update is deferred until ORF or ROUTE-REFRESH is received */ if (CHECK_FLAG (peer->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) return 0; @@ -1353,8 +1353,8 @@ case BGP_TABLE_MAIN: /* Announcement to peer->conf. If the route is filtered, withdraw it. */ - if (selected && bgp_announce_check (selected, peer, p, attr, afi, safi)) - bgp_adj_out_set (rn, peer, p, attr, afi, safi, selected); + if (selected && bgp_announce_check (selected, peer, p, &attr, afi, safi)) + bgp_adj_out_set (rn, peer, p, &attr, afi, safi, selected); else bgp_adj_out_unset (rn, peer, p, afi, safi); break; @@ -1361,13 +1361,16 @@ case BGP_TABLE_RSCLIENT: /* Announcement to peer->conf. If the route is filtered, withdraw it. */ - if (selected && bgp_announce_check_rsclient - (selected, peer, p, attr, afi, safi)) - bgp_adj_out_set (rn, peer, p, attr, afi, safi, selected); - else - bgp_adj_out_unset (rn, peer, p, afi, safi); + if (selected && + bgp_announce_check_rsclient (selected, peer, p, &attr, afi, safi)) + bgp_adj_out_set (rn, peer, p, &attr, afi, safi, selected); + else + bgp_adj_out_unset (rn, peer, p, afi, safi); break; } + + bgp_attr_extra_free (&attr); + return 0; } @@ -1417,8 +1420,7 @@ bgp_info_unset_flag (rn, new_select, BGP_INFO_ATTR_CHANGED); } - bgp_process_announce_selected (rsclient, new_select, rn, &attr, - afi, safi); + bgp_process_announce_selected (rsclient, new_select, rn, afi, safi); } } else @@ -1430,8 +1432,7 @@ bgp_info_set_flag (rn, new_select, BGP_INFO_SELECTED); bgp_info_unset_flag (rn, new_select, BGP_INFO_ATTR_CHANGED); } - bgp_process_announce_selected (rsclient, new_select, rn, - &attr, afi, safi); + bgp_process_announce_selected (rsclient, new_select, rn, afi, safi); } if (old_select && CHECK_FLAG (old_select->flags, BGP_INFO_REMOVED)) @@ -1457,10 +1458,7 @@ struct bgp_info_pair old_and_new; struct listnode *node, *nnode; struct peer *peer; - struct attr attr; - memset (&attr, 0, sizeof (struct attr)); - /* Best path selection. */ bgp_best_selection (bgp, rn, &old_and_new); old_select = old_and_new.old; @@ -1491,7 +1489,7 @@ /* Check each BGP peer. */ for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) { - bgp_process_announce_selected (peer, new_select, rn, &attr, afi, safi); + bgp_process_announce_selected (peer, new_select, rn, afi, safi); } /* FIB update. */ @@ -1516,8 +1514,6 @@ if (old_select && CHECK_FLAG (old_select->flags, BGP_INFO_REMOVED)) bgp_info_reap (rn, old_select); - bgp_attr_extra_free (&attr); - UNSET_FLAG (rn->flags, BGP_NODE_PROCESS_SCHEDULED); return WQ_SUCCESS; } @@ -5888,7 +5884,7 @@ { struct route_map *rmap = output_arg; struct bgp_info binfo; - struct attr dummy_attr; + struct attr dummy_attr = { 0 }; int ret; bgp_attr_dup (&dummy_attr, ri->attr);