Exemplo n.º 1
0
u_char *
ipCidrNumber (struct variable *v, oid objid[], size_t *objid_len,
	    int exact, size_t *val_len, WriteMethod **write_method)
{
  static int result;
  struct route_node *np;

  if (smux_header_generic(v, objid, objid_len, exact, val_len, write_method) == MATCH_FAILED)
    return NULL;

  /* Return number of routing entries. */
  result = 0;
  for (np = route_top (rib_table_ipv4); np; np = route_next (np))
    result++;

  return (u_char *)&result;
}
Exemplo n.º 2
0
static u_char *
rip2Globals (struct variable *v, oid name[], size_t *length,
	     int exact, size_t *var_len, WriteMethod **write_method)
{
  if (smux_header_generic(v, name, length, exact, var_len, write_method)
      == MATCH_FAILED)
    return NULL;

  /* Retrun global counter. */
  switch (v->magic)
    {
    case RIP2GLOBALROUTECHANGES:
      return SNMP_INTEGER (rip_global_route_changes);
      break;
    case RIP2GLOBALQUERIES:
      return SNMP_INTEGER (rip_global_queries);
      break;
    default:
      return NULL;
      break;
    }
  return NULL;
}
Exemplo n.º 3
0
u_char *
ipCidrNumber (struct variable *v, oid objid[], size_t *objid_len,
	      int exact, size_t *val_len, WriteMethod **write_method)
{
  static int result;
  struct route_table *table;
  struct route_node *rn;
  struct rib *rib;

  if (smux_header_generic(v, objid, objid_len, exact, val_len, write_method) == MATCH_FAILED)
    return NULL;

  table = vrf_table (AFI_IP, SAFI_UNICAST, 0);
  if (! table)
    return 0;

  /* Return number of routing entries. */
  result = 0;
  for (rn = route_top (table); rn; rn = route_next (rn))
    for (rib = rn->info; rib; rib = rib->next)
      result++;

  return (u_char *)&result;
}
Exemplo n.º 4
0
static u_char *
ospfv3GeneralGroup (struct variable *v, oid *name, size_t *length,
                    int exact, size_t *var_len, WriteMethod **write_method)
{
  /* 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:                  /* 1*/
      /* Router-ID of this OSPF instance. */
      if (ospf6)
	return SNMP_IPADDRESS (INT32_INADDR (ospf6->router_id));
      else
	return SNMP_IPADDRESS (ospf6_empty_id);
      break;
    case OSPFv3ADMINSTAT:                 /* 2*/
      break;
    case OSPFv3VERSIONNUMBER:             /* 3*/
      break;
    case OSPFv3AREABDRRTRSTATUS:          /* 4*/
      break;
    case OSPFv3ASBDRRTRSTATUS:            /* 5*/
      break;
    case OSPFv3ASSCOPELSACOUNT:           /* 6*/
      break;
    case OSPFv3ASSCOPELSACHECKSUMSUM:     /* 7*/
      break;
    case OSPFv3ORIGINATENEWLSAS:          /* 8*/
      break;
    case OSPFv3RXNEWLSAS:                 /* 9*/
      break;
    case OSPFv3EXTLSACOUNT:               /*10*/
      break;
    case OSPFv3EXTAREALSDBLIMIT:          /*11*/
      break;
    case OSPFv3MULTICASTEXTENSIONS:       /*12*/
      break;
    case OSPFv3EXITOVERFLOWINTERVAL:      /*13*/
      break;
    case OSPFv3DEMANDEXTENSIONS:          /*14*/
      break;
    case OSPFv3TRAFFICENGINEERINGSUPPORT: /*15*/
      break;
    case OSPFv3REFERENCEBANDWIDTH:        /*16*/
      break;
    case OSPFv3RESTARTSUPPORT:            /*17*/
      break;
    case OSPFv3RESTARTINTERVAL:           /*18*/
      break;
    case OSPFv3RESTARTSTATUS:             /*19*/
      break;
    case OSPFv3RESTARTAGE:                /*20*/
      break;
    case OSPFv3RESTARTEXITREASON:         /*21*/
      break;
    default:
      return NULL;
    }
  return NULL;
}
Exemplo n.º 5
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;
}