Esempio n. 1
0
void
ospf6_area_show (struct vty *vty, struct ospf6_area *o6a)
{
  listnode i;
  struct ospf6_interface *o6i;

  vty_out (vty, " Area %s%s", o6a->str, VTY_NEWLINE);
  vty_out (vty, "     Number of Area scoped LSAs is %u%s",
           o6a->lsdb->count, VTY_NEWLINE);

  ospf6_spf_statistics_show (vty, o6a->spf_tree);

  vty_out (vty, "     Interface attached to this area:");
  for (i = listhead (o6a->if_list); i; nextnode (i))
    {
      o6i = (struct ospf6_interface *) getdata (i);
      vty_out (vty, " %s", o6i->interface->name);
    }
  vty_out (vty, "%s", VTY_NEWLINE);

  for (i = listhead (o6a->if_list); i; nextnode (i))
    {
      o6i = (struct ospf6_interface *) getdata (i);
      if (listcount (o6i->neighbor_list) != 0)
        ospf6_interface_statistics_show (vty, o6i);
    }
}
Esempio n. 2
0
void
ospf6_abr_examin_brouter (u_int32_t router_id)
{
  struct ospf6_lsa *lsa;
  struct ospf6_area *oa;
  listnode node;
  u_int16_t type;

  type = htons (OSPF6_LSTYPE_INTER_ROUTER);
  for (node = listhead (ospf6->area_list); node; nextnode (node))
    {
      oa = OSPF6_AREA (getdata (node));
      for (lsa = ospf6_lsdb_type_router_head (type, router_id, oa->lsdb); lsa;
           lsa = ospf6_lsdb_type_router_next (type, router_id, lsa))
        ospf6_abr_examin_summary (lsa, oa);
    }

  type = htons (OSPF6_LSTYPE_INTER_PREFIX);
  for (node = listhead (ospf6->area_list); node; nextnode (node))
    {
      oa = OSPF6_AREA (getdata (node));
      for (lsa = ospf6_lsdb_type_router_head (type, router_id, oa->lsdb); lsa;
           lsa = ospf6_lsdb_type_router_next (type, router_id, lsa))
        ospf6_abr_examin_summary (lsa, oa);
    }
}
Esempio n. 3
0
/* Lookup interface by IPv4 address. */
struct interface *
if_lookup_exact_address (struct in_addr src)
{
  listnode node;
  listnode cnode;
  struct interface *ifp;
  struct prefix *p;
  struct connected *c;

  for (node = listhead (iflist); node; nextnode (node))
    {
      ifp = getdata (node);

      for (cnode = listhead (ifp->connected); cnode; nextnode (cnode))
	{
	  c = getdata (cnode);

	  p = c->address;

	  if (p && p->family == AF_INET)
	    {
	      if (IPV4_ADDR_SAME (&p->u.prefix4, &src))
		return ifp;
	    }	      
	}
    }
  return NULL;
}
Esempio n. 4
0
static int
bfd_ioctl_state_change (struct bfd_nl_peerinfo *peerinfo)
{
	struct bfd_peer peer;
	struct zserv *client;
	struct listnode *node;


	if (IS_ZEBRA_DEBUG_KERNEL)
		zlog_info ("rcvd peerinfo %s: state=%d, ifindex=%d",
		    sockunion_log ((union sockunion *) &peerinfo->dst),
		    peerinfo->state, peerinfo->ifindex);

	memcpy (&peer.su, &peerinfo->dst.sa, sizeof (union sockunion));
	peer.ifindex = peerinfo->ifindex;

	if (peerinfo->state == BSM_Up)
	{
		for (node = listhead (client_list); node; nextnode (node))
			if ((client = getdata (node)) != NULL)
				zsend_bfd_peer_up (client, &peer);
	}
	else if (peerinfo->state == BSM_Down)
	{
		for (node = listhead (client_list); node; nextnode (node))
			if ((client = getdata (node)) != NULL)
				zsend_bfd_peer_down (client, &peer);
	}
	else
	{
	}

	return 0;
}
Esempio n. 5
0
File: zserv.c Progetto: OPSF/uClinux
/* Register zebra server interface information.  Send current all
   interface and address information. */
