本文整理汇总了C++中UNSET_FLAG函数的典型用法代码示例。如果您正苦于以下问题:C++ UNSET_FLAG函数的具体用法?C++ UNSET_FLAG怎么用?C++ UNSET_FLAG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UNSET_FLAG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: connected_withdraw
/* communicate the withdrawal of a connected address */
static void connected_withdraw(struct connected *ifc)
{
if (!ifc)
return;
/* Update interface address information to protocol daemon. */
if (CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL)) {
zebra_interface_address_delete_update(ifc->ifp, ifc);
if (ifc->address->family == AF_INET)
if_subnet_delete(ifc->ifp, ifc);
if (ifc->address->family == AF_INET)
connected_down_ipv4(ifc->ifp, ifc);
#ifdef HAVE_IPV6
else
connected_down_ipv6(ifc->ifp, ifc);
#endif
UNSET_FLAG(ifc->conf, ZEBRA_IFC_REAL);
}
/* The address is not in the kernel anymore, so clear the flag */
UNSET_FLAG(ifc->conf, ZEBRA_IFC_QUEUED);
if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_CONFIGURED)) {
listnode_delete(ifc->ifp->connected, ifc);
connected_free(ifc);
}
}
示例2: ospf_abr_unapprove_summaries
void
ospf_abr_unapprove_summaries (struct ospf *ospf)
{
listnode node;
struct ospf_area *area;
struct route_node *rn;
struct ospf_lsa *lsa;
if (IS_DEBUG_OSPF_EVENT)
zlog_info ("ospf_abr_unapprove_summaries(): Start");
for (node = listhead (ospf->areas); node; nextnode (node))
{
area = getdata (node);
LSDB_LOOP (SUMMARY_LSDB (area), rn, lsa)
if (ospf_lsa_is_self_originated (ospf, lsa))
UNSET_FLAG (lsa->flags, OSPF_LSA_APPROVED);
LSDB_LOOP (ASBR_SUMMARY_LSDB (area), rn, lsa)
if (ospf_lsa_is_self_originated (ospf, lsa))
UNSET_FLAG (lsa->flags, OSPF_LSA_APPROVED);
}
if (IS_DEBUG_OSPF_EVENT)
zlog_info ("ospf_abr_unapprove_summaries(): Stop");
}
示例3: connected_implicit_withdraw
/* Handle implicit withdrawals of addresses, where a system ADDs an address
* to an interface which already has the same address configured.
*
* Returns the struct connected which must be announced to clients,
* or NULL if nothing to do.
*/
static struct connected *
connected_implicit_withdraw (struct interface *ifp, struct connected *ifc)
{
struct connected *current;
/* Check same connected route. */
if ((current = connected_check (ifp, (struct prefix *) ifc->address)))
{
if (CHECK_FLAG(current->conf, ZEBRA_IFC_CONFIGURED))
SET_FLAG(ifc->conf, ZEBRA_IFC_CONFIGURED);
if (CHECK_FLAG (current->ipv6_config, RTMD_IPV6_ADDR_CONFIG))
SET_FLAG (ifc->ipv6_config, RTMD_IPV6_ADDR_CONFIG);
/* Avoid spurious withdraws, this might be just the kernel 'reflecting'
* back an address we have already added.
*/
if (connected_same (current, ifc))
{
/* nothing to do */
connected_free (ifc);
return NULL;
}
UNSET_FLAG(current->conf, ZEBRA_IFC_CONFIGURED);
UNSET_FLAG(current->ipv6_config, RTMD_IPV6_ADDR_CONFIG);
connected_withdraw (current); /* implicit withdraw - freebsd does this */
}
return ifc;
}
示例4: if_delete_update
/* Handle an interface delete event */
void
if_delete_update (struct interface *ifp)
{
struct listnode *node;
struct listnode *next;
struct connected *ifc;
struct prefix *p;
if (if_is_up(ifp))
{
zlog_err ("interface %s index %d is still up while being deleted.",
ifp->name, ifp->ifindex);
return;
}
/* Mark interface as inactive */
UNSET_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE);
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_info ("interface %s index %d is now inactive.",
ifp->name, ifp->ifindex);
/* Delete connected routes from the kernel. */
if (ifp->connected)
{
for (node = listhead (ifp->connected); node; node = next)
{
next = node->next;
ifc = getdata (node);
p = ifc->address;
if (p->family == AF_INET)
connected_down_ipv4 (ifp, ifc);
#ifdef HAVE_IPV6
else if (p->family == AF_INET6)
connected_down_ipv6 (ifp, ifc);
#endif /* HAVE_IPV6 */
zebra_interface_address_delete_update (ifp, ifc);
UNSET_FLAG (ifc->conf, ZEBRA_IFC_REAL);
if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED))
{
listnode_delete (ifp->connected, ifc);
connected_free (ifc);
}
}
}
zebra_interface_delete_update (ifp);
}
示例5: ospf_area_range_substitute_unset
int
ospf_area_range_substitute_unset (struct ospf *ospf, struct in_addr area_id,
struct prefix_ipv4 *p)
{
struct ospf_area *area;
struct ospf_area_range *range;
area = ospf_area_lookup_by_area_id (ospf, area_id);
if (area == NULL)
return 0;
range = ospf_area_range_lookup (area, p);
if (range == NULL)
return 0;
if (CHECK_FLAG (range->flags, OSPF_AREA_RANGE_SUBSTITUTE))
if (ospf_area_range_active (range))
ospf_schedule_abr_task (ospf);
UNSET_FLAG (range->flags, OSPF_AREA_RANGE_SUBSTITUTE);
range->subst_addr.s_addr = 0;
range->subst_masklen = 0;
return 1;
}
示例6: ospf_area_range_set
int
ospf_area_range_set (struct ospf *ospf, struct in_addr area_id,
struct prefix_ipv4 *p, int advertise)
{
struct ospf_area *area;
struct ospf_area_range *range;
int ret = OSPF_AREA_ID_FORMAT_ADDRESS;
area = ospf_area_get (ospf, area_id, ret);
if (area == NULL)
return 0;
range = ospf_area_range_lookup (area, p);
if (range != NULL)
{
if ((CHECK_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE)
&& !CHECK_FLAG (advertise, OSPF_AREA_RANGE_ADVERTISE))
|| (!CHECK_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE)
&& CHECK_FLAG (advertise, OSPF_AREA_RANGE_ADVERTISE)))
ospf_schedule_abr_task (ospf);
}
else
{
range = ospf_area_range_new (p);
ospf_area_range_add (area, range);
ospf_schedule_abr_task (ospf);
}
if (CHECK_FLAG (advertise, OSPF_AREA_RANGE_ADVERTISE))
SET_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE);
else
UNSET_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE);
return 1;
}
示例7: bgp_graceful_restart_timer_expire
static int
bgp_graceful_restart_timer_expire (struct thread *thread)
{
struct peer *peer;
afi_t afi;
safi_t safi;
peer = THREAD_ARG (thread);
peer->t_gr_restart = NULL;
/* NSF delete stale route */
for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
for (safi = SAFI_UNICAST ; safi < SAFI_RESERVED_3 ; safi++)
if (peer->nsf[afi][safi])
bgp_clear_stale_route (peer, afi, safi);
UNSET_FLAG (peer->sflags, PEER_STATUS_NSF_WAIT);
BGP_TIMER_OFF (peer->t_gr_stale);
if (BGP_DEBUG (events, EVENTS))
{
zlog_debug ("%s graceful restart timer expired", peer->host);
zlog_debug ("%s graceful restart stalepath timer stopped", peer->host);
}
bgp_timer_set (peer);
return 0;
}
示例8: if_subnet_add
/* Tie an interface address to its derived subnet list of addresses. */
int
if_subnet_add (struct interface *ifp, struct connected *ifc)
{
struct route_node *rn;
struct zebra_if *zebra_if;
struct prefix cp;
struct list *addr_list;
assert (ifp && ifp->info && ifc);
zebra_if = ifp->info;
/* Get address derived subnet node and associated address list, while marking
address secondary attribute appropriately. */
cp = *ifc->address;
apply_mask (&cp);
rn = route_node_get (zebra_if->ipv4_subnets, &cp);
if ((addr_list = rn->info))
SET_FLAG (ifc->flags, ZEBRA_IFA_SECONDARY);
else
{
UNSET_FLAG (ifc->flags, ZEBRA_IFA_SECONDARY);
rn->info = addr_list = list_new ();
route_lock_node (rn);
}
/* Tie address at the tail of address list. */
listnode_add (addr_list, ifc);
/* Return list element count. */
return (addr_list->count);
}
示例9: ospf6_abr_range_update
static void
ospf6_abr_range_update (struct ospf6_route *range)
{
u_int32_t cost = 0;
struct ospf6_route *ro;
assert (range->type == OSPF6_DEST_TYPE_RANGE);
/* update range's cost and active flag */
for (ro = ospf6_route_match_head (&range->prefix, ospf6->route_table);
ro; ro = ospf6_route_match_next (&range->prefix, ro))
{
if (ro->path.area_id == range->path.area_id &&
! CHECK_FLAG (ro->flag, OSPF6_ROUTE_REMOVE))
cost = MAX (cost, ro->path.cost);
}
if (range->path.cost != cost)
{
range->path.cost = cost;
if (range->path.cost)
SET_FLAG (range->flag, OSPF6_ROUTE_ACTIVE_SUMMARY);
else
UNSET_FLAG (range->flag, OSPF6_ROUTE_ACTIVE_SUMMARY);
ospf6_abr_originate_summary (range);
}
}
示例10: bgp_capability_restart
static int
bgp_capability_restart (struct peer *peer, struct capability_header *caphdr)
{
struct stream *s = BGP_INPUT (peer);
u_int16_t restart_flag_time;
int restart_bit = 0;
size_t end = stream_get_getp (s) + caphdr->length;
SET_FLAG (peer->cap, PEER_CAP_RESTART_RCV);
restart_flag_time = stream_getw(s);
if (CHECK_FLAG (restart_flag_time, RESTART_R_BIT))
restart_bit = 1;
UNSET_FLAG (restart_flag_time, 0xF000);
peer->v_gr_restart = restart_flag_time;
if (BGP_DEBUG (normal, NORMAL))
{
zlog_debug ("%s OPEN has Graceful Restart capability", peer->host);
zlog_debug ("%s Peer has%srestarted. Restart Time : %d",
peer->host, restart_bit ? " " : " not ",
peer->v_gr_restart);
}
while (stream_get_getp (s) + 4 <= end)
{
afi_t afi = stream_getw (s);
safi_t safi = stream_getc (s);
u_char flag = stream_getc (s);
if (!bgp_afi_safi_valid_indices (afi, &safi))
{
if (BGP_DEBUG (normal, NORMAL))
zlog_debug ("%s Addr-family %d/%d(afi/safi) not supported."
" Ignore the Graceful Restart capability",
peer->host, afi, safi);
}
else if (!peer->afc[afi][safi])
{
if (BGP_DEBUG (normal, NORMAL))
zlog_debug ("%s Addr-family %d/%d(afi/safi) not enabled."
" Ignore the Graceful Restart capability",
peer->host, afi, safi);
}
else
{
if (BGP_DEBUG (normal, NORMAL))
zlog_debug ("%s Address family %s is%spreserved", peer->host,
afi_safi_print (afi, safi),
CHECK_FLAG (peer->af_cap[afi][safi],
PEER_CAP_RESTART_AF_PRESERVE_RCV)
? " " : " not ");
SET_FLAG (peer->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV);
if (CHECK_FLAG (flag, RESTART_F_BIT))
SET_FLAG (peer->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV);
}
}
return 0;
}
示例11: connected_add_ipv6
/* Add connected IPv6 route to the interface. */
void
connected_add_ipv6 (struct interface *ifp, int flags, struct in6_addr *addr,
u_char prefixlen, struct in6_addr *broad,
const char *label)
{
struct prefix_ipv6 *p;
struct connected *ifc;
/* Make connected structure. */
ifc = connected_new ();
ifc->ifp = ifp;
ifc->flags = flags;
/* If we get a notification from the kernel,
* we can safely assume the address is known to the kernel */
SET_FLAG(ifc->conf, ZEBRA_IFC_QUEUED);
/* Allocate new connected address. */
p = prefix_ipv6_new ();
p->family = AF_INET6;
IPV6_ADDR_COPY (&p->prefix, addr);
p->prefixlen = prefixlen;
ifc->address = (struct prefix *) p;
/* If there is broadcast or peer address. */
if (broad)
{
if (IN6_IS_ADDR_UNSPECIFIED(broad))
zlog_warn("warning: %s called for interface %s with unspecified "
"destination address; ignoring!", __func__, ifp->name);
else
{
p = prefix_ipv6_new ();
p->family = AF_INET6;
IPV6_ADDR_COPY (&p->prefix, broad);
p->prefixlen = prefixlen;
ifc->destination = (struct prefix *) p;
}
}
if (CHECK_FLAG(ifc->flags, ZEBRA_IFA_PEER) && !ifc->destination)
{
zlog_warn("warning: %s called for interface %s "
"with peer flag set, but no peer address supplied",
__func__, ifp->name);
UNSET_FLAG(ifc->flags, ZEBRA_IFA_PEER);
}
/* Label of this address. */
if (label)
ifc->label = XSTRDUP (MTYPE_CONNECTED_LABEL, label);
/* On Linux, we only get here when DAD is complete, therefore we can set
* ZEBRA_IFC_REAL.
*
* On BSD, there currently doesn't seem to be a way to check for completion of
* DAD, so we replicate the old behaviour and set ZEBRA_IFC_REAL, although DAD
* might still be running.
*/
SET_FLAG(ifc->conf, ZEBRA_IFC_REAL);
connected_update(ifp, ifc);
}
示例12: connected_update
/* Handle changes to addresses and send the neccesary announcements
* to clients. */
static void connected_update(struct interface *ifp, struct connected *ifc)
{
struct connected *current;
/* Check same connected route. */
if ((current = connected_check(ifp, (struct prefix *)ifc->address))) {
if (CHECK_FLAG(current->conf, ZEBRA_IFC_CONFIGURED))
SET_FLAG(ifc->conf, ZEBRA_IFC_CONFIGURED);
/* Avoid spurious withdraws, this might be just the kernel 'reflecting'
* back an address we have already added.
*/
if (connected_same(current, ifc)) {
/* nothing to do */
connected_free(ifc);
return;
}
/* Clear the configured flag on the old ifc, so it will be freed by
* connected withdraw. */
UNSET_FLAG(current->conf, ZEBRA_IFC_CONFIGURED);
connected_withdraw(current); /* implicit withdraw - freebsd does this */
}
/* If the connected is new or has changed, announce it, if it is usable */
if (CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL))
connected_announce(ifp, ifc);
}
示例13: connected_implicit_withdraw
/* Handle implicit withdrawals of addresses, where a system ADDs an address
* to an interface which already has the same address configured.
*
* Returns the struct connected which must be announced to clients,
* or NULL if nothing to do.
*/
static struct connected *
connected_implicit_withdraw (struct interface *ifp, struct connected *ifc)
{
struct connected *current;
/* Check same connected route. */
if ((current = connected_check (ifp, (struct prefix *) ifc->address)))
{
if (CHECK_FLAG(current->conf, ZEBRA_IFC_CONFIGURED))
SET_FLAG(ifc->conf, ZEBRA_IFC_CONFIGURED);
/* Avoid spurious withdraws, this might be just the kernel 'reflecting'
* back an address we have already added.
*/
if (connected_same (current, ifc) && CHECK_FLAG(current->conf, ZEBRA_IFC_REAL))
{
/* nothing to do */
connected_free (ifc);
return NULL;
}
UNSET_FLAG(current->conf, ZEBRA_IFC_CONFIGURED);
if(CHECK_FLAG (current->flags, ZEBRA_IFA_EXPIRES))
{
SET_FLAG (ifc->flags, ZEBRA_IFA_EXPIRES);
}
ifc->expires = current->expires; // HSA - need to copy over address expiration info if we are to explicitly withdraw a route
connected_withdraw (current); /* implicit withdraw - freebsd does this */
}
return ifc;
}
示例14: nsm_reset_nbr
void
nsm_reset_nbr (struct ospf_neighbor *nbr)
{
/* Clear Database Summary list. */
if (!ospf_db_summary_isempty (nbr))
ospf_db_summary_clear (nbr);
/* Clear Link State Request list. */
if (!ospf_ls_request_isempty (nbr))
ospf_ls_request_delete_all (nbr);
/* Clear Link State Retransmission list. */
if (!ospf_ls_retransmit_isempty (nbr))
ospf_ls_retransmit_clear (nbr);
/* Cancel thread. */
OSPF_NSM_TIMER_OFF (nbr->t_db_desc);
OSPF_NSM_TIMER_OFF (nbr->t_ls_req);
OSPF_NSM_TIMER_OFF (nbr->t_ls_upd);
OSPF_NSM_TIMER_OFF (nbr->t_hello_reply);
#ifdef HAVE_OPAQUE_LSA
if (CHECK_FLAG (nbr->options, OSPF_OPTION_O))
UNSET_FLAG (nbr->options, OSPF_OPTION_O);
#endif /* HAVE_OPAQUE_LSA */
}
示例15: ospf_vl_unapprove
void ospf_vl_unapprove(struct ospf *ospf)
{
struct listnode *node;
struct ospf_vl_data *vl_data;
for (ALL_LIST_ELEMENTS_RO(ospf->vlinks, node, vl_data))
UNSET_FLAG(vl_data->flags, OSPF_VL_FLAG_APPROVED);
}