diff options
author | paul <paul> | 2005-06-28 17:17:12 +0000 |
---|---|---|
committer | paul <paul> | 2005-06-28 17:17:12 +0000 |
commit | a1ac18c4d5b4f8f4f279efb2ae12b46258f22282 (patch) | |
tree | e37732ef4b00ae98d1be693e721b01cc2566ba39 /zebra | |
parent | 94f2b3923e9663d0355a829f22e4e31cf68ee7b8 (diff) |
2005-06-28 Paul Jakma <paul.jakma@sun.com>
* (global) Extern and static'ification, with related fixups
of declarations, ensuring files include their own headers, etc.
if_ioctl.c: (interface_info_ioctl) fix obvious arg mis-order in
list loop
Diffstat (limited to 'zebra')
-rw-r--r-- | zebra/ChangeLog | 8 | ||||
-rw-r--r-- | zebra/connected.c | 5 | ||||
-rw-r--r-- | zebra/connected.h | 32 | ||||
-rw-r--r-- | zebra/debug.c | 4 | ||||
-rw-r--r-- | zebra/debug.h | 2 | ||||
-rw-r--r-- | zebra/if_ioctl.c | 14 | ||||
-rw-r--r-- | zebra/interface.c | 30 | ||||
-rw-r--r-- | zebra/interface.h | 24 | ||||
-rw-r--r-- | zebra/ioctl.c | 2 | ||||
-rw-r--r-- | zebra/ioctl.h | 26 | ||||
-rw-r--r-- | zebra/ipforward.h | 12 | ||||
-rw-r--r-- | zebra/ipforward_proc.c | 14 | ||||
-rw-r--r-- | zebra/ipforward_solaris.c | 13 | ||||
-rw-r--r-- | zebra/ipforward_sysctl.c | 13 | ||||
-rw-r--r-- | zebra/main.c | 9 | ||||
-rw-r--r-- | zebra/redistribute.h | 28 | ||||
-rw-r--r-- | zebra/rib.h | 63 | ||||
-rw-r--r-- | zebra/router-id.c | 3 | ||||
-rw-r--r-- | zebra/rt.h | 18 | ||||
-rw-r--r-- | zebra/rt_ioctl.c | 14 | ||||
-rw-r--r-- | zebra/rtadv.c | 52 | ||||
-rw-r--r-- | zebra/rtadv.h | 3 | ||||
-rw-r--r-- | zebra/rtread_proc.c | 11 | ||||
-rw-r--r-- | zebra/zebra_rib.c | 84 | ||||
-rw-r--r-- | zebra/zebra_vty.c | 34 | ||||
-rw-r--r-- | zebra/zserv.c | 2 | ||||
-rw-r--r-- | zebra/zserv.h | 35 |
27 files changed, 282 insertions, 273 deletions
diff --git a/zebra/ChangeLog b/zebra/ChangeLog index 677643ee..f215266c 100644 --- a/zebra/ChangeLog +++ b/zebra/ChangeLog @@ -1,3 +1,11 @@ +2005-06-28 Paul Jakma <paul.jakma@sun.com> + + * (global) Extern and static'ification, with related fixups + of declarations, ensuring files include their own headers, etc. + if_ioctl.c: (interface_info_ioctl) fix obvious arg mis-order in + list loop + + 2005-06-14 Paul Jakma <paul.jakma@sun.com> * kernel_socket.c: consolidate the IFAM{ADDR,MASK}GET and diff --git a/zebra/connected.c b/zebra/connected.c index 3ce59530..46d2aab9 100644 --- a/zebra/connected.c +++ b/zebra/connected.c @@ -33,6 +33,7 @@ #include "zebra/zserv.h" #include "zebra/redistribute.h" #include "zebra/interface.h" +#include "zebra/connected.h" /* If same interface address is already exist... */ struct connected * @@ -88,7 +89,7 @@ connected_up_ipv4 (struct interface *ifp, struct connected *ifc) /* Add connected IPv4 route to the interface. */ void connected_add_ipv4 (struct interface *ifp, int flags, struct in_addr *addr, - int prefixlen, struct in_addr *broad, char *label) + u_char prefixlen, struct in_addr *broad, char *label) { struct prefix_ipv4 *p; struct connected *ifc; @@ -226,7 +227,7 @@ connected_down_ipv4 (struct interface *ifp, struct connected *ifc) /* Delete connected IPv4 route to the interface. */ void connected_delete_ipv4 (struct interface *ifp, int flags, struct in_addr *addr, - int prefixlen, struct in_addr *broad, char *label) + u_char prefixlen, struct in_addr *broad, char *label) { struct prefix_ipv4 p; struct connected *ifc; diff --git a/zebra/connected.h b/zebra/connected.h index 7bf13baf..726092ae 100644 --- a/zebra/connected.h +++ b/zebra/connected.h @@ -23,37 +23,33 @@ #ifndef _ZEBRA_CONNECTED_H #define _ZEBRA_CONNECTED_H -struct connected * +extern struct connected * connected_check_ipv4 (struct interface *ifp, struct prefix *p); -void +extern void connected_add_ipv4 (struct interface *ifp, int flags, struct in_addr *addr, - int prefixlen, struct in_addr *broad, char *label); + u_char prefixlen, struct in_addr *broad, char *label); -void +extern void connected_delete_ipv4 (struct interface *ifp, int flags, struct in_addr *addr, - int prefixlen, struct in_addr *broad, char *label); + u_char prefixlen, struct in_addr *broad, char *label); -void -connected_up_ipv4 (struct interface *, struct connected *); -void -connected_down_ipv4 (struct interface *, struct connected *); +extern void connected_up_ipv4 (struct interface *, struct connected *); +extern void connected_down_ipv4 (struct interface *, struct connected *); #ifdef HAVE_IPV6 -struct connected * +extern struct connected * connected_check_ipv6 (struct interface *ifp, struct prefix *p); -void +extern void connected_add_ipv6 (struct interface *ifp, struct in6_addr *address, - int prefixlen, struct in6_addr *broad); -void + u_char prefixlen, struct in6_addr *broad); +extern void connected_delete_ipv6 (struct interface *ifp, struct in6_addr *address, - int prefixlen, struct in6_addr *broad); -void -connected_up_ipv6 (struct interface *, struct connected *); + u_char prefixlen, struct in6_addr *broad); -void -connected_down_ipv6 (struct interface *ifp, struct connected *); +extern void connected_up_ipv6 (struct interface *, struct connected *); +extern void connected_down_ipv6 (struct interface *ifp, struct connected *); #endif /* HAVE_IPV6 */ diff --git a/zebra/debug.c b/zebra/debug.c index fc99623a..8575a664 100644 --- a/zebra/debug.c +++ b/zebra/debug.c @@ -201,7 +201,7 @@ struct cmd_node debug_node = 1 }; -int +static int config_write_debug (struct vty *vty) { int write = 0; @@ -242,7 +242,7 @@ config_write_debug (struct vty *vty) } void -zebra_debug_init () +zebra_debug_init (void) { zebra_debug_event = 0; zebra_debug_packet = 0; diff --git a/zebra/debug.h b/zebra/debug.h index 6eaa9572..96b7d8fc 100644 --- a/zebra/debug.h +++ b/zebra/debug.h @@ -47,6 +47,6 @@ extern unsigned long zebra_debug_event; extern unsigned long zebra_debug_packet; extern unsigned long zebra_debug_kernel; -void zebra_debug_init (); +extern void zebra_debug_init (void); #endif /* _ZEBRA_DEBUG_H */ diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c index 24c4cd74..66d8327d 100644 --- a/zebra/if_ioctl.c +++ b/zebra/if_ioctl.c @@ -33,8 +33,8 @@ #include "zebra/interface.h" /* Interface looking up using infamous SIOCGIFCONF. */ -int -interface_list_ioctl () +static int +interface_list_ioctl (void) { int ret; int sock; @@ -131,7 +131,7 @@ interface_list_ioctl () } /* Get interface's index by ioctl. */ -int +static int if_get_index (struct interface *ifp) { #if defined(HAVE_IF_NAMETOINDEX) @@ -176,7 +176,7 @@ if_get_index (struct interface *ifp) } #ifdef SIOCGIFHWADDR -int +static int if_get_hwaddr (struct interface *ifp) { int ret; @@ -210,8 +210,8 @@ if_get_hwaddr (struct interface *ifp) #ifdef HAVE_GETIFADDRS #include <ifaddrs.h> -int -if_getaddrs () +static int +if_getaddrs (void) { int ret; struct ifaddrs *ifap; @@ -412,7 +412,7 @@ interface_info_ioctl () struct listnode *node, *nnode; struct interface *ifp; - for (ALL_LIST_ELEMENTS (iflist, ifp, node, nnode)) + for (ALL_LIST_ELEMENTS (iflist, node, nnode, ifp)) { if_get_index (ifp); #ifdef SIOCGIFHWADDR diff --git a/zebra/interface.c b/zebra/interface.c index bd31fb40..8032614f 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -43,7 +43,7 @@ /* Called when new interface is added. */ -int +static int if_zebra_new_hook (struct interface *ifp) { struct zebra_if *zebra_if; @@ -89,7 +89,7 @@ if_zebra_new_hook (struct interface *ifp) } /* Called when interface is deleted. */ -int +static int if_zebra_delete_hook (struct interface *ifp) { struct zebra_if *zebra_if; @@ -189,7 +189,7 @@ if_subnet_delete (struct interface *ifp, struct connected *ifc) /* Wake up configured address if it is not in current kernel address. */ -void +static void if_addr_wakeup (struct interface *ifp) { struct listnode *node, *nnode; @@ -490,7 +490,7 @@ if_refresh (struct interface *ifp) } /* Printout flag information into vty */ -void +static void if_flag_dump_vty (struct vty *vty, unsigned long flag) { int separator = 0; @@ -530,7 +530,7 @@ if_flag_dump_vty (struct vty *vty, unsigned long flag) } /* Output prefix string to vty. */ -int +static int prefix_vty_out (struct vty *vty, struct prefix *p) { char str[INET6_ADDRSTRLEN]; @@ -541,7 +541,7 @@ prefix_vty_out (struct vty *vty, struct prefix *p) } /* Dump if address information to vty. */ -void +static void connected_dump_vty (struct vty *vty, struct connected *connected) { struct prefix *p; @@ -585,7 +585,7 @@ connected_dump_vty (struct vty *vty, struct connected *connected) #ifdef RTADV /* Dump interface ND information to vty. */ -void +static void nd_dump_vty (struct vty *vty, struct interface *ifp) { struct zebra_if *zif; @@ -630,7 +630,7 @@ nd_dump_vty (struct vty *vty, struct interface *ifp) #endif /* RTADV */ /* Interface's information print out to vty interface. */ -void +static void if_dump_vty (struct vty *vty, struct interface *ifp) { #ifdef HAVE_SOCKADDR_DL @@ -813,7 +813,7 @@ if_dump_vty (struct vty *vty, struct interface *ifp) } /* Check supported address family. */ -int +static int if_supported_family (int family) { if (family == AF_INET) @@ -1141,7 +1141,7 @@ ALIAS (no_bandwidth_if, "Set bandwidth informational parameter\n" "Bandwidth in kilobits\n") -int +static int ip_address_install (struct vty *vty, struct interface *ifp, const char *addr_str, const char *peer_str, const char *label) @@ -1226,7 +1226,7 @@ ip_address_install (struct vty *vty, struct interface *ifp, return CMD_SUCCESS; } -int +static int ip_address_uninstall (struct vty *vty, struct interface *ifp, const char *addr_str, const char *peer_str, const char *label) @@ -1337,7 +1337,7 @@ DEFUN (no_ip_address_label, #endif /* HAVE_NETLINK */ #ifdef HAVE_IPV6 -int +static int ipv6_address_install (struct vty *vty, struct interface *ifp, const char *addr_str, const char *peer_str, const char *label, int secondary) @@ -1415,7 +1415,7 @@ ipv6_address_install (struct vty *vty, struct interface *ifp, return CMD_SUCCESS; } -int +static int ipv6_address_uninstall (struct vty *vty, struct interface *ifp, const char *addr_str, const char *peer_str, const char *label, int secondry) @@ -1497,7 +1497,7 @@ DEFUN (no_ipv6_address, } #endif /* HAVE_IPV6 */ -int +static int if_config_write (struct vty *vty) { struct listnode *node; @@ -1571,7 +1571,7 @@ if_config_write (struct vty *vty) /* Allocate and initialize interface vector. */ void -zebra_if_init () +zebra_if_init (void) { /* Initialize interface and new hook. */ if_init (); diff --git a/zebra/interface.h b/zebra/interface.h index 0033f7d5..0083cbab 100644 --- a/zebra/interface.h +++ b/zebra/interface.h @@ -203,30 +203,30 @@ struct zebra_if }; -void if_delete_update (struct interface *ifp); -void if_add_update (struct interface *ifp); -void if_up (struct interface *); -void if_down (struct interface *); -void if_refresh (struct interface *); -int if_subnet_add (struct interface *, struct connected *); -int if_subnet_delete (struct interface *, struct connected *); +extern void if_delete_update (struct interface *ifp); +extern void if_add_update (struct interface *ifp); +extern void if_up (struct interface *); +extern void if_down (struct interface *); +extern void if_refresh (struct interface *); +extern int if_subnet_add (struct interface *, struct connected *); +extern int if_subnet_delete (struct interface *, struct connected *); #ifdef HAVE_PROC_NET_DEV -int ifstat_update_proc (); +extern int ifstat_update_proc (void); #endif /* HAVE_PROC_NET_DEV */ #ifdef HAVE_NET_RT_IFLIST -void ifstat_update_sysctl (); +extern void ifstat_update_sysctl (void); #endif /* HAVE_NET_RT_IFLIST */ #ifdef HAVE_PROC_NET_DEV -int interface_list_proc (); +extern int interface_list_proc (void); #endif /* HAVE_PROC_NET_DEV */ #ifdef HAVE_PROC_NET_IF_INET6 -int ifaddr_proc_ipv6 (); +extern int ifaddr_proc_ipv6 (void); #endif /* HAVE_PROC_NET_IF_INET6 */ #ifdef BSDI -int if_kvm_get_mtu (struct interface *); +extern int if_kvm_get_mtu (struct interface *); #endif /* BSDI */ #endif /* _ZEBRA_INTERFACE_H */ diff --git a/zebra/ioctl.c b/zebra/ioctl.c index 56de810c..4137acfa 100644 --- a/zebra/ioctl.c +++ b/zebra/ioctl.c @@ -75,7 +75,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 a82c3125..5d9e09f0 100644 --- a/zebra/ioctl.h +++ b/zebra/ioctl.h @@ -24,27 +24,27 @@ #define _ZEBRA_IOCTL_H /* Prototypes. */ -void ifreq_set_name (struct ifreq *, struct interface *); -int if_ioctl (u_long, caddr_t); +extern void ifreq_set_name (struct ifreq *, struct interface *); +extern int if_ioctl (u_long, caddr_t); -int if_set_flags (struct interface *, unsigned long); -int if_unset_flags (struct interface *, unsigned long); -void if_get_flags (struct interface *); +extern int if_set_flags (struct interface *, unsigned long); +extern int if_unset_flags (struct interface *, unsigned long); +extern void if_get_flags (struct interface *); -int if_set_prefix (struct interface *, struct connected *); -int if_unset_prefix (struct interface *, struct connected *); +extern int if_set_prefix (struct interface *, struct connected *); +extern int if_unset_prefix (struct interface *, struct connected *); -void if_get_metric (struct interface *); -void if_get_mtu (struct interface *); +extern void if_get_metric (struct interface *); +extern void if_get_mtu (struct interface *); #ifdef HAVE_IPV6 -int if_prefix_add_ipv6 (struct interface *, struct connected *); -int if_prefix_delete_ipv6 (struct interface *, struct connected *); +extern int if_prefix_add_ipv6 (struct interface *, struct connected *); +extern int if_prefix_delete_ipv6 (struct interface *, struct connected *); #endif /* HAVE_IPV6 */ #ifdef SOLARIS_IPV6 -int if_ioctl_ipv6(u_long, caddr_t); -struct connected *if_lookup_linklocal( struct interface *); +extern int if_ioctl_ipv6(u_long, caddr_t); +extern struct connected *if_lookup_linklocal( struct interface *); #define AF_IOCTL(af, request, buffer) \ ((af) == AF_INET? if_ioctl(request, buffer) : \ diff --git a/zebra/ipforward.h b/zebra/ipforward.h index a772337b..8a935c13 100644 --- a/zebra/ipforward.h +++ b/zebra/ipforward.h @@ -22,14 +22,14 @@ #ifndef _ZEBRA_IPFORWARD_H #define _ZEBRA_IPFORWARD_H -int ipforward (); -int ipforward_on (); -int ipforward_off (); +extern int ipforward (void); +extern int ipforward_on (void); +extern int ipforward_off (void); #ifdef HAVE_IPV6 -int ipforward_ipv6 (); -int ipforward_ipv6_on (); -int ipforward_ipv6_off (); +extern int ipforward_ipv6 (void); +extern int ipforward_ipv6_on (void); +extern int ipforward_ipv6_off (void); #endif /* HAVE_IPV6 */ #endif /* _ZEBRA_IPFORWARD_H */ diff --git a/zebra/ipforward_proc.c b/zebra/ipforward_proc.c index f83d88c3..73846137 100644 --- a/zebra/ipforward_proc.c +++ b/zebra/ipforward_proc.c @@ -25,6 +25,8 @@ #include "log.h" #include "privs.h" +#include "zebra/ipforward.h" + extern struct zebra_privs_t zserv_privs; char proc_net_snmp[] = "/proc/net/snmp"; @@ -39,7 +41,7 @@ dropline (FILE *fp) } int -ipforward () +ipforward (void) { FILE *fp; int ipforwarding = 0; @@ -72,7 +74,7 @@ ipforward () char proc_ipv4_forwarding[] = "/proc/sys/net/ipv4/ip_forward"; int -ipforward_on () +ipforward_on (void) { FILE *fp; @@ -98,7 +100,7 @@ ipforward_on () } int -ipforward_off () +ipforward_off (void) { FILE *fp; @@ -127,7 +129,7 @@ ipforward_off () char proc_ipv6_forwarding[] = "/proc/sys/net/ipv6/conf/all/forwarding"; int -ipforward_ipv6 () +ipforward_ipv6 (void) { FILE *fp; char buf[5]; @@ -146,7 +148,7 @@ ipforward_ipv6 () } int -ipforward_ipv6_on () +ipforward_ipv6_on (void) { FILE *fp; @@ -172,7 +174,7 @@ ipforward_ipv6_on () } int -ipforward_ipv6_off () +ipforward_ipv6_off (void) { FILE *fp; diff --git a/zebra/ipforward_solaris.c b/zebra/ipforward_solaris.c index 3ad2c400..4aa1b797 100644 --- a/zebra/ipforward_solaris.c +++ b/zebra/ipforward_solaris.c @@ -25,6 +25,7 @@ #include "prefix.h" #include "privs.h" +#include "zebra/ipforward.h" /* ** Solaris should define IP_DEV_NAME in <inet/ip.h>, but we'll save @@ -126,37 +127,37 @@ solaris_nd_get(const char* parameter) { return solaris_nd(ND_GET, parameter, 0); } int -ipforward() +ipforward(void) { return solaris_nd_get("ip_forwarding"); } int -ipforward_on () +ipforward_on (void) { (void) solaris_nd_set("ip_forwarding", 1); return ipforward(); } int -ipforward_off () +ipforward_off (void) { (void) solaris_nd_set("ip_forwarding", 0); return ipforward(); } #ifdef HAVE_IPV6 -int ipforward_ipv6() +int ipforward_ipv6(void) { return solaris_nd_get("ip6_forwarding"); } int -ipforward_ipv6_on () +ipforward_ipv6_on (void) { (void) solaris_nd_set("ip6_forwarding", 1); return ipforward_ipv6(); } int -ipforward_ipv6_off () +ipforward_ipv6_off (void) { (void) solaris_nd_set("ip6_forwarding", 0); return ipforward_ipv6(); diff --git a/zebra/ipforward_sysctl.c b/zebra/ipforward_sysctl.c index a8d0d8cb..185aee3e 100644 --- a/zebra/ipforward_sysctl.c +++ b/zebra/ipforward_sysctl.c @@ -21,6 +21,7 @@ #include <zebra.h> #include "privs.h" +#include "zebra/ipforward.h" #ifdef NRL #include <netinet6/in6.h> @@ -42,7 +43,7 @@ int mib[MIB_SIZ] = }; int -ipforward () +ipforward (void) { size_t len; int ipforwarding = 0; @@ -57,7 +58,7 @@ ipforward () } int -ipforward_on () +ipforward_on (void) { size_t len; int ipforwarding = 1; @@ -78,7 +79,7 @@ ipforward_on () } int -ipforward_off () +ipforward_off (void) { size_t len; int ipforwarding = 0; @@ -115,7 +116,7 @@ int mib_ipv6[MIB_SIZ] = }; int -ipforward_ipv6 () +ipforward_ipv6 (void) { size_t len; int ip6forwarding = 0; @@ -136,7 +137,7 @@ ipforward_ipv6 () } int -ipforward_ipv6_on () +ipforward_ipv6_on (void) { size_t len; int ip6forwarding = 1; @@ -157,7 +158,7 @@ ipforward_ipv6_on () } int -ipforward_ipv6_off () +ipforward_ipv6_off (void) { size_t len; int ip6forwarding = 0; diff --git a/zebra/main.c b/zebra/main.c index 540bf316..acfde80a 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -37,6 +37,7 @@ #include "zebra/debug.h" #include "zebra/router-id.h" #include "zebra/irdp.h" +#include "zebra/rtadv.h" /* Zebra instance */ struct zebra_t zebrad = @@ -149,7 +150,7 @@ usage (char *progname, int status) } /* SIGHUP handler. */ -void +static void sighup (void) { zlog_info ("SIGHUP received"); @@ -159,7 +160,7 @@ sighup (void) } /* SIGINT handler. */ -void +static void sigint (void) { /* Decrared in rib.c */ @@ -177,7 +178,7 @@ sigint (void) } /* SIGUSR1 handler. */ -void +static void sigusr1 (void) { zlog_rotate (NULL); @@ -215,8 +216,6 @@ main (int argc, char **argv) char *config_file = NULL; char *progname; struct thread thread; - void rib_weed_tables (); - void zebra_vty_init (); /* Set umask before anything for security */ umask (0027); diff --git a/zebra/redistribute.h b/zebra/redistribute.h index 14b92b0d..9e78dfde 100644 --- a/zebra/redistribute.h +++ b/zebra/redistribute.h @@ -26,25 +26,25 @@ #include "table.h" #include "zserv.h" -void zebra_redistribute_add (int, struct zserv *, int); -void zebra_redistribute_delete (int, struct zserv *, int); +extern void zebra_redistribute_add (int, struct zserv *, int); +extern void zebra_redistribute_delete (int, struct zserv *, int); -void zebra_redistribute_default_add (int, struct zserv *, int); -void zebra_redistribute_default_delete (int, struct zserv *, int); +extern void zebra_redistribute_default_add (int, struct zserv *, int); +extern void zebra_redistribute_default_delete (int, struct zserv *, int); -void redistribute_add (struct prefix *, struct rib *); -void redistribute_delete (struct prefix *, struct rib *); +extern void redistribute_add (struct prefix *, struct rib *); +extern void redistribute_delete (struct prefix *, struct rib *); -void zebra_interface_up_update (struct interface *); -void zebra_interface_down_update (struct interface *); +extern void zebra_interface_up_update (struct interface *); +extern void zebra_interface_down_update (struct interface *); -void zebra_interface_add_update (struct interface *); -void zebra_interface_delete_update (struct interface *); +extern void zebra_interface_add_update (struct interface *); +extern void zebra_interface_delete_update (struct interface *); -void zebra_interface_address_add_update (struct interface *, - struct connected *); -void zebra_interface_address_delete_update (struct interface *, - struct connected *c); +extern void zebra_interface_address_add_update (struct interface *, + struct connected *); +extern void zebra_interface_address_delete_update (struct interface *, + struct connected *c); #endif /* _ZEBRA_REDISTRIBUTE_H */ diff --git a/zebra/rib.h b/zebra/rib.h index 1e6393e6..dbd2a6b1 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -201,70 +201,67 @@ struct vrf struct route_table *stable[AFI_MAX][SAFI_MAX]; }; -struct nexthop *nexthop_ifindex_add (struct rib *, unsigned int); -struct nexthop *nexthop_ifname_add (struct rib *, char *); -struct nexthop *nexthop_blackhole_add (struct rib *); -struct nexthop *nexthop_ipv4_add (struct rib *, struct in_addr *); +extern struct nexthop *nexthop_ifindex_add (struct rib *, unsigned int); +extern struct nexthop *nexthop_ifname_add (struct rib *, char *); +extern struct nexthop *nexthop_blackhole_add (struct rib *); +extern struct nexthop *nexthop_ipv4_add (struct rib *, struct in_addr *); #ifdef HAVE_IPV6 -struct nexthop *nexthop_ipv6_add (struct rib *, struct in6_addr *); +extern struct nexthop *nexthop_ipv6_add (struct rib *, struct in6_addr *); #endif /* HAVE_IPV6 */ -struct vrf *vrf_lookup (u_int32_t); -struct route_table *vrf_table (afi_t afi, safi_t safi, u_int32_t id); -struct route_table *vrf_static_table (afi_t afi, safi_t safi, u_int32_t id); +extern struct vrf *vrf_lookup (u_int32_t); +extern struct route_table *vrf_table (afi_t afi, safi_t safi, u_int32_t id); +extern struct route_table *vrf_static_table (afi_t afi, safi_t safi, u_int32_t id); -int -rib_add_ipv4 (int type, int flags, struct prefix_ipv4 *p, - struct in_addr *gate, unsigned int ifindex, u_int32_t vrf_id, - u_int32_t, u_char); +extern int rib_add_ipv4 (int type, int flags, struct prefix_ipv4 *p, + struct in_addr *gate, unsigned int ifindex, + u_int32_t vrf_id, u_int32_t, u_char); -int -rib_add_ipv4_multipath (struct prefix_ipv4 *, struct rib *); +extern int rib_add_ipv4_multipath (struct prefix_ipv4 *, struct rib *); -int -rib_delete_ipv4 (int type, int flags, struct prefix_ipv4 *p, - struct in_addr *gate, unsigned int ifindex, u_int32_t); +extern int rib_delete_ipv4 (int type, int flags, struct prefix_ipv4 *p, + struct in_addr *gate, unsigned int ifindex, + u_int32_t); -struct rib * -rib_match_ipv4 (struct in_addr); +extern struct rib *rib_match_ipv4 (struct in_addr); -struct rib * -rib_lookup_ipv4 (struct prefix_ipv4 *); +extern struct rib *rib_lookup_ipv4 (struct prefix_ipv4 *); -void rib_update (); -void rib_sweep_route (); -void rib_close (); -void rib_init (); +extern void rib_update (void); +extern void rib_weed_tables (void); +extern void rib_sweep_route (void); +extern void rib_close (void); +extern void rib_init (void); -int +extern int static_add_ipv4 (struct prefix *p, struct in_addr *gate, const char *ifname, u_char flags, u_char distance, u_int32_t vrf_id); -int +extern int static_delete_ipv4 (struct prefix *p, struct in_addr *gate, const char *ifname, u_char distance, u_int32_t vrf_id); #ifdef HAVE_IPV6 -int +extern int rib_add_ipv6 (int type, int flags, struct prefix_ipv6 *p, struct in6_addr *gate, unsigned int ifindex, u_int32_t vrf_id); -int +extern int rib_delete_ipv6 (int type, int flags, struct prefix_ipv6 *p, struct in6_addr *gate, unsigned int ifindex, u_int32_t vrf_id); -struct rib *rib_lookup_ipv6 (struct in6_addr *); +extern struct rib *rib_lookup_ipv6 (struct in6_addr *); -struct rib *rib_match_ipv6 (struct in6_addr *); +extern struct rib *rib_match_ipv6 (struct in6_addr *); extern struct route_table *rib_table_ipv6; -int +extern int static_add_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate, const char *ifname, u_char flags, u_char distance, u_int32_t vrf_id); -int +extern int static_delete_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate, const char *ifname, u_char distance, u_int32_t vrf_id); diff --git a/zebra/router-id.c b/zebra/router-id.c index 6194582e..c73b65b5 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -38,6 +38,7 @@ #include "rib.h" #include "zebra/zserv.h" +#include "zebra/router-id.h" static struct list rid_all_sorted_list; static struct list rid_lo_sorted_list; @@ -228,7 +229,7 @@ DEFUN (no_router_id, return CMD_SUCCESS; } -int +static int router_id_cmp (void *a, void *b) { unsigned int A, B; @@ -23,17 +23,17 @@ #ifndef _ZEBRA_RT_H #define _ZEBRA_RT_H -int kernel_add_ipv4 (struct prefix *, struct rib *); -int kernel_delete_ipv4 (struct prefix *, struct rib *); -int kernel_add_route (struct prefix_ipv4 *, struct in_addr *, int, int); -int kernel_address_add_ipv4 (struct interface *, struct connected *); -int kernel_address_delete_ipv4 (struct interface *, struct connected *); +extern int kernel_add_ipv4 (struct prefix *, struct rib *); +extern int kernel_delete_ipv4 (struct prefix *, struct rib *); +extern int kernel_add_route (struct prefix_ipv4 *, struct in_addr *, int, int); +extern int kernel_address_add_ipv4 (struct interface *, struct connected *); +extern int kernel_address_delete_ipv4 (struct interface *, struct connected *); #ifdef HAVE_IPV6 -int kernel_add_ipv6 (struct prefix *, struct rib *); -int kernel_delete_ipv6 (struct prefix *, struct rib *); -int kernel_delete_ipv6_old (struct prefix_ipv6 *dest, struct in6_addr *gate, - unsigned int index, int flags, int table); +extern int kernel_add_ipv6 (struct prefix *, struct rib *); +extern int kernel_delete_ipv6 (struct prefix *, struct rib *); +extern int kernel_delete_ipv6_old (struct prefix_ipv6 *dest, struct in6_addr *gate, + unsigned int index, int flags, int table); #endif /* HAVE_IPV6 */ diff --git a/zebra/rt_ioctl.c b/zebra/rt_ioctl.c index a8e9e521..f4997e22 100644 --- a/zebra/rt_ioctl.c +++ b/zebra/rt_ioctl.c @@ -26,19 +26,21 @@ #include "log.h" #include "if.h" +#include "zebra/zserv.h" #include "zebra/rib.h" #include "zebra/debug.h" +#include "zebra/rt.h" /* Initialize of kernel interface. There is no kernel communication support under ioctl(). So this is dummy stub function. */ void -kernel_init () +kernel_init (void) { return; } /* Dummy function of routing socket. */ -void +static void kernel_read (int sock) { return; @@ -160,7 +162,7 @@ kernel_add_route (struct prefix_ipv4 *dest, struct in_addr *gate, } /* Interface to ioctl route message. */ -int +static int kernel_ioctl_ipv4 (u_long cmd, struct prefix *p, struct rib *rib, int family) { int ret; @@ -360,7 +362,7 @@ kernel_delete_ipv4 (struct prefix *p, struct rib *rib) #include <linux/ipv6_route.h> #endif -int +static int kernel_ioctl_ipv6 (u_long type, struct prefix_ipv6 *dest, struct in6_addr *gate, int index, int flags) { @@ -421,7 +423,7 @@ kernel_ioctl_ipv6 (u_long type, struct prefix_ipv6 *dest, struct in6_addr *gate, return ret; } -int +static int kernel_ioctl_ipv6_multipath (u_long cmd, struct prefix *p, struct rib *rib, int family) { @@ -551,7 +553,7 @@ kernel_delete_ipv6 (struct prefix *p, struct rib *rib) /* Delete IPv6 route from the kernel. */ int kernel_delete_ipv6_old (struct prefix_ipv6 *dest, struct in6_addr *gate, - int index, int flags, int table) + unsigned int index, int flags, int table) { return kernel_ioctl_ipv6 (SIOCDELRT, dest, gate, index, flags); } diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 3e223985..83c3e777 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -62,10 +62,10 @@ extern struct zebra_t zebrad; enum rtadv_event {RTADV_START, RTADV_STOP, RTADV_TIMER, RTADV_TIMER_MSEC, RTADV_READ}; -void rtadv_event (enum rtadv_event, int); +static void rtadv_event (enum rtadv_event, int); -int if_join_all_router (int, struct interface *); -int if_leave_all_router (int, struct interface *); +static int if_join_all_router (int, struct interface *); +static int if_leave_all_router (int, struct interface *); /* Structure which hold status of router advertisement. */ struct rtadv @@ -81,8 +81,8 @@ struct rtadv struct rtadv *rtadv = NULL; -struct rtadv * -rtadv_new () +static struct rtadv * +rtadv_new (void) { struct rtadv *new; new = XMALLOC (MTYPE_TMP, sizeof (struct rtadv)); @@ -90,13 +90,13 @@ rtadv_new () return new; } -void +static void rtadv_free (struct rtadv *rtadv) { XFREE (MTYPE_TMP, rtadv); } -int +static int rtadv_recv_packet (int sock, u_char *buf, int buflen, struct sockaddr_in6 *from, unsigned int *ifindex, int *hoplimit) @@ -149,7 +149,7 @@ rtadv_recv_packet (int sock, u_char *buf, int buflen, #define RTADV_MSG_SIZE 4096 /* Send router advertisement packet. */ -void +static void rtadv_send_packet (int sock, struct interface *ifp) { struct msghdr msg; @@ -333,7 +333,7 @@ rtadv_send_packet (int sock, struct interface *ifp) } } -int +static int rtadv_timer (struct thread *thread) { struct listnode *node, *nnode; @@ -373,7 +373,7 @@ rtadv_timer (struct thread *thread) return 0; } -void +static void rtadv_process_solicit (struct interface *ifp) { zlog_info ("Router solicitation received on %s", ifp->name); @@ -381,13 +381,13 @@ rtadv_process_solicit (struct interface *ifp) rtadv_send_packet (rtadv->sock, ifp); } -void -rtadv_process_advert () +static void +rtadv_process_advert (void) { zlog_info ("Router advertisement received"); } -void +static void rtadv_process_packet (u_char *buf, unsigned int len, unsigned int ifindex, int hoplimit) { struct icmp6_hdr *icmph; @@ -444,7 +444,7 @@ rtadv_process_packet (u_char *buf, unsigned int len, unsigned int ifindex, int h return; } -int +static int rtadv_read (struct thread *thread) { int sock; @@ -473,7 +473,7 @@ rtadv_read (struct thread *thread) return 0; } -int +static int rtadv_make_socket (void) { int sock; @@ -526,7 +526,7 @@ rtadv_make_socket (void) return sock; } -struct rtadv_prefix * +static struct rtadv_prefix * rtadv_prefix_new () { struct rtadv_prefix *new; @@ -537,13 +537,13 @@ rtadv_prefix_new () return new; } -void +static void rtadv_prefix_free (struct rtadv_prefix *rtadv_prefix) { XFREE (MTYPE_RTADV_PREFIX, rtadv_prefix); } -struct rtadv_prefix * +static struct rtadv_prefix * rtadv_prefix_lookup (struct list *rplist, struct prefix *p) { struct listnode *node; @@ -555,7 +555,7 @@ rtadv_prefix_lookup (struct list *rplist, struct prefix *p) return NULL; } -struct rtadv_prefix * +static struct rtadv_prefix * rtadv_prefix_get (struct list *rplist, struct prefix *p) { struct rtadv_prefix *rprefix; @@ -571,7 +571,7 @@ rtadv_prefix_get (struct list *rplist, struct prefix *p) return rprefix; } -void +static void rtadv_prefix_set (struct zebra_if *zif, struct rtadv_prefix *rp) { struct rtadv_prefix *rprefix; @@ -586,7 +586,7 @@ rtadv_prefix_set (struct zebra_if *zif, struct rtadv_prefix *rp) rprefix->AdvRouterAddressFlag = rp->AdvRouterAddressFlag; } -int +static int rtadv_prefix_reset (struct zebra_if *zif, struct rtadv_prefix *rp) { struct rtadv_prefix *rprefix; @@ -1448,7 +1448,7 @@ rtadv_config_write (struct vty *vty, struct interface *ifp) } -void +static void rtadv_event (enum rtadv_event event, int val) { switch (event) @@ -1493,7 +1493,7 @@ rtadv_event (enum rtadv_event event, int val) } void -rtadv_init () +rtadv_init (void) { int sock; @@ -1542,7 +1542,7 @@ rtadv_init () install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_cmd); } -int +static int if_join_all_router (int sock, struct interface *ifp) { int ret; @@ -1563,7 +1563,7 @@ if_join_all_router (int sock, struct interface *ifp) return 0; } -int +static int if_leave_all_router (int sock, struct interface *ifp) { int ret; @@ -1586,7 +1586,7 @@ if_leave_all_router (int sock, struct interface *ifp) #else void -rtadv_init () +rtadv_init (void) { /* Empty.*/; } diff --git a/zebra/rtadv.h b/zebra/rtadv.h index d52c2c08..c2855a30 100644 --- a/zebra/rtadv.h +++ b/zebra/rtadv.h @@ -52,7 +52,8 @@ struct rtadv_prefix }; -void rtadv_config_write (struct vty *, struct interface *); +extern void rtadv_config_write (struct vty *, struct interface *); +extern void rtadv_init (void); /* draft-ietf-mip6-mipext-advapi-03 */ diff --git a/zebra/rtread_proc.c b/zebra/rtread_proc.c index 491fc987..ab3891a3 100644 --- a/zebra/rtread_proc.c +++ b/zebra/rtread_proc.c @@ -27,6 +27,9 @@ #include "if.h" #include "rib.h" +#include "zebra/zserv.h" +#include "zebra/rt.h" + /* Proc file system to read IPv4 routing table. */ #ifndef _PATH_PROCNET_ROUTE #define _PATH_PROCNET_ROUTE "/proc/net/route" @@ -44,8 +47,8 @@ #define RT_BUFSIZ 1024 /* Kernel routing table read up by /proc filesystem. */ -int -proc_route_read () +static int +proc_route_read (void) { FILE *fp; char buf[RT_BUFSIZ]; @@ -101,7 +104,7 @@ proc_route_read () } #ifdef HAVE_IPV6 -int +static int proc_ipv6_route_read () { FILE *fp; @@ -162,7 +165,7 @@ proc_ipv6_route_read () #endif /* HAVE_IPV6 */ void -route_read () +route_read (void) { proc_route_read (); #ifdef HAVE_IPV6 diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index a8aaef3e..da6a3a8e 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -71,7 +71,7 @@ struct zebra_queue_node_t vector vrf_vector; /* Allocate new VRF. */ -struct vrf * +static struct vrf * vrf_alloc (const char *name) { struct vrf *vrf; @@ -92,7 +92,7 @@ vrf_alloc (const char *name) } /* Free VRF. */ -void +static void vrf_free (struct vrf *vrf) { if (vrf->name) @@ -108,7 +108,7 @@ vrf_lookup (u_int32_t id) } /* Lookup VRF by name. */ -struct vrf * +static struct vrf * vrf_lookup_by_name (char *name) { unsigned int i; @@ -122,8 +122,8 @@ vrf_lookup_by_name (char *name) } /* Initialize VRF. */ -void -vrf_init () +static void +vrf_init (void) { struct vrf *default_table; @@ -164,7 +164,7 @@ vrf_static_table (afi_t afi, safi_t safi, u_int32_t id) } /* Add nexthop to the end of the list. */ -void +static void nexthop_add (struct rib *rib, struct nexthop *nexthop) { struct nexthop *last; @@ -181,7 +181,7 @@ nexthop_add (struct rib *rib, struct nexthop *nexthop) } /* Delete specified nexthop from the list. */ -void +static void nexthop_delete (struct rib *rib, struct nexthop *nexthop) { if (nexthop->next) @@ -194,7 +194,7 @@ nexthop_delete (struct rib *rib, struct nexthop *nexthop) } /* Free nexthop. */ -void +static void nexthop_free (struct nexthop *nexthop) { if (nexthop->ifname) @@ -247,7 +247,7 @@ nexthop_ipv4_add (struct rib *rib, struct in_addr *ipv4) return nexthop; } -struct nexthop * +static struct nexthop * nexthop_ipv4_ifindex_add (struct rib *rib, struct in_addr *ipv4, unsigned int ifindex) { @@ -280,7 +280,7 @@ nexthop_ipv6_add (struct rib *rib, struct in6_addr *ipv6) return nexthop; } -struct nexthop * +static struct nexthop * nexthop_ipv6_ifname_add (struct rib *rib, struct in6_addr *ipv6, char *ifname) { @@ -297,7 +297,7 @@ nexthop_ipv6_ifname_add (struct rib *rib, struct in6_addr *ipv6, return nexthop; } -struct nexthop * +static struct nexthop * nexthop_ipv6_ifindex_add (struct rib *rib, struct in6_addr *ipv6, unsigned int ifindex) { @@ -332,7 +332,7 @@ nexthop_blackhole_add (struct rib *rib) /* If force flag is not set, do not modify falgs at all for uninstall the route from FIB. */ -int +static int nexthop_active_ipv4 (struct rib *rib, struct nexthop *nexthop, int set, struct route_node *top) { @@ -429,7 +429,7 @@ nexthop_active_ipv4 (struct rib *rib, struct nexthop *nexthop, int set, #ifdef HAVE_IPV6 /* If force flag is not set, do not modify falgs at all for uninstall the route from FIB. */ -int +static int nexthop_active_ipv6 (struct rib *rib, struct nexthop *nexthop, int set, struct route_node *top) { @@ -685,7 +685,7 @@ rib_match_ipv6 (struct in6_addr *addr) } #endif /* HAVE_IPV6 */ -int +static int nexthop_active_check (struct route_node *rn, struct rib *rib, struct nexthop *nexthop, int set) { @@ -757,7 +757,7 @@ nexthop_active_check (struct route_node *rn, struct rib *rib, return CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE); } -int +static int nexthop_active_update (struct route_node *rn, struct rib *rib, int set) { struct nexthop *nexthop; @@ -816,7 +816,7 @@ rib_unlock (struct rib *rib) return rib; } -void +static void rib_install_kernel (struct route_node *rn, struct rib *rib) { int ret = 0; @@ -842,7 +842,7 @@ rib_install_kernel (struct route_node *rn, struct rib *rib) } /* Uninstall the route from kernel. */ -int +static int rib_uninstall_kernel (struct route_node *rn, struct rib *rib) { int ret = 0; @@ -867,7 +867,7 @@ rib_uninstall_kernel (struct route_node *rn, struct rib *rib) } /* Uninstall the route from kernel. */ -void +static void rib_uninstall (struct route_node *rn, struct rib *rib) { if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED)) @@ -880,7 +880,7 @@ rib_uninstall (struct route_node *rn, struct rib *rib) } /* Core function for processing routing information base. */ -wq_item_status +static wq_item_status rib_process (struct zebra_queue_node_t *qnode) { struct rib *rib; @@ -999,7 +999,7 @@ rib_process (struct zebra_queue_node_t *qnode) } /* Add work queue item to work queue and schedule processing */ -void +static void rib_queue_add_qnode (struct zebra_t *zebra, struct zebra_queue_node_t *qnode) { route_lock_node (qnode->node); @@ -1025,7 +1025,7 @@ rib_queue_add_qnode (struct zebra_t *zebra, struct zebra_queue_node_t *qnode) } /* Add route node and rib to work queue and schedule processing */ -void +static void rib_queue_add (struct zebra_t *zebra, struct route_node *rn, struct rib *del) { struct zebra_queue_node_t *qnode; @@ -1051,7 +1051,7 @@ rib_queue_add (struct zebra_t *zebra, struct route_node *rn, struct rib *del) } /* free zebra_queue_node_t */ -void +static void rib_queue_qnode_del (struct zebra_queue_node_t *qnode) { route_unlock_node (qnode->node); @@ -1063,7 +1063,7 @@ rib_queue_qnode_del (struct zebra_queue_node_t *qnode) } /* initialise zebra rib work queue */ -void +static void rib_queue_init (struct zebra_t *zebra) { assert (zebra); @@ -1088,7 +1088,7 @@ rib_queue_init (struct zebra_t *zebra) } /* Add RIB to head of the route node. */ -void +static void rib_addnode (struct route_node *rn, struct rib *rib) { struct rib *head; @@ -1105,7 +1105,7 @@ rib_addnode (struct route_node *rn, struct rib *rib) rn->info = rib; } -void +static void rib_delnode (struct route_node *rn, struct rib *rib) { assert (rn && rib); @@ -1418,7 +1418,7 @@ rib_delete_ipv4 (int type, int flags, struct prefix_ipv4 *p, } /* Install static route into rib. */ -void +static void static_install_ipv4 (struct prefix *p, struct static_ipv4 *si) { struct rib *rib; @@ -1489,7 +1489,7 @@ static_install_ipv4 (struct prefix *p, struct static_ipv4 *si) } } -int +static int static_ipv4_nexthop_same (struct nexthop *nexthop, struct static_ipv4 *si) { if (nexthop->type == NEXTHOP_TYPE_IPV4 @@ -1507,7 +1507,7 @@ static_ipv4_nexthop_same (struct nexthop *nexthop, struct static_ipv4 *si) } /* Uninstall static route from RIB. */ -void +static void static_uninstall_ipv4 (struct prefix *p, struct static_ipv4 *si) { struct route_node *rn; @@ -1725,7 +1725,7 @@ static_delete_ipv4 (struct prefix *p, struct in_addr *gate, const char *ifname, #ifdef HAVE_IPV6 -int +static int rib_bogus_ipv6 (int type, struct prefix_ipv6 *p, struct in6_addr *gate, unsigned int ifindex, int table) { @@ -1967,7 +1967,7 @@ rib_delete_ipv6 (int type, int flags, struct prefix_ipv6 *p, } /* Install static route into rib. */ -void +static void static_install_ipv6 (struct prefix *p, struct static_ipv6 *si) { struct rib *rib; @@ -2039,7 +2039,7 @@ static_install_ipv6 (struct prefix *p, struct static_ipv6 *si) } } -int +static int static_ipv6_nexthop_same (struct nexthop *nexthop, struct static_ipv6 *si) { if (nexthop->type == NEXTHOP_TYPE_IPV6 @@ -2058,7 +2058,7 @@ static_ipv6_nexthop_same (struct nexthop *nexthop, struct static_ipv6 *si) return 0;; } -void +static void static_uninstall_ipv6 (struct prefix *p, struct static_ipv6 *si) { struct route_table *table; @@ -2250,7 +2250,7 @@ static_delete_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate, /* RIB update function. */ void -rib_update () +rib_update (void) { struct route_node *rn; struct route_table *table; @@ -2269,21 +2269,21 @@ rib_update () } /* Interface goes up. */ -void +static void rib_if_up (struct interface *ifp) { rib_update (); } /* Interface goes down. */ -void +static void rib_if_down (struct interface *ifp) { rib_update (); } /* Remove all routes which comes from non main table. */ -void +static void rib_weed_table (struct route_table *table) { struct route_node *rn; @@ -2304,14 +2304,14 @@ rib_weed_table (struct route_table *table) /* Delete all routes from non main table. */ void -rib_weed_tables () +rib_weed_tables (void) { rib_weed_table (vrf_table (AFI_IP, SAFI_UNICAST, 0)); rib_weed_table (vrf_table (AFI_IP6, SAFI_UNICAST, 0)); } /* Delete self installed routes after zebra is relaunched. */ -void +static void rib_sweep_table (struct route_table *table) { struct route_node *rn; @@ -2337,14 +2337,14 @@ rib_sweep_table (struct route_table *table) /* Sweep all RIB tables. */ void -rib_sweep_route () +rib_sweep_route (void) { rib_sweep_table (vrf_table (AFI_IP, SAFI_UNICAST, 0)); rib_sweep_table (vrf_table (AFI_IP6, SAFI_UNICAST, 0)); } /* Close RIB and clean up kernel routes. */ -void +static void rib_close_table (struct route_table *table) { struct route_node *rn; @@ -2360,7 +2360,7 @@ rib_close_table (struct route_table *table) /* Close all RIB tables. */ void -rib_close () +rib_close (void) { rib_close_table (vrf_table (AFI_IP, SAFI_UNICAST, 0)); rib_close_table (vrf_table (AFI_IP6, SAFI_UNICAST, 0)); @@ -2368,7 +2368,7 @@ rib_close () /* Routing information base initialize. */ void -rib_init () +rib_init (void) { rib_queue_init (&zebrad); /* VRF initialization. */ diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 9830e5b1..ad91d959 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -27,8 +27,10 @@ #include "table.h" #include "rib.h" +#include "zebra/zserv.h" + /* Return route type string for VTY output. */ -const char * +static const char * route_type_str (u_char type) { switch (type) @@ -59,7 +61,7 @@ route_type_str (u_char type) }; /* Return route type string for VTY output. */ -char +static const char route_type_char (u_char type) { switch (type) @@ -90,7 +92,7 @@ route_type_char (u_char type) }; /* General fucntion for static route. */ -int +static int zebra_static_ipv4 (struct vty *vty, int add_cmd, const char *dest_str, const char *mask_str, const char *gate_str, const char *flag_str, const char *distance_str) @@ -535,7 +537,7 @@ DEFUN (no_ip_route_mask_flags_distance2, } /* New RIB. Detailed information for IPv4 route. */ -void +static void vty_show_ip_route_detail (struct vty *vty, struct route_node *rn) { struct rib *rib; @@ -641,7 +643,7 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn) } } -void +static void vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib) { struct nexthop *nexthop; @@ -1008,7 +1010,7 @@ DEFUN (show_ip_route_prefix, return CMD_SUCCESS; } -void +static void zebra_show_ip_route (struct vty *vty, struct vrf *vrf) { vty_out (vty, "IP routing table name is %s(%d)%s", @@ -1059,7 +1061,7 @@ DEFUN (show_ip_route_summary, } /* Write IPv4 static route configuration. */ -int +static int static_config_ipv4 (struct vty *vty) { struct route_node *rn; @@ -1115,7 +1117,7 @@ static_config_ipv4 (struct vty *vty) #ifdef HAVE_IPV6 /* General fucntion for IPv6 static route. */ -int +static int static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str, const char *gate_str, const char *ifname, const char *flag_str, const char *distance_str) @@ -1420,7 +1422,7 @@ DEFUN (no_ipv6_route_ifname_flags_pref, } /* New RIB. Detailed information for IPv6 route. */ -void +static void vty_show_ipv6_route_detail (struct vty *vty, struct route_node *rn) { struct rib *rib; @@ -1535,7 +1537,7 @@ vty_show_ipv6_route_detail (struct vty *vty, struct route_node *rn) } } -void +static void vty_show_ipv6_route (struct vty *vty, struct route_node *rn, struct rib *rib) { @@ -1867,7 +1869,7 @@ DEFUN (show_ipv6_route_prefix, /* Write IPv6 static route configuration. */ -int +static int static_config_ipv6 (struct vty *vty) { struct route_node *rn; @@ -1921,7 +1923,7 @@ static_config_ipv6 (struct vty *vty) #endif /* HAVE_IPV6 */ /* Static ip route configuration write function. */ -int +static int zebra_ip_config (struct vty *vty) { int write = 0; @@ -1939,7 +1941,7 @@ struct cmd_node ip_node = { IP_NODE, "", 1 }; /* Route VTY. */ void -zebra_vty_route_init () +zebra_vty_init (void) { install_node (&ip_node, zebra_ip_config); @@ -2014,9 +2016,3 @@ zebra_vty_route_init () install_element (ENABLE_NODE, &show_ipv6_route_prefix_longer_cmd); #endif /* HAVE_IPV6 */ } - -void -zebra_vty_init () -{ - zebra_vty_route_init (); -} diff --git a/zebra/zserv.c b/zebra/zserv.c index 17e7888d..f08f7ce8 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -1729,7 +1729,7 @@ struct cmd_node forwarding_node = /* Initialisation of zebra and installation of commands. */ void -zebra_init () +zebra_init (void) { /* Client list init. */ zebrad.client_list = list_new (); diff --git a/zebra/zserv.h b/zebra/zserv.h index 66270157..8e67c605 100644 --- a/zebra/zserv.h +++ b/zebra/zserv.h @@ -85,25 +85,26 @@ struct zebra_t #define PSIZE(a) (((a) + 7) / (8)) /* Prototypes. */ -void zebra_init (); -void zebra_if_init (); -void hostinfo_get (); -void rib_init (); -void interface_list (); -void kernel_init (); -void route_read (); -void rtadv_init (); -void zebra_snmp_init (); - -int zsend_interface_add (struct zserv *, struct interface *); +extern void zebra_init (void); +extern void zebra_if_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_snmp_init (void); +extern void zebra_vty_init (void); + +extern int zsend_interface_add (struct zserv *, struct interface *); #if (defined(RTM_IFANNOUNCE) || defined(HAVE_NETLINK)) -int zsend_interface_delete (struct zserv *, struct interface *); +extern int zsend_interface_delete (struct zserv *, struct interface *); #endif -int zsend_interface_address (int, struct zserv *, struct interface *, - struct connected *); -int zsend_interface_update (int, struct zserv *, struct interface *); -int zsend_route_multipath (int, struct zserv *, struct prefix *, struct rib *); -int zsend_router_id_update(struct zserv *, struct prefix *); +extern int zsend_interface_address (int, struct zserv *, struct interface *, + struct connected *); +extern int zsend_interface_update (int, struct zserv *, struct interface *); +extern int zsend_route_multipath (int, struct zserv *, struct prefix *, + struct rib *); +extern int zsend_router_id_update(struct zserv *, struct prefix *); extern pid_t pid; extern pid_t old_pid; |