| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes a reported assert() in 'no neighbor xxx'.
It also fixes other issues found when reviewing and testing that.
Also fixed is a reported segfault caused by prefix lists without explicit
sequence numbers.
Peer State
==========
Tightened up the peer state handling, including:
* shades of pIdle -- depending on some peer flags and the session, if any
* state transitions -- particularly pEstablished -> pIdle or pClearing
* handling if deleting peer and associated session
* handling of PEER_DOWN_XXX -- why peer was last downed
* handling of last NOTIFICATION sent/received
RS Client RIBs
==============
Cleared up places where RS Client RIBs were not disposed of properly when a
peer's afi/safi state changed, in particular:
-- when deactivating an afi/safi
-- when unsetting the rs client state for an afi/safi
-- when binding a peer to a group for an afi/safi
In the past these issues were probably invisible, except for a slight leak of
memory. With the newer code these issues triggered some asserts when closing
down a peer or the entire program.
Program Termination
===================
Now terminates by deleting all peers -- essentially 'no neighbor' for all
peers. Each time a peer is set to be deleted bm->peer_linger_count is
incremented, when the peer finally is deleted, the count is decremented.
So while in program_terminating state, all nexuses continue to run until
the Routing Engine spots that there are no peers left to delete. Then all
nexuses are shut down and the program finally terminates. To do this, when
termination starts a new Routing Engine foreground task is added, which
calls program_terminate_if_all_peers_deleted().
Accept() Status for Session
===========================
The accept() code needs to find the session associated with the incoming IP
address. Then it needs to see if can accept the incoming connection.
It looks up the IP address in the Peer Index (under its Mutex).
Previously: the Peer Index entry contained a pointer to the accepting
connection (if any), and the session had a pointer to the Peer Index entry
so that it could set/clear the accept field in that entry.
Now: have removed the accept field in the Peer Index entry, and the pointer
from the session to that entry.
There is now an "accept" flag in the session structure -- so setting/clearing
accept does not have to fiddle with any state to do with the peer. Which
seems cleaner.
To find the session, the accept() code goes via the Peer Index and then via
the peer to find the session. This is done under the Peer Index Mutex. To
support that, the Routing Engine only changes the peer->session pointer under
the same Mutex.
General Changes
===============
1. name changes: peer_lock -> bgp_peer_lock etc.
2. bgp_notify_send -> bgp_peer_down_error
bgp_notify_send_with_data -> bgp_peer_down_error_with_data
3. name changes: bgp_peer_sIdle -> bgp_peer_pIdle etc.
4. changing int to bool
5. added "received" flag to bgp_notify structure
Files Affected
==============
configure.ac -- set version to 0.99.15ex02
bgpd/bgp.h -- format changes only
bgpd/bgp_advertise.c -- (1)
bgpd/bgp_attr.c -- (2)
bgpd/bgp_common.h -- (3)
bgpd/bgp_connection.c -- (4) for session->active
- adding session->accept flag
- removing peer index accept entry
- adding bgp_connection_query_accept()
bgpd/bgp_connection.h -- adding bgp_connection_query_accept()
bgpd/bgp_debug.c -- (3) (5)
- changed bgp_notify_print() to remove "sending"
parameter and use (5)
bgpd/bgp_debug.h -- changed bgp_notify_print()
bgpd/bgp_fsm.c -- added TODO for NSF and for
CollisionDetectEstablishedState
bgpd/bgp_main.c -- (4) for various flags
- added static bool program_terminating
- used "mqb_priority" name instead of "1"
- ignore SIGHUP and SIGTERM messages once is
"program_terminating"
- added program_terminate_if_all_peers_deleted()
- in SIGTERM: set program_terminating and add
the foreground hook.
bgpd/bgp_mplsvpn.c -- (3)
bgpd/bgp_msg_read.c -- (5) set the "received" flag on incoming
notifications
- update call of bgp_notify_print()
bgpd/bgp_msg_write.c -- update call of bgp_notify_print()
bgpd/bgp_network.c -- (4)
bgpd/bgp_nexthop.c -- (3)
bgpd/bgp_notification.c -- add "received" flag to notification structure,
which is false by default.
bgpd/bgp_notification.h -- add "received" flag to notification structure
- add bgp_notify_set_received()
- add bgp_notify_get_received()
bgpd/bgp_open.c -- (2)
bgpd/bgp_open_state.c -- in bgp_peer_open_state_receive():
- copy the session->hold_timer_interval
and session->keepalive_timer_interval
values (as negotiated by the BGP Engine)
into the peer
- set PEER_CAP_RESTART_RCV if have
- fix typo, use: open_recv->can_preserve
not: open_recv->can_g_restart
bgpd/bgp_packet.c -- delete bgp_notify_send() and
bgp_notify_send_with_data()
- (1) (2) (3)
- bgp_clear_route_normal() -> bgp_clear_routes()
and now returns "completed" state.
bgpd/bgp_packet.h -- delete: bgp_keepalive_send()
bgp_open_send()
bgp_notify_send()
bgp_notify_send_with_data()
bgpd/bgp_peer.c -- changed:
bgp_session_has_established()
bgp_session session()
bgp_session_has_disabled()
to void and to take session, not peer.
- removed lock of session structure in
bgp_session_do_event() -- was holding the lock
for far longer than necessary, particularly
when clearing routes !
- in bgp_session_has_established():
- lock session structure where and only where
required
- tidied up timer handling
- in bgp_session_has_stopped():
- extend IdleHoldTime
- examine notification etc to see why session
came down.
- invoke bgp_peer_down_notify(), which will
start the process of downing the peer.
- in bgp_session_has_disabled():
- removed defer_enable
- removed calls to bgp_peer_stop() etc. That
is done in bgp_peer_down() et all.
- now if session is marked delete_me, then do
that; otherwise, can enable again.
- removed program_terminate_if_all_disabled(),
replaced by new mechanism
- in bgp_peer_stop():
- changed to void function and added nsf
parameter.
- sets pClearing state.
- MUST now only be called when pEstablished.
- removed some code to bgp_peer_reset_idle().
So... bgp_peer_stop() brings pEstablished
peer to halt, while bgp_peer_reset_idle()
prepares it for new session.
- now passes nsf to bgp_clear_all_routes(),
which returns flag to say whether task is
complete or whether it continues in
background.
- clearing of NSF_MODE and flags moved to
bgp_peer_reset_idle().
- sets pIdle state if route clearing completed
- renamed peer_nsf_stop() -> bgp_peer_nsf_stop()
- if is pIdle or pClearing and have NSF
routes, then stops timers and clears out
all the NSF routes.
- added bgp_peer_clear_all_stale_routes()
- added bgp_peer_shutdown() -- used when peer
is downed for PEER_DOWN_USER_SHUTDOWN !
- added bgp_peer_reset_idle() -- used when peer
goes pIdle or is about to enable session.
- deleted bgp_peer_timers_stop() -- see
bgp_peer_change_status().
- replaced bgp_peer_clearing_completed()
- if pClearing, sets pIdle and enables if can
- if pDeleting, unlocks peer
- replaced bgp_timer_set() by
bgp_peer_timers_set() -- deals in new peer
states only.
- renamed peer_new() -> bgp_peer_new()
- renamed peer_create() -> bgp_peer_create()
- added setting of PEER_STATUS_REAL_PEER
- changed auto activation to reflect what
actually happens.
- changed bgp_session_init_new() call because
it now sets peer->session.
- sets timers suitable for pIdle. before any
auto enable.
- renamed peer_delete() -> bgp_peer_delete()
- removed call of peer_nsf_stop()
- added bgp_peer_down() with
PEER_DOWN_NEIGHBOR_DELETE -- which does all
the work of flattening an active peer, and
returns it pIdle or pClearing.
- if pClearing, lock the peer so that when
clearing completes, it can unlock it.
- sets pDeleting state, and increments
bm->peer_linger_count.
- tightened procedure for dealing with various
references to peer -- including use of the
PEER_STATUS_REAL_PEER flag.
- tidied up dealing with rsclient RIBs and
shared pointers to group versions of same.
- removed call of bgp_timer_set(), now done
in bgp_peer_change_status().
- now unregisters the peer immediately, so
can register a new one before this one
is completely deleted.
- deletes session if it can.
- moved peer_lock() & peer_unlock() from bgpd.c
and renamed bgp_peer_lock() & bgp_peer_unlock()
- renamed peer_free() bgp_peer_free() and made
static.
- peer must be pDeleting -- so have been
through bgp_peer_delete()
- peer->session must be NULL
- decrements bm->peer_linger_count
- deleted peer->clear_node_queue handling
- deleted bgp_session_free() -- that's done
in bgp_peer_delete() or elsewhere.
- unlocked bgp at end
- assert peer->session == NULL, to be sure
- set peer->lock == -54321
- in bgp_peer_enable():
- recast as switch() on peer state
- added bgp_peer_reset)idle() before enabling
the session.
- renamed bgp_peer_disable() -> bgp_peer_down()
- takes PEER_DOWN_XXX argument, which drives
what notification is sent, and sets the
peer->last_reset status. A small number of
PEER_DOWN_XXX are special.
- removed the IdleHoldTimer stuff.
- copies outbound notification to session.
- for PEER_DOWN_NSF_CLOSE_SESSION, keep non-
stale routes.
- for PEER_DOWN_USER_SHUTDOWN, do
bgp_peer_shutdown()
- after disabling any session and doing any
shutdown, proceed as per peer->status:
pIdle -- flush stale routes
bgp_peer_enable()
pEstablished -- bgp_peer_stop()
pClearing -- flush stale routes
- added bgp_peer_down_notify().
- added bgp_peer_down_error(), which replaces
bgp_notify_send().
- added bgp_peer_down_error_with_data(), which
replaces bgp_notify_send_with_data()
The "down_error" functions calculate the
appropriate PEER_DOWN_XXX value, and call
bgp_peer_down_notify().
- added bgp_peer_map_peer_down(), to map
PEER_DOWN_XXX to a notification message.
- added bgp_peer_map_notification, to map
notification message to a PEER_DOWN_XXX.
- renamed peer_change_status() ->
bgp_peer_change_status()
- do most things only if state changes.
- add call to bgp_peer_reset_idle() as enter
pIdle state.
- at all times do bgp_peer_timer_set()
- renamed peer_timers_set() ->
bgp_peer_timers_set()
- commoned up code for Graceful Restart and
Graceful Restart Stale timers and stale routes.
- changed Graceful Restart Stale time to cope if
it should expire before Graceful Restart !
bgpd/bgp_peer.h -- added PEER_DOWN_XXX values and tidied up
+ PEER_DOWN_NULL
+ PEER_DOWN_UNSPECIFIED
+ PEER_DOWN_CONFIG_CHANGE
+ PEER_DOWN_AF_DEACTIVATE
+ PEER_DOWN_PASSWORD_CHANGE
+ PEER_DOWN_ALLOWAS_IN_CHANGE
+ PEER_DOWN_INTERFACE_DOWN
+ PEER_DOWN_MAX_PREFIX
+ PEER_DOWN_HEADER_ERROR
+ PEER_DOWN_OPEN_ERROR
+ PEER_DOWN_UPDATE_ERROR
+ PEER_DOWN_HOLD_TIMER
+ PEER_DOWN_FSM_ERROR
+ PEER_DOWN_DYN_CAP_ERROR
- PEER_DOWN_NOTIFY_SEND (deleted)
- added typedef peer_down_t
- struct peer:
- deleted redundant clear_node_queue
- removed PEER_STATUS_ACCEPT_PEER flag
- added PEER_STATUS_REAL_PEER flag
- (3)
- deleted bgp_peer_reenable() -- redundant
- deleted bgp_peer_stop() -- now static
- replaced bgp_peer_disable() by bgp_peer_down()
- added bgp_peer_down_error()
- added bgp_peer_down_error_with_data()
- deleted peer_change_status() -- now static
- renamed peer_new() -> bgp_peer_new()
- renamed peer_create() -> bgp_peer_create()
- renamed peer_delete() -> bgp_peer_delete()
- added bgp_peer_lock()
- added bgp_peer_unlock()
- deleted peer_free()
- deleted peer_nsf_stop()
bgpd/bgp_peer_index.c -- removed accept entry from bgp_peer_index_entry
structure
- added explicit next_free entry to the structure
- sets next_free to point at self in entries
which are in use -- and checks this.
- change bgp_peer_index_seek_accept() to link to
session via the peer data structure, and to
call bgp_connection_query_accept() under the
Peer Index Mutex.
- (4) for bgp_peer_index_seek_accept()
bgpd/bgp_peer_index.h -- removed accept entry from bgp_peer_index_entry
structure
- added explicit next_free entry to the structure
- (4) for bgp_peer_index_seek_accept()
bgpd/bgp_route.c -- (1) (2) (3)
- in bgp_process_rsclient(), bgp_process_main(),
and bgp_processq_del():
- extra dasserts()
- clear rn->wq_next
- unlock table *after* unlock node (bug fix)
- in bgp_process(), lock bgp before table.
- in bgp_maximum_prefix_restart_timer(), replace
call of peer_clear() by unset of flag and
bgp_peer_enable() -- peer is already down.
- added bgp_maximum_prefix_cancel_timer()
- deleted bgp_clear_this_route() -- code now
inline in only caller.
- renamed bgp_clear_route_normal() ->
bgp_clear_routes()
- takes an "nsf" argument to invoke NSF
"clearing", iff nsf set for afi/safi. Sets
PEER_STATUS_NSF_WAIT if so.
- returns bool "completed" if clearing has
completed immediately -- ie no background
work left to be done.
- renamed bgp_clear_route_all() ->
bgp_clear_all_routes()
- takes "nsf" argument and returns "completed"
as for bgp_clear_routes().
- removed call: bgp_peer_clearing_completed()
- renamed bgp_clear_route_rsclient() ->
bgp_clear_rsclient_rib()
- deleted bgp_cleanup_routes() -- was used
during termination, no longer required because
termination deletes all peers.
bgpd/bgp_route.h -- deleted bgp_cleanup_routes() -- program
termination now deletes all peers, which
implicitly cleans up all routes.
- renamed: bgp_clear_route_normal() ->
bgp_clear_routes()
- renamed: bgp_clear_route_rsclient() ->
bgp_clear_rsclient_rib()
- renamed: bgp_clear_route_all() ->
bgp_clear_all_routes()
- added: bgp_maximum_prefix_cancel_timer()
bgpd/bgp_session.c -- (3)
- deleted bgp_session_defer_if_limping()
- in bgp_session_init_new()
- changed to void and removed session argument
-- always creates a new session
- peer MUST not have a session
- removed Peer Index pointer stuff as Peer
Index no longer has accept field
- sets session->peer and locks peer
- sets peer->session under Peer Index Mutex
- sets session->delete_me false
- sets session->accept flag false
- replaced bgp_session_free() by
bgp_session_delete()
- changed to void function
- if session is active, set the delete_me flag
so session will be deleted when goes
sDisabled.
- make sure that session Mutex has been
released by the BGP Engine before destroying
it... otherwise: tears.
- unhook session from peer under Peer Index
mutex -- for accept() stuff.
- unhook peer from session.
- unlock peer.
- in bgp_session_enable()
- assert that peer is pIdle.
- clear delete_me for completeness
- clear additional fields
- in bgp_session_disable()
- clear session->accept
- in bgp_session_is_active()
- no longer interested in Peer Index stuff
- deleted bgp_session_defer_if_limping()
bgpd/bgp_session.h -- in bgp_session structure:
- removed index_entry pointer to Peer Index
- added delete_me flag
- removed defer_enable flag
- added accept flag
- removed session parameter from
bgp_session_init_new()
- deleted bgp_session_free()
- added bgp_session_delete()
- bgp_session_is_active() now returns bool
bgpd/bgp_table.c -- bgp_node_free() sets lock count = -54321
- in bgp_table_free():
- assert that route node is empty
- set lock count = -54321
- bgp_node_delete() asserts that is not on_wq
- (1)
bgpd/bgp_vty.c -- (1) (3) (4)
- change peer_af_flag_modify_vty() to call
peer_af_flag_modify() not set or unset.
- change name: bgp_clear_route_rsclient() ->
bgp_clear_rsclient_rib()
- in peer_rsclient_set_vty():
- add peer to bgp->rsclient list after all
validation is complete
- in peer_rsclient_unset_vty():
- removed code for deleting the rsclient RIB
etc to peer_rsclient_unset().
- added peer_rsclient_unset()
bgpd/bgp_zebra.c -- bgp_peer_disable() -> bgp_peer_down() and now
takes PEER_DOWN_INTERFACE_DOWN argument.
bgpd/bgpd.c -- (1) (3)
- replaced setting peer->last_reset and call of
bgp_notify_send() by call of the new
bgp_peer_down().
- bgp_router_id_set()
... PEER_DOWN_RID_CHANGE
- bgp_cluster_id_set()
... PEER_DOWN_CLID_CHANGE
- bgp_cluster_id_unset()
... PEER_DOWN_CLID_CHANGE
- bgp_confederation_id_set()
... PEER_DOWN_CONFED_ID_CHANGE
... PEER_DOWN_CONFED_ID_CHANGE
- bgp_confederation_id_unset()
... PEER_DOWN_CONFED_ID_CHANGE
- bgp_confederation_peers_add()
... PEER_DOWN_CONFED_PEER_CHANGE
- bgp_confederation_peers_remove()
... PEER_DOWN_CONFED_PEER_CHANGE
- peer_as_change()
... PEER_DOWN_REMOTE_AS_CHANGE
- peer_activate()
... PEER_DOWN_AF_ACTIVATE
- peer_deactivate()
... PEER_DOWN_AF_DEACTIVATE
- peer_group_bind()
... PEER_DOWN_RMAP_BIND
- peer_group_unbind()
... PEER_DOWN_RMAP_UNBIND
- peer_change_action()
... why_changed
... why_changed
- peer_flag_modify_action()
... action->peer_down
- peer_update_source_if_set()
... PEER_DOWN_UPDATE_SOURCE_CHANGE
... PEER_DOWN_UPDATE_SOURCE_CHANGE
- peer_update_source_addr_set()
... PEER_DOWN_UPDATE_SOURCE_CHANGE
... PEER_DOWN_UPDATE_SOURCE_CHANGE
- peer_update_source_unset()
... PEER_DOWN_UPDATE_SOURCE_CHANGE
... PEER_DOWN_UPDATE_SOURCE_CHANGE
- peer_local_as_set()
... PEER_DOWN_LOCAL_AS_CHANGE
... PEER_DOWN_LOCAL_AS_CHANGE
- peer_local_as_unset()
... PEER_DOWN_LOCAL_AS_CHANGE
... PEER_DOWN_LOCAL_AS_CHANGE
- peer_password_set()
... PEER_DOWN_PASSWORD_CHANGE
... PEER_DOWN_PASSWORD_CHANGE
- peer_password_unset()
... PEER_DOWN_PASSWORD_CHANGE
... PEER_DOWN_PASSWORD_CHANGE
- peer_clear()
... PEER_DOWN_USER_RESET
- bgp_terminate()
... PEER_DOWN_USER_RESET
- deleted peer_lock() & peer_unlock(). See
bgp_peer_lock() & bgp_peer_unlock() in bgp_peer
- in peer_as_change(), move downing of peer to
after all config changes have been made.
- in peer_remote_as() implicitly activate iff
!BGP_FLAG_NO_DEFAULT and is IPv4/Unicast.
(but only ever called with IPv4/Unicast or
nothing at all.)
- in peer_deactivate()
- if cannot dynamically reconfigure, then will
down the peer PEER_DOWN_AF_DEACTIVATE.
- uses new peer_rsclient_unset() to tidy away
any rsclient RIB etc.
- in peer_change_action():
- added 'why_down' argument
- replace if's by switch()
- in struct peer_flag_action, updated entry types
- in peer_flag_action_list[], added the
appropriate PEER_DOWN_XXX values.
- in peer_af_flag_action_list[]
- added the appropriate PEER_DOWN_XXX values
- added multiple flag entries
- in peer_flag_action_set():
- changed to return const address of
peer_flag_action structure -- or NULL.
- table may now contain entries which the
given flag must be a subset of.
- in peer_flag_modify_action():
- now takes peer_flag_action* and whether flag
has been set or not.
- allow *only* peer_change_none or
peer_change_reset
- deal with clearing PEER_FLAG_SHUTDOWN,
otherwise bgp_peer_down().
- in peer_group_bind():
- uses new peer_rsclient_unset() to tidy away
any rsclient RIB etc.
- in peer_flag_modify():
- takes bool set flag
- changed to suit peer_flag_action_set() and
peer_flag_modify_action()
- in peer_flag_set() and peer_flag_unset()
changed to bool flag
- added peer_af_flag_modify_action(), common
code for use in peer_af_flag_modify().
- in peer_af_flag_modify():
- takes bool set flag
- changed to suit peer_flag_action_set() and
peer_flag_modify_action()
- use peer_af_flag_modify_action()
- in peer_af_flag_set() and peer_af_flag_unset()
changed to bool flag
- in peer_clear(): adjust for new bgp_peer_down()
mechanics.
- in bgp_master_init(): account for
peer_linger_count (starting at 0)
- in bgp_terminate():
- removed program_terminating -- see flag now
in bgp_main.c
- implement "retain_mode" by using
BGP_OPT_NO_FIB flag to turn off changing
the FIB as routes are deleted.
- either bgp_peer_delete() if terminating
or bgp_peer_down() all peers.
- flush process queues.
- deleted program_terminate_if_all_disabled()
- in peer_lookup(), removed handling of
PEER_STATUS_ACCEPT_PEER().
- deleted peer_lookup_with_open().
- in bgp_config_write_family(), removed handling
of PEER_STATUS_ACCEPT_PEER().
- in bgp_config_write(), removed handling
of PEER_STATUS_ACCEPT_PEER().
bgpd/bgpd.h -- add peer_linger_count entry to the
bgp_master structure.
- remove: peer_lock(), peer_unlock() and
peer_delete()
- (4) for peer_af_flag_modify()
- added peer_rsclient_unset()
lib/plist.c -- fixed handling of prefix lists with no
explicit sequence numbers.
lib/qpnexus.c -- (4) for main_thread & terminate flags
- change qpn_terminate() so does nothing if
terminate flag is already set.
lib/qpnexus.h -- (4) for main_thread & terminate flags
tests/bgp_capability_test.c -- (3)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make one version of check prefix bit, and put it inline
with proper prototype. This gets rid of some macro's and also some
assert() that can never happen on a non-broken compiler.
* bgpd/bgp_table.c
* CHECK_BIT(): sayonara
* check_bit(): sayonara
* SET_LINK(): sayonara
* set_link(): make use of prefix_bit() instead of check_bit()
* bgp_node_match(): idem
* bgp_node_lookup(): idem
* bgp_node_get(): idem
* lib/prefix.h
* prefix_bit(): new inline version of check_bit()
* lib/table.c
* CHECK_BIT(): sayonara
* check_bit(): sayonara
* SET_LINK(): sayonara
* set_link(): make use of prefix_bit() instead of check_bit()
* route_node_match(): idem
* route_node_lookup(): idem
* route_node_get(): idem
* ospf6d/ospf6_lsdb.c
* CHECK_BIT(): sayonara
* ospf6_lsdb_lookup_next(): make use of prefix_bit() instead of
CHECK_BIT()
* ospf6_lsdb_type_router_head(): idem
* ospf6_lsdb_type_head(): idem
* ospf6d/ospf6_route.c
* CHECK_BIT(): sayonara
* ospf6_route_match_head() make use of prefix_bit() instead of
* CHECK_BIT()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I've spent the last several weeks working on stability fixes to bgpd.
These patches fix all of the numerous crashes, assertion failures, memory
leaks and memory stomping I could find. Valgrind was used extensively.
Added new function bgp_exit() to help catch problems. If "debug bgp" is
configured and bgpd exits with status of 0, statistics on remaining
lib/memory.c allocations are printed to stderr. It is my hope that other
developers will use this to stay on top of memory issues.
Example questionable exit:
bgpd: memstats: Current memory utilization in module LIB:
bgpd: memstats: Link List : 6
bgpd: memstats: Link Node : 5
bgpd: memstats: Hash : 8
bgpd: memstats: Hash Bucket : 2
bgpd: memstats: Hash Index : 8
bgpd: memstats: Work queue : 3
bgpd: memstats: Work queue item : 2
bgpd: memstats: Work queue name string : 3
bgpd: memstats: Current memory utilization in module BGP:
bgpd: memstats: BGP instance : 1
bgpd: memstats: BGP peer : 1
bgpd: memstats: BGP peer hostname : 1
bgpd: memstats: BGP attribute : 1
bgpd: memstats: BGP extra attributes : 1
bgpd: memstats: BGP aspath : 1
bgpd: memstats: BGP aspath str : 1
bgpd: memstats: BGP table : 24
bgpd: memstats: BGP node : 1
bgpd: memstats: BGP route : 1
bgpd: memstats: BGP synchronise : 8
bgpd: memstats: BGP Process queue : 1
bgpd: memstats: BGP node clear queue : 1
bgpd: memstats: NOTE: If configuration exists, utilization may be expected.
Example clean exit:
bgpd: memstats: No remaining tracked memory utilization.
This patch fixes bug #397: "Invalid free in bgp_announce_check()".
This patch fixes bug #492: "SIGBUS in bgpd/bgp_route.c:
bgp_clear_route_node()".
My apologies for not separating out these changes into individual patches.
The complexity of doing so boggled what is left of my brain. I hope this
is all still useful to the community.
This code has been production tested, in non-route-server-client mode, on
a linux 32-bit box and a 64-bit box.
Release/reset functions, used by bgp_exit(), added to:
bgpd/bgp_attr.c,h
bgpd/bgp_community.c,h
bgpd/bgp_dump.c,h
bgpd/bgp_ecommunity.c,h
bgpd/bgp_filter.c,h
bgpd/bgp_nexthop.c,h
bgpd/bgp_route.c,h
lib/routemap.c,h
File by file analysis:
* bgpd/bgp_aspath.c: Prevent re-use of ashash after it is released.
* bgpd/bgp_attr.c: #if removed uncalled cluster_dup().
* bgpd/bgp_clist.c,h: Allow community_list_terminate() to be called from
bgp_exit().
* bgpd/bgp_filter.c: Fix aslist->name use without allocation check, and
also fix memory leak.
* bgpd/bgp_main.c: Created bgp_exit() exit routine. This function frees
allocations made as part of bgpd initialization and, to some extent,
configuration. If "debug bgp" is configured, memory stats are printed
as described above.
* bgpd/bgp_nexthop.c: zclient_new() already allocates stream for
ibuf/obuf, so bgp_scan_init() shouldn't do it too. Also, made it so
zlookup is global so bgp_exit() can use it.
* bgpd/bgp_packet.c: bgp_capability_msg_parse() call to bgp_clear_route()
adjusted to use new BGP_CLEAR_ROUTE_NORMAL flag.
* bgpd/bgp_route.h: Correct reference counter "lock" to be signed.
bgp_clear_route() now accepts a bgp_clear_route_type of either
BGP_CLEAR_ROUTE_NORMAL or BGP_CLEAR_ROUTE_MY_RSCLIENT.
* bgpd/bgp_route.c:
- bgp_process_rsclient(): attr was being zero'ed and then
bgp_attr_extra_free() was being called with it, even though it was
never filled with valid data.
- bgp_process_rsclient(): Make sure rsclient->group is not NULL before
use.
- bgp_processq_del(): Add call to bgp_table_unlock().
- bgp_process(): Add call to bgp_table_lock().
- bgp_update_rsclient(): memset clearing of new_attr not needed since
declarationw with "= { 0 }" does it. memset was already commented
out.
- bgp_update_rsclient(): Fix screwed up misleading indentation.
- bgp_withdraw_rsclient(): Fix screwed up misleading indentation.
- bgp_clear_route_node(): Support BGP_CLEAR_ROUTE_MY_RSCLIENT.
- bgp_clear_node_queue_del(): Add call to bgp_table_unlock() and also
free struct bgp_clear_node_queue used for work item.
- bgp_clear_node_complete(): Do peer_unlock() after BGP_EVENT_ADD() in
case peer is released by peer_unlock() call.
- bgp_clear_route_table(): Support BGP_CLEAR_ROUTE_MY_RSCLIENT. Use
struct bgp_clear_node_queue to supply data to worker. Add call to
bgp_table_lock().
- bgp_clear_route(): Add support for BGP_CLEAR_ROUTE_NORMAL or
BGP_CLEAR_ROUTE_MY_RSCLIENT.
- bgp_clear_route_all(): Use BGP_CLEAR_ROUTE_NORMAL.
Bug 397 fixes:
- bgp_default_originate()
- bgp_announce_table()
* bgpd/bgp_table.h:
- struct bgp_table: Added reference count. Changed type of owner to be
"struct peer *" rather than "void *".
- struct bgp_node: Correct reference counter "lock" to be signed.
* bgpd/bgp_table.c:
- Added bgp_table reference counting.
- bgp_table_free(): Fixed cleanup code. Call peer_unlock() on owner if
set.
- bgp_unlock_node(): Added assertion.
- bgp_node_get(): Added call to bgp_lock_node() to code path that it was
missing from.
* bgpd/bgp_vty.c:
- peer_rsclient_set_vty(): Call peer_lock() as part of peer assignment
to owner. Handle failure gracefully.
- peer_rsclient_unset_vty(): Add call to bgp_clear_route() with
BGP_CLEAR_ROUTE_MY_RSCLIENT purpose.
* bgpd/bgp_zebra.c: Made it so zclient is global so bgp_exit() can use it.
* bgpd/bgpd.c:
- peer_lock(): Allow to be called when status is "Deleted".
- peer_deactivate(): Supply BGP_CLEAR_ROUTE_NORMAL purpose to
bgp_clear_route() call.
- peer_delete(): Common variable listnode pn. Fix bug in which rsclient
was only dealt with if not part of a peer group. Call
bgp_clear_route() for rsclient, if appropriate, and do so with
BGP_CLEAR_ROUTE_MY_RSCLIENT purpose.
- peer_group_get(): Use XSTRDUP() instead of strdup() for conf->host.
- peer_group_bind(): Call bgp_clear_route() for rsclient, and do so with
BGP_CLEAR_ROUTE_MY_RSCLIENT purpose.
- bgp_create(): Use XSTRDUP() instead of strdup() for peer_self->host.
- bgp_delete(): Delete peers before groups, rather than after. And then
rather than deleting rsclients, verify that there are none at this
point.
- bgp_unlock(): Add assertion.
- bgp_free(): Call bgp_table_finish() rather than doing XFREE() itself.
* lib/command.c,h: Compiler warning fixes. Add cmd_terminate(). Fixed
massive leak in install_element() in which cmd_make_descvec() was being
called more than once for the same cmd->strvec/string/doc.
* lib/log.c: Make closezlog() check fp before calling fclose().
* lib/memory.c: Catch when alloc count goes negative by using signed
counts. Correct #endif comment. Add log_memstats_stderr().
* lib/memory.h: Add log_memstats_stderr().
* lib/thread.c: thread->funcname was being accessed in thread_call() after
it had been freed. Rearranged things so that thread_call() frees
funcname. Also made it so thread_master_free() cleans up cpu_record.
* lib/vty.c,h: Use global command_cr. Add vty_terminate().
* lib/zclient.c,h: Re-enable zclient_free().
|
|
|
|
|
| |
Use Ansi-C prototypes rather than old K&R method of declaring
function without arguments
|
|
|
|
| |
Simple conversion of XMALLOC/memset to XCALLOC
|
|
|
|
|
|
|
|
|
|
| |
2008-07-22 Paul Jakma <paul.jakma@sun.com>
* bgp_community.c: (community_str2com) assigns defaults to local
vars
* bgp_attr.c: (bgp_attr_parse) match format specifier to arg
* bgp_table.{c,h}: (bgp_table_top) can take a * to a const, quelling
warning in bgp_route.c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2008-07-02 Stephen Hemminger <stephen.hemminger@vyatta.com>
* bgp_table.{c,h}: (bgp_table_finish) Take a double pointer and
scrub pointer in caller, so fixing double-free crashes seen
with route-server-client configuration.
* *.c: Adjust all callers of bgp_table_finish
2008-07-02 Paul Jakma <paul.jakma@sun.com>
* bgp_table.{c,h}: (bgp_node_delete, bgp_table_free) shouldn't be
exported.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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-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.
|
|
|
|
|
|
|
|
|
|
| |
* (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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(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.
|
|
|