summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Hall <GMCH@hestia.halldom.com>2010-04-17 16:11:13 +0100
committerChris Hall <GMCH@hestia.halldom.com>2010-04-17 16:11:13 +0100
commit825f338d44433fc2d351c08d41272f52a15329db (patch)
tree927c6a37e8dbf4c425d845895500b59ac997fbfb
parent68297cc9dc2eb920dd6e956d0d55098ea9edaafc (diff)
downloadquagga-825f338d44433fc2d351c08d41272f52a15329db.tar.bz2
quagga-825f338d44433fc2d351c08d41272f52a15329db.tar.xz
Fixing declarations to eliminate compiler warnings in zebra.
Only parts of zebra/*.c are compiled and linked, depending on what was chosen at "configure" time. A subset of that is compiled and linked for testzebra. Some things were not declared, or not declared everywhere they were required... leading to a number of compiler warnings. These changes are intended to tidy that up.
-rw-r--r--zebra/Makefile.am3
-rw-r--r--zebra/if_ioctl.c3
-rw-r--r--zebra/if_ioctl_solaris.c5
-rw-r--r--zebra/if_method.h39
-rw-r--r--zebra/if_netlink.c5
-rw-r--r--zebra/if_proc.c32
-rw-r--r--zebra/if_sysctl.c3
-rw-r--r--zebra/interface.h17
-rw-r--r--zebra/ioctl.c2
-rw-r--r--zebra/ioctl.h9
-rw-r--r--zebra/ipforward.h11
-rw-r--r--zebra/ipforward_aix.c1
-rw-r--r--zebra/ipforward_ews.c1
-rw-r--r--zebra/main.c2
-rw-r--r--zebra/misc_null.c16
-rw-r--r--zebra/mtu_kvm.c7
-rw-r--r--zebra/router-id.c2
-rw-r--r--zebra/rt.h9
-rw-r--r--zebra/rt_netlink.c4
-rw-r--r--zebra/rtread.h38
-rw-r--r--zebra/rtread_getmsg.c2
-rw-r--r--zebra/rtread_netlink.c6
-rw-r--r--zebra/rtread_sysctl.c2
-rw-r--r--zebra/test_main.c1
-rw-r--r--zebra/zserv.h2
25 files changed, 189 insertions, 33 deletions
diff --git a/zebra/Makefile.am b/zebra/Makefile.am
index 542f36f4..68762ccc 100644
--- a/zebra/Makefile.am
+++ b/zebra/Makefile.am
@@ -37,7 +37,8 @@ testzebra_SOURCES = test_main.c zebra_rib.c interface.c connected.c debug.c \
noinst_HEADERS = \
connected.h ioctl.h rib.h rt.h zserv.h redistribute.h debug.h rtadv.h \
- interface.h ipforward.h irdp.h router-id.h kernel_socket.h
+ interface.h ipforward.h irdp.h router-id.h kernel_socket.h \
+ if_method.h rtread.h
zebra_LDADD = $(otherobj) $(LIBCAP) $(LIB_IPV6) ../lib/libzebra.la
diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c
index f357e154..14d40481 100644
--- a/zebra/if_ioctl.c
+++ b/zebra/if_ioctl.c
@@ -20,7 +20,10 @@
* 02111-1307, USA.
*/
+/* This is compiled and linked if found to be required at "configure" time. */
+
#include <zebra.h>
+#include "if_method.h"
#include "if.h"
#include "sockunion.h"
diff --git a/zebra/if_ioctl_solaris.c b/zebra/if_ioctl_solaris.c
index fc384ea2..d86842b8 100644
--- a/zebra/if_ioctl_solaris.c
+++ b/zebra/if_ioctl_solaris.c
@@ -20,7 +20,10 @@
* 02111-1307, USA.
*/
+/* This is compiled and linked if found to be required at "configure" time. */
+
#include <zebra.h>
+#include "if_method.h"
#include "if.h"
#include "sockunion.h"
@@ -31,8 +34,6 @@
#include "log.h"
#include "privs.h"
-#include "zebra/interface.h"
-
void lifreq_set_name (struct lifreq *, const char *);
int if_get_flags_direct (const char *, uint64_t *, unsigned int af);
static int if_get_addr (struct interface *, struct sockaddr *, const char *);
diff --git a/zebra/if_method.h b/zebra/if_method.h
new file mode 100644
index 00000000..b5c95806
--- /dev/null
+++ b/zebra/if_method.h
@@ -0,0 +1,39 @@
+/* if_method header.
+ * Copyright (C) 1999 Kunihiro Ishiguro
+ *
+ * This file is part of GNU Zebra.
+ *
+ * GNU Zebra is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef _ZEBRA_IF_METHOD_H
+#define _ZEBRA_IF_METHOD_H
+
+/* There are (as at 17-Apr-2010) the following if methods:
+ *
+ * if_ioctl_solaris.c
+ * if_ioctl.c
+ * if_netlink.c
+ * if_sysctl.c
+ *
+ * one of which is selected at "configure" time, see: IF_METHOD
+ *
+ * Note that if_proc.c is NOT a member of this family !
+ */
+
+extern void interface_list (void) ;
+
+#endif /* _ZEBRA_IF_METHOD_H */
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c
index 013dd811..4a4a2862 100644
--- a/zebra/if_netlink.c
+++ b/zebra/if_netlink.c
@@ -21,13 +21,12 @@
*/
#include <zebra.h>
+#include "if_method.h"
extern int interface_lookup_netlink (void);
/* Interface information read by netlink. */
-extern void interface_list (void) ;
-
-extern void
+void
interface_list (void)
{
interface_lookup_netlink ();
diff --git a/zebra/if_proc.c b/zebra/if_proc.c
index 3aec530b..bb83b993 100644
--- a/zebra/if_proc.c
+++ b/zebra/if_proc.c
@@ -19,6 +19,16 @@
* 02111-1307, USA.
*/
+/* This is compiled and linked if found to be required at "configure" time.
+ *
+ * HAVE_PROC_NET_DEV => /proc/net/dev exists
+ * HAVE_PROC_NET_IF_INET6 => /proc/net/if_inet6 exists
+ *
+ * One or both of this will be the case if this is being compiled.
+ *
+ * Appears NOT to be used if netlink is available.
+ */
+
#include <zebra.h>
#include "if.h"
@@ -29,6 +39,16 @@
#include "zebra/connected.h"
#include "zebra/interface.h"
+/* zebra/interface.h declares the extern functions for if_proc.c
+ *
+ * The following are not declared if HAVE_PROC_NET_DEV is not defined.
+ * So declare them here if required, in order to suppress warnings.
+ */
+#ifndef HAVE_PROC_NET_DEV
+extern void ifstat_update_proc (void);
+extern int interface_list_proc (void);
+#endif
+
/* Proc filesystem one line buffer. */
#define PROCBUFSIZ 1024
@@ -123,8 +143,8 @@ ifstat_dev_fields (int version, char *buf, struct interface *ifp)
}
/* Update interface's statistics. */
-void
-ifstat_update_proc (void)
+extern void
+ifstat_update_proc (void) /* declared in interface.h */
{
FILE *fp;
char buf[PROCBUFSIZ];
@@ -166,8 +186,8 @@ ifstat_update_proc (void)
}
/* Interface structure allocation by proc filesystem. */
-int
-interface_list_proc ()
+extern int
+interface_list_proc () /* declared in interface.h */
{
FILE *fp;
char buf[PROCBUFSIZ];
@@ -205,8 +225,8 @@ interface_list_proc ()
#define _PATH_PROC_NET_IF_INET6 "/proc/net/if_inet6"
#endif /* _PATH_PROC_NET_IF_INET6 */
-int
-ifaddr_proc_ipv6 ()
+extern int
+ifaddr_proc_ipv6 () /* declared in interface.h */
{
FILE *fp;
char buf[PROCBUFSIZ];
diff --git a/zebra/if_sysctl.c b/zebra/if_sysctl.c
index 5e809964..8c78daa6 100644
--- a/zebra/if_sysctl.c
+++ b/zebra/if_sysctl.c
@@ -20,7 +20,10 @@
* 02111-1307, USA.
*/
+/* This is compiled and linked if found to be required at "configure" time. */
+
#include <zebra.h>
+#include "if_method.h"
#include "if.h"
#include "sockunion.h"
diff --git a/zebra/interface.h b/zebra/interface.h
index 0cf66403..e07388cb 100644
--- a/zebra/interface.h
+++ b/zebra/interface.h
@@ -225,21 +225,20 @@ extern int if_subnet_add (struct interface *, struct connected *);
extern int if_subnet_delete (struct interface *, struct connected *);
#ifdef HAVE_PROC_NET_DEV
-extern void ifstat_update_proc (void);
+extern void ifstat_update_proc (void); /* see if_proc.c */
+extern int interface_list_proc (void); /* see if_proc.c */
#endif /* HAVE_PROC_NET_DEV */
+
+#if defined(HAVE_IPV6) && defined(HAVE_PROC_NET_IF_INET6)
+extern int ifaddr_proc_ipv6 (void); /* see if_proc.c */
+#endif /* HAVE_PROC_NET_IF_INET6 */
+
#ifdef HAVE_NET_RT_IFLIST
extern void ifstat_update_sysctl (void);
-
#endif /* HAVE_NET_RT_IFLIST */
-#ifdef HAVE_PROC_NET_DEV
-extern int interface_list_proc (void);
-#endif /* HAVE_PROC_NET_DEV */
-#ifdef HAVE_PROC_NET_IF_INET6
-extern int ifaddr_proc_ipv6 (void);
-#endif /* HAVE_PROC_NET_IF_INET6 */
#ifdef BSDI
-extern int if_kvm_get_mtu (struct interface *);
+extern int if_kvm_get_mtu (struct interface *); /* see mtu_kvm.c */
#endif /* BSDI */
#endif /* _ZEBRA_INTERFACE_H */
diff --git a/zebra/ioctl.c b/zebra/ioctl.c
index 97a26b86..7c51e91b 100644
--- a/zebra/ioctl.c
+++ b/zebra/ioctl.c
@@ -80,7 +80,7 @@ if_ioctl (u_long request, caddr_t buffer)
}
#ifdef HAVE_IPV6
-int
+static int
if_ioctl_ipv6 (u_long request, caddr_t buffer)
{
int sock;
diff --git a/zebra/ioctl.h b/zebra/ioctl.h
index 5481451c..2feb39bc 100644
--- a/zebra/ioctl.h
+++ b/zebra/ioctl.h
@@ -23,6 +23,14 @@
#ifndef _ZEBRA_IOCTL_H
#define _ZEBRA_IOCTL_H
+/* There are (as at 17-Apr-2010) the following ioctl methods:
+ *
+ * * ioctl.c
+ * * ioctl_solaris.c
+ *
+ * one of which is selected at "configure" time, see: IOCTL_METHOD
+ */
+
/* Prototypes. */
extern void ifreq_set_name (struct ifreq *, struct interface *);
extern int if_ioctl (u_long, caddr_t);
@@ -40,7 +48,6 @@ extern void if_get_mtu (struct interface *);
#ifdef HAVE_IPV6
extern int if_prefix_add_ipv6 (struct interface *, struct connected *);
extern int if_prefix_delete_ipv6 (struct interface *, struct connected *);
-extern int if_ioctl_ipv6(u_long, caddr_t);
#endif /* HAVE_IPV6 */
#ifdef SOLARIS_IPV6
diff --git a/zebra/ipforward.h b/zebra/ipforward.h
index 8a935c13..992ee269 100644
--- a/zebra/ipforward.h
+++ b/zebra/ipforward.h
@@ -22,6 +22,17 @@
#ifndef _ZEBRA_IPFORWARD_H
#define _ZEBRA_IPFORWARD_H
+/* There are (as at 17-Apr-2010) the following ipforward methods:
+ *
+ * * ipforward_proc.c
+ * * ipforward_solaris.c
+ * * ipforward_sysctl.c
+ * * ipforward_aix.c -- appears to be vestigial
+ * * ipforward_ews.c -- appears to be vestigial
+ *
+ * one of which is selected at "configure" time, see: IPFORWARD
+ */
+
extern int ipforward (void);
extern int ipforward_on (void);
extern int ipforward_off (void);
diff --git a/zebra/ipforward_aix.c b/zebra/ipforward_aix.c
index c79e7f1c..b9ef2d54 100644
--- a/zebra/ipforward_aix.c
+++ b/zebra/ipforward_aix.c
@@ -21,6 +21,7 @@
*/
#include <zebra.h>
+#include "zebra/ipforward.h"
int
ipforward ()
diff --git a/zebra/ipforward_ews.c b/zebra/ipforward_ews.c
index c872000a..4eb618f1 100644
--- a/zebra/ipforward_ews.c
+++ b/zebra/ipforward_ews.c
@@ -21,6 +21,7 @@
*/
#include <zebra.h>
+#include "zebra/ipforward.h"
int
ipforward ()
diff --git a/zebra/main.c b/zebra/main.c
index d829c046..d324acb5 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -39,6 +39,8 @@
#include "zebra/router-id.h"
#include "zebra/irdp.h"
#include "zebra/rtadv.h"
+#include "zebra/if_method.h"
+#include "zebra/rtread.h"
/* Zebra instance */
struct zebra_t zebrad =
diff --git a/zebra/misc_null.c b/zebra/misc_null.c
index f0269ec2..f37ce657 100644
--- a/zebra/misc_null.c
+++ b/zebra/misc_null.c
@@ -1,3 +1,7 @@
+/* misc_null.c
+ *
+ * This is used only in the testzebra build.
+ */
#include <zebra.h>
#include "prefix.h"
@@ -5,7 +9,17 @@
#include "zebra/irdp.h"
#include "zebra/interface.h"
-void ifstat_update_proc (void) { return; } ;
+/* ifstat_update_proc() is defined in if_proc.c -- which is not part of the
+ * testzebra build.
+ *
+ * ifstat_update_proc() is declared in interface.h -- but only if
+ * #ifdef HAVE_PROC_NET_DEV.
+ *
+ * So declare it here as well, to avoid a compiler warning.
+ */
+extern void ifstat_update_proc (void);
+
+void ifstat_update_proc (void) { return; }
#pragma weak rtadv_config_write = ifstat_update_proc
#pragma weak irdp_config_write = ifstat_update_proc
diff --git a/zebra/mtu_kvm.c b/zebra/mtu_kvm.c
index d37bb9bb..c54741dd 100644
--- a/zebra/mtu_kvm.c
+++ b/zebra/mtu_kvm.c
@@ -24,9 +24,16 @@
#include <kvm.h>
#include <limits.h>
#include <fcntl.h>
+#include "zebra/interface.h" /* declares if_kvm_get_mtu() */
#include "if.h"
+/* This is compiled and linked for BSDI if found to be required at "configure"
+ * time.
+ *
+ * See: OTHER_METHOD
+ */
+
/* get interface MTU to use kvm_read */
void
if_kvm_get_mtu (struct interface *ifp)
diff --git a/zebra/router-id.c b/zebra/router-id.c
index 41bab545..81ffa1b7 100644
--- a/zebra/router-id.c
+++ b/zebra/router-id.c
@@ -136,7 +136,7 @@ router_id_add_address (struct connected *ifc)
l = &rid_all_sorted_list;
if (!router_id_find_node (l, ifc))
- listnode_add (l, ifc);
+ listnode_add_sort (l, ifc);
router_id_get (&after);
diff --git a/zebra/rt.h b/zebra/rt.h
index 8bfe5a42..41e3b070 100644
--- a/zebra/rt.h
+++ b/zebra/rt.h
@@ -23,6 +23,15 @@
#ifndef _ZEBRA_RT_H
#define _ZEBRA_RT_H
+/* There are (as at 17-Apr-2010) the following rt methods:
+ *
+ * rt_ioctl.c
+ * rt_netlink.c
+ * rt_socket.c
+ *
+ * one of which is selected at "configure" time, see: RT_METHOD
+ */
+
#include "prefix.h"
#include "if.h"
#include "zebra/rib.h"
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index b5fe0ec8..fb5a79a2 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -1037,7 +1037,7 @@ netlink_information_fetch (struct sockaddr_nl *snl, struct nlmsghdr *h)
}
/* Interface lookup by netlink socket. */
-extern int interface_lookup_netlink (void) ;
+extern int interface_lookup_netlink (void) ; /* see: if_netlink.c */
extern int
interface_lookup_netlink (void)
@@ -1075,7 +1075,7 @@ interface_lookup_netlink (void)
/* Routing table read function using netlink interface. Only called
bootstrap time. */
-extern int netlink_route_read (void) ;
+extern int netlink_route_read (void) ; /* see: rtread_netlink.c */
extern int
netlink_route_read (void)
diff --git a/zebra/rtread.h b/zebra/rtread.h
new file mode 100644
index 00000000..6dea5652
--- /dev/null
+++ b/zebra/rtread.h
@@ -0,0 +1,38 @@
+/*
+ * kernel routing table reading prototype.
+ * Copyright (C) 1998 Kunihiro Ishiguro
+ *
+ * This file is part of GNU Zebra.
+ *
+ * GNU Zebra is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * GNU Zebra 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 GNU Zebra; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef _ZEBRA_RTREAD_H
+#define _ZEBRA_RTREAD_H
+
+/* There are (as at 17-Apr-2010) the following rtread methods:
+ *
+ * rtread_getmsg.c
+ * rtread_netlink.c
+ * rtread_proc.c
+ * rtread_sysctl.c
+ *
+ * one of which is selected at "configure" time, see: RTREAD_METHOD
+ */
+
+extern void route_read (void) ;
+
+#endif /* _ZEBRA_RTREAD_H */
diff --git a/zebra/rtread_getmsg.c b/zebra/rtread_getmsg.c
index 3e065c6f..c8412fdf 100644
--- a/zebra/rtread_getmsg.c
+++ b/zebra/rtread_getmsg.c
@@ -27,7 +27,7 @@
#include "if.h"
#include "zebra/rib.h"
-#include "zebra/zserv.h"
+#include "zebra/rtread.h"
#include <sys/stream.h>
#include <sys/tihdr.h>
diff --git a/zebra/rtread_netlink.c b/zebra/rtread_netlink.c
index 800e552b..aa09406e 100644
--- a/zebra/rtread_netlink.c
+++ b/zebra/rtread_netlink.c
@@ -21,8 +21,10 @@
*/
#include <zebra.h>
-extern void netlink_route_read (void);
-extern void route_read (void) ;
+
+#include "zebra/rtread.h"
+
+extern void netlink_route_read (void) ; /* see: rt_netlink.c */
extern void route_read (void)
{
diff --git a/zebra/rtread_sysctl.c b/zebra/rtread_sysctl.c
index b8f5bde7..3cceee7e 100644
--- a/zebra/rtread_sysctl.c
+++ b/zebra/rtread_sysctl.c
@@ -25,7 +25,7 @@
#include "memory.h"
#include "log.h"
-#include "zebra/zserv.h"
+#include "zebra/rtread.h"
#include "zebra/rt.h"
#include "zebra/kernel_socket.h"
diff --git a/zebra/test_main.c b/zebra/test_main.c
index 70a1a3a6..926bf4fb 100644
--- a/zebra/test_main.c
+++ b/zebra/test_main.c
@@ -32,6 +32,7 @@
#include "zebra/rib.h"
#include "zebra/zserv.h"
+#include "zebra/rtread.h"
#include "zebra/debug.h"
#include "zebra/router-id.h"
#include "zebra/interface.h"
diff --git a/zebra/zserv.h b/zebra/zserv.h
index a7371830..3ad3863c 100644
--- a/zebra/zserv.h
+++ b/zebra/zserv.h
@@ -92,9 +92,7 @@ extern void zebra_if_init (void);
extern void zebra_zserv_socket_init (void);
extern void hostinfo_get (void);
extern void rib_init (void);
-extern void interface_list (void);
extern void kernel_init (void);
-extern void route_read (void);
extern void zebra_route_map_init (void);
extern void zebra_snmp_init (void);
extern void zebra_vty_init (void);