Skip to content

Commit

Permalink
[isisd] Fix compiler warnings and allow v4-only compilation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Paul Jakma committed Dec 8, 2006
1 parent 3c0755d commit 41b36e9
Show file tree
Hide file tree
Showing 17 changed files with 118 additions and 35 deletions.
9 changes: 9 additions & 0 deletions isisd/ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions isisd/isis_adjacency.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 10 additions & 2 deletions isisd/isis_circuit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
{
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion isisd/isis_lsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
10 changes: 10 additions & 0 deletions isisd/isis_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions isisd/isis_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions isisd/isis_misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 *);

/*
Expand Down
6 changes: 3 additions & 3 deletions isisd/isis_pdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand All @@ -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;

Expand Down
9 changes: 8 additions & 1 deletion isisd/isis_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}
Expand Down Expand Up @@ -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))
{
Expand All @@ -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))
{
Expand Down Expand Up @@ -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]);
Expand Down
8 changes: 8 additions & 0 deletions isisd/isis_routemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
8 changes: 5 additions & 3 deletions isisd/isis_spf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down Expand Up @@ -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);
}
}
Expand Down
5 changes: 5 additions & 0 deletions isisd/isis_tlv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
6 changes: 4 additions & 2 deletions isisd/isis_zebra.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down Expand Up @@ -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]
Expand Down
25 changes: 20 additions & 5 deletions isisd/isisd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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]);
}

/*
Expand All @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 41b36e9

Please sign in to comment.