diff options
Diffstat (limited to 'ospf6d')
| -rw-r--r-- | ospf6d/ChangeLog | 24 | ||||
| -rw-r--r-- | ospf6d/ospf6_asbr.c | 16 | ||||
| -rw-r--r-- | ospf6d/ospf6_interface.c | 31 | ||||
| -rw-r--r-- | ospf6d/ospf6_interface.h | 2 | ||||
| -rw-r--r-- | ospf6d/ospf6_intra.c | 10 | ||||
| -rw-r--r-- | ospf6d/ospf6_lsa.c | 15 | ||||
| -rw-r--r-- | ospf6d/ospf6_lsa.h | 4 | ||||
| -rw-r--r-- | ospf6d/ospf6_lsdb.c | 2 | ||||
| -rw-r--r-- | ospf6d/ospf6_main.c | 2 | ||||
| -rw-r--r-- | ospf6d/ospf6_message.c | 38 | ||||
| -rw-r--r-- | ospf6d/ospf6_message.h | 4 | ||||
| -rw-r--r-- | ospf6d/ospf6_neighbor.c | 2 | ||||
| -rw-r--r-- | ospf6d/ospf6_neighbor.h | 2 | ||||
| -rw-r--r-- | ospf6d/ospf6_proto.c | 2 | ||||
| -rw-r--r-- | ospf6d/ospf6_route.c | 16 | ||||
| -rw-r--r-- | ospf6d/ospf6_route.h | 12 | ||||
| -rw-r--r-- | ospf6d/ospf6_snmp.c | 8 | ||||
| -rw-r--r-- | ospf6d/ospf6_snmp.h | 2 | ||||
| -rw-r--r-- | ospf6d/ospf6_spf.c | 2 | ||||
| -rw-r--r-- | ospf6d/ospf6_spf.h | 2 | ||||
| -rw-r--r-- | ospf6d/ospf6_top.c | 6 | ||||
| -rw-r--r-- | ospf6d/ospf6d.c | 8 | 
22 files changed, 123 insertions, 87 deletions
| diff --git a/ospf6d/ChangeLog b/ospf6d/ChangeLog index 2628fecd..3142bea6 100644 --- a/ospf6d/ChangeLog +++ b/ospf6d/ChangeLog @@ -1,7 +1,29 @@  2004-10-10 Paul Jakma <paul@dishone.st>  	* Makefile.am: fix listing of ospf_snmp.c in noinst_HEADERS - +	* ospf6_route.c: Add const qualifier to various char arrays of +          constants. signed/unsigned fixes. +          (ospf6_linkstate_table_show) argv is const +        * ospf6_snmp.c: listnode typedef is dead. +          (ospf6_snmp_init) Take struct thread_master arg, needed for +          smux_init. +        * ospf6_snmp.h: update ospf6_snmp_init declaration. +        * ospf6d.c: (ospf6_init) add const qualifier to sargv, pass master +          to ospf_snmp6_init. +	* ospf6_asbr.c: const char update. +	* ospf6_interface.c: ditto, plus signed/unsigned fixes. +	  (ipv6_ospf6_cost) Check whether cost fits in u_int32_t and use +          strtoul. +	* ospf6_intra.c: const char update. Parenthesise expression. +	* ospf6_lsa.c: signed/unsigned and const char updates. +	* ospf6_proto.c: ditto. +	* ospf6_message.c: ditto. +	* ospf6_lsdb.c: signed/unsigned update. +	* ospf6_main.c: const char update. +	* ospf6_neighbor.c: ditto. +	* ospf6_spf.c: ditto. +	* ospf6_top.c: ditto. +	  2004-10-06  Yasuhiro Ohara  <yasu@sfc.wide.ad.jp>  	* ospf6_snmp.[ch], OSPFV3-MIB.txt: start supporting SNMP. diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 31050816..41da5e7e 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -50,11 +50,11 @@  unsigned char conf_debug_ospf6_asbr = 0; -char *zroute_name[] = +const char *zroute_name[] =  { "system", "kernel", "connected", "static",    "rip", "ripng", "ospf", "ospf6", "isis", "bgp", "unknown" }; -char *zroute_abname[] = +const char *zroute_abname[] =  { "X", "K", "C", "S", "R", "R", "O", "O", "I", "B", "?" };  #define ZROUTE_NAME(x)                                     \ @@ -365,7 +365,7 @@ ospf6_asbr_lsentry_remove (struct ospf6_route *asbr_entry)  /* redistribute function */  void -ospf6_asbr_routemap_set (int type, char *mapname) +ospf6_asbr_routemap_set (int type, const char *mapname)  {    if (ospf6->rmap[type].name)      free (ospf6->rmap[type].name); @@ -383,7 +383,7 @@ ospf6_asbr_routemap_unset (int type)  }  void -ospf6_asbr_routemap_update (char *mapname) +ospf6_asbr_routemap_update (const char *mapname)  {    int type; @@ -828,7 +828,7 @@ ospf6_routemap_rule_match_address_prefixlist (void *rule,  }  void * -ospf6_routemap_rule_match_address_prefixlist_compile (char *arg) +ospf6_routemap_rule_match_address_prefixlist_compile (const char *arg)  {    return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);  } @@ -867,7 +867,7 @@ ospf6_routemap_rule_set_metric_type (void *rule, struct prefix *prefix,  }  void * -ospf6_routemap_rule_set_metric_type_compile (char *arg) +ospf6_routemap_rule_set_metric_type_compile (const char *arg)  {    if (strcmp (arg, "type-2") && strcmp (arg, "type-1"))      return NULL; @@ -904,7 +904,7 @@ ospf6_routemap_rule_set_metric (void *rule, struct prefix *prefix,  }  void * -ospf6_routemap_rule_set_metric_compile (char *arg) +ospf6_routemap_rule_set_metric_compile (const char *arg)  {    u_int32_t metric;    char *endp; @@ -950,7 +950,7 @@ ospf6_routemap_rule_set_forwarding (void *rule, struct prefix *prefix,  }  void * -ospf6_routemap_rule_set_forwarding_compile (char *arg) +ospf6_routemap_rule_set_forwarding_compile (const char *arg)  {    struct in6_addr a;    if (inet_pton (AF_INET6, arg, &a) != 1) diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 85f908ed..99d5acbc 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -44,7 +44,7 @@  unsigned char conf_debug_ospf6_interface = 0; -char *ospf6_interface_state_str[] = +const char *ospf6_interface_state_str[] =  {    "None",    "Down", @@ -107,7 +107,7 @@ struct ospf6_interface *  ospf6_interface_create (struct interface *ifp)  {    struct ospf6_interface *oi; -  int iobuflen; +  unsigned int iobuflen;    oi = (struct ospf6_interface *)      XMALLOC (MTYPE_OSPF6_IF, sizeof (struct ospf6_interface)); @@ -261,7 +261,7 @@ void  ospf6_interface_if_add (struct interface *ifp)  {    struct ospf6_interface *oi; -  int iobuflen; +  unsigned int iobuflen;    oi = (struct ospf6_interface *) ifp->info;    if (oi == NULL) @@ -774,8 +774,8 @@ ospf6_interface_show (struct vty *vty, struct interface *ifp)    struct prefix *p;    struct listnode *i;    char strbuf[64], drouter[32], bdrouter[32]; -  char *updown[3] = {"down", "up", NULL}; -  char *type; +  const char *updown[3] = {"down", "up", NULL}; +  const char *type;    struct timeval res, now;    char duration[32];    struct ospf6_lsa *lsa; @@ -1058,7 +1058,7 @@ DEFUN (ipv6_ospf6_ifmtu,  {    struct ospf6_interface *oi;    struct interface *ifp; -  int ifmtu, iobuflen; +  unsigned int ifmtu, iobuflen;    struct listnode *node;    struct ospf6_neighbor *on; @@ -1119,7 +1119,7 @@ DEFUN (no_ipv6_ospf6_ifmtu,  {    struct ospf6_interface *oi;    struct interface *ifp; -  int iobuflen; +  unsigned int iobuflen;    struct listnode *node;    struct ospf6_neighbor *on; @@ -1168,6 +1168,7 @@ DEFUN (ipv6_ospf6_cost,  {    struct ospf6_interface *oi;    struct interface *ifp; +  unsigned long int lcost;    ifp = (struct interface *) vty->index;    assert (ifp); @@ -1177,11 +1178,19 @@ DEFUN (ipv6_ospf6_cost,      oi = ospf6_interface_create (ifp);    assert (oi); -  if (oi->cost == strtol (argv[0], NULL, 10)) -    return CMD_SUCCESS; - -  oi->cost = strtol (argv[0], NULL, 10); +  lcost = strtol (argv[0], NULL, 10); +  if (lcost > UINT32_MAX) +    { +      vty_out (vty, "Cost %ld is out of range%s", lcost, VNL); +      return CMD_WARNING; +    } +   +  if (oi->cost == lcost) +    return CMD_SUCCESS; +   +  oi->cost = lcost; +      /* update cost held in route_connected list in ospf6_interface */    ospf6_interface_connected_route_update (oi->interface); diff --git a/ospf6d/ospf6_interface.h b/ospf6d/ospf6_interface.h index d28b3105..c6615d8c 100644 --- a/ospf6d/ospf6_interface.h +++ b/ospf6d/ospf6_interface.h @@ -115,7 +115,7 @@ struct ospf6_interface  #define OSPF6_INTERFACE_DR               7  #define OSPF6_INTERFACE_MAX              8 -extern char *ospf6_interface_state_str[]; +extern const char *ospf6_interface_state_str[];  /* flags */  #define OSPF6_INTERFACE_DISABLE      0x01 diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c index fd208fd0..365b98d1 100644 --- a/ospf6d/ospf6_intra.c +++ b/ospf6d/ospf6_intra.c @@ -172,9 +172,9 @@ ospf6_router_lsa_originate (struct thread *thread)          continue;        /* Multiple Router-LSA instance according to size limit setting */ -      if (oa->router_lsa_size_limit != 0 && -          (caddr_t) lsdesc + sizeof (struct ospf6_router_lsdesc) - -          (caddr_t) buffer > oa->router_lsa_size_limit) +      if ( (oa->router_lsa_size_limit != 0) +          && ((caddr_t) lsdesc + sizeof (struct ospf6_router_lsdesc) - +              (caddr_t) buffer > oa->router_lsa_size_limit))          {            if ((caddr_t) lsdesc == (caddr_t) router_lsa +                                    sizeof (struct ospf6_router_lsa)) @@ -471,7 +471,7 @@ ospf6_link_lsa_show (struct vty *vty, struct ospf6_lsa *lsa)    int prefixnum;    char buf[128], options[32];    struct ospf6_prefix *prefix; -  char *p, *mc, *la, *nu; +  const char *p, *mc, *la, *nu;    struct in6_addr in6;    link_lsa = (struct ospf6_link_lsa *) @@ -625,7 +625,7 @@ ospf6_intra_prefix_lsa_show (struct vty *vty, struct ospf6_lsa *lsa)    char buf[128];    struct ospf6_prefix *prefix;    char id[16], adv_router[16]; -  char *p, *mc, *la, *nu; +  const char *p, *mc, *la, *nu;    struct in6_addr in6;    intra_prefix_lsa = (struct ospf6_intra_prefix_lsa *) diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index da732798..d6356c72 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -90,7 +90,7 @@ struct ospf6_lsa_handler *  ospf6_get_lsa_handler (u_int16_t type)  {    struct ospf6_lsa_handler *handler = NULL; -  int index = ntohs (type) & OSPF6_LSTYPE_FCODE_MASK; +  unsigned int index = ntohs (type) & OSPF6_LSTYPE_FCODE_MASK;    if (index >= vector_max (ospf6_lsa_handler_vector))      handler = &unknown_handler; @@ -100,7 +100,7 @@ ospf6_get_lsa_handler (u_int16_t type)    return handler;  } -char * +const char *  ospf6_lstype_name (u_int16_t type)  {    static char buf[8]; @@ -711,7 +711,8 @@ char *  ospf6_lsa_handler_name (struct ospf6_lsa_handler *h)  {    static char buf[64]; -  int i, size = strlen (h->name); +  unsigned int i;  +  unsigned int size = strlen (h->name);    if (h->name == "Unknown" &&        h->type != OSPF6_LSTYPE_UNKNOWN) @@ -740,7 +741,7 @@ DEFUN (debug_ospf6_lsa_type,         "Specify LS type as Hexadecimal\n"        )  { -  int i; +  unsigned int i;    struct ospf6_lsa_handler *handler = NULL;    unsigned long val;    char *endptr = NULL; @@ -808,7 +809,7 @@ DEFUN (no_debug_ospf6_lsa_type,         "Specify LS type as Hexadecimal\n"        )  { -  int i; +  u_int i;    struct ospf6_lsa_handler *handler = NULL;    unsigned long val;    char *endptr = NULL; @@ -868,7 +869,7 @@ struct cmd_element no_debug_ospf6_lsa_type_detail_cmd;  void  install_element_ospf6_debug_lsa ()  { -  int i; +  u_int i;    struct ospf6_lsa_handler *handler;  #define STRSIZE  256  #define DOCSIZE  1024 @@ -969,7 +970,7 @@ install_element_ospf6_debug_lsa ()  int  config_write_ospf6_debug_lsa (struct vty *vty)  { -  int i; +  u_int i;    struct ospf6_lsa_handler *handler;    for (i = 0; i < vector_max (ospf6_lsa_handler_vector); i++) diff --git a/ospf6d/ospf6_lsa.h b/ospf6d/ospf6_lsa.h index 0f81b6ad..c23d6f71 100644 --- a/ospf6d/ospf6_lsa.h +++ b/ospf6d/ospf6_lsa.h @@ -143,7 +143,7 @@ struct ospf6_lsa  struct ospf6_lsa_handler  {    u_int16_t type; /* host byte order */ -  char *name; +  const char *name;    int (*show) (struct vty *, struct ospf6_lsa *);    u_char debug;  }; @@ -202,7 +202,7 @@ struct ospf6_lsa_handler  /* Function Prototypes */ -char *ospf6_lstype_name (u_int16_t type); +const char *ospf6_lstype_name (u_int16_t type);  u_char ospf6_lstype_debug (u_int16_t type);  int ospf6_lsa_is_differ (struct ospf6_lsa *lsa1, struct ospf6_lsa *lsa2);  int ospf6_lsa_is_changed (struct ospf6_lsa *lsa1, struct ospf6_lsa *lsa2); diff --git a/ospf6d/ospf6_lsdb.c b/ospf6d/ospf6_lsdb.c index 6cd633f5..d20e9a1f 100644 --- a/ospf6d/ospf6_lsdb.c +++ b/ospf6d/ospf6_lsdb.c @@ -75,7 +75,7 @@ static void  _lsdb_count_assert (struct ospf6_lsdb *lsdb)  {    struct ospf6_lsa *debug; -  int num = 0; +  unsigned int num = 0;    for (debug = ospf6_lsdb_head (lsdb); debug;         debug = ospf6_lsdb_next (debug))      num++; diff --git a/ospf6d/ospf6_main.c b/ospf6d/ospf6_main.c index b5e64033..95086f2f 100644 --- a/ospf6d/ospf6_main.c +++ b/ospf6d/ospf6_main.c @@ -92,7 +92,7 @@ int daemon_mode = 0;  struct thread_master *master;  /* Process ID saved for use by init system */ -char *pid_file = PATH_OSPF6D_PID; +const char *pid_file = PATH_OSPF6D_PID;  /* Help information display. */  static void diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index d4a60dd9..e436867e 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -43,7 +43,7 @@  #include "ospf6d.h"  unsigned char conf_debug_ospf6_message[6] = {0x03, 0, 0, 0, 0, 0}; -char *ospf6_message_type_str[] = +const char *ospf6_message_type_str[] =    { "Unknown", "Hello", "DbDesc", "LSReq", "LSUpdate", "LSAck" };  /* print functions */ @@ -1160,12 +1160,12 @@ ospf6_lsack_recv (struct in6_addr *src, struct in6_addr *dst,      }  } -char *recvbuf = NULL; -char *sendbuf = NULL; -int iobuflen = 0; +u_char *recvbuf = NULL; +u_char *sendbuf = NULL; +unsigned int iobuflen = 0;  int -ospf6_iobuf_size (int size) +ospf6_iobuf_size (unsigned int size)  {    char *recvnew, *sendnew; @@ -1198,7 +1198,8 @@ ospf6_iobuf_size (int size)  int  ospf6_receive (struct thread *thread)  { -  int sockfd, len; +  int sockfd; +  unsigned int len;    char srcname[64], dstname[64];    struct in6_addr src, dst;    unsigned int ifindex; @@ -1386,7 +1387,7 @@ ospf6_hello_send (struct thread *thread)    struct ospf6_interface *oi;    struct ospf6_header *oh;    struct ospf6_hello *hello; -  char *p; +  u_char *p;    struct listnode *node;    struct ospf6_neighbor *on; @@ -1452,7 +1453,7 @@ ospf6_dbdesc_send (struct thread *thread)    struct ospf6_neighbor *on;    struct ospf6_header *oh;    struct ospf6_dbdesc *dbdesc; -  char *p; +  u_char *p;    struct ospf6_lsa *lsa;    on = (struct ospf6_neighbor *) THREAD_ARG (thread); @@ -1568,7 +1569,7 @@ ospf6_lsreq_send (struct thread *thread)    struct ospf6_neighbor *on;    struct ospf6_header *oh;    struct ospf6_lsreq_entry *e; -  char *p; +  u_char *p;    struct ospf6_lsa *lsa;    on = (struct ospf6_neighbor *) THREAD_ARG (thread); @@ -1632,7 +1633,7 @@ ospf6_lsupdate_send_neighbor (struct thread *thread)    struct ospf6_neighbor *on;    struct ospf6_header *oh;    struct ospf6_lsupdate *lsupdate; -  char *p; +  u_char *p;    int num;    struct ospf6_lsa *lsa; @@ -1673,7 +1674,8 @@ ospf6_lsupdate_send_neighbor (struct thread *thread)         lsa = ospf6_lsdb_next (lsa))      {        /* MTU check */ -      if (p - sendbuf + OSPF6_LSA_SIZE (lsa->header) > on->ospf6_if->ifmtu) +      if ( (p - sendbuf + (unsigned int)OSPF6_LSA_SIZE (lsa->header)) +          > on->ospf6_if->ifmtu)          {            ospf6_lsa_unlock (lsa);            break; @@ -1692,7 +1694,8 @@ ospf6_lsupdate_send_neighbor (struct thread *thread)         lsa = ospf6_lsdb_next (lsa))      {        /* MTU check */ -      if (p - sendbuf + OSPF6_LSA_SIZE (lsa->header) > on->ospf6_if->ifmtu) +      if ( (p - sendbuf + (unsigned int)OSPF6_LSA_SIZE (lsa->header)) +          > on->ospf6_if->ifmtu)          {            ospf6_lsa_unlock (lsa);            break; @@ -1733,7 +1736,7 @@ ospf6_lsupdate_send_interface (struct thread *thread)    struct ospf6_interface *oi;    struct ospf6_header *oh;    struct ospf6_lsupdate *lsupdate; -  char *p; +  u_char *p;    int num;    struct ospf6_lsa *lsa; @@ -1764,7 +1767,8 @@ ospf6_lsupdate_send_interface (struct thread *thread)         lsa = ospf6_lsdb_next (lsa))      {        /* MTU check */ -      if (p - sendbuf + OSPF6_LSA_SIZE (lsa->header) > oi->ifmtu) +      if ( (p - sendbuf + ((unsigned int)OSPF6_LSA_SIZE (lsa->header))) +          > oi->ifmtu)          {            ospf6_lsa_unlock (lsa);            break; @@ -1804,7 +1808,7 @@ ospf6_lsack_send_neighbor (struct thread *thread)  {    struct ospf6_neighbor *on;    struct ospf6_header *oh; -  char *p; +  u_char *p;    struct ospf6_lsa *lsa;    on = (struct ospf6_neighbor *) THREAD_ARG (thread); @@ -1864,7 +1868,7 @@ ospf6_lsack_send_interface (struct thread *thread)  {    struct ospf6_interface *oi;    struct ospf6_header *oh; -  char *p; +  u_char *p;    struct ospf6_lsa *lsa;    oi = (struct ospf6_interface *) THREAD_ARG (thread); @@ -2082,7 +2086,7 @@ ALIAS (no_debug_ospf6_message,  int  config_write_ospf6_debug_message (struct vty *vty)  { -  char *type_str[] = {"unknown", "hello", "dbdesc", +  const char *type_str[] = {"unknown", "hello", "dbdesc",                        "lsreq", "lsupdate", "lsack"};    unsigned char s = 0, r = 0;    int i; diff --git a/ospf6d/ospf6_message.h b/ospf6d/ospf6_message.h index 186fc74b..95b07ced 100644 --- a/ospf6d/ospf6_message.h +++ b/ospf6d/ospf6_message.h @@ -47,7 +47,7 @@ extern unsigned char conf_debug_ospf6_message[];  #define OSPF6_MESSAGE_TYPE_CANONICAL(T) \    ((T) > OSPF6_MESSAGE_TYPE_LSACK ? OSPF6_MESSAGE_TYPE_UNKNOWN : (T)) -extern char *ospf6_message_type_str[]; +extern const char *ospf6_message_type_str[];  #define OSPF6_MESSAGE_TYPE_NAME(T) \    (ospf6_message_type_str[ OSPF6_MESSAGE_TYPE_CANONICAL (T) ]) @@ -122,7 +122,7 @@ void ospf6_lsreq_print (struct ospf6_header *);  void ospf6_lsupdate_print (struct ospf6_header *);  void ospf6_lsack_print (struct ospf6_header *); -int ospf6_iobuf_size (int size); +int ospf6_iobuf_size (unsigned int size);  int ospf6_receive (struct thread *thread);  int ospf6_hello_send (struct thread *thread); diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index 752b3fc6..7b91c17d 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -42,7 +42,7 @@  unsigned char conf_debug_ospf6_neighbor = 0; -char *ospf6_neighbor_state_str[] = +const char *ospf6_neighbor_state_str[] =  { "None", "Down", "Attempt", "Init", "Twoway", "ExStart", "ExChange",    "Loading", "Full", NULL }; diff --git a/ospf6d/ospf6_neighbor.h b/ospf6d/ospf6_neighbor.h index 441ab81c..8f94790d 100644 --- a/ospf6d/ospf6_neighbor.h +++ b/ospf6d/ospf6_neighbor.h @@ -105,7 +105,7 @@ struct ospf6_neighbor  #define OSPF6_NEIGHBOR_LOADING  7  #define OSPF6_NEIGHBOR_FULL     8 -extern char *ospf6_neighbor_state_str[]; +const extern char *ospf6_neighbor_state_str[];  /* Function Prototypes */ diff --git a/ospf6d/ospf6_proto.c b/ospf6d/ospf6_proto.c index 584382ae..c792aa45 100644 --- a/ospf6d/ospf6_proto.c +++ b/ospf6d/ospf6_proto.c @@ -72,7 +72,7 @@ ospf6_capability_printbuf (char capability, char *buf, int size)  void  ospf6_options_printbuf (u_char *options, char *buf, int size)  { -  char *dc, *r, *n, *mc, *e, *v6; +  const char *dc, *r, *n, *mc, *e, *v6;    dc = (OSPF6_OPT_ISSET (options, OSPF6_OPT_DC) ? "DC" : "--");    r  = (OSPF6_OPT_ISSET (options, OSPF6_OPT_R)  ? "R"  : "-" );    n  = (OSPF6_OPT_ISSET (options, OSPF6_OPT_N)  ? "N"  : "-" ); diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index 7a5a3941..c1c6d359 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -63,16 +63,16 @@ ospf6_linkstate_prefix2str (struct prefix *prefix, char *buf, int size)  }  /* Global strings for logging */ -char *ospf6_dest_type_str[OSPF6_DEST_TYPE_MAX] = +const char *ospf6_dest_type_str[OSPF6_DEST_TYPE_MAX] =  { "Unknown", "Router", "Network", "Discard", "Linkstate", "AddressRange", }; -char *ospf6_dest_type_substr[OSPF6_DEST_TYPE_MAX] = +const char *ospf6_dest_type_substr[OSPF6_DEST_TYPE_MAX] =  { "?", "R", "N", "D", "L", "A", }; -char *ospf6_path_type_str[OSPF6_PATH_TYPE_MAX] = +const char *ospf6_path_type_str[OSPF6_PATH_TYPE_MAX] =  { "Unknown", "Intra-Area", "Inter-Area", "External-1", "External-2", }; -char *ospf6_path_type_substr[OSPF6_PATH_TYPE_MAX] = +const char *ospf6_path_type_substr[OSPF6_PATH_TYPE_MAX] =  { "??", "IA", "IE", "E1", "E2", }; @@ -206,7 +206,7 @@ _route_count_assert (struct ospf6_route_table *table)  {    struct ospf6_route *debug;    char buf[64]; -  int num = 0; +  unsigned int num = 0;    for (debug = ospf6_route_head (table); debug;         debug = ospf6_route_next (debug))      num++; @@ -769,7 +769,7 @@ ospf6_route_show_table_summary (struct vty *vty,  {    struct ospf6_route *route, *prev = NULL;    int i, pathtype[OSPF6_PATH_TYPE_MAX]; -  int number = 0; +  unsigned int number = 0;    int nhinval = 0, ecmp = 0;    int alternative = 0, destination = 0; @@ -908,7 +908,7 @@ ospf6_route_show_table (struct vty *vty, int detail,  }  int -ospf6_route_table_show (struct vty *vty, int argc, char **argv, +ospf6_route_table_show (struct vty *vty, int argc, const char *argv[],                          struct ospf6_route_table *table)  {    int summary = 0; @@ -1083,7 +1083,7 @@ ospf6_linkstate_show_table (struct vty *vty, int detail,  }  int -ospf6_linkstate_table_show (struct vty *vty, int argc, char **argv, +ospf6_linkstate_table_show (struct vty *vty, int argc, const char *argv[],                              struct ospf6_route_table *table)  {    int detail = 0; diff --git a/ospf6d/ospf6_route.h b/ospf6d/ospf6_route.h index d9456a14..d91cd7b7 100644 --- a/ospf6d/ospf6_route.h +++ b/ospf6d/ospf6_route.h @@ -173,8 +173,8 @@ struct ospf6_route_table    void (*hook_remove) (struct ospf6_route *);  }; -extern char *ospf6_dest_type_str[OSPF6_DEST_TYPE_MAX]; -extern char *ospf6_dest_type_substr[OSPF6_DEST_TYPE_MAX]; +extern const char *ospf6_dest_type_str[OSPF6_DEST_TYPE_MAX]; +extern const char *ospf6_dest_type_substr[OSPF6_DEST_TYPE_MAX];  #define OSPF6_DEST_TYPE_NAME(x)                       \    (0 < (x) && (x) < OSPF6_DEST_TYPE_MAX ?             \     ospf6_dest_type_str[(x)] : ospf6_dest_type_str[0]) @@ -182,8 +182,8 @@ extern char *ospf6_dest_type_substr[OSPF6_DEST_TYPE_MAX];    (0 < (x) && (x) < OSPF6_DEST_TYPE_MAX ?                   \     ospf6_dest_type_substr[(x)] : ospf6_dest_type_substr[0]) -extern char *ospf6_path_type_str[OSPF6_PATH_TYPE_MAX]; -extern char *ospf6_path_type_substr[OSPF6_PATH_TYPE_MAX]; +extern const char *ospf6_path_type_str[OSPF6_PATH_TYPE_MAX]; +extern const char *ospf6_path_type_substr[OSPF6_PATH_TYPE_MAX];  #define OSPF6_PATH_TYPE_NAME(x)                       \    (0 < (x) && (x) < OSPF6_PATH_TYPE_MAX ?             \     ospf6_path_type_str[(x)] : ospf6_path_type_str[0]) @@ -266,9 +266,9 @@ void ospf6_route_dump (struct ospf6_route_table *table);  void ospf6_route_show (struct vty *vty, struct ospf6_route *route);  void ospf6_route_show_detail (struct vty *vty, struct ospf6_route *route); -int ospf6_route_table_show (struct vty *, int, char **, +int ospf6_route_table_show (struct vty *, int, const char *[],                              struct ospf6_route_table *); -int ospf6_linkstate_table_show (struct vty *vty, int argc, char **argv, +int ospf6_linkstate_table_show (struct vty *vty, int argc, const char *argv[],                              struct ospf6_route_table *table);  void ospf6_brouter_show_header (struct vty *vty); diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c index 186c8e2f..98a7f5a9 100644 --- a/ospf6d/ospf6_snmp.c +++ b/ospf6d/ospf6_snmp.c @@ -234,8 +234,8 @@ ospfv3AreaEntry (struct variable *v, oid *name, size_t *length,  {    struct ospf6_area *oa, *area = NULL;    u_int32_t area_id = 0; -  listnode node; -  int len; +  struct listnode *node; +  unsigned int len;    if (ospf6 == NULL)      return NULL; @@ -293,9 +293,9 @@ ospfv3AreaEntry (struct variable *v, oid *name, size_t *length,  /* Register OSPFv3-MIB. */  void -ospf6_snmp_init () +ospf6_snmp_init (struct thread_master *master)  { -  smux_init (ospf6d_oid, sizeof (ospf6d_oid) / sizeof (oid)); +  smux_init (master, ospf6d_oid, sizeof (ospf6d_oid) / sizeof (oid));    REGISTER_MIB ("OSPFv3MIB", ospfv3_variables, variable, ospfv3_oid);    smux_start ();  } diff --git a/ospf6d/ospf6_snmp.h b/ospf6d/ospf6_snmp.h index 89c8c478..7ef784c9 100644 --- a/ospf6d/ospf6_snmp.h +++ b/ospf6d/ospf6_snmp.h @@ -22,7 +22,7 @@  #ifndef OSPF6_SNMP_H  #define OSPF6_SNMP_H -void ospf6_snmp_init (); +void ospf6_snmp_init (struct thread_master *);  #endif /*OSPF6_SNMP_H*/ diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index 79539b2f..4f3af7cd 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -527,7 +527,7 @@ ospf6_spf_schedule (struct ospf6_area *oa)  }  void -ospf6_spf_display_subtree (struct vty *vty, char *prefix, int rest, +ospf6_spf_display_subtree (struct vty *vty, const char *prefix, int rest,                             struct ospf6_vertex *v)  {    struct listnode *node; diff --git a/ospf6d/ospf6_spf.h b/ospf6d/ospf6_spf.h index 6a6424ea..c9e031bf 100644 --- a/ospf6d/ospf6_spf.h +++ b/ospf6d/ospf6_spf.h @@ -82,7 +82,7 @@ void ospf6_spf_calculation (u_int32_t router_id,                              struct ospf6_area *oa);  void ospf6_spf_schedule (struct ospf6_area *oa); -void ospf6_spf_display_subtree (struct vty *vty, char *prefix, +void ospf6_spf_display_subtree (struct vty *vty, const char *prefix,                                  int rest, struct ospf6_vertex *v);  int config_write_ospf6_debug_spf (struct vty *vty); diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 712b337e..9fd32641 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -521,7 +521,7 @@ DEFUN (show_ipv6_ospf6_route_match,         "Display routes which match the specified route\n"         )  { -  char *sargv[CMD_ARGC_MAX]; +  const char *sargv[CMD_ARGC_MAX];    int i, sargc;    /* copy argv to sargv and then append "match" */ @@ -547,7 +547,7 @@ DEFUN (show_ipv6_ospf6_route_match_detail,         "Detailed information\n"         )  { -  char *sargv[CMD_ARGC_MAX]; +  const char *sargv[CMD_ARGC_MAX];    int i, sargc;    /* copy argv to sargv and then append "match" and "detail" */ @@ -589,7 +589,7 @@ DEFUN (show_ipv6_ospf6_route_type_detail,         "Detailed information\n"         )  { -  char *sargv[CMD_ARGC_MAX]; +  const char *sargv[CMD_ARGC_MAX];    int i, sargc;    /* copy argv to sargv and then append "detail" */ diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index 695e8eca..d10d1df6 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -129,7 +129,7 @@ config_write_ospf6_debug (struct vty *vty)    "%s        AS Scoped Link State Database%s%s"  static int -parse_show_level (int argc, char **argv) +parse_show_level (int argc, const char *argv[])  {    int level = 0;    if (argc) @@ -147,7 +147,7 @@ parse_show_level (int argc, char **argv)  }  static u_int16_t -parse_type_spec (int argc, char **argv) +parse_type_spec (int argc, const char *argv[])  {    u_int16_t type = 0;    assert (argc); @@ -1775,7 +1775,7 @@ DEFUN (show_ipv6_ospf6_linkstate_detail,         "Display linkstate routing table\n"        )  { -  char *sargv[CMD_ARGC_MAX]; +  const char *sargv[CMD_ARGC_MAX];    int i, sargc;    struct listnode *node;    struct ospf6_area *oa; @@ -1817,7 +1817,7 @@ ospf6_init ()    ospf6_abr_init ();  #ifdef HAVE_SNMP -  ospf6_snmp_init (); +  ospf6_snmp_init (master);  #endif /*HAVE_SNMP*/    install_node (&debug_node, config_write_ospf6_debug); | 