static void
zread_interface_add (struct zserv *client, u_short length)
{
  struct listnode *ifnode;
  struct listnode *cnode;
  struct interface *ifp;
  struct connected *c;

  /* Interface information is needed. */
  client->ifinfo = 1;

  for (ifnode = listhead (iflist); ifnode; ifnode = nextnode (ifnode))
    {
      ifp = getdata (ifnode);

      /* Skip pseudo interface. */
      if (! CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE))
	continue;

      zsend_interface_add (client, ifp);

      for (cnode = listhead (ifp->connected); cnode; nextnode (cnode))
	{
	  c = getdata (cnode);
	  if (CHECK_FLAG (c->conf, ZEBRA_IFC_REAL))
	    zsend_interface_address (ZEBRA_INTERFACE_ADDRESS_ADD, client, 
				     ifp, c);
	}
    }
}
Esempio n. 6
0
void *Safe_malloc(int numbytes)
{

  unsigned *end,*end1,          /* MARKS THE 1st BLOCK SEARCHED (SEARCH
				   TERMINATION MARKER) */
	   *newblock;           /* THE NEW SEGMENT PULLED OUT OF THE HOLE */
  long int numwords;            /* THE MINIMUM SIZE OF THE NEW SEGMENT */
  int intflag;                  /* SAVES THE STATE OF THE INTERRUPT FLAG */

  if (current == NULL)          /* NO ROOM AT THE INN... */
    return (NULL);

  intflag = Mod_int(INT_DISABLE);

  numwords = BYTE_TO_WORD(numbytes);    /* FREE MEMORY STRUCTURE IS UNSIGNED */
  if (numwords < SMALLEST_BLOCK)
    numwords = SMALLEST_BLOCK;
  end = current;                /* THE SEARCH TERMINATION MARKER */
  newblock = NULL;              /* INITIALIZE IN CASE SEARCH FAILS */

  /* FIND USING FIRST-FIT SELECTION METHOD */
  do
  {
    if (bottom_tag(current)->size >= numwords)  /* SEARCH FOR NEXT FIT HOLE */
      extract(current, numwords, &newblock);  /* GET IT IF FOUND */
    current = nextnode(current); /* ELSE CHECK NEXT HOLE */



    end1 = current;             /* THE SEARCH TERMINATION MARKER */

    /* FIND USING FIRST-FIT SELECTION METHOD */
    do
    {
      current = nextnode(current); /* ELSE CHECK NEXT HOLE */
    }
    while ( (current != end1) );        /* OR UNTIL NO MORE HOLES */


  }
  while ( (newblock == NULL)            /* REPEAT UNTIL FOUND A HOLE */
	  && (current != end) );        /* OR UNTIL NO MORE HOLES */


  if (newblock == NULL)
    end = end1;

  Mod_int(intflag);                      /* RESTORE INTERRUPTS */
  return ((void *)newblock);
}
Esempio n. 7
0
/* elect DR and BDR. Refer to RFC2319 section 9.4 */
struct ospf_neighbor *
ospf_dr_election_sub (struct list *routers)
{
  struct listnode *node;
  struct ospf_neighbor *nbr, *max = NULL;

  /* Choose highest router priority.
     In case of tie, choose highest Router ID. */
  for (node = listhead (routers); node; nextnode (node))
    {
      nbr = getdata (node);

      if (max == NULL)
	max = nbr;
      else
	{
	  if (max->priority < nbr->priority)
	    max = nbr;
	  else if (max->priority == nbr->priority)
	    if (IPV4_ADDR_CMP (&max->router_id, &nbr->router_id) < 0)
	      max = nbr;
	}
    }

  return max;
}
Esempio n. 8
0
/*
 * When we recieve a NULL list, we will know its p2p
 */
