void
ospf6_abr_reimport (struct ospf6_area *oa)
{
  struct ospf6_lsa *lsa;
  u_int16_t type;

  type = htons (OSPF6_LSTYPE_INTER_ROUTER);
  for (lsa = ospf6_lsdb_type_head (type, oa->lsdb); lsa;
       lsa = ospf6_lsdb_type_next (type, lsa))
    ospf6_abr_examin_summary (lsa, oa);

  type = htons (OSPF6_LSTYPE_INTER_PREFIX);
  for (lsa = ospf6_lsdb_type_head (type, oa->lsdb); lsa;
       lsa = ospf6_lsdb_type_next (type, lsa))
    ospf6_abr_examin_summary (lsa, oa);
}
Esempio n. 2
0
void
ospf6_lsdb_show (struct vty *vty, int level,
                 u_int16_t *type, u_int32_t *id, u_int32_t *adv_router,
                 struct ospf6_lsdb *lsdb)
{
  struct ospf6_lsa *lsa;
  void (*showfunc) (struct vty *, struct ospf6_lsa *) = NULL;

  if (level == OSPF6_LSDB_SHOW_LEVEL_NORMAL)
    showfunc = ospf6_lsa_show_summary;
  else if (level == OSPF6_LSDB_SHOW_LEVEL_DETAIL)
    showfunc = ospf6_lsa_show;
  else if (level == OSPF6_LSDB_SHOW_LEVEL_INTERNAL)
    showfunc = ospf6_lsa_show_internal;
  else if (level == OSPF6_LSDB_SHOW_LEVEL_DUMP)
    showfunc = ospf6_lsa_show_dump;

  if (type && id && adv_router)
    {
      lsa = ospf6_lsdb_lookup (*type, *id, *adv_router, lsdb);
      if (lsa)
        {
          if (level == OSPF6_LSDB_SHOW_LEVEL_NORMAL)
            ospf6_lsa_show (vty, lsa);
          else
            (*showfunc) (vty, lsa);
        }
      return;
    }

  if (level == OSPF6_LSDB_SHOW_LEVEL_NORMAL)
    ospf6_lsa_show_summary_header (vty);

  if (type && adv_router)
    lsa = ospf6_lsdb_type_router_head (*type, *adv_router, lsdb);
  else if (type)
    lsa = ospf6_lsdb_type_head (*type, lsdb);
  else
    lsa = ospf6_lsdb_head (lsdb);
  while (lsa)
    {
      if ((! adv_router || lsa->header->adv_router == *adv_router) &&
          (! id || lsa->header->id == *id))
        (*showfunc) (vty, lsa);

      if (type && adv_router)
        lsa = ospf6_lsdb_type_router_next (*type, *adv_router, lsa);
      else if (type)
        lsa = ospf6_lsdb_type_next (*type, lsa);
      else
        lsa = ospf6_lsdb_next (lsa);
    }
}
Esempio n. 3
0
static u_char *
ospfv3GeneralGroup (struct variable *v, oid *name, size_t *length,
                    int exact, size_t *var_len, WriteMethod **write_method)
{
  u_int16_t sum;
  u_int32_t count;
  struct ospf6_lsa *lsa = NULL;

  /* Check whether the instance identifier is valid */
  if (smux_header_generic (v, name, length, exact, var_len, write_method)
      == MATCH_FAILED)
    return NULL;

  /* Return the current value of the variable */
  switch (v->magic)
    {
    case OSPFv3ROUTERID:
      /* Router-ID of this OSPF instance. */
      if (ospf6)
	return SNMP_INTEGER (ntohl (ospf6->router_id));
      return SNMP_INTEGER (0);
    case OSPFv3ADMINSTAT:
      if (ospf6)
	return SNMP_INTEGER (CHECK_FLAG (ospf6->flag, OSPF6_DISABLED)?
			     OSPF_STATUS_DISABLED:OSPF_STATUS_ENABLED);
      return SNMP_INTEGER (OSPF_STATUS_DISABLED);
    case OSPFv3VERSIONNUMBER:
      return SNMP_INTEGER (3);
    case OSPFv3AREABDRRTRSTATUS:
      if (ospf6)
	return SNMP_INTEGER (ospf6_is_router_abr (ospf6)?SNMP_TRUE:SNMP_FALSE);
      return SNMP_INTEGER (SNMP_FALSE);
    case OSPFv3ASBDRRTRSTATUS:
      if (ospf6)
	return SNMP_INTEGER (ospf6_asbr_is_asbr (ospf6)?SNMP_TRUE:SNMP_FALSE);
      return SNMP_INTEGER (SNMP_FALSE);
    case OSPFv3ASSCOPELSACOUNT:
      if (ospf6)
	return SNMP_INTEGER (ospf6->lsdb->count);
      return SNMP_INTEGER (0);
    case OSPFv3ASSCOPELSACHECKSUMSUM:
      if (ospf6)
        {
          for (sum = 0, lsa = ospf6_lsdb_head (ospf6->lsdb);
               lsa;
               lsa = ospf6_lsdb_next (lsa))
            sum += ntohs (lsa->header->checksum);
          return SNMP_INTEGER (sum);
        }
      return SNMP_INTEGER (0);
    case OSPFv3ORIGINATENEWLSAS:
      return SNMP_INTEGER (0);	/* Don't know where to get this value... */
    case OSPFv3RXNEWLSAS:
      return SNMP_INTEGER (0);	/* Don't know where to get this value... */
    case OSPFv3EXTLSACOUNT:
      if (ospf6)
        {
          for (count = 0, lsa = ospf6_lsdb_type_head (htons (OSPF6_LSTYPE_AS_EXTERNAL),
                                                      ospf6->lsdb);
               lsa;
               lsa = ospf6_lsdb_type_next (htons (OSPF6_LSTYPE_AS_EXTERNAL),
                                           lsa))
            count += 1;
          return SNMP_INTEGER (count);
        }
      return SNMP_INTEGER (0);
    case OSPFv3EXTAREALSDBLIMIT:
      return SNMP_INTEGER (-1);
    case OSPFv3EXITOVERFLOWINTERVAL:
      return SNMP_INTEGER (0);	/* Not supported */
    case OSPFv3DEMANDEXTENSIONS:
      return SNMP_INTEGER (0);	/* Not supported */
    case OSPFv3REFERENCEBANDWIDTH:
      return SNMP_INTEGER (100000);
    case OSPFv3RESTARTSUPPORT:
    case OSPFv3RESTARTINTERVAL:
    case OSPFv3RESTARTSTRICTLSACHECKING:
    case OSPFv3RESTARTSTATUS:
    case OSPFv3RESTARTAGE:
    case OSPFv3RESTARTEXITREASON:
    case OSPFv3NOTIFICATIONENABLE:
    case OSPFv3STUBROUTERSUPPORT:
    case OSPFv3STUBROUTERADVERTISEMENT:
    case OSPFv3DISCONTINUITYTIME:
    case OSPFv3RESTARTTIME:
      /* TODO: Not implemented */
      return NULL;
    }
  return NULL;
}