summaryrefslogtreecommitdiff
path: root/lib/if.c
diff options
context:
space:
mode:
authorpaul <paul>2005-05-06 21:25:49 +0000
committerpaul <paul>2005-05-06 21:25:49 +0000
commit8cc4198f9fabe5f10f5a773de1503d82f33a01fb (patch)
tree77045da709ff66629bd12029b9ee17700360909b /lib/if.c
parente7fe8c88c3d552400e1ae3ae9243319ab95d6f2d (diff)
2005-05-06 Paul Jakma <paul@dishone.st>
* (general) extern and static'ification of functions in code and header. Cleanup any definitions with unspecified arguments. Add casts for callback assignments where the callback is defined, typically, as passing void *, but the function being assigned has some other pointer type defined as its argument, as gcc complains about casts from void * to X* via function arguments. Fix some old K&R style function argument definitions. Add noreturn gcc attribute to some functions, as appropriate. Add unused gcc attribute to some functions (eg ones meant to help while debugging) Add guard defines to headers which were missing them. * command.c: (install_node) add const qualifier, still doesnt shut up the warning though, because of the double pointer. (cmp_node) ditto * keychain.c: (key_str2time) Add GET_LONG_RANGE() macro, derived fromn vty.h ones to fix some of the (long) < 0 warnings. * thread.c: (various) use thread_empty (cpu_record_hash_key) should cast to uintptr_t, a stdint.h type * vty.h: Add VTY_GET_IPV4_ADDRESS and VTY_GET_IPV4_PREFIX so they removed from ospfd/ospf_vty.h * zebra.h: Move definition of ZEBRA_PORT to here, to remove dependence of lib on zebra/zserv.h
Diffstat (limited to 'lib/if.c')
-rw-r--r--lib/if.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/lib/if.c b/lib/if.c
index 35fe9caa..a57da352 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -191,13 +191,13 @@ if_lookup_by_index (unsigned int index)
return NULL;
}
-char *
+const char *
ifindex2ifname (unsigned int index)
{
struct interface *ifp;
return ((ifp = if_lookup_by_index(index)) != NULL) ?
- ifp->name : (char *)"unknown";
+ ifp->name : "unknown";
}
unsigned int
@@ -434,7 +434,7 @@ if_flag_dump (unsigned long flag)
}
/* For debugging */
-void
+static void
if_dump (struct interface *ifp)
{
struct listnode *node;
@@ -587,7 +587,7 @@ DEFUN (show_address,
/* Allocate connected structure. */
struct connected *
-connected_new ()
+connected_new (void)
{
struct connected *new = XMALLOC (MTYPE_CONNECTED, sizeof (struct connected));
memset (new, 0, sizeof (struct connected));
@@ -611,7 +611,7 @@ connected_free (struct connected *connected)
}
/* Print if_addr structure. */
-void
+static void __attribute__ ((unused))
connected_log (struct connected *connected, char *str)
{
struct prefix *p;
@@ -637,7 +637,7 @@ connected_log (struct connected *connected, char *str)
}
/* If two connected address has same prefix return 1. */
-int
+static int
connected_same_prefix (struct prefix *p1, struct prefix *p2)
{
if (p1->family == p2->family)
@@ -767,13 +767,16 @@ if_indextoname (unsigned int ifindex, char *name)
}
#endif
+#if 0 /* this route_table of struct connected's is unused
+ * however, it would be good to use a route_table rather than
+ * a list..
+ */
/* Interface looking up by interface's address. */
-
/* Interface's IPv4 address reverse lookup table. */
struct route_table *ifaddr_ipv4_table;
/* struct route_table *ifaddr_ipv6_table; */
-void
+static void
ifaddr_ipv4_add (struct in_addr *ifaddr, struct interface *ifp)
{
struct route_node *rn;
@@ -794,7 +797,7 @@ ifaddr_ipv4_add (struct in_addr *ifaddr, struct interface *ifp)
rn->info = ifp;
}
-void
+static void
ifaddr_ipv4_delete (struct in_addr *ifaddr, struct interface *ifp)
{
struct route_node *rn;
@@ -817,7 +820,7 @@ ifaddr_ipv4_delete (struct in_addr *ifaddr, struct interface *ifp)
}
/* Lookup interface by interface's IP address or interface index. */
-struct interface *
+static struct interface *
ifaddr_ipv4_lookup (struct in_addr *addr, unsigned int ifindex)
{
struct prefix_ipv4 p;
@@ -841,13 +844,16 @@ ifaddr_ipv4_lookup (struct in_addr *addr, unsigned int ifindex)
else
return if_lookup_by_index(ifindex);
}
+#endif /* ifaddr_ipv4_table */
/* Initialize interface list. */
void
-if_init ()
+if_init (void)
{
iflist = list_new ();
+#if 0
ifaddr_ipv4_table = route_table_init ();
+#endif /* ifaddr_ipv4_table */
if (iflist) {
iflist->cmp = (int (*)(void *, void *))if_cmp_func;