void
isis_delete_adj (struct isis_adjacency *adj, struct list *adjdb)
{
  struct isis_adjacency *adj2;
  struct listnode *node;

  if (adjdb)
    {
      for (node = listhead (adjdb); node; nextnode (node))
	{
	  adj2 = getdata (node);
	  if (adj2 == adj)
	    break;
	}
      listnode_delete (adjdb, adj);
    }

  if (adj->ipv4_addrs)
    list_delete (adj->ipv4_addrs);
#ifdef HAVE_IPV6
  if (adj->ipv6_addrs)
    list_delete (adj->ipv6_addrs);
#endif
  if (adj)
    {
      XFREE (MTYPE_ISIS_ADJACENCY, adj);
    }
  else
    {
      zlog_warn ("tried to delete a non-existent adjacency");
    }

  return;
}
Esempio n. 9
0
/*
*  check if interface with given address is configured and
*  return it if yes.
*/
struct ospf_interface *
ospf_if_is_configured (struct ospf *ospf, struct in_addr *address)
{
  listnode node;
  struct ospf_interface *oi;
  struct prefix *addr;
  struct prefix query_addr;
  
  for (node = listhead (ospf->oiflist); node; nextnode (node))
    if ((oi = getdata (node)) != NULL && oi->type != OSPF_IFTYPE_VIRTUALLINK)
      {
/*	if (oi->type == OSPF_IFTYPE_POINTOPOINT)
	  addr = oi->connected->destination;
	else
*/
	  addr = oi->address;

	  query_addr.family = AF_INET;
	  query_addr.u.prefix4 = *address;
	  query_addr.prefixlen = IPV4_ALLOWABLE_BITLEN_P2P;
	  
	if (oi->type == OSPF_IFTYPE_POINTOPOINT && 
	     prefix_match (addr, &query_addr))
	     return oi;
	else if (IPV4_ADDR_SAME (address, &addr->u.prefix4))
	  return oi;
      }

  return NULL;
}
Esempio n. 10
0
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");
}
Esempio n. 11
0
void
isis_adj_build_up_list (struct list *adjdb, struct list *list)
{
  struct isis_adjacency *adj;
  struct listnode *node;

  if (!list)
    {
      zlog_warn ("isis_adj_build_up_list(): NULL list");
      return;
    }

  for (node = listhead (adjdb); node; nextnode (node))
    {
      adj = getdata (node);

      if (!adj)
	{
	  zlog_warn ("isis_adj_build_up_list(): NULL adj");
	  return;
	}

      if (adj->adj_state == ISIS_ADJ_UP)
	listnode_add (list, adj);
    }

  return;
}
Esempio n. 12
0
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!");
           }
        }
    }
}
Esempio n. 13
0
void
ripng_connect_set (struct interface *ifp, int set)
{
  struct listnode *nn;
  struct connected *connected;
  struct prefix_ipv6 address;

  for (nn = listhead (ifp->connected); nn; nextnode (nn))
    if ((connected = getdata (nn)) != NULL) {
      struct prefix *p;
      p = connected->address;

      if (p->family != AF_INET6)
        continue;

      address.family = AF_INET6;
      address.prefix = p->u.prefix6;
      address.prefixlen = p->prefixlen;
      apply_mask_ipv6 (&address);

      if (set) {
        /* Check once more wether this prefix is within a "network IF_OR_PREF" one */
        if ((ripng_enable_if_lookup(connected->ifp->name) >= 0) ||
            (ripng_enable_network_lookup2(connected) >= 0))
          ripng_redistribute_add (ZEBRA_ROUTE_CONNECT, RIPNG_ROUTE_INTERFACE,
                                  &address, connected->ifp->ifindex, NULL);
      } else {
        ripng_redistribute_delete (ZEBRA_ROUTE_CONNECT, RIPNG_ROUTE_INTERFACE,
                                   &address, connected->ifp->ifindex);
        if (ripng_redistribute_check (ZEBRA_ROUTE_CONNECT))
          ripng_redistribute_add (ZEBRA_ROUTE_CONNECT, RIPNG_ROUTE_REDISTRIBUTE,
                                  &address, connected->ifp->ifindex, NULL);
      }
    }
}
Esempio n. 14
0
struct ospf_interface *
ospf_if_lookup_by_prefix (struct ospf *ospf, struct prefix_ipv4 *p)
{
  struct listnode *node;
  struct ospf_interface *oi;
  struct prefix ptmp;
  
  /* Check each Interface. */
  for (node = listhead (ospf->oiflist); node; nextnode (node))
    {
      if ((oi = getdata (node)) != NULL && oi->type != OSPF_IFTYPE_VIRTUALLINK)
	{
	  if ((oi->type == OSPF_IFTYPE_POINTOPOINT) &&
	      CONNECTED_DEST_HOST(oi->connected))
	    {
	      prefix_copy (&ptmp, oi->connected->destination);
	      ptmp.prefixlen = IPV4_MAX_BITLEN;
	    }
	  else
	    prefix_copy (&ptmp, oi->address);
	
	  apply_mask (&ptmp);
	  if (prefix_same (&ptmp, (struct prefix *) p))
	    return oi;
	}
    }
  return NULL;
}
Esempio n. 15
0
void
ripng_interface_reset () {
  struct listnode *node;
  struct interface *ifp;
  struct ripng_interface *ri;

  for (node = listhead (iflist); node; nextnode (node))
    {
      ifp = getdata (node);
      ri = ifp->info;

      ri->enable_network = 0;
      ri->enable_interface = 0;
      ri->running = 0;

      ri->split_horizon = RIPNG_NO_SPLIT_HORIZON;
      ri->split_horizon_default = RIPNG_NO_SPLIT_HORIZON;

      ri->list[RIPNG_FILTER_IN] = NULL;
      ri->list[RIPNG_FILTER_OUT] = NULL;

      ri->prefix[RIPNG_FILTER_IN] = NULL;
      ri->prefix[RIPNG_FILTER_OUT] = NULL;

      if (ri->t_wakeup)
        {
          thread_cancel (ri->t_wakeup);
          ri->t_wakeup = NULL;
        }

      ri->passive = 0;
    }
}
Esempio n. 16
0
/* Check wether the interface has at least a connected prefix that
 * is within the ripng_enable_network table. */
