本文整理汇总了C++中BGP_DEBUG函数的典型用法代码示例。如果您正苦于以下问题:C++ BGP_DEBUG函数的具体用法?C++ BGP_DEBUG怎么用?C++ BGP_DEBUG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BGP_DEBUG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bgp_interface_add
/* Inteface addition message from zebra. */
static int
bgp_interface_add (int command, struct zclient *zclient, zebra_size_t length,
vrf_id_t vrf_id)
{
struct interface *ifp;
ifp = zebra_interface_add_read (zclient->ibuf, vrf_id);
if (BGP_DEBUG(zebra, ZEBRA) && ifp)
zlog_debug("Zebra rcvd: interface add %s", ifp->name);
return 0;
}
示例2: bgp_start
/* This function is the first starting point of all BGP connection. It
try to connect to remote peer with non-blocking IO. */
int
bgp_start (struct peer *peer)
{
int status;
status = bgp_connect (peer);
switch (status)
{
case connect_error:
if (BGP_DEBUG (fsm, FSM))
plog_info (peer->log, "%s [FSM] Connect error", peer->host);
BGP_EVENT_ADD (peer, TCP_connection_open_failed);
break;
case connect_success:
if (BGP_DEBUG (fsm, FSM))
plog_info (peer->log, "%s [FSM] Connect immediately success",
peer->host);
BGP_EVENT_ADD (peer, TCP_connection_open);
break;
case connect_in_progress:
/* To check nonblocking connect, we wait until socket is
readable or writable. */
if (BGP_DEBUG (fsm, FSM))
plog_info (peer->log, "%s [FSM] Non blocking connect waiting result",
peer->host);
if (peer->fd < 0)
{
zlog_err ("bgp_start peer's fd is negative value %d",
peer->fd);
return -1;
}
BGP_READ_ON (peer->t_read, bgp_read, peer->fd);
BGP_WRITE_ON (peer->t_write, bgp_write, peer->fd);
break;
}
return 0;
}
示例3: bgp_connect
/* BGP try to connect to the peer. */
int
bgp_connect (struct peer *peer)
{
ifindex_t ifindex = 0;
/* Make socket for the peer. */
peer->fd = sockunion_socket (&peer->su);
if (peer->fd < 0)
return -1;
set_nonblocking (peer->fd);
/* Set socket send buffer size */
bgp_update_sock_send_buffer_size(peer->fd);
bgp_set_socket_ttl (peer, peer->fd);
sockopt_reuseaddr (peer->fd);
sockopt_reuseport (peer->fd);
#ifdef IPTOS_PREC_INTERNETCONTROL
if (bgpd_privs.change (ZPRIVS_RAISE))
zlog_err ("%s: could not raise privs", __func__);
if (sockunion_family (&peer->su) == AF_INET)
setsockopt_ipv4_tos (peer->fd, IPTOS_PREC_INTERNETCONTROL);
else if (sockunion_family (&peer->su) == AF_INET6)
setsockopt_ipv6_tclass (peer->fd, IPTOS_PREC_INTERNETCONTROL);
if (bgpd_privs.change (ZPRIVS_LOWER))
zlog_err ("%s: could not lower privs", __func__);
#endif
if (peer->password)
bgp_md5_set_connect (peer->fd, &peer->su, peer->password);
/* Bind socket. */
bgp_bind (peer);
/* Update source bind. */
bgp_update_source (peer);
if (peer->ifname)
ifindex = ifname2ifindex (peer->ifname);
if (BGP_DEBUG (events, EVENTS))
plog_debug (peer->log, "%s [Event] Connect start to %s fd %d",
peer->host, peer->host, peer->fd);
/* Connect to the remote peer. */
return sockunion_connect (peer->fd, &peer->su, htons (peer->port), ifindex);
}
示例4: bgp_interface_down
static int
bgp_interface_down (int command, struct zclient *zclient, zebra_size_t length)
{
struct stream *s;
struct interface *ifp;
struct connected *c;
struct listnode *node, *nnode;
s = zclient->ibuf;
ifp = zebra_interface_state_read (s);
if (! ifp)
return 0;
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("Zebra rcvd: interface %s down", ifp->name);
for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, c))
bgp_connected_delete (c);
/* Fast external-failover (Currently IPv4 only) */
{
struct listnode *mnode;
struct bgp *bgp;
struct peer *peer;
struct interface *peer_if;
for (ALL_LIST_ELEMENTS_RO (bm->bgp, mnode, bgp))
{
if (CHECK_FLAG (bgp->flags, BGP_FLAG_NO_FAST_EXT_FAILOVER))
continue;
for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
{
if (peer->ttl != 1)
continue;
if (peer->su.sa.sa_family == AF_INET)
peer_if = if_lookup_by_ipv4 (&peer->su.sin.sin_addr);
else
continue;
if (ifp == peer_if)
BGP_EVENT_ADD (peer, BGP_Stop);
}
}
}
return 0;
}
示例5: bgp_fsm_change_status
/* Called after event occured, this function change status and reset
read/write and timer thread. */
void
bgp_fsm_change_status (struct peer *peer, int status)
{
bgp_dump_state (peer, peer->status, status);
/* Preserve old status and change into new status. */
peer->ostatus = peer->status;
peer->status = status;
if (BGP_DEBUG (normal, NORMAL))
zlog_debug ("%s went from %s to %s",
peer->host,
LOOKUP (bgp_status_msg, peer->ostatus),
LOOKUP (bgp_status_msg, peer->status));
}
示例6: bgp_fsm_change_status
/* Called after event occured, this function change status and reset
read/write and timer thread. */
void
bgp_fsm_change_status (struct peer *peer, int status)
{
bgp_dump_state (peer, peer->status, status);
/* Preserve old status and change into new status. */
peer->ostatus = peer->status;
peer->status = status;
if (BGP_DEBUG (normal, NORMAL))
if (! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER))
zlog_info ("%s went from %s to %s", peer->host,
LOOKUP (bgp_status_msg, peer->ostatus),
LOOKUP (bgp_status_msg, peer->status));
}
示例7: bgp_notify_print
/* dump notify packet */
void
bgp_notify_print(struct peer *peer, struct bgp_notify *bgp_notify,
const char *direct)
{
const char *subcode_str;
subcode_str = "";
switch (bgp_notify->code)
{
case BGP_NOTIFY_HEADER_ERR:
subcode_str = LOOKUP (bgp_notify_head_msg, bgp_notify->subcode);
break;
case BGP_NOTIFY_OPEN_ERR:
subcode_str = LOOKUP (bgp_notify_open_msg, bgp_notify->subcode);
break;
case BGP_NOTIFY_UPDATE_ERR:
subcode_str = LOOKUP (bgp_notify_update_msg, bgp_notify->subcode);
break;
case BGP_NOTIFY_HOLD_ERR:
subcode_str = "";
break;
case BGP_NOTIFY_FSM_ERR:
subcode_str = "";
break;
case BGP_NOTIFY_CEASE:
subcode_str = LOOKUP (bgp_notify_cease_msg, bgp_notify->subcode);
break;
case BGP_NOTIFY_CAPABILITY_ERR:
subcode_str = LOOKUP (bgp_notify_capability_msg, bgp_notify->subcode);
break;
}
if (bgp_flag_check (peer->bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES))
zlog_info ("%%NOTIFICATION: %s neighbor %s %d/%d (%s%s) %d bytes %s",
strcmp (direct, "received") == 0 ? "received from" : "sent to",
peer->host, bgp_notify->code, bgp_notify->subcode,
LOOKUP (bgp_notify_msg, bgp_notify->code),
subcode_str, bgp_notify->length,
bgp_notify->data ? bgp_notify->data : "");
else if (BGP_DEBUG (normal, NORMAL))
plog_debug (peer->log, "%s %s NOTIFICATION %d/%d (%s%s) %d bytes %s",
peer ? peer->host : "",
direct, bgp_notify->code, bgp_notify->subcode,
LOOKUP (bgp_notify_msg, bgp_notify->code),
subcode_str, bgp_notify->length,
bgp_notify->data ? bgp_notify->data : "");
}
示例8: bgp_interface_delete
static int
bgp_interface_delete (int command, struct zclient *zclient,
zebra_size_t length)
{
struct stream *s;
struct interface *ifp;
s = zclient->ibuf;
ifp = zebra_interface_state_read (s);
ifp->ifindex = IFINDEX_INTERNAL;
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("Zebra rcvd: interface delete %s", ifp->name);
return 0;
}
示例9: bgp_scan_timer
/* BGP scan thread. This thread check nexthop reachability. */
static int
bgp_scan_timer (struct thread *t)
{
bgp_scan_thread =
thread_add_timer (master, bgp_scan_timer, NULL, bgp_scan_interval);
if (BGP_DEBUG (events, EVENTS))
zlog_debug ("Performing BGP general scanning");
bgp_scan (AFI_IP, SAFI_UNICAST);
#ifdef HAVE_IPV6
bgp_scan (AFI_IP6, SAFI_UNICAST);
#endif /* HAVE_IPV6 */
return 0;
}
示例10: bgp_connect_timer
/* BGP connect retry timer. */
static int
bgp_connect_timer (struct thread *thread)
{
struct peer *peer;
peer = THREAD_ARG (thread);
peer->t_connect = NULL;
if (BGP_DEBUG (fsm, FSM))
zlog (peer->log, LOG_DEBUG, "%s [FSM] Timer (connect timer expire)",
peer->host);
THREAD_VAL (thread) = ConnectRetry_timer_expired;
bgp_event (thread); /* bgp_event unlocks peer */
return 0;
}
示例11: bgp_connect
/* BGP try to connect to the peer. */
int
bgp_connect (struct peer *peer)
{
unsigned int ifindex = 0;
/* Make socket for the peer. */
peer->fd = sockunion_socket (&peer->su);
if (peer->fd < 0)
return -1;
/* If we can get socket for the peer, adjest TTL and make connection. */
if (peer_sort (peer) == BGP_PEER_EBGP) {
sockopt_ttl (peer->su.sa.sa_family, peer->fd, peer->ttl);
if (peer->gtsm_hops)
sockopt_minttl (peer->su.sa.sa_family, peer->fd, MAXTTL + 1 - peer->gtsm_hops);
}
sockopt_reuseaddr (peer->fd);
sockopt_reuseport (peer->fd);
#ifdef IPTOS_PREC_INTERNETCONTROL
if (sockunion_family (&peer->su) == AF_INET)
setsockopt_ipv4_tos (peer->fd, IPTOS_PREC_INTERNETCONTROL);
#endif
if (peer->password)
bgp_md5_set_connect (peer->fd, &peer->su, peer->password);
/* Bind socket. */
bgp_bind (peer);
/* Update source bind. */
bgp_update_source (peer);
#ifdef HAVE_IPV6
if (peer->ifname)
ifindex = if_nametoindex (peer->ifname);
#endif /* HAVE_IPV6 */
if (BGP_DEBUG (events, EVENTS))
plog_debug (peer->log, "%s [Event] Connect start to %s fd %d",
peer->host, peer->host, peer->fd);
/* Connect to the remote peer. */
return sockunion_connect (peer->fd, &peer->su, htons (peer->port), ifindex);
}
示例12: bgp_start_timer
/* BGP start timer. This function set BGP_Start event to thread value
and process event. */
static int
bgp_start_timer (struct thread *thread)
{
struct peer *peer;
peer = THREAD_ARG (thread);
peer->t_start = NULL;
if (BGP_DEBUG (fsm, FSM))
zlog (peer->log, LOG_DEBUG,
"%s [FSM] Timer (start timer expire).", peer->host);
THREAD_VAL (thread) = BGP_Start;
bgp_event (thread); /* bgp_event unlocks peer */
return 0;
}
示例13: bgp_holdtime_timer
/* BGP holdtime timer. */
static int
bgp_holdtime_timer (struct thread *thread)
{
struct peer *peer;
peer = THREAD_ARG (thread);
peer->t_holdtime = NULL;
if (BGP_DEBUG (fsm, FSM))
zlog (peer->log, LOG_DEBUG,
"%s [FSM] Timer (holdtime timer expire)",
peer->host);
THREAD_VAL (thread) = Hold_Timer_expired;
bgp_event (thread);
return 0;
}
示例14: bgp_keepalive_timer
/* BGP keepalive fire ! */
static int
bgp_keepalive_timer (struct thread *thread)
{
struct peer *peer;
peer = THREAD_ARG (thread);
peer->t_keepalive = NULL;
if (BGP_DEBUG (fsm, FSM))
zlog (peer->log, LOG_DEBUG,
"%s [FSM] Timer (keepalive timer expire)",
peer->host);
THREAD_VAL (thread) = KeepAlive_timer_expired;
bgp_event (thread); /* bgp_event unlocks peer */
return 0;
}
示例15: bgp_start_timer
/* BGP start timer. This function set BGP_Start event to thread value
and process event. */
static int
bgp_start_timer (struct thread *thread)
{
struct peer *peer;
peer = THREAD_ARG (thread);
peer->t_start = NULL;
UNSET_FLAG (peer->sflags, PEER_STATUS_CREATE_INIT);
if (BGP_DEBUG (fsm, FSM))
zlog (peer->log, LOG_DEBUG,
"%s [FSM] Timer (start timer expire).", peer->host);
THREAD_VAL (thread) = BGP_Start;
bgp_event (thread);
return 0;
}