Esempio n. 1
0
/* Connect retry timer is expired when the peer status is Connect. */
static int
bgp_reconnect (struct peer *peer)
{
  bgp_stop (peer);
  bgp_start (peer);
  return 0;
}
Esempio n. 2
0
/* Flush the event queue and ensure the peer is shut down */
static int
bgp_clearing_completed (struct peer *peer)
{
  int rc = bgp_stop(peer);
  BGP_EVENT_FLUSH (peer);

  return rc;
}
Esempio n. 3
0
File: bgp.c Progetto: deepfield/bird
static void
bgp_graceful_restart_timeout(timer *t)
{
  struct bgp_proto *p = t->data;

  BGP_TRACE(D_EVENTS, "Neighbor graceful restart timeout");
  bgp_stop(p, 0);
}
Esempio n. 4
0
File: bgp.c Progetto: rogerhu/dd-wrt
static void
bgp_conn_leave_established_state(struct bgp_proto *p)
{
    BGP_TRACE(D_EVENTS, "BGP session closed");
    p->conn = NULL;

    if (p->p.proto_state == PS_UP)
        bgp_stop(p, 0);
}
Esempio n. 5
0
/* BGP peer is stoped by the error. */
static int
bgp_stop_with_error (struct peer *peer)
{
  /* Double start timer. */
  peer->v_start *= 2;

  /* Overflow check. */
  if (peer->v_start >= (60 * 2))
    peer->v_start = (60 * 2);

  bgp_stop (peer);

  return 0;
}
Esempio n. 6
0
File: bgp.c Progetto: i3149/bird
int
bgp_apply_limits(struct bgp_proto *p)
{
  if (p->cf->route_limit && (p->p.stats.imp_routes > p->cf->route_limit))
    {
      log(L_WARN "%s: Route limit exceeded, shutting down", p->p.name);
      bgp_store_error(p, NULL, BE_AUTO_DOWN, BEA_ROUTE_LIMIT_EXCEEDED);
      bgp_update_startup_delay(p);
      bgp_stop(p, 1); // Errcode 6, 1 - max number of prefixes reached
      return -1;
    }

  return 0;
}
Esempio n. 7
0
/* BGP peer is stoped by the error. */
int
bgp_stop_with_error (struct peer *peer)
{
  /* Double start timer. */
  peer->v_active_delay *= 2;

  /* Overflow check. */
  if (peer->v_active_delay > BGP_DEFAULT_CONNECT_RETRY)
    peer->v_active_delay = BGP_DEFAULT_CONNECT_RETRY;

  bgp_stop (peer);

  return 0;
}
Esempio n. 8
0
/* Hold timer expire.  This is error of BGP connection. So cut the
   peer and change to Idle status. */
static int
bgp_fsm_holdtime_expire (struct peer *peer)
{
  if (BGP_DEBUG (fsm, FSM))
    zlog (peer->log, LOG_DEBUG, "%s [FSM] Hold timer expire", peer->host);

  /* Send notify to remote peer. */
  bgp_notify_send (peer, BGP_NOTIFY_HOLD_ERR, 0);

  /* Sweep if it is temporary peer. */
  if (CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER))
    {
      zlog_info ("%s [Event] Accepting BGP peer is deleted", peer->host);
      peer_delete (peer);
      return -1;
    }

  /* bgp_stop needs to be invoked while in Established state */
  bgp_stop(peer);

  return 0;
}
Esempio n. 9
0
/* something went wrong, send notify and tear down */
static int
bgp_stop_with_notify (struct peer *peer, u_char code, u_char sub_code)
{
  /* Send notify to remote peer */
  bgp_notify_send (peer, code, sub_code);

  /* Sweep if it is temporary peer. */
  if (CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER))
    {
      zlog_info ("%s [Event] Accepting BGP peer is deleted", peer->host);
      peer_delete (peer);
      return -1;
    }

  /* Clear start timer value to default. */
  peer->v_start = BGP_INIT_START_TIMER;

  /* bgp_stop needs to be invoked while in Established state */
  bgp_stop(peer);

  return 0;
}
Esempio n. 10
0
/* TCP connect fail */
static int
bgp_connect_fail (struct peer *peer)
{
  bgp_stop (peer);
  return 0;
}