diff options
| -rw-r--r-- | bgpd/bgp_packet.c | 40 | ||||
| -rw-r--r-- | bgpd/bgp_packet.h | 8 | ||||
| -rw-r--r-- | bgpd/bgp_vty.c | 28 | ||||
| -rw-r--r-- | bgpd/bgpd.h | 1 | 
4 files changed, 59 insertions, 18 deletions
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 49b6f2f279..88b95496e6 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -439,29 +439,32 @@ int bgp_generate_updgrp_packets(struct thread *thread)  			 */  			if (!next_pkt || !next_pkt->buffer) {  				if (CHECK_FLAG(peer->cap, -					       PEER_CAP_RESTART_RCV)) { +						PEER_CAP_RESTART_RCV)) {  					if (!(PAF_SUBGRP(paf))->t_coalesce -					    && peer->afc_nego[afi][safi] -					    && peer->synctime -					    && !CHECK_FLAG( -						       peer->af_sflags[afi] -								      [safi], -						       PEER_STATUS_EOR_SEND)) { -						SET_FLAG(peer->af_sflags[afi] -									[safi], -							 PEER_STATUS_EOR_SEND); - -						if ((s = bgp_update_packet_eor( -							     peer, afi, -							     safi))) { -							bgp_packet_add(peer, s); +						&& peer->afc_nego[afi][safi] +						&& peer->synctime +						&& !CHECK_FLAG( +						peer->af_sflags[afi][safi], +						PEER_STATUS_EOR_SEND)) { +						/* If EOR is disabled, +						 * the message is  not sent +						 */ +						if (!bgp_flag_check(peer->bgp, +							BGP_FLAG_GR_DISABLE_EOR +								)) { +							SET_FLAG( +							peer->af_sflags +							[afi][safi], +							PEER_STATUS_EOR_SEND); + +							BGP_UPDATE_EOR_PKT( +								peer, afi, +								safi, s);  						}  					}  				}  				continue;  			} - -  			/* Found a packet template to send, overwrite  			 * packet with appropriate attributes from peer  			 * and advance peer */ @@ -1675,7 +1678,8 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)  				 */  				if (gr_info->eor_required ==  						gr_info->eor_received) { -					if (bgp_debug_neighbor_events(peer)) +					if (bgp_debug_neighbor_events( +								peer))  						zlog_debug("%s %d, %s %d",  							"EOR REQ",  							gr_info->eor_required, diff --git a/bgpd/bgp_packet.h b/bgpd/bgp_packet.h index 49e401790f..1c2bafcb74 100644 --- a/bgpd/bgp_packet.h +++ b/bgpd/bgp_packet.h @@ -48,6 +48,14 @@ DECLARE_HOOK(bgp_packet_send,  #define ORF_COMMON_PART_PERMIT     0x00  #define ORF_COMMON_PART_DENY       0x20 +#define BGP_UPDATE_EOR_PKT(_peer, _afi, _safi, _s)       \ +		do { \ +			_s = bgp_update_packet_eor(_peer, _afi, _safi); \ +			if (_s) { \ +				bgp_packet_add(_peer, _s); \ +			} \ +		} while (0) +  /* Packet send and receive function prototypes. */  extern void bgp_keepalive_send(struct peer *);  extern void bgp_open_send(struct peer *); diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index bca28150e4..71a41cd688 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -2586,6 +2586,31 @@ DEFUN (no_bgp_neighbor_graceful_restart_disable,  	return bgp_vty_return(vty, ret);  } +DEFUN_HIDDEN (bgp_graceful_restart_disable_eor, +              bgp_graceful_restart_disable_eor_cmd, +              "bgp graceful-restart disable-eor", +              "BGP specific commands\n" +              "Graceful restart configuration parameters\n" +              "Disable EOR Check\n") +{ +	VTY_DECLVAR_CONTEXT(bgp, bgp); +	bgp_flag_set(bgp, BGP_FLAG_GR_DISABLE_EOR); +	return CMD_SUCCESS; +} + +DEFUN_HIDDEN (no_bgp_graceful_restart_disable_eor, +              no_bgp_graceful_restart_disable_eor_cmd, +              "no bgp graceful-restart disable-eor", +              NO_STR +              "BGP specific commands\n" +              "Graceful restart configuration parameters\n" +              "Disable EOR Check\n") +{ +	VTY_DECLVAR_CONTEXT(bgp, bgp); +	bgp_flag_unset(bgp, BGP_FLAG_GR_DISABLE_EOR); +	return CMD_SUCCESS; +} +  /* "bgp graceful-shutdown" configuration */  DEFUN (bgp_graceful_shutdown,         bgp_graceful_shutdown_cmd, @@ -15446,6 +15471,9 @@ void bgp_vty_init(void)  	install_element(BGP_NODE, &bgp_graceful_restart_preserve_fw_cmd);  	install_element(BGP_NODE, &no_bgp_graceful_restart_preserve_fw_cmd); +	install_element(BGP_NODE, &bgp_graceful_restart_disable_eor_cmd); +	install_element(BGP_NODE, &no_bgp_graceful_restart_disable_eor_cmd); +  	/* "bgp graceful-shutdown" commands */  	install_element(BGP_NODE, &bgp_graceful_shutdown_cmd);  	install_element(BGP_NODE, &no_bgp_graceful_shutdown_cmd); diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index a8ba6ad258..9b4f8d3eb4 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -408,6 +408,7 @@ struct bgp {  #define BGP_FLAG_GRACEFUL_SHUTDOWN        (1 << 21)  #define BGP_FLAG_DELETE_IN_PROGRESS       (1 << 22)  #define BGP_FLAG_SELECT_DEFER_DISABLE     (1 << 23) +#define BGP_FLAG_GR_DISABLE_EOR           (1 << 24)  	enum global_mode GLOBAL_GR_FSM[GLOBAL_MODE][EVENT_CMD];  	enum global_mode global_gr_present_state;  | 
