]> git.puffer.fish Git - mirror/frr.git/commitdiff
[isisd] Fix compiler warnings and allow v4-only compilation
authorPaul Jakma <paul.jakma@sun.com>
Fri, 8 Dec 2006 01:09:50 +0000 (01:09 +0000)
committerPaul Jakma <paul.jakma@sun.com>
Fri, 8 Dec 2006 01:09:50 +0000 (01:09 +0000)
2006-12-08 Hannes Gredler <hannes@gredler.at>

* isis_adjacency.c: (isis_new_adj) Allow NULL snpa argument.
* isis_pdu.c: (various) Update calls to isis_new_adj() to pass
  NULL and use default.
* (general) Add forward declarations where required.
  Fix up const char *'s.
  Allow V4-only compilation.

17 files changed:
isisd/ChangeLog
isisd/isis_adjacency.c
isisd/isis_circuit.c
isisd/isis_lsp.c
isisd/isis_main.c
isisd/isis_misc.c
isisd/isis_misc.h
isisd/isis_pdu.c
isisd/isis_route.c
isisd/isis_routemap.c
isisd/isis_spf.c
isisd/isis_tlv.c
isisd/isis_zebra.c
isisd/isisd.c
isisd/iso_checksum.c
isisd/topology/random.c
isisd/topology/spgrid.c

index 5e203c8c0e9ae4a2a2f9d62ea547cfc862354761..8797af1816ac19793bb31516abc04ac7fc2d7877 100644 (file)
@@ -1,3 +1,12 @@
+2006-12-08 Hannes Gredler <hannes@gredler.at>
+
+       * isis_adjacency.c: (isis_new_adj) Allow NULL snpa argument.
+       * isis_pdu.c: (various) Update calls to isis_new_adj() to pass
+         NULL and use default.
+       * (general) Add forward declarations where required.
+         Fix up const char *'s.
+         Allow V4-only compilation.
+
 2006-01-17 Paul Jakma <paul.jakma@sun.com>
 
        * isis_zebra.c: (isis_zebra_route_add_ipv4) fix for new
index d8c7448e8343074f43fb22bf75707187b4dbca03..aab8d1a3dcede78466332046489a1fc33908ca70 100644 (file)
@@ -72,7 +72,12 @@ isis_new_adj (u_char * id, u_char * snpa, int level,
       return NULL;
     }
 
+  if (snpa) {
   memcpy (adj->snpa, snpa, 6);
+  } else {
+      memset (adj->snpa, ' ', 6);
+  }
+
   adj->circuit = circuit;
   adj->level = level;
   adj->flaps = 0;
index 76145f026b955847f654cb2cc677208a853751bb..6ef24a9a80f48506802d1fda6416385e8725bd9c 100644 (file)
 extern struct thread_master *master;
 extern struct isis *isis;
 
