summaryrefslogtreecommitdiff
path: root/bgpd
AgeCommit message (Collapse)Author
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] Coverity CID #64: Needless NULL check, CID #64: Deref of potentially ↵Paul Jakma
NULL pointer. 2006-10-15 Paul Jakma <paul.jakma@sun.com> * bgp_packet.c: (bgp_update_packet) adv->rn can not be NULL, check is bogus - changed to assert(), CID#64. binfo is checked for NULL, but then dereferenced unconditionally, fix, CID #63. (bgp_withdraw_packet) Assert adv->rn is valid, as with bgp_update_packet().
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-10-15[bgpd] Bug #302 fixes. ClearingCompleted event gets flushed, leaving peers ↵Paul Jakma
stuck in Clearing. 2006-10-14 Paul Jakma <paul.jakma@sun.com> * bgp_fsm.h: Remove BGP_EVENT_FLUSH_ADD, dangerous and not needed. * bgp_fsm.c: (bgp_stop) Move BGP_EVENT_FLUSH to the top of the of the function, otherwise it could flush a ClearingCompleted event, bug #302. * bgp_packet.c: Replace all BGP_EVENT_FLUSH_ADD with BGP_EVENT_ADD, fixing bug #302.
2006-10-15[daemon startup] Add --dry-run/-C argument to daemons, to check config file ↵Paul Jakma
syntax 2006-10-04 Oliver Hookins <ohookins@gmail.com> * bgpd/bgp_main.c: Add configuration check option, with '-C' rather than '-c' for consistency between daemons. * isisd/isis_main.c: ditto * ospf6d/ospf6_main.c: ditto * ospfd/ospf_main.c: ditto * ripngd/ripng_main.c: ditto * vtysh/vtysh_main.c: ditto * ripd/rip_main.c: Change the config check option to '-C' and tidy up the code. * zebra/main.c: ditto 2006-10-04 Stergiakis Alexandros <astergiakis@antcor.com> * ripd/rip_main.c: This trivial patch introduces a new command-line option '-c', which instructs zebra/ripd to check its configuration file for validity, print any error message, and then exit. This is useful when the configuration file is edited by hand or otherwise, and you simply want to validate it without any other effect. * zebra/main.c: ditto
2006-09-19[bgpd] Trivial fix of printf format/arg mismatchAndrew J. Schorr
2006-09-19 Andrew J. Schorr <ajschorr@alumni.princeton.edu> * bgpd.c: (peer_uptime) Fix printf format/arg mismatch in zlog_warn message (%ld/size_t -> %lu/u_long).
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] simplify peer refcounts, squash slow peer leakPaul Jakma
2006-09-14 Paul Jakma <paul.jakma@sun.com> * (general) fix the peer refcount issue exposed by previous, by just removing refcounting of peer threads, which is mostly senseless as they're references leading from struct peer, which peer_free cancels anyway. No need to muck around.. * bgp_fsm.h: Just remove the refcounting from the various TIMER/READ/WRITE/EVENT ON/OFF/ADD macros. * bgp_fsm.c: (bgp_stop) use BGP_EVENT_FLUSH, no refcounts attached to events anymore. (bgp_event) remove peer_unlock, events not refcounted. * bgpd.c: (peer_free) flush events before free.
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-08-27[bgpd] fix mtype in XFREE and NULL out freed pointerPaul Jakma
2006-08-27 Paul Jakma <paul.jakma@sun.com> * bgp_advertise.c: (bgp_sync_delete) fix mtype in XFREE. NULL out peer->hash after free, to be sure.
2006-08-06[bgpd] aspath_loop_check was broken, fix it and the aspath unit test code.Paul Jakma
2006-08-06 Paul Jakma <paul.jakma@sun.com> * bgp_aspath.c: (aspath_loop_check) Fix the typo-bug which essentially had disabled this check. Problem reported by Bartek Kania <mrbk@gnarf.org> in [quagga-users 7388]. * aspath_test.c: (validate) Fix the sense of the aspath_loop_check, which was the wrong way around and had actually been testing for aspath_loop_check to be buggy.
2006-07-27[bgpd] Potential bug#287 fix, peer_delete should NULL out freed buffersPaul Jakma
2006-07-27 Paul Jakma <paul.jakma@sun.com> * bgpd.c: (peer_delete) Ensure freed buffers can not be accidently reused. A potential fix for bug #287.
2006-07-02[bgpd] Fix crash on shutdown of peerPaul Jakma
2006-07-02 Paul Jakma <paul.jakma@sun.com> * bgp_fsm.c: (bgp_{stop,start}) Move clear/free of certain bits of state from stop to start, as they may be used via peer references on clearing queues..
2006-05-23[bgpd] expand vty help for neighbor ... update-sourcePaul Jakma
2006-05-23 Paul Jakma <paul.jakma@sun.com> * bgp_vty.c: (neighbor_update_source_cmd) Expand tab completion to make it clear it takes both address and ifname.
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-12[bgpd] Remove dead code in ORIGINATOR_ID packet forming codePaul Jakma
2006-05-12 Paul Jakma <paul.jakma@sun.com> * bgp_attr.c: (bgp_packet_attribute) Remove dead code, Coverity CID #1
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-08[bgpd] CID#62 fix double-free, use-after-free in community_str2comPaul Jakma
2006-05-08 Paul Jakma <paul.jakma@sun.com> * bgp_community.c: (community_str2com) Coverity CID#62, fix double-free, use-after-free.
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-05-04[bgpd] bug #210: Enable crucial VPNv4 code which was disabledPaul Jakma
2006-05-04 Paul Jakma <paul.jakma@sun.com> * (general) VPNv4 fixes. Certain VPNv4 code was not enabled. See bug #210. * bgp_attr.{c,h}: (bgp_packet_{withdraw,attribute}) Tag should be u_char really. * bgp_packet.c: (bgp_{update,withdraw}_packet) Enable some VPNv4 code which inexplicably was ifdef'd out. comments from a tester on IRC suggest this fixes bug #210.
2006-03-30[bgpd] Fix infinite loop in community_str2comPaul Jakma
2006-03-30 Paul Jakma <paul.jakma@sun.com> * bgp_community.c: (community_gettoken) Unknown token should return NULL, to give a strong indication to callers that the token no longer can be parsed, otherwise callers looping on this function may have a hard time ending their loop. (community_str2com) While loop around community_gettoken appears to have been coded thinking that break statement would break from the while{}, hence it could never exit for unknown token case. Fix it to do..while, so it can use the NULL result from community_gettoken easily.
2006-03-30[bgpd] release peer specific clear queue in peer_freePaul Jakma
2006-03-22 Paul Jakma <paul.jakma@sun.com> * bgpd.c: (peer_free) release the per-peer workqueue when freeing the peer.
2006-03-30[bgpd] trivial: use a distinct memtype for struct bgp_synchronizePaul Jakma
2006-03-19 Paul Jakma <paul.jakma@sun.com> * memtypes.c: Add MTYPE_BGP_SYNCHRONISE. * bgp_advertise.c: Use a distinct memory type for struct bgp_synchronize.
2006-03-30[bgpd] Add 'show bgp memory' for stats on fixed-size allocations in bgpdPaul Jakma
2006-03-19 Paul Jakma <paul.jakma@sun.com> * bgpd/bgp_vty.c: Add includes to get several structs we want to provide usage statistics on. (show_bgp_memory_cmd) Show memory usage stats for various notable fixed size objects. Using mtype_stats_alloc and mtype_memstr recently added to memory.c. (bgp_show_summary) Report some additional stats specific to the given BGP instance and/or AFI/SAFI such as table counts, peers, rsclients and peer-groups. (bgp_vty_init) Install show_bgp_memory_cmd.
2006-03-30[bgpd] Include header dependency in bgp_nexthop.hPaul Jakma
2006-03-19 Paul Jakma <paul.jakma@sun.com> * bgp_nexthop.h: Include if.h as a dependent header, for struct connected.
2006-03-30[bgpd] rearrange some structs for less padding, stats for table/attrs.Paul Jakma
2006-03-12 Paul Jakma <paul.jakma@sun.com> * bgp_attr.h: (struct attr) rearrange fields to avoid wasted padding between them as much as possible. (attr_count,attr_unknown_count) export new functions to return number of counts of cached attributes. * bgp_attr.c: (attr_count,attr_unknown_count) new functions to return number of counts of cached attributes. * bgp_route.h: (struct bgp_info) rearrange fields to avoid wasted padding. * bgp_table.h: (struct bgp_table) Add a count field, of number of nodes in the table. (struct bgp_node) rearrange fields to avoid wasted padding between them, though I don't think there was any in this case. * bgp_table.c: (bgp_node_{delete,get}) Maintain the table node count. (bgp_table_count) new function to access the table count.
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] Add Clrng description to bgp summary state.Paul Jakma
2006-02-21 Paul Jakma <paul.jakma@sun.com> * bgp_vty.c: (bgp_show_summary) Add a 'Clrng' sub-description to state of peer while it's suppressed due to clearing.
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-18[bug #89] Fix leak of community when set community is usedPaul Jakma
2006-02-18 Paul Jakma <paul.jakma@sun.com> * bgp_routemap.c: (route_set_community) Quick, very hacky, fix for the set-community leak, bug #89. True fix will be to detangle the web of *_intern caching and provide saner object caching for Quagga, future work.
2006-02-05[bgpd] trivial fix for gcc warningpaul
2006-02-05 Paul Jakma <paul.jakma@sun.com> * bgp_aspath.c: (aspath_gettoken) fix gcc warning about possible uninitialised usage.
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.
2006-01-17[zserv] fix up custom isisd and bgpd Zserv functions for new format.paul
2006-01-17 Paul Jakma <paul.jakma@sun.com> * bgp_nexthop.c: (zlookup_read*) convert to new Zserv format. (zlookup_query_ipv6) ditto. (bgp_import_check) ditto. * isis_zebra.c: (isis_zebra_route_add_ipv4) fix for new zserv format.
2006-01-16[bgpd] add aspath_finish, static resource cleanup function.paul
2006-01-16 Paul Jakma <paul.jakma@sun.com> * bgp_aspath.c: (aspath_snmp_pathseg) move the static stream pointer out to file scope, so it can be freed. (aspath_finish) new function, free aspath resources. * bgp_aspath.h: (aspath_finish) export.
2006-01-16[bgpd] fix some leaks introduced in aspath rewrite.paul
2006-01-16 Paul Jakma <paul.jakma@sun.com> * bgp_aspath.c: (assegment_append_asns) XREALLOC can return NULL theoretically, take care not to lose the allocated data. (aspath_hash_alloc) aspath_dup already set the aspath string - fix leak. (aspath_parse) aspath_hash_alloc dupes the entire aspath, including segments, but we forgot to free the temporary assegment.
2006-01-10[bgpd] remove export of long defunct functionpaul
2006-01-10 Juris Kalnins <juris@mt.lv> * bgpd.h: (bgp_router_id_unset) ex-function, remove.
2005-11-23[bgp] Fix SEGV if empty path is confed-compared ([quagga-users 5968])paul
2005-11-23 Paul Jakma <paul.jakma@sun.com> * bgp_aspath.c: (assegments_parse) should be static 2005-11-23 Juergen Kammer <j.kammer@eurodata.de> * bgp_aspath.c: (aspath_cmp_left_confed) fix SEGV for case where one or both paths are empty.
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-11-032005-11-03 Paul Jakma <paul.jakma@sun.com>paul
* bgp_damp.c: (bgp_reuse_timer) struct bgp can be retrieved via the struct bgp_damp_info, no need to guess by using bgp_get_default().