mirror of
				https://git.proxmox.com/git/mirror_frr
				synced 2025-11-03 23:47:16 +00:00 
			
		
		
		
	bgpd: move t_start into peer_connection
The t_start event pointer belongs on the peer_connection Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
		
							parent
							
								
									b8f3b2cd4a
								
							
						
					
					
						commit
						904c98c4d9
					
				@ -358,9 +358,9 @@ void bgp_timer_set(struct peer *peer)
 | 
			
		||||
		   inactive.  All other timer must be turned off */
 | 
			
		||||
		if (BGP_PEER_START_SUPPRESSED(peer) || !peer_active(peer)
 | 
			
		||||
		    || peer->bgp->vrf_id == VRF_UNKNOWN) {
 | 
			
		||||
			EVENT_OFF(peer->t_start);
 | 
			
		||||
			EVENT_OFF(peer->connection->t_start);
 | 
			
		||||
		} else {
 | 
			
		||||
			BGP_TIMER_ON(peer->t_start, bgp_start_timer,
 | 
			
		||||
			BGP_TIMER_ON(peer->connection->t_start, bgp_start_timer,
 | 
			
		||||
				     peer->v_start);
 | 
			
		||||
		}
 | 
			
		||||
		EVENT_OFF(peer->connection->t_connect);
 | 
			
		||||
@ -374,7 +374,7 @@ void bgp_timer_set(struct peer *peer)
 | 
			
		||||
		/* After start timer is expired, the peer moves to Connect
 | 
			
		||||
		   status.  Make sure start timer is off and connect timer is
 | 
			
		||||
		   on. */
 | 
			
		||||
		EVENT_OFF(peer->t_start);
 | 
			
		||||
		EVENT_OFF(peer->connection->t_start);
 | 
			
		||||
		if (CHECK_FLAG(peer->flags, PEER_FLAG_TIMER_DELAYOPEN))
 | 
			
		||||
			BGP_TIMER_ON(peer->connection->t_connect,
 | 
			
		||||
				     bgp_connect_timer,
 | 
			
		||||
@ -391,7 +391,7 @@ void bgp_timer_set(struct peer *peer)
 | 
			
		||||
	case Active:
 | 
			
		||||
		/* Active is waiting connection from remote peer.  And if
 | 
			
		||||
		   connect timer is expired, change status to Connect. */
 | 
			
		||||
		EVENT_OFF(peer->t_start);
 | 
			
		||||
		EVENT_OFF(peer->connection->t_start);
 | 
			
		||||
		/* If peer is passive mode, do not set connect timer. */
 | 
			
		||||
		if (CHECK_FLAG(peer->flags, PEER_FLAG_PASSIVE)
 | 
			
		||||
		    || CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT)) {
 | 
			
		||||
@ -413,7 +413,7 @@ void bgp_timer_set(struct peer *peer)
 | 
			
		||||
 | 
			
		||||
	case OpenSent:
 | 
			
		||||
		/* OpenSent status. */
 | 
			
		||||
		EVENT_OFF(peer->t_start);
 | 
			
		||||
		EVENT_OFF(peer->connection->t_start);
 | 
			
		||||
		EVENT_OFF(peer->connection->t_connect);
 | 
			
		||||
		if (peer->v_holdtime != 0) {
 | 
			
		||||
			BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer,
 | 
			
		||||
@ -428,7 +428,7 @@ void bgp_timer_set(struct peer *peer)
 | 
			
		||||
 | 
			
		||||
	case OpenConfirm:
 | 
			
		||||
		/* OpenConfirm status. */
 | 
			
		||||
		EVENT_OFF(peer->t_start);
 | 
			
		||||
		EVENT_OFF(peer->connection->t_start);
 | 
			
		||||
		EVENT_OFF(peer->connection->t_connect);
 | 
			
		||||
 | 
			
		||||
		/*
 | 
			
		||||
@ -452,7 +452,7 @@ void bgp_timer_set(struct peer *peer)
 | 
			
		||||
	case Established:
 | 
			
		||||
		/* In Established status start and connect timer is turned
 | 
			
		||||
		   off. */
 | 
			
		||||
		EVENT_OFF(peer->t_start);
 | 
			
		||||
		EVENT_OFF(peer->connection->t_start);
 | 
			
		||||
		EVENT_OFF(peer->connection->t_connect);
 | 
			
		||||
		EVENT_OFF(peer->connection->t_delayopen);
 | 
			
		||||
 | 
			
		||||
@ -482,7 +482,7 @@ void bgp_timer_set(struct peer *peer)
 | 
			
		||||
		EVENT_OFF(peer->t_refresh_stalepath);
 | 
			
		||||
	/* fallthru */
 | 
			
		||||
	case Clearing:
 | 
			
		||||
		EVENT_OFF(peer->t_start);
 | 
			
		||||
		EVENT_OFF(peer->connection->t_start);
 | 
			
		||||
		EVENT_OFF(peer->connection->t_connect);
 | 
			
		||||
		EVENT_OFF(peer->t_holdtime);
 | 
			
		||||
		bgp_keepalives_off(peer);
 | 
			
		||||
@ -1513,7 +1513,7 @@ enum bgp_fsm_state_progress bgp_stop(struct peer_connection *connection)
 | 
			
		||||
	EVENT_OFF(peer->t_connect_check_w);
 | 
			
		||||
 | 
			
		||||
	/* Stop all timers. */
 | 
			
		||||
	EVENT_OFF(peer->t_start);
 | 
			
		||||
	EVENT_OFF(connection->t_start);
 | 
			
		||||
	EVENT_OFF(connection->t_connect);
 | 
			
		||||
	EVENT_OFF(peer->t_holdtime);
 | 
			
		||||
	EVENT_OFF(peer->t_routeadv);
 | 
			
		||||
 | 
			
		||||
@ -436,8 +436,8 @@ static void bgp_accept(struct event *thread)
 | 
			
		||||
				sockopt_tcp_mss_set(bgp_sock, peer1->tcp_mss);
 | 
			
		||||
 | 
			
		||||
			bgp_fsm_change_status(peer1, Active);
 | 
			
		||||
			EVENT_OFF(
 | 
			
		||||
				peer1->t_start); /* created in peer_create() */
 | 
			
		||||
			EVENT_OFF(peer1->connection
 | 
			
		||||
					  ->t_start); /* created in peer_create() */
 | 
			
		||||
 | 
			
		||||
			if (peer_active(peer1)) {
 | 
			
		||||
				if (CHECK_FLAG(peer1->flags,
 | 
			
		||||
@ -569,7 +569,7 @@ static void bgp_accept(struct event *thread)
 | 
			
		||||
	}
 | 
			
		||||
	bgp_peer_reg_with_nht(peer);
 | 
			
		||||
	bgp_fsm_change_status(peer, Active);
 | 
			
		||||
	EVENT_OFF(peer->t_start); /* created in peer_create() */
 | 
			
		||||
	EVENT_OFF(peer->connection->t_start); /* created in peer_create() */
 | 
			
		||||
 | 
			
		||||
	SET_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER);
 | 
			
		||||
	/* Make dummy peer until read Open packet. */
 | 
			
		||||
 | 
			
		||||
@ -15128,10 +15128,12 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
 | 
			
		||||
						    p->rtt_keepalive_rcv);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if (p->t_start)
 | 
			
		||||
			json_object_int_add(
 | 
			
		||||
				json_neigh, "nextStartTimerDueInMsecs",
 | 
			
		||||
				event_timer_remain_second(p->t_start) * 1000);
 | 
			
		||||
		if (p->connection->t_start)
 | 
			
		||||
			json_object_int_add(json_neigh,
 | 
			
		||||
					    "nextStartTimerDueInMsecs",
 | 
			
		||||
					    event_timer_remain_second(
 | 
			
		||||
						    p->connection->t_start) *
 | 
			
		||||
						    1000);
 | 
			
		||||
		if (p->connection->t_connect)
 | 
			
		||||
			json_object_int_add(json_neigh,
 | 
			
		||||
					    "nextConnectTimerDueInMsecs",
 | 
			
		||||
@ -15172,9 +15174,10 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
 | 
			
		||||
					"Shutdown when RTT > %dms, count > %u\n",
 | 
			
		||||
					p->rtt_expected, p->rtt_keepalive_rcv);
 | 
			
		||||
		}
 | 
			
		||||
		if (p->t_start)
 | 
			
		||||
		if (p->connection->t_start)
 | 
			
		||||
			vty_out(vty, "Next start timer due in %ld seconds\n",
 | 
			
		||||
				event_timer_remain_second(p->t_start));
 | 
			
		||||
				event_timer_remain_second(
 | 
			
		||||
					p->connection->t_start));
 | 
			
		||||
		if (p->connection->t_connect)
 | 
			
		||||
			vty_out(vty, "Next connect timer due in %ld seconds\n",
 | 
			
		||||
				event_timer_remain_second(
 | 
			
		||||
 | 
			
		||||
@ -1140,6 +1140,7 @@ struct peer_connection {
 | 
			
		||||
	struct event *t_write;
 | 
			
		||||
	struct event *t_connect;
 | 
			
		||||
	struct event *t_delayopen;
 | 
			
		||||
	struct event *t_start;
 | 
			
		||||
 | 
			
		||||
	struct event *t_process_packet;
 | 
			
		||||
	struct event *t_process_packet_error;
 | 
			
		||||
@ -1550,7 +1551,6 @@ struct peer {
 | 
			
		||||
	_Atomic uint32_t v_gr_restart;
 | 
			
		||||
 | 
			
		||||
	/* Threads. */
 | 
			
		||||
	struct event *t_start;
 | 
			
		||||
	struct event *t_connect_check_r;
 | 
			
		||||
	struct event *t_connect_check_w;
 | 
			
		||||
	struct event *t_holdtime;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user