summaryrefslogtreecommitdiffstats
path: root/isisd
diff options
context:
space:
mode:
Diffstat (limited to 'isisd')
-rw-r--r--isisd/dict.c36
-rw-r--r--isisd/dict.h2
-rw-r--r--isisd/isis_misc.c37
-rw-r--r--isisd/isis_spf.c40
-rw-r--r--isisd/topology/spgrid.c3
5 files changed, 54 insertions, 64 deletions
diff --git a/isisd/dict.c b/isisd/dict.c
index 6c3e1e7f..4d2400f6 100644
--- a/isisd/dict.c
+++ b/isisd/dict.c
@@ -18,9 +18,9 @@
* $Name$
*/
+#include "zebra.h"
#include <stdlib.h>
#include <stddef.h>
-#include "zebra.h"
#include "zassert.h"
#define DICT_IMPLEMENTATION
#include "dict.h"
@@ -32,7 +32,7 @@ static const char rcsid[] = "Id: dict.c,v 1.40.2.7 2000/11/13 01:36:44 kaz";
/*
* These macros provide short convenient names for structure members,
* which are embellished with dict_ prefixes so that they are
- * properly confined to the documented namespace. It's legal for a
+ * properly confined to the documented namespace. It's legal for a
* program which uses dict to define, for instance, a macro called ``parent''.
* Such a macro would interfere with the dnode_t struct definition.
* In general, highly portable and reusable C modules which expose their
@@ -143,7 +143,7 @@ static void free_nodes(dict_t *dict, dnode_t *node, dnode_t *nil)
* dict_next() successor function, verifying that the key of each node is
* strictly lower than that of its successor, if duplicates are not allowed,
* or lower or equal if duplicates are allowed. This function is used for
- * debugging purposes.
+ * debugging purposes.
*/
static int verify_bintree(dict_t *dict)
@@ -203,7 +203,7 @@ static unsigned int verify_redblack(dnode_t *nil, dnode_t *root)
if (root->color != dnode_black)
return 0;
return height_left + 1;
- }
+ }
return 1;
}
@@ -336,7 +336,7 @@ dict_t *dict_init(dict_t *dict, dictcount_t maxcount, dict_comp_t comp)
return dict;
}
-/*
+/*
* Initialize a dictionary in the likeness of another dictionary
*/
@@ -376,7 +376,7 @@ static void dict_clear(dict_t *dict)
* debugging purposes, and should be placed in assert statements. Just because
* this function succeeds doesn't mean that the tree is not corrupt. Certain
* corruptions in the tree may simply cause undefined behavior.
- */
+ */
int dict_verify(dict_t *dict)
{
@@ -430,7 +430,7 @@ int dict_similar(const dict_t *left, const dict_t *right)
/*
* Locate a node in the dictionary having the given key.
- * If the node is not found, a null a pointer is returned (rather than
+ * If the node is not found, a null a pointer is returned (rather than
* a pointer that dictionary's nil sentinel node), otherwise a pointer to the
* located node is returned.
*/
@@ -494,9 +494,9 @@ dnode_t *dict_lower_bound(dict_t *dict, const void *key)
tentative = root;
root = root->left;
}
- }
+ }
}
-
+
return tentative;
}
@@ -526,9 +526,9 @@ dnode_t *dict_upper_bound(dict_t *dict, const void *key)
tentative = root;
root = root->right;
}
- }
+ }
}
-
+
return tentative;
}
@@ -708,10 +708,10 @@ dnode_t *dict_delete(dict_t *dict, dnode_t *delete)
child = (delete->left != nil) ? delete->left : delete->right;
- child->parent = delparent = delete->parent;
+ child->parent = delparent = delete->parent;
if (delete == delparent->left) {
- delparent->left = child;
+ delparent->left = child;
} else {
assert (delete == delparent->right);
delparent->right = child;
@@ -1035,7 +1035,7 @@ void dict_load_next(dict_load_t *load, dnode_t *newnode, const void *key)
{
dict_t *dict = load->dictptr;
dnode_t *nil = &load->nilnode;
-
+
assert (!dnode_is_in_a_dict(newnode));
assert (dict->nodecount < dict->maxcount);
@@ -1141,7 +1141,7 @@ void dict_merge(dict_t *dest, dict_t *source)
dict_load_t load;
dnode_t *leftnode = dict_first(dest), *rightnode = dict_first(source);
- assert (dict_similar(dest, source));
+ assert (dict_similar(dest, source));
if (source == dest)
return;
@@ -1174,7 +1174,7 @@ void dict_merge(dict_t *dest, dict_t *source)
leftnode = next;
continue;
}
-
+
copyright:
{
dnode_t *next = dict_next(source, rightnode);
@@ -1202,7 +1202,7 @@ typedef char input_t[256];
static int tokenize(char *string, ...)
{
- char **tokptr;
+ char **tokptr;
va_list arglist;
int tokcount = 0;
@@ -1266,7 +1266,7 @@ static void construct(dict_t *d)
dnode_t *dn;
char *tok1, *tok2, *val;
const char *key;
- char *help =
+ char *help =
"p turn prompt on\n"
"q finish construction\n"
"a <key> <val> add new entry\n";
diff --git a/isisd/dict.h b/isisd/dict.h
index 9395d1c0..e381256f 100644
--- a/isisd/dict.h
+++ b/isisd/dict.h
@@ -21,7 +21,7 @@
#ifndef DICT_H
#define DICT_H
-#include <limits.h>
+#include "misc.h"
#ifdef KAZLIB_SIDEEFFECT_DEBUG
#include "sfx.h"
#endif
diff --git a/isisd/isis_misc.c b/isisd/isis_misc.c
index fd910835..d45d7aa0 100644
--- a/isisd/isis_misc.c
+++ b/isisd/isis_misc.c
@@ -3,21 +3,21 @@
* Miscellanous routines
*
* Copyright (C) 2001,2002 Sampo Saaristo
- * Tampere University of Technology
+ * Tampere University of Technology
* Institute of Communications Engineering
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public Licenseas published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public Licenseas published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * This program is distributed in the hope that it will be useful,but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * This program is distributed in the hope that it will be useful,but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
@@ -96,7 +96,7 @@ isonet_print (u_char * from, int len)
/*
* Returns 0 on error, length of buff on ok
- * extract dot from the dotted str, and insert all the number in a buff
+ * extract dot from the dotted str, and insert all the number in a buff
*/
int
dotformat2buff (u_char * buff, const u_char * dotted)
@@ -464,7 +464,7 @@ isis_jitter (unsigned long timer, unsigned long jitter)
if (timer == 1)
return timer;
- /*
+ /*
* randomizing just the percent value provides
* no good random numbers - hence the spread
* to RANDOM_SPREAD (100000), which is ok as
@@ -496,16 +496,5 @@ newprefix2inaddr (u_char * prefix_start, u_char prefix_masklen)
const char *
unix_hostname (void)
{
- static struct utsname names;
- const char *hostname;
- extern struct host host;
-
- hostname = host.name;
- if (!hostname)
- {
- uname (&names);
- hostname = names.nodename;
- }
-
- return hostname;
-}
+ return cmd_host_name(true) ; /* if required, get fresh system hostname */
+} ;
diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c
index 5d7e9da4..c4433e49 100644
--- a/isisd/isis_spf.c
+++ b/isisd/isis_spf.c
@@ -3,21 +3,21 @@
* The SPT algorithm
*
* Copyright (C) 2001,2002 Sampo Saaristo
- * Tampere University of Technology
+ * Tampere University of Technology
* Institute of Communications Engineering
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public Licenseas published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public Licenseas published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
- * This program is distributed in the hope that it will be useful,but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * This program is distributed in the hope that it will be useful,but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
@@ -64,7 +64,7 @@ remove_excess_adjs (struct list *adjs)
struct isis_adjacency *adj, *candidate = NULL;
int comp;
- for (ALL_LIST_ELEMENTS_RO (adjs, node, adj))
+ for (ALL_LIST_ELEMENTS_RO (adjs, node, adj))
{
if (excess == NULL)
excess = node;
@@ -229,7 +229,7 @@ isis_spftree_del (struct isis_spftree *spftree)
return;
}
-#endif
+#endif
void
spftree_area_init (struct isis_area *area)
@@ -241,7 +241,7 @@ spftree_area_init (struct isis_area *area)
area->spftree6[0] = isis_spftree_new ();
#endif
- /* thread_add_timer (master, isis_run_spf_l1, area,
+ /* thread_add_timer (master, isis_run_spf_l1, area,
isis_jitter (PERIODIC_SPF_INTERVAL, 10)); */
}
@@ -251,7 +251,7 @@ spftree_area_init (struct isis_area *area)
#ifdef HAVE_IPV6
area->spftree6[1] = isis_spftree_new ();
#endif
- /* thread_add_timer (master, isis_run_spf_l2, area,
+ /* thread_add_timer (master, isis_run_spf_l2, area,
isis_jitter (PERIODIC_SPF_INTERVAL, 10)); */
}
@@ -416,7 +416,7 @@ isis_spf_add2tent (struct isis_spftree *spftree, enum vertextype vtype,
listnode_add (spftree->tents, vertex);
return vertex;
}
-
+
/* XXX: This cant use the standard ALL_LIST_ELEMENT macro */
for (node = listhead (spftree->tents); node; node = listnextnode (node))
{
@@ -613,7 +613,7 @@ lspfragloop:
if (family == AF_INET && lsp->tlv_data.ipv4_int_reachs)
{
prefix.family = AF_INET;
- for (ALL_LIST_ELEMENTS_RO (lsp->tlv_data.ipv4_int_reachs,
+ for (ALL_LIST_ELEMENTS_RO (lsp->tlv_data.ipv4_int_reachs,
node, ipreach))
{
dist = cost + ipreach->metrics.metric_default;
@@ -658,7 +658,7 @@ lspfragloop:
if (family == AF_INET6 && lsp->tlv_data.ipv6_reachs)
{
prefix.family = AF_INET6;
- for (ALL_LIST_ELEMENTS_RO (lsp->tlv_data.ipv6_reachs,
+ for (ALL_LIST_ELEMENTS_RO (lsp->tlv_data.ipv6_reachs,
node, ip6reach))
{
dist = cost + ip6reach->metric;
@@ -789,7 +789,7 @@ isis_spf_preload_tent (struct isis_spftree *spftree,
if (family == AF_INET6 && !circuit->ipv6_router)
continue;
#endif /* HAVE_IPV6 */
- /*
+ /*
* Add IP(v6) addresses of this circuit
*/
if (family == AF_INET)
@@ -872,7 +872,7 @@ isis_spf_preload_tent (struct isis_spftree *spftree,
}
list_delete (adj_list);
/*
- * Add the pseudonode
+ * Add the pseudonode
*/
if (level == 1)
memcpy (lsp_id, circuit->u.bc.l1_desig_is, ISIS_SYS_ID_LEN + 1);
@@ -1272,7 +1272,7 @@ isis_spf_schedule6 (struct isis_area *area, int level)
spftree->pending = 1;
return retval;
}
-
+
THREAD_TIMER_OFF (spftree->t_spf);
if (diff < MINIMUM_SPF_INTERVAL)
@@ -1323,7 +1323,7 @@ isis_print_paths (struct vty *vty, struct list *paths)
continue;
if (memcmp (vertex->N.id, isis->sysid, ISIS_SYS_ID_LEN) == 0)
{
- vty_out (vty, "%s --%s", host.name?host.name:"",
+ vty_out (vty, "%s --%s", cmd_host_name(true),
VTY_NEWLINE);
}
else
diff --git a/isisd/topology/spgrid.c b/isisd/topology/spgrid.c
index 5197beb1..2aec9841 100644
--- a/isisd/topology/spgrid.c
+++ b/isisd/topology/spgrid.c
@@ -1,10 +1,11 @@
+#include <zebra.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "random.c"
-#include <zebra.h>
#include "thread.h"
#include "vty.h"