本文整理汇总了C++中IS_DEBUG_OSPF函数的典型用法代码示例。如果您正苦于以下问题:C++ IS_DEBUG_OSPF函数的具体用法?C++ IS_DEBUG_OSPF怎么用?C++ IS_DEBUG_OSPF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IS_DEBUG_OSPF函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ospf_vl_up_check
void
ospf_vl_up_check (struct ospf_area *area, struct in_addr rid,
struct vertex *v)
{
struct ospf *ospf = area->ospf;
struct listnode *node;
struct ospf_vl_data *vl_data;
struct ospf_interface *oi;
if (IS_DEBUG_OSPF_EVENT)
{
zlog_debug ("ospf_vl_up_check(): Start");
zlog_debug ("ospf_vl_up_check(): Router ID is %s", inet_ntoa (rid));
zlog_debug ("ospf_vl_up_check(): Area is %s", inet_ntoa (area->area_id));
}
for (node = listhead (ospf->vlinks); node; nextnode (node))
{
if ((vl_data = getdata (node)) == NULL)
continue;
if (IS_DEBUG_OSPF_EVENT)
{
zlog_debug ("ospf_vl_up_check(): considering VL, name: %s",
vl_data->vl_oi->ifp->name);
zlog_debug ("ospf_vl_up_check(): VL area: %s, peer ID: %s",
inet_ntoa (vl_data->vl_area_id),
inet_ntoa (vl_data->vl_peer));
}
if (IPV4_ADDR_SAME (&vl_data->vl_peer, &rid) &&
IPV4_ADDR_SAME (&vl_data->vl_area_id, &area->area_id))
{
oi = vl_data->vl_oi;
SET_FLAG (vl_data->flags, OSPF_VL_FLAG_APPROVED);
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("ospf_vl_up_check(): this VL matched");
if (oi->state == ISM_Down)
{
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("ospf_vl_up_check(): VL is down, waking it up");
SET_FLAG (oi->ifp->flags, IFF_UP);
OSPF_ISM_EVENT_EXECUTE(oi,ISM_InterfaceUp);
}
if (ospf_vl_set_params (vl_data, v))
{
if (IS_DEBUG_OSPF (ism, ISM_EVENTS))
zlog_debug ("ospf_vl_up_check: VL cost change,"
" scheduling router lsa refresh");
if(ospf->backbone)
ospf_router_lsa_timer_add (ospf->backbone);
else if (IS_DEBUG_OSPF (ism, ISM_EVENTS))
zlog_debug ("ospf_vl_up_check: VL cost change, no backbone!");
}
}
}
}
示例2: ospf_vl_up_check
void
ospf_vl_up_check (struct ospf_area *area, struct in_addr rid,
struct vertex *v)
{
struct ospf *ospf = area->ospf;
struct listnode *node;
struct ospf_vl_data *vl_data;
struct ospf_interface *oi;
if (IS_DEBUG_OSPF_EVENT)
{
zlog_debug ("ospf_vl_up_check(): Start");
zlog_debug ("ospf_vl_up_check(): Router ID is %s", inet_ntoa (rid));
zlog_debug ("ospf_vl_up_check(): Area is %s", inet_ntoa (area->area_id));
}
for (ALL_LIST_ELEMENTS_RO (ospf->vlinks, node, vl_data))
{
if (IS_DEBUG_OSPF_EVENT)
{
zlog_debug ("%s: considering VL, %s in area %s", __func__,
vl_data->vl_oi->ifp->name,
inet_ntoa (vl_data->vl_area_id));
zlog_debug ("%s: peer ID: %s", __func__,
inet_ntoa (vl_data->vl_peer));
}
if (IPV4_ADDR_SAME (&vl_data->vl_peer, &rid) &&
IPV4_ADDR_SAME (&vl_data->vl_area_id, &area->area_id))
{
oi = vl_data->vl_oi;
SET_FLAG (vl_data->flags, OSPF_VL_FLAG_APPROVED);
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("ospf_vl_up_check(): this VL matched");
if (oi->state == ISM_Down)
{
if (IS_DEBUG_OSPF_EVENT)
zlog_debug ("ospf_vl_up_check(): VL is down, waking it up");
SET_FLAG (oi->ifp->flags, IFF_UP);
OSPF_ISM_EVENT_EXECUTE(oi,ISM_InterfaceUp);
}
if (ospf_vl_set_params (vl_data, v))
{
if (IS_DEBUG_OSPF (ism, ISM_EVENTS))
zlog_debug ("ospf_vl_up_check: VL cost change,"
" scheduling router lsa refresh");
if (ospf->backbone)
ospf_router_lsa_update_area (ospf->backbone);
else if (IS_DEBUG_OSPF (ism, ISM_EVENTS))
zlog_debug ("ospf_vl_up_check: VL cost change, no backbone!");
}
}
}
}
示例3: ospf_nsm_event
/* Execute NSM event process. */
int
ospf_nsm_event (struct thread *thread)
{
int event;
int next_state;
struct ospf_neighbor *nbr;
struct in_addr router_id;
int old_state;
struct ospf_interface *oi;
nbr = THREAD_ARG (thread);
event = THREAD_VAL (thread);
router_id = nbr->router_id;
old_state = nbr->state;
oi = nbr->oi ;
/* Call function. */
next_state = (*(NSM [nbr->state][event].func))(nbr);
/* When event is NSM_KillNbr or InactivityTimer, the neighbor is
deleted. */
if (event == NSM_KillNbr || event == NSM_InactivityTimer)
{
if (IS_DEBUG_OSPF (nsm, NSM_EVENTS))
zlog_debug ("NSM[%s:%s]: neighbor deleted",
IF_NAME (oi), inet_ntoa (router_id));
/* Timers are canceled in ospf_nbr_free, moreover we cannot call
nsm_timer_set here because nbr is freed already!!!*/
/*nsm_timer_set (nbr);*/
return 0;
}
if (! next_state)
next_state = NSM [nbr->state][event].next_state;
if (IS_DEBUG_OSPF (nsm, NSM_EVENTS))
zlog_debug ("NSM[%s:%s]: %s (%s)", IF_NAME (oi),
inet_ntoa (nbr->router_id),
LOOKUP (ospf_nsm_state_msg, nbr->state),
ospf_nsm_event_str [event]);
/* If state is changed. */
if (next_state != nbr->state)
nsm_change_state (nbr, next_state);
/* Make sure timer is set. */
nsm_timer_set (nbr);
return 0;
}
示例4: ospf_adjust_sndbuflen
void
ospf_adjust_sndbuflen (struct ospf * ospf, int buflen)
{
int ret, newbuflen;
/* Check if any work has to be done at all. */
if (ospf->maxsndbuflen >= buflen)
return;
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
zlog_debug ("%s: adjusting OSPF send buffer size to %d",
__func__, buflen);
if (ospfd_privs.change (ZPRIVS_RAISE))
zlog_err ("%s: could not raise privs, %s", __func__,
safe_strerror (errno));
/* Now we try to set SO_SNDBUF to what our caller has requested
* (the MTU of a newly added interface). However, if the OS has
* truncated the actual buffer size to somewhat less size, try
* to detect it and update our records appropriately. The OS
* may allocate more buffer space, than requested, this isn't
* a error.
*/
ret = setsockopt_so_sendbuf (ospf->fd, buflen);
newbuflen = getsockopt_so_sendbuf (ospf->fd);
if (ret < 0 || newbuflen < buflen)
zlog_warn ("%s: tried to set SO_SNDBUF to %d, but got %d",
__func__, buflen, newbuflen);
if (newbuflen >= 0)
ospf->maxsndbuflen = newbuflen;
else
zlog_warn ("%s: failed to get SO_SNDBUF", __func__);
if (ospfd_privs.change (ZPRIVS_LOWER))
zlog_err ("%s: could not lower privs, %s", __func__,
safe_strerror (errno));
}
示例5: nsm_kill_nbr
static int
nsm_kill_nbr (struct ospf_neighbor *nbr)
{
/* killing nbr_self is invalid */
if (nbr == nbr->oi->nbr_self)
{
assert (nbr != nbr->oi->nbr_self);
return 0;
}
if (nbr->oi->type == OSPF_IFTYPE_NBMA && nbr->nbr_nbma != NULL)
{
struct ospf_nbr_nbma *nbr_nbma = nbr->nbr_nbma;
nbr_nbma->nbr = NULL;
nbr_nbma->state_change = nbr->state_change;
nbr->nbr_nbma = NULL;
OSPF_POLL_TIMER_ON (nbr_nbma->t_poll, ospf_poll_timer,
nbr_nbma->v_poll);
if (IS_DEBUG_OSPF (nsm, NSM_EVENTS))
zlog_debug ("NSM[%s:%s]: Down (PollIntervalTimer scheduled)",
IF_NAME (nbr->oi), inet_ntoa (nbr->address.u.prefix4));
}
return 0;
}
示例6: ospf_interface_state_down
static int
ospf_interface_state_down (int command, struct zclient *zclient,
zebra_size_t length)
{
struct interface *ifp;
struct ospf_interface *oi;
struct route_node *node;
ifp = zebra_interface_state_read (zclient->ibuf);
if (ifp == NULL)
return 0;
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
zlog_debug ("Zebra: Interface[%s] state change to down.", ifp->name);
for (node = route_top (IF_OIFS (ifp)); node; node = route_next (node))
{
if ((oi = node->info) == NULL)
continue;
ospf_if_down (oi);
}
return 0;
}
示例7: ospf_interface_address_add
static int
ospf_interface_address_add (int command, struct zclient *zclient,
zebra_size_t length)
{
struct connected *c;
c = zebra_interface_address_read (command, zclient->ibuf);
if (c == NULL)
return 0;
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
{
char buf[128];
prefix2str(c->address, buf, sizeof(buf));
zlog_debug("Zebra: interface %s address add %s", c->ifp->name, buf);
}
ospf_if_update (NULL, c->ifp);
#ifdef HAVE_SNMP
ospf_snmp_if_update (c->ifp);
#endif /* HAVE_SNMP */
return 0;
}
示例8: ospf_interface_delete
static int
ospf_interface_delete (int command, struct zclient *zclient,
zebra_size_t length)
{
struct interface *ifp;
struct stream *s;
struct route_node *rn;
s = zclient->ibuf;
/* zebra_interface_state_read() updates interface structure in iflist */
ifp = zebra_interface_state_read (s);
if (ifp == NULL)
return 0;
if (if_is_up (ifp))
zlog_warn ("Zebra: got delete of %s, but interface is still up",
ifp->name);
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
zlog_debug
("Zebra: interface delete %s index %d flags %llx metric %d mtu %d",
ifp->name, ifp->ifindex, (unsigned long long)ifp->flags, ifp->metric, ifp->mtu);
#ifdef HAVE_SNMP
ospf_snmp_if_delete (ifp);
#endif /* HAVE_SNMP */
for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
if (rn->info)
ospf_if_free ((struct ospf_interface *) rn->info);
ifp->ifindex = IFINDEX_INTERNAL;
return 0;
}
示例9: ospf_ism_event
/* Execute ISM event process. */
int
ospf_ism_event (struct thread *thread)
{
int event;
int next_state;
struct ospf_interface *oi;
oi = THREAD_ARG (thread);
event = THREAD_VAL (thread);
/* Call function. */
next_state = (*(ISM [oi->state][event].func))(oi);
if (! next_state)
next_state = ISM [oi->state][event].next_state;
if (IS_DEBUG_OSPF (ism, ISM_EVENTS))
zlog (NULL, LOG_DEBUG, "ISM[%s]: %s (%s)", IF_NAME (oi),
LOOKUP (ospf_ism_state_msg, oi->state),
ospf_ism_event_str[event]);
/* If state is changed. */
if (next_state != oi->state)
ism_change_state (oi, next_state);
/* Make sure timer is set. */
ism_timer_set (oi);
return 0;
}
示例10: ospf_interface_add
/* Inteface addition message from zebra. */
static int
ospf_interface_add (int command, struct zclient *zclient, zebra_size_t length)
{
struct interface *ifp;
ifp = zebra_interface_add_read (zclient->ibuf);
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
zlog_debug ("Zebra: interface add %s index %d flags %llx metric %d mtu %d",
ifp->name, ifp->ifindex, (unsigned long long)ifp->flags,
ifp->metric, ifp->mtu);
assert (ifp->info);
if (!OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp), type))
{
SET_IF_PARAM (IF_DEF_PARAMS (ifp), type);
IF_DEF_PARAMS (ifp)->type = ospf_default_iftype(ifp);
}
ospf_if_update (NULL, ifp);
#ifdef HAVE_SNMP
ospf_snmp_if_update (ifp);
#endif /* HAVE_SNMP */
return 0;
}
示例11: ospf_adjust_sndbuflen_oisock
void ospf_adjust_sndbuflen_oisock (struct ospf * ospf, int buflen,struct ospf_interface *oi)
{
int ret, newbuflen;
/* Check if any work has to be done at all. */
if (ospf->maxsndbuflen >= buflen)
{
return;
}
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
{
zlog_debug ("%s: adjusting OSPF send buffer size to %d",
__func__, buflen);
}
ret = setsockopt_so_sendbuf (oi->packet_fd, buflen);
newbuflen = getsockopt_so_sendbuf (oi->packet_fd);
if (ret < 0 || newbuflen < buflen)
{
zlog_warn ("%s: tried to set SO_SNDBUF to %d, but got %d",
__func__, buflen, newbuflen);
}
if (newbuflen >= 0)
{
ospf->maxsndbuflen = newbuflen;
}
else
{
zlog_warn ("%s: failed to get SO_SNDBUF", __func__);
}
}
示例12: ism_ignore
static int
ism_ignore (struct ospf_interface *oi)
{
if (IS_DEBUG_OSPF (ism, ISM_EVENTS))
zlog (NULL, LOG_DEBUG, "ISM[%s]: ism_ignore called", IF_NAME (oi));
return 0;
}
示例13: ism_change_state
void
ism_change_state (struct ospf_interface *oi, int state)
{
int old_state;
struct ospf_lsa *lsa;
/* Logging change of state. */
if (IS_DEBUG_OSPF (ism, ISM_STATUS))
zlog (NULL, LOG_DEBUG, "ISM[%s]: State change %s -> %s", IF_NAME (oi),
LOOKUP (ospf_ism_state_msg, oi->state),
LOOKUP (ospf_ism_state_msg, state));
old_state = oi->state;
oi->state = state;
oi->state_change++;
if (old_state == ISM_Down || state == ISM_Down)
ospf_check_abr_status (oi->ospf);
/* Originate router-LSA. */
if (oi->area)
{
if (state == ISM_Down)
{
if (oi->area->act_ints > 0)
oi->area->act_ints--;
}
else if (old_state == ISM_Down)
oi->area->act_ints++;
/* schedule router-LSA originate. */
ospf_router_lsa_timer_add (oi->area);
}
/* Originate network-LSA. */
if (old_state != ISM_DR && state == ISM_DR)
ospf_network_lsa_timer_add (oi);
else if (old_state == ISM_DR && state != ISM_DR)
{
/* Free self originated network LSA. */
lsa = oi->network_lsa_self;
if (lsa)
{
ospf_lsa_flush_area (lsa, oi->area);
OSPF_TIMER_OFF (oi->t_network_lsa_self);
}
ospf_lsa_unlock (oi->network_lsa_self);
oi->network_lsa_self = NULL;
}
#ifdef HAVE_OPAQUE_LSA
ospf_opaque_ism_change (oi, old_state);
#endif /* HAVE_OPAQUE_LSA */
/* Check area border status. */
ospf_check_abr_status (oi->ospf);
}
示例14: nsm_ignore
/* OSPF NSM functions. */
int
nsm_ignore (struct ospf_neighbor *nbr)
{
if (IS_DEBUG_OSPF (nsm, NSM_EVENTS))
zlog (NULL, LOG_DEBUG, "NSM[%s:%s]: nsm_ignore called",
IF_NAME (nbr->oi), inet_ntoa (nbr->router_id));
return 0;
}
示例15: ospf_interface_address_delete
static int
ospf_interface_address_delete (int command, struct zclient *zclient,
zebra_size_t length)
{
struct ospf *ospf;
struct connected *c;
struct interface *ifp;
struct ospf_interface *oi;
struct route_node *rn;
struct prefix p;
c = zebra_interface_address_read (command, zclient->ibuf);
if (c == NULL)
return 0;
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
{
char buf[128];
prefix2str(c->address, buf, sizeof(buf));
zlog_debug("Zebra: interface %s address delete %s", c->ifp->name, buf);
}
ifp = c->ifp;
p = *c->address;
p.prefixlen = IPV4_MAX_PREFIXLEN;
rn = route_node_lookup (IF_OIFS (ifp), &p);
if (!rn)
{
connected_free (c);
return 0;
}
assert (rn->info);
oi = rn->info;
/* Call interface hook functions to clean up */
ospf_if_free (oi);
#ifdef HAVE_SNMP
ospf_snmp_if_update (c->ifp);
#endif /* HAVE_SNMP */
connected_free (c);
ospf = ospf_lookup ();
if (ospf != NULL)
ospf_if_update (ospf);
return 0;
}