int
ripng_enable_network_lookup_if (struct interface *ifp)
{
  struct listnode *listnode;
  struct connected *connected;
  struct prefix_ipv6 address;

  for (listnode = listhead (ifp->connected); listnode; nextnode (listnode))
    if ((connected = getdata (listnode)) != NULL)
      {
	struct prefix *p; 
	struct route_node *node;

	p = connected->address;

	if (p->family == AF_INET6)
	  {
	    address.family = AF_INET6;
	    address.prefix = p->u.prefix6;
	    address.prefixlen = IPV6_MAX_BITLEN;

	    node = route_node_match (ripng_enable_network,
			             (struct prefix *)&address);
	    if (node)
	      {
		route_unlock_node (node);
		return 1;
	      }
	  }
      }
  return -1;
}
Esempio n. 17
0
int
kernel_bfd_delete_peer (struct bfd_peer *peer, char appid)
{
	struct bfd_peer *tmp_peer;
	struct listnode *node;
	char *tmp_appid;

	tmp_peer = bfd_peer_lookup (&peer->su, peer->ifindex, peer->type);
	if (!tmp_peer)
		return 0;

	for (node = listhead (tmp_peer->appid_lst); node; nextnode (node))
	{
		tmp_appid = getdata (node);
		if (*tmp_appid == appid)
			break;
		tmp_appid = NULL;
	}

	if (!tmp_appid)
		return 0;

	listnode_delete (tmp_peer->appid_lst, (void *) tmp_appid);
	if (listcount (tmp_peer->appid_lst) == 0)
	{
		list_delete (tmp_peer->appid_lst);
		listnode_delete (bfd_peer_list, tmp_peer);
		bfd_ioctl_peer (BFD_DELPEER, tmp_peer);
		XFREE (MTYPE_BFD_PEER, tmp_peer);
	}

	return 0;
}
Esempio n. 18
0
void
ospf_abr_remove_unapproved_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_remove_unapproved_summaries(): Start");

  for (node = listhead (ospf->areas); node; nextnode (node))
    {
      area = getdata (node);

      if (IS_DEBUG_OSPF_EVENT)
	zlog_info ("ospf_abr_remove_unapproved_summaries(): "
		   "looking at area %s", inet_ntoa (area->area_id));

      LSDB_LOOP (SUMMARY_LSDB (area), rn, lsa)
	if (ospf_lsa_is_self_originated (ospf, lsa))
	  if (!CHECK_FLAG (lsa->flags, OSPF_LSA_APPROVED))
	    ospf_lsa_flush_area (lsa, area);

      LSDB_LOOP (ASBR_SUMMARY_LSDB (area), rn, lsa)
	if (ospf_lsa_is_self_originated (ospf, lsa))
	  if (!CHECK_FLAG (lsa->flags, OSPF_LSA_APPROVED))
	    ospf_lsa_flush_area (lsa, area);
    }
 
  if (IS_DEBUG_OSPF_EVENT)
    zlog_info ("ospf_abr_remove_unapproved_summaries(): Stop");
}
Esempio n. 19
0
void
ospf_abr_prepare_aggregates (struct ospf *ospf)
{
  listnode node;
  struct route_node *rn;
  struct ospf_area_range *range;

  if (IS_DEBUG_OSPF_EVENT)
    zlog_info ("ospf_abr_prepare_aggregates(): Start");

  for (node = listhead (ospf->areas); node; nextnode (node))
    {
      struct ospf_area *area = getdata (node);

      for (rn = route_top (area->ranges); rn; rn = route_next (rn))
	if ((range = rn->info) != NULL)
	  {
	    range->cost = 0;
	    range->specifics = 0;
	  }
    }

  if (IS_DEBUG_OSPF_EVENT)
    zlog_info ("ospf_abr_prepare_aggregates(): Stop");
}
Esempio n. 20
0
void
isis_adj_print (struct isis_adjacency *adj)
{
  struct isis_dynhn *dyn;
  struct listnode *node;
  struct in_addr *ipv4_addr;
#ifdef HAVE_IPV6
  struct in6_addr *ipv6_addr;
  u_char ip6[INET6_ADDRSTRLEN];
#endif /* HAVE_IPV6 */

  if (!adj)
    return;
  dyn = dynhn_find_by_id (adj->sysid);
  if (dyn)
    zlog_debug ("%s", dyn->name.name);

  zlog_debug ("SystemId %20s SNPA %s, level %d\nHolding Time %d",
	      adj->sysid ? sysid_print (adj->sysid) : "unknown",
	      snpa_print (adj->snpa), adj->level, adj->hold_time);
  if (adj->ipv4_addrs && listcount (adj->ipv4_addrs) > 0)
    {
      zlog_debug ("IPv4 Addresses:");

      for (node = listhead (adj->ipv4_addrs); node; nextnode (node))
	{
	  ipv4_addr = getdata (node);
	  zlog_debug ("%s", inet_ntoa (*ipv4_addr));
	}
    }

#ifdef HAVE_IPV6
  if (adj->ipv6_addrs && listcount (adj->ipv6_addrs) > 0)
    {
      zlog_debug ("IPv6 Addresses:");
      for (node = listhead (adj->ipv6_addrs); node; nextnode (node))
	{
	  ipv6_addr = getdata (node);
	  inet_ntop (AF_INET6, ipv6_addr, (char *)ip6, INET6_ADDRSTRLEN);
	  zlog_debug ("%s", ip6);
	}
    }
#endif /* HAVE_IPV6 */
  zlog_debug ("Speaks: %s", nlpid2string (&adj->nlpids));

  return;
}
Esempio n. 21
0
void
ospf_vl_unapprove (struct ospf *ospf)
{
  struct listnode *node;
  struct ospf_vl_data *vl_data;

  for (node = listhead (ospf->vlinks); node; nextnode (node))
    if ((vl_data = getdata (node)) != NULL)
      UNSET_FLAG (vl_data->flags, OSPF_VL_FLAG_APPROVED);
}
Esempio n. 22
0
void
ospf_vl_shut_unapproved (struct ospf *ospf)
{
  struct listnode *node;
  struct ospf_vl_data *vl_data;

  for (node = listhead (ospf->vlinks); node; nextnode (node))
    if ((vl_data = getdata (node)) != NULL)
      if (!CHECK_FLAG (vl_data->flags, OSPF_VL_FLAG_APPROVED))
        ospf_vl_shutdown (vl_data);
}
Esempio n. 23
0
void
ospf_abr_announce_rtr (struct ospf *ospf,
		       struct prefix_ipv4 *p, struct ospf_route *or)
{
  listnode node;
  struct ospf_area *area;

