summaryrefslogtreecommitdiff
path: root/bgpd/bgp_route.c
AgeCommit message (Collapse)Author
2007-06-14[bgpd] bug #370, default-originate was broken by a silly thinkoPaul Jakma
2007-05-25 Paul Jakma <paul.jakma@sun.com> * bgp_route.c: (bgp_default_originate) Sanity check added previously was broken and always failed, thus this function never could run, bug #370.
2007-05-04[bgpd] Trim memory usage of BGP routesPaul Jakma
2007-05-03 Paul Jakma <paul.jakma@sun.com> * bgp_route.h: (struct info) Move less frequently used fields to a lazily allocated struct info_extra. Export bgp_info_extra_get * bgp_route.c: (bgp_info_extra_new) allocate extra (bgp_info_extra_free) Free damp info and the info_extra. (bgp_info_extra_get) Retrieve the info_extra of a struct info, allocating as required. (generally) adjust to use info->extra * bgp_damp.c: (generally) use bgp_info_extra_get to access dampinfo * bgp_attr.h: Move rarely allocated attributes from struct attr to a struct attr_extra, for a substantial saving in size of struct attr. * bgp_attr.c: (bgp_attr_extra_{new,free}), new, self-explanatory. (bgp_attr_extra_get) Get the attr_extra for a given struct attr, allocating it if needs be. (bgp_attr_dup) Shallow copy the struct attr and its attr_extra. (generally) adjust to know about attr->extra. * bgp_debug.c: (bgp_dump_attr) ditto * bgp_vty.c: (show_bgp_memory) print attr and info extra sizes. * bgp_nexthop.c: (generally) adjust to know about attr->extra and info->extra. * bgp_{packet,routemap,snmp,zebra}.c: ditto * lib/memtypes.c: Add MTYPE_ATTR_EXTRA and MTYPE_BGP_ROUTE_EXTRA
2007-04-10[bgpd] V. quick route flap gets mistaken for duplicate, route is then ignoredPaul Jakma
2007-04-08 Paul Jakma <paul.jakma@sun.com> * bgp_route.c: (general) Same bug as fixed on 2006-11-28 by ajs for bgp static routes, but for main BGP RIB: Quick 'flap' of routes can cause bgpd to mistake a new route for a duplicate route, due to presence of removed, but not yet processed BGP RIB entry. (bgp_update_rsclient) Ignore REMOVED bgp_info for duplicate, restore route instead. (bgp_update_main) Ditto.
2007-02-22[bgpd] Peer delete can race with reconfig leading to crashPaul Jakma
2007-02-22 Paul Jakma <paul.jakma@sun.com> * bgp_fsm.c: (bgp_fsm_change_status) Handle state change into clearing or greater here. Simpler. (bgp_event) Clearing state change work moved to previous * bgp_route.c: (bgp_clear_route_node) Clearing adj-in here is too late, as it leaves a race between a peer being deleted and an identical peer being configured before clearing completes, leading to a crash. Simplest fix is to clean peers Adj-in up-front, rather than queueing such work. (bgp_clear_route_table) Clear peer's Adj-In and Adj-Out up-front here, rather than queueing such work. Extensive comment added on the various bits of indexed data that exist and how they need to be dealt with. (bgp_clear_route) Update comment.
2006-11-28[bgpd] Fix bug where a deleted route that was quickly re-added was being lostAndrew J. Schorr
2006-11-28 Andrew J. Schorr <ajschorr@alumni.princeton.edu> * bgp_route.c: (bgp_info_restore) New function that undoes the effects of a previous call to bgp_info_delete. This is used when a route is deleted and quickly re-added before the deletion has been processed. (bgp_static_update_rsclient, bgp_static_update_main, bgp_redistribute_add) Check whether a pre-existing route has the BGP_INFO_REMOVED set, and, if so, we need to call bgp_info_restore to resurrect it.
2006-10-27[bgpd] trivial: non C99 u_int.._t should be uint.._tPaul Jakma
2006-10-27 Paul Jakma <paul.jakma@sun.com> * bgp_route.c: (bgp_table_stats) oops, u_intXX_t should be uintXX_t
2006-10-22[bgpd] struct peer must have bgp field valid (redistribute crash)Paul Jakma
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.
2006-10-15[bgpd] CID#73, potential crash in bgp statistics if called for AFI/SAFI with ↵Paul Jakma
emtpy table 2006-10-15 Paul Jakma <paul.jakma@sun.com> * bgp_route.c: (bgp_table_stats_walker) NULL deref if table is empty, bgp_table_top may return NULL, Coverity CID#73.
2006-09-14[bgpd] reduce the process queue hold time to something more sensiblePaul Jakma
2006-09-14 Paul Jakma <paul.jakma@sun.com> * bgp_route.c: (bgp_process_queue_init) process queue hold time too high, adds extra memory load. Change to be much lower, until such time as it's made configurable.
2006-09-14[bgpd] RIB statistics address space size shouldnt double count spacePaul Jakma
2006-09-14 Paul Jakma <paul.jakma@sun.com> * bgp_route.c: (bgp_table_stats_walker) Address space announced should only count top-level unaggregateable prefixes, to avoid falling afoul of anti-dodgy-accounting regulations in various jurisdictions.. ;)
2006-09-14[bgpd] Fix 0.99 shutdown regression, introduce Clearing and Deleted statesPaul Jakma
2006-09-14 Paul Jakma <paul.jakma@sun.com> * (general) Fix some niggly issues around 'shutdown' and clearing by adding a Clearing FSM wait-state and a hidden 'Deleted' FSM state, to allow deleted peers to 'cool off' and hit 0 references. This introduces a slow memory leak of struct peer, however that's more a testament to the fragility of the reference counting than a bug in this patch, cleanup of reference counting to fix this is to follow. * bgpd.h: Add Clearing, Deleted states and Clearing_Completed and event. * bgp_debug.c: (bgp_status_msg[]) Add strings for Clearing and Deleted. * bgp_fsm.h: Don't allow timer/event threads to set anything for Deleted peers. * bgp_fsm.c: (bgp_timer_set) Add Clearing and Deleted. Deleted needs to stop everything. (bgp_stop) Remove explicit fsm_change_status call, the general framework handles the transition. (bgp_start) Log a warning if a start is attempted on a peer that should stay down, trying to start a peer. (struct .. FSM) Add Clearing_Completed events, has little influence except when in state Clearing to signal wait-state can end. Add Clearing and Deleted states, former is a wait-state, latter is a placeholder state to allow peers to disappear quietly once refcounts settle. (bgp_event) Try reduce verbosity of FSM state-change debug, changes to same state are not interesting (Established->Established) Allow NULL action functions in FSM. * bgp_packet.c: (bgp_write) Use FSM events, rather than trying to twiddle directly with FSM state behind the back of FSM. (bgp_write_notify) ditto. (bgp_read) Remove the vague ACCEPT_PEER peer_unlock, or else this patch crashes, now it leaks instead. * bgp_route.c: (bgp_clear_node_complete) Clearing_Completed event, to end clearing. (bgp_clear_route) See extensive comments. * bgpd.c: (peer_free) should only be called while in Deleted, peer refcounting controls when peer_free is called. bgp_sync_delete should be here, not in peer_delete. (peer_delete) Initiate delete. Transition to Deleted state manually. When removing peer from indices that provide visibility of it, take great care to be idempotent wrt the reference counting of struct peer through those indices. Use bgp_timer_set, rather than replicating. Call to bgp_sync_delete isn't appropriate here, sync can be referenced while shutting down and finishing deletion. (peer_group_bind) Take care to be idempotent wrt list references indexing peers.
2006-09-14[bgpd] Add RIB reporting commands, show bgp ... statisticsPaul Jakma
2006-09-13 Paul Jakma <paul.jakma@sun.com> * bgp_aspath.c: (aspath_highest) new, return highest ASN in an aspath. * bgp_route.c: (bgp_peer_count_walker) new, do the walk done in bgp_peer_counts as a thread. (bgp_peer_counts) move walk to previous and call it via thread_execute so this RIB walk shows up in thread stats. (bgp_table_stats) New, gather some statistics for a given RIB. (bgp_table_stats_walker) New, RIB walker thread for former. (bgp_table_stats_vty) Parsing front-end for 'show bgp ...', useful model for future rationalisation of 'show ... bgp'. (bgp_route_init) Add new RIB stats commands.
2006-09-07[bgpd] Handle pcount as flags are changed, fixing pcount issuesPaul Jakma
2006-09-06 Paul Jakma <paul.jakma@sun.com> * (general) Squash any and all prefix-count issues by abstracting route flag changes, and maintaining count as and when flags are modified (rather than relying on explicit modifications of count being sprinkled in just the right places throughout the code). * bgp_route.c: (bgp_pcount_{dec,inc}rement) removed. (bgp_pcount_adjust) new, update prefix count as needed for a given route. (bgp_info_{uns,s}et_flag) set/unset a BGP_INFO route status flag, calling previous function when appropriate. (general) Update all set/unsets of flags to use previous. Remove pcount_{dec,inc}rement calls. No need to unset BGP_INFO_VALID in places where bgp_info_delete is called, it does that anyway. * bgp_{damp,nexthop}.c: Update to use bgp_info_{un,}set_flag. * bgp_route.h: Export bgp_info_{un,}set_flag. Add a 'meta' BGP_INFO flag, BGP_INFO_UNUSEABLE. Move BGP_INFO_HOLDDOWN macro to here from bgpd.h
2006-09-04[bgpd] Add 'show ... neighbor .... prefix-counts' commandPaul Jakma
2006-09-03 Paul Jakma <paul.jakma@sun.com> * bgp_route.c: Add 'show ... bgp ... <neighbour> prefix-count' commands, to provide detailed counts of prefixes for a peer. Informative, and should help pin down to pfxcnt drift problems.
2006-05-12[bgpd] CID #4,#5,#9,#10, simplify aspath_print_vty usagePaul Jakma
2006-05-12 Paul Jakma <paul.jakma@sun.com> * bgp_aspath.{c,h}: (aspath_print_vty) take a format string, so as to reduce burden on callers, all in bgp_route.c * bgp_route.c: (route_vty_out{,tmp}) Update to match aspath_print_vty, simplifying checks needed to get spacing right. CID #4,#5. ({damp,flap}_route_vty_out) Ditto, CID #9, #10
2006-05-12[bgpd] CID #6, remove useless NULL check, bgp_static_update_rsclientPaul Jakma
2006-05-12 Paul Jakma <paul.jakma@sun.com> * bgp_route.c: (bgp_static_update_rsclient) Remove useless NULL check, code already assumes bgp_static can not be NULL, fixes CID #6.
2006-05-12[bgpd] CID #7, remove useless NULL check, bgp_static_update_mainPaul Jakma
2006-05-12 Paul Jakma <paul.jakma@sun.com> * bgp_route.c: (bgp_static_update_main) Remove useless NULL check, code already assumes bgp_static can not be NULL, fixes CID #7.
2006-05-08[bgpd] Bug #240, Fix route-server crash when static routes are configuredPaul Jakma
2006-05-08 Paul Jakma <paul.jakma@sun.com> * bgp_route.c: (bgp_afi_node_get) given table should never be NULL, check/assert this. (bgp_static_update) Bug #240. Rsclients should only be passed the static update if they are configured for the afi,safi.
2006-05-04[bgpd] Fix bug where FSM can stay hung forever in Idle/ClrngPaul Jakma
2006-05-04 Paul Jakma <paul.jakma@sun.com> * bgp_route.c: (general) Fix logical bug in clearing, noted by Chris Caputo in [quagga-users 6728] - clearing depended on at least one route being added to workqueue, in order for workqueue completion function to restart FSM. However, if no routes are cleared, then the completion function never is called, it needs to be called manually if the workqueue didn't get scheduled. Finally, clearing is per-peer-session, not per AFI/SAFI, so the FSM synchronisation should be in bgp_clear_route_table. (bgp_clear_route_table) Wrong place for FSM/clearing synchronisation, move to.. (bgp_clear_route) FSM/clearing synchronisation should be here. If no routes were cleared, no workqueue scheduled, call the completion func to ensure FSM kicks off again.
2006-03-06[bgpd] Start off FSM again once clearing finishes.Paul Jakma
2006-03-03 Paul Jakma <paul.jakma@sun.com> * bgp_route.c: (bgp_clear_node_complete) Doh. When clearing is complete we need to kick off FSM again.
2006-02-21[bgpd] Record afi/safi in bgp_table. Serialise peer clear with FSM.Paul Jakma
2006-02-21 Paul Jakma <paul.jakma@sun.com> * bgpd.h: move the clear_node_queue to be peer specific. Add a new peer status flag, PEER_STATUS_CLEARING. * bgp_table.h: (struct bgp_table) Add fields to record afi, safi of the table. (bgp_table_init) Take afi and safi to create table for. * bgp_table.c: (bgp_table_init) record the afi and safi. * bgp_nexthop.c: Update all calls to bgp_table_init. * bgp_vty.c: ditto. * bgpd.c: ditto. * bgp_fsm.c: (bgp_timer_set) dont bring up a session which is clearing. * bgp_route.c: (general) Update all bgp_table_init calls. (bgp_process_{rsclient,main}) clear_node is serialised via PEER_STATUS_CLEARING and fsm now. (struct bgp_clear_node_queue) can be removed. struct bgp_node can be the queue item data directly, as struct peer can be kept in the new wq global user data and afi/safi can be retrieved via bgp_node -> bgp_table. (bgp_clear_route_node) fix to get peer via wq->spec.data, afi/safi via bgp_node->bgp_table. (bgp_clear_node_queue_del) no more item data to delete, only unlock the bgp_node. (bgp_clear_node_complete) only need to unset CLEARING flag and unlock struct peer. (bgp_clear_node_queue_init) queue attaches to struct peer now. record peer name as queue name. (bgp_clear_route_table) If queue transitions to active, serialise clearing by setting PEER_STATUS_CLEARING rather than plugging process queue, and lock peer while queue active. Update to pass only bgp_node as per-queue-item specific data.
2006-02-18[bgpd] trivial readability fixPaul Jakma
2006-02-18 Paul Jakma <paul.jakma@sun.com> * bgp_route.c: (bgp_announce_check) trivial, move declaration of two local variables into the only block where they are used, to aid the reader.
2006-02-05[bgpd] Fix peer prefix counts and make it slightly more robustpaul
2006-02-05 Paul Jakma <paul.jakma@sun.com> * bgp_route.h: Add BGP_INFO_COUNTED to track whether prefix has been counted or not. * bgp_route.c: (bgp_pcount_{inc,dec}rement) new helpers, to centralise inc/dec of prefix-count, (bgp_rib_remove) Remove pcount decrement, use helper. (bgp_rib_withdraw) ditto, additionally use previous function too. (bgp_update_main) Use pcount helpers. (bgp_clear_route_node) ditto, aslo REMOVED routes don't need clearing.
2006-02-02[lib/workqueue] remove the useless 'delay' factor.paul
2006-02-02 Paul Jakma <paul.jakma@sun.com> * workqueue.h: (struct work_queue) Remove the delay field. It served no purpose and just introduced bad behaviour. Should be excised before its allowed to escape into 1.0. This removes need for the 'flood' and runs_since_clear fields. * workqueue.c: (general) excise delay factor between queue runs, hence the 'flood' crap too.. See above. * bgp_route.c: (bgp_{clear_node,process}_queue_init) delay field is removed from workqueue spec.
2006-01-19[compiler] miscellaneous trivial compiler warning fixespaul
2006-01-19 Paul Jakma <paul.jakma@sun.com> * (general) various miscellaneous compiler warning fixes. Remove redundant break statements from switch clauses which return. return from main, not exit, cause it annoys SOS. Remove stray semi-colons which cause empty-statement warnings. * zebra/main.c: (sighup) remove private declaration of external function.
2005-11-142005-11-14 Paul Jakma <paul.jakma@sun.com>paul
* zebra_rib.c: (rib_process) convert to new workqueue specs and shut up gcc, which complains about cast from void via function parameters, for some dumb reason. Do the cast inside the function instead. (rib_queue_qnode_del) ditto. (rib_queue_init) no need for the casts anymore.
2005-09-102005-09-10 Paul Jakma <paul.jakma@sun.com>paul
* Makefile.am: bgpd shouldn't list libgp's sources as its own. Use LDADD. * bgp_aspath.h: (struct assegment) New struct, abstract representation of a list of AS_PATH segments and the contained ASNs. (struct aspath) Remove the raw-data related fields, reference the abstract struct assegment instead. Remove several other computed fields, it's just a headache to maintain them and they're cheap to compute from struct assegment. (aspath_parse) parse a stream, not a pointer to raw data. (aspath_count_{hops,confeds,size}) helpers to access information formerly directly contained in struct aspath. (aspath_snmp_pathseg) Helper for SNMP, BGP MIB wants to be able to output hex representation of raw data. * bgp_aspath.c: (general) partial-rewrite. Store aspath data as an abstract singly-linked list of abstract segments, rather than storing the raw data, and parsing it each and every time. Remove several count/size fields which are cheap to compute from the abstract segment structure. (global) Include stream.h, needed for aspath_parse, and others. Couple of helper macros added. (struct assegment_header) Just the header, and only the header. (assegment_data_{new,free}) convenience functions for AS_SEG_DATA allocation, the dynamic, per-segment array of ASNs. (assegment_{new,free,free_all,dup,dup_all}) convenience functions for creating struct assegments. The _all forms will follow the entire chain of segments from the given segment. (assegment_prepend_asns) new function, prepend an ASN N times to segment. (assegment_append_asns) Append a list (array) of ASNs to segment. (int_cmp) convenience function for the aspath hash. (assegment_normalise) new function. Normalise the given segment chain to meet expectations of Quagga, and to eliminate differing raw representations of the same paths. Merge 'runs' of SEQUENCEs into one segment as our internal segment is not limited by the protocol AS_PATH segment length. Sort ASNs in SETs. (aspath_new) Take void argument to quell warnings. Use the assegment convenience functions. (assegment_count_{asns,confeds,hops}) new functions to compute at runtime values previously held in struct aspath. (aspath_size) ditto. (aspath_make_str_count) rewritten to stringify new representation, and to be slightly easier to understand hopefully. (aspath_str_update) convenience function, update the aspath str. Should investigate removing maintained string from struct aspath, just run-time compute it, as per other fields. It's just a maintenance headache, would save noticeable amount of RAM with possibly not much extra run-time cost. (aspath_dup) use the assegment dup functions. (aspath_hash_alloc) Take void * argument to satisfy gcc. Use the proper helper functions to dup data. (assegments_parse) new function. parse raw AS_PATH data into struct assegments. Normalise and return the head of the list. (aspath_parse) Parse a stream, not pointer to raw data and use assegments_parse to do it. (assegment_data_put) Write out a single segment data in protocol form to stream. (assegment_header_put) ditto but for segment header. (aspath_put) new function. As per previous but for an entire struct aspath. (aspath_snmp_pathseg) wrapper around aspath_put for bgp_snmp.c. Uses a static buffer sadly. (aspath_aggregate_as_set_add) rewritten to use assegments. (aspath_aggregate) ditto (aspath_{firstas,loop,private_as}_check) ditto (aspath_{merge,prepend,add_one_as}) ditto (aspath_cmp_left{_confed}) ditto (aspath_delete_confed_seq) ditto, plus fixed to properly delete all leading confed segments. (aspath_as_add) Just use assegment_append_asns. (aspath_segment_add) updated to use assegments. (enum as_token) Add values for confeds (aspath_gettoken) Add support for confeds (aspath_str2aspath) ditto (aspath_key_make) updated to use as_segments. Also, add segment type into the hash value as appropriate. (aspath_cmp) updated to use as_segments. (aspath_print) don't segfault on NULL argument. * bgp_attr.c: (bgp_attr_aspath) aspath_parse wants the stream now. No need for manual forwarding of stream. (bgp_packet_attribute) empty aspath is now denoted by NULL segment field, length is gone. Use aspath_size() to determine size. (bgp_attr_init) Fix declaration, explicitely specify void arg. (bgp_dump_routes_attr) Use aspath_size() to determine size. * bgp_route.c: (bgp_info_cmp) use the aspath_count_* functions. (bgp_rib_withdraw) remove unused variable. Use aspath_count_hops. * bgp_snmp.c: (bgp4PathAttrTable) raw data is gone, use aspath_snmp_pathseg to get the representation.
2005-08-26 * bgp_route.c: Third (?) attempt to fix best selection breakagehasso
introduced long time ago with route server patch. Hopefully it's last case to fix - route-server client not in peer group. [backport candidate]
2005-08-222005-08-22 Paul Jakma <paul.jakma@sun.com>paul
* bgp_route.h: (struct bgp_info) add a new flag, BGP_INFO_REMOVED. BGP_INFO_VALID is already overloaded, don't care to do same thing to STALE or HISTORY. * bgpd.h: (BGP_INFO_HOLDDOWN) Add INFO_REMOVED to the macro, as a route which should generally be ignored. * bgp_route.c: (bgp_info_delete) Just set the REMOVE flag, rather than doing actual work, so that bgp_process (called directly, or indirectly via the scanner) can catch withdrawn routes. (bgp_info_reap) Actually remove the route, what bgp_info_delete used to do, only for use by bgp_process. (bgp_best_selection) reap any REMOVED routes, other than the old selected route. (bgp_process_rsclient) reap the old-selected route, if appropriate (bgp_process_main) ditto (bgp_rib_withdraw, bgp_rib_remove) make them more consistent with each other. Don't play games with the VALID flag, bgp_process is async now, so it didn't make a difference anyway. Remove the 'force' argument from bgp_rib_withdraw, withdraw+force is equivalent to bgp_rib_remove. Update all its callers. (bgp_update_rsclient) bgp_rib_withdraw and force set is same as bgp_rib_remove. (route_vty_short_status_out) new helper to print the leading route-status string used in many command outputs. Consolidate. (route_vty_out, route_vty_out_tag, damp_route_vty_out, flap_route_vty_out) use route_vty_short_status_out rather than duplicate. (route_vty_out_detail) print state of REMOVED flag. (BGP_SHOW_SCODE_HEADER) update for Removed flag.
2005-06-282005-06-28 Paul Jakma <paul.jakma@sun.com>paul
* (global) The great bgpd extern and static'ification. * bgp_routemap.c: remove unused ROUTE_MATCH_ASPATH_OLD code (route_set_metric_compile) fix u_int32_t to ULONG_MAX comparison warnings. * bgp_route.h: (bgp_process, bgp_withdraw, bgp_update) export these used by various files which had their own private declarations, in the case of mplsvpn - incorrect.
2005-06-012005-06-01 Paul Jakma <paul.jakma@sun.com>paul
* bgpd/(general) refcount struct peer and bgp_info, hence allowing us add work_queues for bgp_process. * bgpd/bgp_route.h: (struct bgp_info) Add 'lock' field for refcount. Add bgp_info_{lock,unlock} helper functions. Add bgp_info_{add,delete} helpers, to remove need for users managing locking/freeing of bgp_info and bgp_node's. * bgpd/bgp_table.h: (struct bgp_node) Add a flags field, and BGP_NODE_PROCESS_SCHEDULED to merge redundant processing of nodes. * bgpd/bgp_fsm.h: Make the ON/OFF/ADD/REMOVE macros lock and unlock peer reference as appropriate. * bgpd/bgp_damp.c: Remove its internal prototypes for bgp_info_delete/free. Just use bgp_info_delete. * bgpd/bgpd.h: (struct bgp_master) Add work_queue pointers. (struct peer) Add reference count 'lock' (peer_lock,peer_unlock) New helpers to take/release reference on struct peer. * bgpd/bgp_advertise.c: (general) Add peer and bgp_info refcounting and balance how references are taken and released. (bgp_advertise_free) release bgp_info reference, if appropriate (bgp_adj_out_free) unlock peer (bgp_advertise_clean) leave the adv references alone, or else call bgp_advertise_free cant unlock them. (bgp_adj_out_set) lock the peer on new adj's, leave the reference alone otherwise. lock the new bgp_info reference. (bgp_adj_in_set) lock the peer reference (bgp_adj_in_remove) and unlock it here (bgp_sync_delete) make hash_free on peer conditional, just in case. * bgpd/bgp_fsm.c: (general) document that the timers depend on bgp_event to release a peer reference. (bgp_fsm_change_status) moved up the file, unchanged. (bgp_stop) Decrement peer lock as many times as cancel_event canceled - shouldnt be needed but just in case. stream_fifo_clean of obuf made conditional, just in case. (bgp_event) always unlock the peer, regardless of return value of bgp_fsm_change_status. * bgpd/bgp_packet.c: (general) change several bgp_stop's to BGP_EVENT's. (bgp_read) Add a mysterious extra peer_unlock for ACCEPT_PEERs along with a comment on it. * bgpd/bgp_route.c: (general) Add refcounting of bgp_info, cleanup some of the resource management around bgp_info. Refcount peer. Add workqueues for bgp_process and clear_table. (bgp_info_new) make static (bgp_info_free) Ditto, and unlock the peer reference. (bgp_info_lock,bgp_info_unlock) new exported functions (bgp_info_add) Add a bgp_info to a bgp_node in correct fashion, taking care of reference counts. (bgp_info_delete) do the opposite of bgp_info_add. (bgp_process_rsclient) Converted into a work_queue work function. (bgp_process_main) ditto. (bgp_processq_del) process work queue item deconstructor (bgp_process_queue_init) process work queue init (bgp_process) call init function if required, set up queue item and add to queue, rather than calling process functions directly. (bgp_rib_remove) let bgp_info_delete manage bgp_info refcounts (bgp_rib_withdraw) ditto (bgp_update_rsclient) let bgp_info_add manage refcounts (bgp_update_main) ditto (bgp_clear_route_node) clear_node_queue work function, does per-node aspects of what bgp_clear_route_table did previously (bgp_clear_node_queue_del) clear_node_queue item delete function (bgp_clear_node_complete) clear_node_queue completion function, it unplugs the process queues, which have to be blocked while clear_node_queue is being processed to prevent a race. (bgp_clear_node_queue_init) init function for clear_node_queue work queues (bgp_clear_route_table) Sets up items onto a workqueue now, rather than clearing each node directly. Plugs both process queues to avoid potential race. (bgp_static_withdraw_rsclient) let bgp_info_{add,delete} manage bgp_info refcounts. (bgp_static_update_rsclient) ditto (bgp_static_update_main) ditto (bgp_static_update_vpnv4) ditto, remove unneeded cast. (bgp_static_withdraw) see bgp_static_withdraw_rsclient (bgp_static_withdraw_vpnv4) ditto (bgp_aggregate_{route,add,delete}) ditto (bgp_redistribute_{add,delete,withdraw}) ditto * bgpd/bgp_vty.c: (peer_rsclient_set_vty) lock rsclient list peer reference (peer_rsclient_unset_vty) ditto, but unlock same reference * bgpd/bgpd.c: (peer_free) handle frees of info to be kept for lifetime of struct peer. (peer_lock,peer_unlock) peer refcount helpers (peer_new) add initial refcounts (peer_create,peer_create_accept) lock peer as appropriate (peer_delete) unlock as appropriate, move out some free's to peer_free. (peer_group_bind,peer_group_unbind) peer refcounting as appropriate. (bgp_create) check CALLOC return value. (bgp_terminate) free workqueues too. * lib/memtypes.c: Add MTYPE_BGP_PROCESS_QUEUE and MTYPE_BGP_CLEAR_NODE_QUEUE
2005-04-08 * bgpd.texi: Document new "bgp bestpath as-path confed" command.hasso
* bgp_aspath.[ch], bgp_route.c, bgp_vty.c, bgpd.[ch]: Allow to enable the length of confederation path segments to be included during the as-path length check in the best path decision.
2005-04-072005-04-07 Paul Jakma <paul.jakma@sun.com>paul
* (global): Fix up list loops to match changes in lib/linklist, and some basic auditing of usage. * configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES * HACKING: Add notes about deprecating interfaces and commands. * lib/linklist.h: Add usage comments. Rename getdata macro to listgetdata. Rename nextnode to listnextnode and fix its odd behaviour to be less dangerous. Make listgetdata macro assert node is not null, NULL list entries should be bug condition. ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use with for loop, Suggested by Jim Carlson of Sun. Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the "safety" of previous macro. LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to distinguish from the similarly named functions, and reflect their effect better. Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section with the old defines which were modified above, for backwards compatibility - guarded to prevent Quagga using it.. * lib/linklist.c: fix up for linklist.h changes. * ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single scan of the area list, rather than scanning all areas first for INTER_ROUTER and then again for INTER_NETWORK. According to 16.2, the scan should be area specific anyway, and further ospf6d does not seem to implement 16.3 anyway.
2005-03-21 * bgp_route.c: Don't crash while clearing route tables if there ishasso
no particular afi/safi configured. [backport candidate]
2005-02-23 * bgp_route.c: Make reannouncing prefixes with changed attributeshasso
work again.
2005-02-02 * bgp_clist.[ch], bgp_route.c, bgp_routemap.c, bgp_vty.c:hasso
community-list cleanup. [merge from GNU Zebra]
2005-02-02 * bgp_route.c, bgp_vty.c, bgp_zebra.c, bgpd.[ch]: "enforce-multihop"hasso
-> "disable-connected-check". [merge from GNU Zebra]
2005-02-02 * bgp_fsm.c, bgp_open.c, bgp_packet.c, bgp_route.[ch], bgp_vty.c,hasso
bgpd.[ch]: Add BGP_INFO_STALE flag and end-of-rib support. "bgp graceful-restart" commands added. Show numbers of individual messages in "show ip bgp neighbor" command. Final pieces of graceful restart. [merge from GNU Zebra]
2005-02-01 * bgpd.[ch], bgp_vty.c, bgp_route.c: "Restart session afterhasso
maximum-prefix limit" feature support. [merge from GNU Zebra]
2005-01-292005-01-29 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* buffer.h: Fix comment on buffer_getstr to reflect that it now uses XMALLOC. * buffer.c: (buffer_getstr) Use XMALLOC(MTYPE_TMP) instead of malloc. * filter.c: (access_list_remark,ipv6_access_list_remark) Use argv_concat instead of buffer_getstr. * if.c: (interface_desc) Use argv_concat instead of buffer_getstr. * plist.c: (ip_prefix_list_description,ipv6_prefix_list_description) Use argv_concat instead of buffer_getstr. * bgp_filter.c: (ip_as_path,no_ip_as_path) Use argv_concat instead of buffer_getstr. * bgp_route.c: (bgp_show_regexp) Fix memory leak: need to free string returned by buffer_getstr. (bgp_show_community) Must use XFREE instead of free on string returned by buffer_getstr. * bgp_routemap.c: (set_community) Must use XFREE instead of free on string returned by buffer_getstr. * bgp_vty.c: (neighbor_description) Use argv_concat instead of buffer_getstr.
2005-01-24 * bgp_route.c: Fix showstopper bug. New route must be selected alsohasso
if old one is flaged as BGP_INFO_ATTR_CHANGED.
2005-01-17 * bgp_route.c: Clear peer's routing table regardless whether it'shasso
configured or not. Being not configured is even better reason to do it.
2004-12-082004-12-08 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* *.c: Change level of debug messages to LOG_DEBUG.
2004-11-052004-11-04 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* vty.h: Remove fields in struct vty that were related to VTY_CONTINUE capabilities (that were used only in bgpd/bgp_route.c and are now removed). Also remove some other fields that were not being used at all. * vty.c: (vty_execute) Do not test for obsolete status values VTY_START and VTY_CONTINUE. (vty_read) Remove calls to vty->output_func since that was part of the VTY_CONTINUE infrastructure that has been removed. (vty_flush) Remove code to support VTY_START and VTY_CONTINUE. (vty_close) Remove code to cancel vty->t_output thread, since that thread was never actually used. * bgp_route.c: Remove all code related to VTY_CONTINUE; this feature is deprecated because the output did not represent a single point in time. All output needs to be generated inline and buffered by the library code. (route_vty_out,route_vty_out_tag,damp_route_vty_out, flap_route_vty_out) Remove code to count number of lines of output, since this was only useful for VTY_CONTINUE behavior. (bgp_show_callback) Removed. (bgp_show_table) Remove hooks for VTY_CONTINUE callback support. As a result, there's a new output_arg argument to this function. Make function static. (bgp_show) Make function static and add a new output_arg argument. Change all functions that call bgp_show or bgp_show_table to pass the new output_arg argument (that used to be passed inside vty->output_arg). * bgp_mplsvpn.c: Remove declarations of functions defined in bgp_route.c; these declarations belong in bgp_route.h. * bgp_route.h: Declare 3 global functions used in both bgp_route.c and in bgp_mplsvpn.c.
2004-10-132004-10-13 Paul Jakma <paul@dishone.st>paul
* (global) more const'ification and fixups of types to clean up code. * bgp_mplsvpn.{c,h}: (str2tag) fix abuse. Still not perfect, should use something like the VTY_GET_INTEGER macro, but without the vty_out bits.. * bgp_routemap.c: (set_aggregator_as) use VTY_GET_INTEGER_RANGE (no_set_aggregator_as) ditto. * bgpd.c: (peer_uptime) fix unlikely bug, where no buffer is returned, add comments about troublesome return value.
2004-09-132004-09-13 Jose Luis Rubio <jrubio@dit.upm.es>paul
(at Technical University of Madrid as part of Euro6ix Project) Enhanced Route Server functionality and Route-Maps: * bgpd/bgpd.h: Modified 'struct peer' and 'struct bgp_filter' to support rs-clients. A 'struct bgp_table *rib' has been added to the first (to mantain a separated RIB for each rs-client) and two new route-maps have been added to the last (for import/export policies). Added the following #defines: RMAP_{IN|OUT|IMPORT|EXPORT|MAX}, PEER_RMAP_TYPE_{IMPORT|EXPORT} and BGP_CLEAR_SOFT_RSCLIENT. * bgpd/bgpd.c: Modified the functions that create/delete/etc peers in order to consider the new fields included in 'struct peer' for supporting rs-clients, i.e. the import/export route-maps and the 'struct bgp_table'. * bgpd/bgp_route.{ch}: Modified several functions related with receiving/sending announces in order to support the new Route Server capabilities. Function 'bgp_process' has been reorganized, creating an auxiliar function for best path selection ('bgp_best_selection'). Modified 'bgp_show' and 'bgp_show_route' for displaying information about any RIB (and not only the main bgp RIB). Added commands for displaying information about RS-clients RIBs: 'show bgp rsclient (A.B.C.D|X:X::X:X)', 'show bgp rsclient (A.B.C.D|X:X::X:X) X:X::X:X/M', etc * bgpd/bgp_table.{ch}: The structure 'struct bgp_table' now has two new fields: type (which can take the values BGP_TABLE_{MAIN|RSCLIENT}) and 'void *owner' which points to 'struct bgp' or 'struct peer' which owns the table. When creating a new bgp_table by default 'type=BGP_TABLE_MAIN' is set. * bgpd/bgp_vty.c: The commands 'neighbor ... route-server-client' and 'no neighbor ... route-server-client' now not only set/unset the flag PEER_FLAG_RSERVER_CLIENT, but they create/destroy the 'struct bgp_table' of the peer. Special actions are taken for peer_groups. Command 'neighbor ... route-map WORD (in|out)' now also supports two new kinds of route-map: 'import' and 'export'. Added commands 'clear bgp * rsclient', etc. These commands allow a new kind of soft_reconfig which affects only the RIB of the specified RS-client. Added commands 'show bgp rsclient summary', etc which display a summary of the rs-clients configured for the corresponding address family. * bgpd/bgp_routemap.c: A new match statement is available, 'match peer (A.B.C.D|X:X::X:X)'. This statement can only be used in import/export route-maps, and it matches when the peer who announces (when used in an import route-map) or is going to receive (when used in an export route-map) the route is the same than the one specified in the statement. For peer-groups the statement matches if the specified peer is member of the peer-group. A special version of the command, 'match peer local', matches with routes originated by the Route Server (defined with 'network ...', redistributed routes and default-originate). * lib/routemap.{ch}: Added a new clause 'call NAME' for use in route-maps. It jumps into the specified route-map and when it returns the first route-map ends if the called RM returns DENY_MATCH, or continues in other case.
2004-07-092004-07-09 Sowmini Varadhan <sowmini.varadhan@sun.com>paul
* bgp_packet.c: (bgp_collision_detect) Send NOTIFY on new socket if that is connection we're closing. (bgp_read) invalid marker check applies to KEEPALIVE too. * bgp_route.c: Ignore multicast NRLI, dont send NOTIFY.
2004-06-042004-06-04 Paul Jakma <paul@dishone.st>paul
* type mismatch fixes
2004-05-20Merge bgpd changeset 1176 from Zebra repository by Rivo Nurges.hasso
2004-05-012004-05-01 rivo nurges <rix@estpak.ee>paul
* bgp_route.c: fix UNH IOL BGP-4.1.12f