+/*
+ * Prototypes.
+ */
+void isis_circuit_down(struct isis_circuit *);
+int isis_interface_config_write(struct vty *);
+int isis_if_new_hook(struct interface *);
+int isis_if_delete_hook(struct interface *);
+
 struct isis_circuit *
 isis_circuit_new ()
 {
@@ -275,10 +283,10 @@ isis_circuit_del_addr (struct isis_circuit *circuit,
 {
   struct prefix_ipv4 *ipv4, *ip = NULL;
   struct listnode *node;
-  int found = 0;
   u_char buf[BUFSIZ];
 #ifdef HAVE_IPV6
   struct prefix_ipv6 *ipv6, *ip6 = NULL;
+  int found = 0;
 #endif /* HAVE_IPV6 */
 
   memset (&buf, 0, BUFSIZ);
@@ -944,7 +952,7 @@ DEFUN (isis_circuit_type,
 
   assert (circuit);
 
-  circuit_t = string2circuit_t ((u_char *)argv[0]);
+  circuit_t = string2circuit_t (argv[0]);
 
   if (!circuit_t)
     {
index 63f2b6b963b4571dceffff919a60005c3dd79600..1a4deb1b4ef03ea7a3016c6ba75d4ba257536633 100644 (file)
@@ -727,10 +727,10 @@ lsp_print_detail (dnode_t * node, struct vty *vty, char dynhost)
 #ifdef HAVE_IPV6
   struct ipv6_reachability *ipv6_reach;
   struct in6_addr in6;
+  u_char buff[BUFSIZ];
 #endif
   u_char LSPid[255];
   u_char hostname[255];
-  u_char buff[BUFSIZ];
   u_char ipv4_reach_prefix[20];
   u_char ipv4_reach_mask[20];
   u_char ipv4_address[20];
index 74fc647542914e78db69c8107cfdd294050ab282..2411518d82e40e704835a13f686953b961466716 100644 (file)
@@ -107,6 +107,16 @@ int _argc;
 char **_argv;
 char **_envp;
 
+/*
+ * Prototypes.
+ */
+void reload(void);
+void sighup(void);
+void sigint(void);
+void sigterm(void);
+void sigusr1(void);
+
+
 /* Help information display. */
 static void
 usage (int status)
index 384ebe0bb132e86be1a192221f81facd8578dec0..6b565bcbe23a5b2b0659f8afa96e72e88b2883fc 100644 (file)
@@ -99,15 +99,15 @@ isonet_print (u_char * from, int len)
  * extract dot from the dotted str, and insert all the number in a buff 
  */
 int
-dotformat2buff (u_char * buff, u_char * dotted)
+dotformat2buff (u_char * buff, const u_char * dotted)
 {
   int dotlen, len = 0;
-  u_char *pos = dotted;
+  const u_char *pos = dotted;
   u_char number[3];
   int nextdotpos = 2;
 
   number[2] = '\0';
-  dotlen = strlen ((char *)dotted);
+  dotlen = strlen(dotted);
   if (dotlen > 50)
     {
       /* this can't be an iso net, its too long */
@@ -165,7 +165,7 @@ sysid2buff (u_char * buff, const u_char * dotted)
 
   number[2] = '\0';
   // surely not a sysid_string if not 14 length
-  if (strlen ((char *)dotted) != 14)
+  if (strlen (dotted) != 14)
     {
       return 0;
     }
@@ -271,19 +271,19 @@ speaks (struct nlpids *nlpids, int family)
  * Returns 0 on error, IS-IS Circuit Type on ok
  */
 int
-string2circuit_t (u_char * str)
+string2circuit_t (const u_char * str)
 {
 
   if (!str)
     return 0;
 
-  if (!strcmp ((char *)str, "level-1"))
+  if (!strcmp (str, "level-1"))
     return IS_LEVEL_1;
 
-  if (!strcmp ((char *)str, "level-2-only") || !strcmp ((char *)str, "level-2"))
+  if (!strcmp (str, "level-2-only") || !strcmp (str, "level-2"))
     return IS_LEVEL_2;
 
-  if (!strcmp ((char *)str, "level-1-2"))
+  if (!strcmp (str, "level-1-2"))
     return IS_LEVEL_1_AND_2;
 
   return 0;
index 3b9758953f315f1d83143dfa669f21e0c2705beb..d5003a8e68ccb31ced677666e1b14c6e59885961 100644 (file)
@@ -24,8 +24,7 @@
 #ifndef _ZEBRA_ISIS_MISC_H
 #define _ZEBRA_ISIS_MISC_H
 
-int dotformat2buff (u_char *, u_char *);
-int string2circuit_t (u_char *);
+int string2circuit_t (const u_char *);
 const char *circuit_t2string (int);
 const char *syst2string (int);
 struct in_addr newprefix2inaddr (u_char * prefix_start,
@@ -34,7 +33,7 @@ struct in_addr newprefix2inaddr (u_char * prefix_start,
  * Converting input to memory stored format
  * return value of 0 indicates wrong input
  */
-int dotformat2buff (u_char *, u_char *);
+int dotformat2buff (u_char *, const u_char *);
 int sysid2buff (u_char *, const u_char *);
 
 /*
index 2dc821560d15a898bd0bb75238c3040b6c158a16..6fcc5ed5ec30cfbad12a17f8da1315054217423a 100644 (file)
@@ -335,7 +335,7 @@ process_p2p_hello (struct isis_circuit *circuit)
   adj = circuit->u.p2p.neighbor;
   if (!adj)
     {
-      adj = isis_new_adj (hdr->source_id, (u_char *) "      ", 0, circuit);
+      adj = isis_new_adj (hdr->source_id, NULL, 0, circuit);
       if (adj == NULL)
        return ISIS_ERROR;
       circuit->u.p2p.neighbor = adj;
@@ -1596,7 +1596,7 @@ process_is_hello (struct isis_circuit *circuit)
   if (!adj)
     {
       /* 8.2.2 */
-      adj = isis_new_adj (sysid, (u_char *) "      ", 0, circuit);
+      adj = isis_new_adj (sysid, NULL, 0, circuit);
       if (adj == NULL)
        return ISIS_ERROR;
 
@@ -1612,7 +1612,7 @@ process_is_hello (struct isis_circuit *circuit)
       /* 8.2.2 a) 2) delete the adj */
       XFREE (MTYPE_ISIS_ADJACENCY, adj);
       /* 8.2.2 a) 3) create a new adj */
-      adj = isis_new_adj (sysid, (u_char *) "      ", 0, circuit);
+      adj = isis_new_adj (sysid, NULL, 0, circuit);
       if (adj == NULL)
        return ISIS_ERROR;
 
index c8f0aaba7b978f628259fd4b18f9527bb0506a67..1286486cec6b95bcca8e22f35152d86088e6a456 100644 (file)
@@ -631,6 +631,8 @@ isis_route_validate_table (struct isis_area *area, struct route_table *table)
              if (drnode->info == rnode->info)
                drnode->info = NULL;
            }
+
+#ifdef HAVE_IPV6
          if (rnode->p.family == AF_INET6)
            {
              drnode = route_node_get (area->route_table6[0], &rnode->p);
@@ -640,6 +642,7 @@ isis_route_validate_table (struct isis_area *area, struct route_table *table)
              if (drnode->info == rnode->info)
                drnode->info = NULL;
            }
+#endif
              
          isis_route_delete (&rnode->p, table);
        }
@@ -667,8 +670,10 @@ isis_route_validate_merge (struct isis_area *area, int family)
 
   if (family == AF_INET)
     table = area->route_table[0];
+#ifdef HAVE_IPV6
   else if (family == AF_INET6)
     table = area->route_table6[0];
+#endif
 
   for (rnode = route_top (table); rnode; rnode = route_next (rnode))
     {
@@ -680,8 +685,10 @@ isis_route_validate_merge (struct isis_area *area, int family)
 
   if (family == AF_INET)
     table = area->route_table[1];
+#ifdef HAVE_IPV6
   else if (family == AF_INET6)
     table = area->route_table6[1];
+#endif
 
   for (rnode = route_top (table); rnode; rnode = route_next (rnode))
     {
@@ -719,8 +726,8 @@ isis_route_validate (struct thread *thread)
 
   isis_route_validate_merge (area, AF_INET);
 
-#ifdef HAVE_IPV6
 validate_ipv6:
+#ifdef HAVE_IPV6
   if (area->is_type == IS_LEVEL_1)
     {
       isis_route_validate_table (area, area->route_table6[0]);
index 4235d882f32aa641b0d63aeb4a9f458fbe747e51..cff0fa3ff96b40c8d616ad582819a27280633915 100644 (file)
 
 extern struct isis *isis;
 
+/*
+ * Prototypes.
+ */
+void isis_route_map_upd(const char *);
+void isis_route_map_event(route_map_event_t, const char *);
+void isis_route_map_init(void);
+
+
 void
 isis_route_map_upd (const char *name)
 {
index 706ed16c3ed78e6aa47aa814c00b0672d62352ee..5d7e9da4255525e08048663fcbef8e26ca7330d6 100644 (file)
@@ -998,8 +998,10 @@ isis_run_spf (struct isis_area *area, int level, int family)
   /* Make all routes in current route table inactive. */
   if (family == AF_INET)
     table = area->route_table[level - 1];
+#ifdef HAVE_IPV6
   else if (family == AF_INET6)
     table = area->route_table6[level - 1];
+#endif
 
   for (rode = route_top (table); rode; rode = route_next (rode))
     {
@@ -1333,16 +1335,16 @@ isis_print_paths (struct vty *vty, struct list *paths)
              nh_dyn = dynhn_find_by_id (adj->sysid);
              vty_out (vty, "%-20s %-10u %-20s %-11s %-5s%s",
                       (dyn != NULL) ? dyn->name.name :
-                      (u_char *) rawlspid_print ((u_char *) vertex->N.id),
+                      (const u_char *)rawlspid_print ((u_char *) vertex->N.id),
                       vertex->d_N, (nh_dyn != NULL) ? nh_dyn->name.name :
-                      (u_char *) rawlspid_print (adj->sysid),
+                      (const u_char *)rawlspid_print (adj->sysid),
                       adj->circuit->interface->name,
                       snpa_print (adj->snpa), VTY_NEWLINE);
            }
          else
            {
              vty_out (vty, "%s              %u %s", dyn ? dyn->name.name :
-                      (u_char *) rawlspid_print (vertex->N.id),
+                      (const u_char *) rawlspid_print (vertex->N.id),
                       vertex->d_N, VTY_NEWLINE);
            }
        }
index 7b99ab5d109beafeae2c15bbf9a1673ed566d9d1..94fa65ed32936ebaef4d77f87262c62e858aad07 100644 (file)
 
 extern struct isis *isis;
 
+/*
+ * Prototypes.
+ */
+int add_tlv (u_char, u_char, u_char *, struct stream *);
+
 void
 free_tlv (void *val)
 {
index 4631cc704bcd31220ccfc9bab119e88e09b55780..9ee5ffc5d22ea07a8cc5cdfab13c1114f0820a13 100644 (file)
@@ -72,7 +72,7 @@ isis_zebra_if_add (int command, struct zclient *zclient, zebra_size_t length)
 
   if (isis->debugs & DEBUG_ZEBRA)
     zlog_debug ("Zebra I/F add: %s index %d flags %ld metric %d mtu %d",
-               ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu);
+               ifp->name, ifp->ifindex, (long)ifp->flags, ifp->metric, ifp->mtu);
 
   if (if_is_operative (ifp))
     isis_csm_state_change (IF_UP_FROM_Z, circuit_scan_by_ifp (ifp), ifp);
@@ -98,7 +98,7 @@ isis_zebra_if_del (int command, struct zclient *zclient, zebra_size_t length)
 
   if (isis->debugs & DEBUG_ZEBRA)
     zlog_debug ("Zebra I/F delete: %s index %d flags %ld metric %d mtu %d",
-               ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu);
+               ifp->name, ifp->ifindex, (long)ifp->flags, ifp->metric, ifp->mtu);
 
 
   /* Cannot call if_delete because we should retain the pseudo interface
@@ -571,12 +571,14 @@ isis_zebra_read_ipv4 (int command, struct zclient *zclient,
   return 0;
 }
 
+#ifdef HAVE_IPV6
 static int
 isis_zebra_read_ipv6 (int command, struct zclient *zclient,
                      zebra_size_t length)
 {
   return 0;
 }
+#endif
 
 #define ISIS_TYPE_IS_REDISTRIBUTED(T) \
 T == ZEBRA_ROUTE_MAX ? zclient->default_information : zclient->redist[type]
index c5c2153f2c1560937126bc1907faeff9d3068240..48ea47afa2d314132ec333bb6c6377c0bfbded00 100644 (file)
@@ -61,6 +61,21 @@ u_char DEFAULT_TOPOLOGY_BASEIS[6] = { 0xFE, 0xED, 0xFE, 0xED, 0x00, 0x00 };
 struct isis *isis = NULL;
 extern struct thread_master *master;
 
+/*
+ * Prototypes.
+ */
+void isis_new(unsigned long);
+struct isis_area *isis_area_create(void);
+int isis_area_get(struct vty *, const char *);
+int isis_area_destroy(struct vty *, const char *);
+int area_net_title(struct vty *, const u_char *);
+int area_clear_net_title(struct vty *, const u_char *);
+int show_clns_neigh(struct vty *, char);
+void print_debug(struct vty *, int, int);
+int isis_config_write(struct vty *);
+
+
+
 void
 isis_new (unsigned long process_id)
 {
@@ -217,7 +232,7 @@ isis_area_destroy (struct vty *vty, const char *area_tag)
 }
 
 int
-area_net_title (struct vty *vty, u_char *net_title)
+area_net_title (struct vty *vty, const u_char *net_title)
 {
   struct isis_area *area;
   struct area_addr *addr;
@@ -311,7 +326,7 @@ area_net_title (struct vty *vty, u_char *net_title)
 }
 
 int
-area_clear_net_title (struct vty *vty, u_char *net_title)
+area_clear_net_title (struct vty *vty, const u_char *net_title)
 {
   struct isis_area *area;
   struct area_addr addr, *addrp = NULL;
@@ -997,7 +1012,7 @@ DEFUN (net,
        "A Network Entity Title for this process (OSI only)\n"
        "XX.XXXX. ... .XXX.XX  Network entity title (NET)\n")
 {
-  return area_net_title (vty, (u_char *)argv[0]);
+  return area_net_title (vty, argv[0]);
 }
 
 /*
@@ -1010,7 +1025,7 @@ DEFUN (no_net,
        "A Network Entity Title for this process (OSI only)\n"
        "XX.XXXX. ... .XXX.XX  Network entity title (NET)\n")
 {
-  return area_clear_net_title (vty, (u_char *)argv[0]);
+  return area_clear_net_title (vty, argv[0]);
 }
 
 DEFUN (area_passwd,
@@ -1182,7 +1197,7 @@ DEFUN (is_type,
       return CMD_WARNING;
     }
 
-  type = string2circuit_t ((u_char *)argv[0]);
+  type = string2circuit_t (argv[0]);
   if (!type)
     {
       vty_out (vty, "Unknown IS level %s", VTY_NEWLINE);
index eabe281fb30ae61f69f8e91205cfdd3e69730c5c..16f18e50a3dcb936a0cf9db950c6d8f7229eea98 100644 (file)
@@ -191,9 +191,3 @@ iso_csum_create (u_char * buffer, int len, u_int16_t n)
   /* return the checksum for user usage */
   return checksum;
 }
-
-int
-iso_csum_modify (u_char * buffer, int len, uint16_t * csum)
-{
-  return 0;
-}
index 6ee17a0a3af1f13f5022388b5ca38a58c1883aba..c49c08202191e3349015d229dbe527af6c2ec24c 100644 (file)
 #include <sys/types.h>
 #include <sys/times.h>
 
-unsigned long timer()
+/*
+ * Prototypes.
+ */
+unsigned long timer(void);
+void init_rand(long);
+double rand01(void);
+double randg01(void);
+long nrand(long);
+void free_arc(void *);
+
+unsigned long timer ()
    { struct tms hold;
 
         times(&hold);
index a1aa6d77edc3ad9abeca23b9cb978087759dc331..611b672799cace111ca528b85e5fa3cc76c0acde 100644 (file)
 
 #define NODE( x, y ) (x*Y + y + 1)
 
+/*
+ * Prototypes.
+ */
+void free_arc(void *);
+void help(struct vty *);
+void print_arc(struct vty *, struct list *, long, long, long);
+void hhelp(struct vty *);
+void usage(struct vty *);
+
 const char   *graph_type[] =  {
   "double cycle",
   "cycle",