[isisd] Fix compiler warnings and allow v4-only compilation
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.
diff --git a/isisd/ChangeLog b/isisd/ChangeLog
index 5e203c8..8797af1 100644
--- a/isisd/ChangeLog
+++ b/isisd/ChangeLog
@@ -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
diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c
index d8c7448..aab8d1a 100644
--- a/isisd/isis_adjacency.c
+++ b/isisd/isis_adjacency.c
@@ -72,7 +72,12 @@
return NULL;
}
+ if (snpa) {
memcpy (adj->snpa, snpa, 6);
+ } else {
+ memset (adj->snpa, ' ', 6);
+ }
+
adj->circuit = circuit;
adj->level = level;
adj->flaps = 0;
diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c
index 76145f0..6ef24a9 100644
--- a/isisd/isis_circuit.c
+++ b/isisd/isis_circuit.c
@@ -57,6 +57,14 @@
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 @@
{
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 @@
assert (circuit);
- circuit_t = string2circuit_t ((u_char *)argv[0]);
+ circuit_t = string2circuit_t (argv[0]);
if (!circuit_t)
{
diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c
index 63f2b6b..1a4deb1 100644
--- a/isisd/isis_lsp.c
+++ b/isisd/isis_lsp.c
@@ -727,10 +727,10 @@
#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];
diff --git a/isisd/isis_main.c b/isisd/isis_main.c
index 74fc647..2411518 100644
--- a/isisd/isis_main.c
+++ b/isisd/isis_main.c
@@ -107,6 +107,16 @@
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)
diff --git a/isisd/isis_misc.c b/isisd/isis_misc.c
index 384ebe0..6b565bc 100644
--- a/isisd/isis_misc.c
+++ b/isisd/isis_misc.c
@@ -99,15 +99,15 @@
* 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 @@
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 @@
* 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;
diff --git a/isisd/isis_misc.h b/isisd/isis_misc.h
index 3b97589..d5003a8 100644
--- a/isisd/isis_misc.h
+++ b/isisd/isis_misc.h
@@ -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 @@
* 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 *);
/*
diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c
index 2dc8215..6fcc5ed 100644
--- a/isisd/isis_pdu.c
+++ b/isisd/isis_pdu.c
@@ -335,7 +335,7 @@
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 @@
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 @@
/* 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;
diff --git a/isisd/isis_route.c b/isisd/isis_route.c
index c8f0aab..1286486 100644
--- a/isisd/isis_route.c
+++ b/isisd/isis_route.c
@@ -631,6 +631,8 @@
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 @@
if (drnode->info == rnode->info)
drnode->info = NULL;
}
+#endif
isis_route_delete (&rnode->p, table);
}
@@ -667,8 +670,10 @@
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 @@
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_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]);
diff --git a/isisd/isis_routemap.c b/isisd/isis_routemap.c
index 4235d88..cff0fa3 100644
--- a/isisd/isis_routemap.c
+++ b/isisd/isis_routemap.c
@@ -49,6 +49,14 @@
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)
{
diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c
index 706ed16..5d7e9da 100644
--- a/isisd/isis_spf.c
+++ b/isisd/isis_spf.c
@@ -998,8 +998,10 @@
/* 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 @@
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);
}
}
diff --git a/isisd/isis_tlv.c b/isisd/isis_tlv.c
index 7b99ab5..94fa65e 100644
--- a/isisd/isis_tlv.c
+++ b/isisd/isis_tlv.c
@@ -45,6 +45,11 @@
extern struct isis *isis;
+/*
+ * Prototypes.
+ */
+int add_tlv (u_char, u_char, u_char *, struct stream *);
+
void
free_tlv (void *val)
{
diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c
index 4631cc7..9ee5ffc 100644
--- a/isisd/isis_zebra.c
+++ b/isisd/isis_zebra.c
@@ -72,7 +72,7 @@
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 @@
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 @@
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]
diff --git a/isisd/isisd.c b/isisd/isisd.c
index c5c2153..48ea47a 100644
--- a/isisd/isisd.c
+++ b/isisd/isisd.c
@@ -61,6 +61,21 @@
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 @@
}
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 @@
}
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 @@
"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 @@
"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 @@
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);
diff --git a/isisd/iso_checksum.c b/isisd/iso_checksum.c
index eabe281..16f18e5 100644
--- a/isisd/iso_checksum.c
+++ b/isisd/iso_checksum.c
@@ -191,9 +191,3 @@
/* return the checksum for user usage */
return checksum;
}
-
-int
-iso_csum_modify (u_char * buffer, int len, uint16_t * csum)
-{
- return 0;
-}
diff --git a/isisd/topology/random.c b/isisd/topology/random.c
index 6ee17a0..c49c082 100644
--- a/isisd/topology/random.c
+++ b/isisd/topology/random.c
@@ -10,7 +10,17 @@
#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);
diff --git a/isisd/topology/spgrid.c b/isisd/topology/spgrid.c
index a1aa6d7..611b672 100644
--- a/isisd/topology/spgrid.c
+++ b/isisd/topology/spgrid.c
@@ -26,6 +26,15 @@
#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",