  if (IS_DEBUG_OSPF_EVENT)
    zlog_info ("ospf_abr_announce_rtr(): Start");

  for (node = listhead (ospf->areas); node; nextnode (node))
    {
      area = getdata (node);

      if (IS_DEBUG_OSPF_EVENT)
	zlog_info ("ospf_abr_announce_rtr(): looking at area %s",
		   inet_ntoa (area->area_id));

      if (IPV4_ADDR_SAME (&or->u.std.area_id, &area->area_id))
	continue;

      if (ospf_abr_nexthops_belong_to_area (or, area))
	continue;

      if (area->external_routing != OSPF_AREA_DEFAULT)
	{
	  if (IS_DEBUG_OSPF_EVENT)
	    zlog_info ("ospf_abr_announce_network(): "
		       "area %s doesn't support external routing",
		       inet_ntoa(area->area_id));
          continue;
	}

      if (or->path_type == OSPF_PATH_INTER_AREA)
	{
	  if (IS_DEBUG_OSPF_EVENT)
	    zlog_info ("ospf_abr_announce_rtr(): "
		       "this is inter-area route to %s", inet_ntoa (p->prefix));
          if (!OSPF_IS_AREA_BACKBONE (area))
	    ospf_abr_announce_rtr_to_area (p, or->cost, area);
	}

      if (or->path_type == OSPF_PATH_INTRA_AREA)
	{
	  if (IS_DEBUG_OSPF_EVENT)
	    zlog_info ("ospf_abr_announce_rtr(): "
		       "this is intra-area route to %s", inet_ntoa (p->prefix));
          ospf_abr_announce_rtr_to_area (p, or->cost, area);
	}
    }

  if (IS_DEBUG_OSPF_EVENT)
    zlog_info ("ospf_abr_announce_rtr(): Stop");
}
ter pathcursor::reverseliquidity () const
{
    // every account has a transfer rate for its issuances.

    // tomove: the account charges
    // a fee when third parties transfer that account's own issuances.

    // node.transferrate_ caches the output transfer rate for this node.
    node().transferrate_ = amountfromrate (
        rippletransferrate (ledger(), node().issue_.account));

    if (node().isaccount ())
        return reverseliquidityforaccount ();

    // otherwise the node is an offer.
    if (isnative (nextnode().account_))
    {
        writelog (lstrace, ripplecalc)
            << "reverseliquidityforoffer: "
            << "offer --> offer: nodeindex_=" << nodeindex_;
        return tessuccess;

        // this control structure ensures delivernodereverse is only called for the
        // rightmost offer in a chain of offers - which means that
        // delivernodereverse has to take all of those offers into consideration.
    }

    // next is an account node, resolve current offer node's deliver.
    stamount sadeliveract;

    writelog (lstrace, ripplecalc)
        << "reverseliquidityforoffer: offer --> account:"
        << " nodeindex_=" << nodeindex_
        << " sarevdeliver=" << node().sarevdeliver;

    // the next node wants the current node to deliver this much:
    return delivernodereverse (
        nextnode().account_,
        node().sarevdeliver,
        sadeliveract);
}
Esempio n. 25
0
void
isis_adjdb_iterate (struct list *adjdb, void (*func) (struct isis_adjacency *,
						      void *), void *arg)
{
  struct listnode *node;
  struct isis_adjacency *adj;
  for (node = listhead (adjdb); node; nextnode (node))
    {
      adj = getdata (node);
      (*func) (adj, arg);
    }
}
Esempio n. 26
0
struct ospf_area_range *
ospf_area_range_match_any (struct ospf *ospf, struct prefix_ipv4 *p)
{
  struct ospf_area_range *range;
  listnode node;

  for (node = listhead (ospf->areas); node; nextnode (node))
    if ((range = ospf_area_range_match (node->data, p)))
      return range;

  return NULL;
}
Esempio n. 27
0
void
ripng_passive_interface_apply_all (void)
{
  struct interface *ifp;
  struct listnode *node;

  for (node = listhead (iflist); node; nextnode (node))
    {
      ifp = getdata (node);
      ripng_passive_interface_apply (ifp);
    }
}
Esempio n. 28
0
void
globlist(LinkList list)
{
    LinkNode node, next;

    badcshglob = 0;
    for (node = firstnode(list); !errflag && node; node = next) {
	next = nextnode(node);
	glob(list, node);
    }
    if (badcshglob == 1)
	zerr("no match", NULL, 0);
}
Esempio n. 29
0
static void
ospf6_area_foreach_neighbor (struct ospf6_area *o6a, void *arg, int val,
                             void (*func) (void *, int, void *))
{
  listnode node;
  struct ospf6_interface *o6i;

  for (node = listhead (o6a->if_list); node; nextnode (node))
    {
      o6i = (struct ospf6_interface *) getdata (node);
      (*o6i->foreach_nei) (o6i, arg, val, func);
    }
}
Esempio n. 30
0
void
ospf_vl_up_check (struct ospf_area *area, struct in_addr rid,
                  struct vertex *v)
{
  struct ospf *ospf = area->ospf;
  listnode node;
  struct ospf_vl_data *vl_data;
  struct ospf_interface *oi;

  if (IS_DEBUG_OSPF_EVENT)
    {
      zlog_info ("ospf_vl_up_check(): Start");
      zlog_info ("ospf_vl_up_check(): Router ID is %s", inet_ntoa (rid));
      zlog_info ("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_info ("ospf_vl_up_check(): considering VL, name: %s", 
		     vl_data->vl_oi->ifp->name);
	  zlog_info ("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_info ("ospf_vl_up_check(): this VL matched");

          if (oi->state == ISM_Down)
            {
	      if (IS_DEBUG_OSPF_EVENT)
		zlog_info ("ospf_vl_up_check(): VL is down, waking it up");
              SET_FLAG (oi->ifp->flags, IFF_UP);
              OSPF_ISM_EVENT_SCHEDULE (oi, ISM_InterfaceUp);
            }

          ospf_vl_set_params (vl_data, v);
        }
    }
}