summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2009-04-05 15:55:09 +0000
committerphk <phk@FreeBSD.org>2009-04-05 15:55:09 +0000
commit0aa4473504e30b8c42fde93c3e832d615620f0c0 (patch)
tree6feb868b340092763bc9b967ac76d4decc89314e /sbin
parent30d15f06f1df7487f207c55cacbc1ea43eb39559 (diff)
downloadFreeBSD-src-0aa4473504e30b8c42fde93c3e832d615620f0c0.zip
FreeBSD-src-0aa4473504e30b8c42fde93c3e832d615620f0c0.tar.gz
Modernize prototypes (ie: no extern)
Make lots of stuff static.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/routed/defs.h209
-rw-r--r--sbin/routed/if.c21
-rw-r--r--sbin/routed/main.c27
-rw-r--r--sbin/routed/output.c8
-rw-r--r--sbin/routed/parms.c2
-rw-r--r--sbin/routed/radix.c31
-rw-r--r--sbin/routed/radix.h19
-rw-r--r--sbin/routed/rdisc.c4
-rw-r--r--sbin/routed/table.c9
-rw-r--r--sbin/routed/trace.c2
10 files changed, 157 insertions, 175 deletions
diff --git a/sbin/routed/defs.h b/sbin/routed/defs.h
index 3d5ea7f..5e72e3c 100644
--- a/sbin/routed/defs.h
+++ b/sbin/routed/defs.h
@@ -150,12 +150,10 @@
#define MaxMaxAdvertiseInterval 1800
#define MinMaxAdvertiseInterval 4
#define DefMaxAdvertiseInterval 600
-#define DEF_PreferenceLevel 0
#define MIN_PreferenceLevel 0x80000000
#define MAX_INITIAL_ADVERT_INTERVAL 16
#define MAX_INITIAL_ADVERTS 3
-#define MAX_RESPONSE_DELAY 2
#define MAX_SOLICITATION_DELAY 1
#define SOLICITATION_INTERVAL 3
@@ -392,7 +390,7 @@ struct ag_info {
/* parameters for interfaces */
-extern struct parm {
+struct parm {
struct parm *parm_next;
char parm_name[IF_NAME_LEN+1];
naddr parm_net;
@@ -405,7 +403,7 @@ extern struct parm {
int parm_rdisc_pref; /* signed IRDP preference */
int parm_rdisc_int; /* IRDP advertising interval */
struct auth parm_auth[MAX_AUTH_KEYS];
-} *parms;
+};
/* authority for internal networks */
extern struct intnet {
@@ -444,24 +442,21 @@ extern struct ws_buf {
struct netinfo *base;
struct netinfo *lim;
enum output_type type;
-} v12buf, v2buf;
+} v12buf;
extern pid_t mypid;
extern naddr myaddr; /* main address of this system */
extern int stopint; /* !=0 to stop */
-extern int sock_max;
extern int rip_sock; /* RIP socket */
extern struct interface *rip_sock_mcast; /* current multicast interface */
extern int rt_sock; /* routing socket */
extern int rt_sock_seqno;
extern int rdisc_sock; /* router-discovery raw socket */
-extern int seqno; /* sequence number for messages */
extern int supplier; /* process should supply updates */
extern int supplier_set; /* -s or -q requested */
-extern int lookforinterfaces; /* 1=probe for new up interfaces */
extern int ridhosts; /* 1=reduce host routes */
extern int mhome; /* 1=want multi-homed host route */
extern int advertise_mhome; /* 1=must continue advertising it */
@@ -474,7 +469,6 @@ extern time_t now_stale;
extern time_t now_expire;
extern time_t now_garbage;
-extern struct timeval next_bcast; /* next general broadcast */
extern struct timeval age_timer; /* next check of old routes */
extern struct timeval no_flash; /* inhibit flash update until then */
extern struct timeval rdisc_timer; /* next advert. or solicitation */
@@ -488,7 +482,6 @@ extern int rip_interfaces; /* # of interfaces doing RIP */
extern struct ifhead ifnet; /* all interfaces */
extern struct ifhead remote_if; /* remote interfaces */
extern int have_ripv1_out; /* have a RIPv1 interface */
-extern int have_ripv1_in;
extern int need_flash; /* flash update needed */
extern struct timeval need_kern; /* need to update kernel table */
extern u_int update_seqno; /* a route has changed */
@@ -510,21 +503,21 @@ extern struct radix_node_head *rhead;
#define dup2(x,y) BSDdup2(x,y)
#endif /* sgi */
-extern void fix_sock(int, const char *);
-extern void fix_select(void);
-extern void rip_off(void);
-extern void rip_on(struct interface *);
+void fix_sock(int, const char *);
+void fix_select(void);
+void rip_off(void);
+void rip_on(struct interface *);
-extern void bufinit(void);
-extern int output(enum output_type, struct sockaddr_in *,
+void bufinit(void);
+int output(enum output_type, struct sockaddr_in *,
struct interface *, struct rip *, int);
-extern void clr_ws_buf(struct ws_buf *, struct auth *);
-extern void rip_query(void);
-extern void rip_bcast(int);
-extern void supply(struct sockaddr_in *, struct interface *,
+void clr_ws_buf(struct ws_buf *, struct auth *);
+void rip_query(void);
+void rip_bcast(int);
+void supply(struct sockaddr_in *, struct interface *,
enum output_type, int, int, int);
-extern void msglog(const char *, ...) PATTRIB(1,2);
+void msglog(const char *, ...) PATTRIB(1,2);
struct msg_limit {
time_t reuse;
struct msg_sub {
@@ -533,118 +526,110 @@ struct msg_limit {
# define MSG_SUBJECT_N 8
} subs[MSG_SUBJECT_N];
};
-extern void msglim(struct msg_limit *, naddr,
+void msglim(struct msg_limit *, naddr,
const char *, ...) PATTRIB(3,4);
#define LOGERR(msg) msglog(msg ": %s", strerror(errno))
-extern void logbad(int, const char *, ...) PATTRIB(2,3);
+void logbad(int, const char *, ...) PATTRIB(2,3);
#define BADERR(dump,msg) logbad(dump,msg ": %s", strerror(errno))
#ifdef DEBUG
#define DBGERR(dump,msg) BADERR(dump,msg)
#else
#define DBGERR(dump,msg) LOGERR(msg)
#endif
-extern char *naddr_ntoa(naddr);
-extern const char *saddr_ntoa(struct sockaddr *);
-
-extern void *rtmalloc(size_t, const char *);
-extern void timevaladd(struct timeval *, struct timeval *);
-extern void intvl_random(struct timeval *, u_long, u_long);
-extern int getnet(char *, naddr *, naddr *);
-extern int gethost(char *, naddr *);
-extern void gwkludge(void);
-extern const char *parse_parms(char *, int);
-extern const char *check_parms(struct parm *);
-extern void get_parms(struct interface *);
-
-extern void lastlog(void);
-extern void trace_close(int);
-extern void set_tracefile(const char *, const char *, int);
-extern void tracelevel_msg(const char *, int);
-extern void trace_off(const char*, ...) PATTRIB(1,2);
-extern void set_tracelevel(void);
-extern void trace_flush(void);
-extern void trace_misc(const char *, ...) PATTRIB(1,2);
-extern void trace_act(const char *, ...) PATTRIB(1,2);
-extern void trace_pkt(const char *, ...) PATTRIB(1,2);
-extern void trace_add_del(const char *, struct rt_entry *);
-extern void trace_change(struct rt_entry *, u_int, struct rt_spare *,
+char *naddr_ntoa(naddr);
+const char *saddr_ntoa(struct sockaddr *);
+
+void *rtmalloc(size_t, const char *);
+void timevaladd(struct timeval *, struct timeval *);
+void intvl_random(struct timeval *, u_long, u_long);
+int getnet(char *, naddr *, naddr *);
+int gethost(char *, naddr *);
+void gwkludge(void);
+const char *parse_parms(char *, int);
+const char *check_parms(struct parm *);
+void get_parms(struct interface *);
+
+void lastlog(void);
+void trace_close(int);
+void set_tracefile(const char *, const char *, int);
+void tracelevel_msg(const char *, int);
+void trace_off(const char*, ...) PATTRIB(1,2);
+void set_tracelevel(void);
+void trace_flush(void);
+void trace_misc(const char *, ...) PATTRIB(1,2);
+void trace_act(const char *, ...) PATTRIB(1,2);
+void trace_pkt(const char *, ...) PATTRIB(1,2);
+void trace_add_del(const char *, struct rt_entry *);
+void trace_change(struct rt_entry *, u_int, struct rt_spare *,
const char *);
-extern void trace_if(const char *, struct interface *);
-extern void trace_upslot(struct rt_entry *, struct rt_spare *,
+void trace_if(const char *, struct interface *);
+void trace_upslot(struct rt_entry *, struct rt_spare *,
struct rt_spare *);
-extern void trace_rip(const char*, const char*, struct sockaddr_in *,
+void trace_rip(const char*, const char*, struct sockaddr_in *,
struct interface *, struct rip *, int);
-extern char *addrname(naddr, naddr, int);
-extern char *rtname(naddr, naddr, naddr);
-
-extern void rdisc_age(naddr);
-extern void set_rdisc_mg(struct interface *, int);
-extern void set_supplier(void);
-extern void if_bad_rdisc(struct interface *);
-extern void if_ok_rdisc(struct interface *);
-extern void read_rip(int, struct interface *);
-extern void read_rt(void);
-extern void read_d(void);
-extern void rdisc_adv(void);
-extern void rdisc_sol(void);
-
-extern void sigalrm(int);
-extern void sigterm(int);
-
-extern void sigtrace_on(int);
-extern void sigtrace_off(int);
-
-extern void flush_kern(void);
-extern void age(naddr);
-
-extern void ag_flush(naddr, naddr, void (*)(struct ag_info *));
-extern void ag_check(naddr, naddr, naddr, naddr, char, char, u_int,
+char *addrname(naddr, naddr, int);
+char *rtname(naddr, naddr, naddr);
+
+void rdisc_age(naddr);
+void set_rdisc_mg(struct interface *, int);
+void set_supplier(void);
+void if_bad_rdisc(struct interface *);
+void if_ok_rdisc(struct interface *);
+void read_rip(int, struct interface *);
+void read_rt(void);
+void read_d(void);
+void rdisc_adv(void);
+void rdisc_sol(void);
+
+void sigtrace_on(int);
+void sigtrace_off(int);
+
+void flush_kern(void);
+void age(naddr);
+
+void ag_flush(naddr, naddr, void (*)(struct ag_info *));
+void ag_check(naddr, naddr, naddr, naddr, char, char, u_int,
u_short, u_short, void (*)(struct ag_info *));
-extern void del_static(naddr, naddr, naddr, int);
-extern void del_redirects(naddr, time_t);
-extern struct rt_entry *rtget(naddr, naddr);
-extern struct rt_entry *rtfind(naddr);
-extern void rtinit(void);
-extern void rtadd(naddr, naddr, u_int, struct rt_spare *);
-extern void rtchange(struct rt_entry *, u_int, struct rt_spare *, char *);
-extern void rtdelete(struct rt_entry *);
-extern void rts_delete(struct rt_entry *, struct rt_spare *);
-extern void rtbad_sub(struct rt_entry *);
-extern void rtswitch(struct rt_entry *, struct rt_spare *);
-extern void rtbad(struct rt_entry *);
+void del_static(naddr, naddr, naddr, int);
+void del_redirects(naddr, time_t);
+struct rt_entry *rtget(naddr, naddr);
+struct rt_entry *rtfind(naddr);
+void rtinit(void);
+void rtadd(naddr, naddr, u_int, struct rt_spare *);
+void rtchange(struct rt_entry *, u_int, struct rt_spare *, char *);
+void rtdelete(struct rt_entry *);
+void rts_delete(struct rt_entry *, struct rt_spare *);
+void rtbad_sub(struct rt_entry *);
+void rtswitch(struct rt_entry *, struct rt_spare *);
#define S_ADDR(x) (((struct sockaddr_in *)(x))->sin_addr.s_addr)
#define INFO_DST(I) ((I)->rti_info[RTAX_DST])
#define INFO_GATE(I) ((I)->rti_info[RTAX_GATEWAY])
#define INFO_MASK(I) ((I)->rti_info[RTAX_NETMASK])
#define INFO_IFA(I) ((I)->rti_info[RTAX_IFA])
-#define INFO_IFP(I) ((I)->rti_info[RTAX_IFP])
#define INFO_AUTHOR(I) ((I)->rti_info[RTAX_AUTHOR])
#define INFO_BRD(I) ((I)->rti_info[RTAX_BRD])
void rt_xaddrs(struct rt_addrinfo *, struct sockaddr *, struct sockaddr *,
int);
-extern naddr std_mask(naddr);
-extern naddr ripv1_mask_net(naddr, struct interface *);
-extern naddr ripv1_mask_host(naddr,struct interface *);
+naddr std_mask(naddr);
+naddr ripv1_mask_net(naddr, struct interface *);
+naddr ripv1_mask_host(naddr,struct interface *);
#define on_net(a,net,mask) (((ntohl(a) ^ (net)) & (mask)) == 0)
-extern int check_dst(naddr);
-extern struct interface *check_dup(naddr, naddr, naddr, int);
-extern int check_remote(struct interface *);
-extern int addrouteforif(struct interface *);
-extern void ifinit(void);
-extern int walk_bad(struct radix_node *, struct walkarg *);
-extern int if_ok(struct interface *, const char *);
-extern void if_sick(struct interface *);
-extern void if_bad(struct interface *);
-extern void if_link(struct interface *);
-extern struct interface *ifwithaddr(naddr, int, int);
-extern struct interface *ifwithname(char *, naddr);
-extern struct interface *ifwithindex(u_short, int);
-extern struct interface *iflookup(naddr);
-
-extern struct auth *find_auth(struct interface *);
-extern void end_md5_auth(struct ws_buf *, struct auth *);
+int check_dst(naddr);
+struct interface *check_dup(naddr, naddr, naddr, int);
+int check_remote(struct interface *);
+void ifinit(void);
+int walk_bad(struct radix_node *, struct walkarg *);
+int if_ok(struct interface *, const char *);
+void if_sick(struct interface *);
+void if_link(struct interface *);
+struct interface *ifwithaddr(naddr addr, int bcast, int remote);
+struct interface *ifwithindex(u_short, int);
+struct interface *iflookup(naddr);
+
+struct auth *find_auth(struct interface *);
+void end_md5_auth(struct ws_buf *, struct auth *);
#if defined(__FreeBSD__) || defined(__NetBSD__)
#include <md5.h>
@@ -655,7 +640,7 @@ typedef struct {
u_int32_t count[2]; /* # of bits, modulo 2^64 (LSB 1st) */
unsigned char buffer[64]; /* input buffer */
} MD5_CTX;
-extern void MD5Init(MD5_CTX*);
-extern void MD5Update(MD5_CTX*, u_char*, u_int);
-extern void MD5Final(u_char[MD5_DIGEST_LEN], MD5_CTX*);
+void MD5Init(MD5_CTX*);
+void MD5Update(MD5_CTX*, u_char*, u_int);
+void MD5Final(u_char[MD5_DIGEST_LEN], MD5_CTX*);
#endif
diff --git a/sbin/routed/if.c b/sbin/routed/if.c
index 69ca3cb..9b05457 100644
--- a/sbin/routed/if.c
+++ b/sbin/routed/if.c
@@ -51,11 +51,11 @@ struct ifhead remote_if = LIST_HEAD_INITIALIZER(ifnet); /* remote interfaces */
*/
#define AHASH_LEN 211 /* must be prime */
#define AHASH(a) &ahash_tbl[(a)%AHASH_LEN]
-struct interface *ahash_tbl[AHASH_LEN];
+static struct interface *ahash_tbl[AHASH_LEN];
#define BHASH_LEN 211 /* must be prime */
#define BHASH(a) &bhash_tbl[(a)%BHASH_LEN]
-struct interface *bhash_tbl[BHASH_LEN];
+static struct interface *bhash_tbl[BHASH_LEN];
/* hash for physical interface names.
@@ -63,13 +63,13 @@ struct interface *bhash_tbl[BHASH_LEN];
* aliases are put on the end of the hash chains.
*/
#define NHASH_LEN 97
-struct interface *nhash_tbl[NHASH_LEN];
+static struct interface *nhash_tbl[NHASH_LEN];
int tot_interfaces; /* # of remote and local interfaces */
int rip_interfaces; /* # of interfaces doing RIP */
-int foundloopback; /* valid flag for loopaddr */
+static int foundloopback; /* valid flag for loopaddr */
naddr loopaddr; /* our address on loopback */
-struct rt_spare loop_rts;
+static struct rt_spare loop_rts;
struct timeval ifinit_timer;
static struct timeval last_ifinit;
@@ -78,9 +78,12 @@ static struct timeval last_ifinit;
&& timercmp(&ifinit_timer, &now, >))
int have_ripv1_out; /* have a RIPv1 interface */
-int have_ripv1_in;
+static int have_ripv1_in;
+static void if_bad(struct interface *);
+static int addrouteforif(struct interface *);
+
static struct interface**
nhash(char *p)
{
@@ -173,7 +176,7 @@ ifwithaddr(naddr addr,
/* find the interface with a name
*/
-struct interface *
+static struct interface *
ifwithname(char *name, /* "ec0" or whatever */
naddr addr) /* 0 or network address */
{
@@ -535,7 +538,7 @@ if_sick(struct interface *ifp)
/* Mark an interface dead.
*/
-void
+static void
if_bad(struct interface *ifp)
{
struct interface *ifp1;
@@ -1309,7 +1312,7 @@ check_net_syn(struct interface *ifp)
* Create route to other end if a point-to-point link,
* otherwise a route to this (sub)network.
*/
-int /* 0=bad interface */
+static int /* 0=bad interface */
addrouteforif(struct interface *ifp)
{
struct rt_entry *rt;
diff --git a/sbin/routed/main.c b/sbin/routed/main.c
index 570f2e0..fd01d8e 100644
--- a/sbin/routed/main.c
+++ b/sbin/routed/main.c
@@ -54,38 +54,39 @@ __RCSID("$Revision: 2.31 $");
pid_t mypid;
naddr myaddr; /* system address */
-char myname[MAXHOSTNAMELEN+1];
+static char myname[MAXHOSTNAMELEN+1];
-int verbose;
+static int verbose;
int supplier; /* supply or broadcast updates */
int supplier_set;
-int ipforwarding = 1; /* kernel forwarding on */
+static int ipforwarding = 1; /* kernel forwarding on */
-int default_gateway; /* 1=advertise default */
-int background = 1;
+static int default_gateway; /* 1=advertise default */
+static int background = 1;
int ridhosts; /* 1=reduce host routes */
int mhome; /* 1=want multi-homed host route */
int advertise_mhome; /* 1=must continue advertising it */
int auth_ok = 1; /* 1=ignore auth if we do not care */
struct timeval epoch; /* when started */
-struct timeval clk, prev_clk;
+struct timeval clk;
+static struct timeval prev_clk;
static int usec_fudge;
struct timeval now; /* current idea of time */
time_t now_stale;
time_t now_expire;
time_t now_garbage;
-struct timeval next_bcast; /* next general broadcast */
+static struct timeval next_bcast; /* next general broadcast */
struct timeval no_flash = { /* inhibit flash update */
EPOCH+SUPPLY_INTERVAL, 0
};
-struct timeval flush_kern_timer;
+static struct timeval flush_kern_timer;
-fd_set fdbits;
-int sock_max;
+static fd_set fdbits;
+static int sock_max;
int rip_sock = -1; /* RIP socket */
struct interface *rip_sock_mcast; /* current multicast interface */
int rt_sock; /* routing socket */
@@ -94,6 +95,8 @@ int rt_sock_seqno;
static int get_rip_sock(naddr, int);
static void timevalsub(struct timeval *, struct timeval *, struct timeval *);
+static void sigalrm(int s UNUSED);
+static void sigterm(int sig);
int
main(int argc,
@@ -543,7 +546,7 @@ usage:
/* ARGSUSED */
-void
+static void
sigalrm(int s UNUSED)
{
/* Historically, SIGALRM would cause the daemon to check for
@@ -555,7 +558,7 @@ sigalrm(int s UNUSED)
/* watch for fatal signals */
-void
+static void
sigterm(int sig)
{
stopint = sig;
diff --git a/sbin/routed/output.c b/sbin/routed/output.c
index dd4f1a9..66cbc29 100644
--- a/sbin/routed/output.c
+++ b/sbin/routed/output.c
@@ -46,7 +46,7 @@ u_int update_seqno;
/* walk the tree of routes with this for output
*/
-struct {
+static struct {
struct sockaddr_in to;
naddr to_mask;
naddr to_net;
@@ -69,11 +69,11 @@ struct {
/* A buffer for what can be heard by both RIPv1 and RIPv2 listeners */
struct ws_buf v12buf;
-union pkt_buf ripv12_buf;
+static union pkt_buf ripv12_buf;
/* Another for only RIPv2 listeners */
-struct ws_buf v2buf;
-union pkt_buf rip_v2_buf;
+static struct ws_buf v2buf;
+static union pkt_buf rip_v2_buf;
diff --git a/sbin/routed/parms.c b/sbin/routed/parms.c
index f7cbf9b..7be52e0 100644
--- a/sbin/routed/parms.c
+++ b/sbin/routed/parms.c
@@ -43,7 +43,7 @@ __RCSID("$Revision: 2.26 $");
#endif
-struct parm *parms;
+static struct parm *parms;
struct intnet *intnets;
struct r1net *r1nets;
struct tgate *tgates;
diff --git a/sbin/routed/radix.c b/sbin/routed/radix.c
index a805d43..5bca9d3 100644
--- a/sbin/routed/radix.c
+++ b/sbin/routed/radix.c
@@ -51,10 +51,11 @@ __RCSID("$Revision: 2.23 $");
#define min(a,b) (((a)<(b))?(a):(b))
int max_keylen;
-struct radix_mask *rn_mkfreelist;
-struct radix_node_head *mask_rnhead;
+static struct radix_mask *rn_mkfreelist;
+static struct radix_node_head *mask_rnhead;
static char *addmask_key;
-static char normal_chars[] = {0, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, -1};
+static uint8_t normal_chars[] =
+ { 0, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff};
static char *rn_zeros, *rn_ones;
#define rn_masktop (mask_rnhead->rnh_treetop)
@@ -63,6 +64,10 @@ static char *rn_zeros, *rn_ones;
: memcmp((caddr_t)(a), (caddr_t)(b), (size_t)l))
static int rn_satisfies_leaf(char *, struct radix_node *, int);
+static struct radix_node *rn_addmask(void *n_arg, int search, int skip);
+static struct radix_node *rn_addroute(void *v_arg, void *n_arg,
+ struct radix_node_head *head, struct radix_node treenodes[2]);
+static struct radix_node *rn_match(void *v_arg, struct radix_node_head *head);
/*
* The data structure for the keys is a radix tree with one way
@@ -98,7 +103,7 @@ static int rn_satisfies_leaf(char *, struct radix_node *, int);
* that governs a subtree.
*/
-struct radix_node *
+static struct radix_node *
rn_search(void *v_arg,
struct radix_node *head)
{
@@ -114,7 +119,7 @@ rn_search(void *v_arg,
return (x);
}
-struct radix_node *
+static struct radix_node *
rn_search_m(void *v_arg,
struct radix_node *head,
void *m_arg)
@@ -132,7 +137,7 @@ rn_search_m(void *v_arg,
return x;
}
-int
+static int
rn_refines(void* m_arg, void *n_arg)
{
caddr_t m = m_arg, n = n_arg;
@@ -158,7 +163,7 @@ rn_refines(void* m_arg, void *n_arg)
return (!masks_are_equal);
}
-struct radix_node *
+static struct radix_node *
rn_lookup(void *v_arg, void *m_arg, struct radix_node_head *head)
{
struct radix_node *x;
@@ -197,7 +202,7 @@ rn_satisfies_leaf(char *trial,
return 1;
}
-struct radix_node *
+static struct radix_node *
rn_match(void *v_arg,
struct radix_node_head *head)
{
@@ -321,7 +326,7 @@ int rn_saveinfo;
int rn_debug = 1;
#endif
-struct radix_node *
+static struct radix_node *
rn_newpair(void *v, int b, struct radix_node nodes[2])
{
struct radix_node *tt = nodes, *t = tt + 1;
@@ -336,7 +341,7 @@ rn_newpair(void *v, int b, struct radix_node nodes[2])
return t;
}
-struct radix_node *
+static struct radix_node *
rn_insert(void* v_arg,
struct radix_node_head *head,
int *dupentry,
@@ -404,7 +409,7 @@ on1:
return (tt);
}
-struct radix_node *
+static struct radix_node *
rn_addmask(void *n_arg, int search, int skip)
{
caddr_t netmask = (caddr_t)n_arg;
@@ -512,7 +517,7 @@ rn_new_radix_mask(struct radix_node *tt,
return m;
}
-struct radix_node *
+static struct radix_node *
rn_addroute(void *v_arg,
void *n_arg,
struct radix_node_head *head,
@@ -655,7 +660,7 @@ on2:
return tt;
}
-struct radix_node *
+static struct radix_node *
rn_delete(void *v_arg,
void *netmask_arg,
struct radix_node_head *head)
diff --git a/sbin/routed/radix.h b/sbin/routed/radix.h
index 4558e87..5c7c2d6 100644
--- a/sbin/routed/radix.h
+++ b/sbin/routed/radix.h
@@ -80,7 +80,7 @@ struct radix_node {
* Annotations to tree concerning potential routes applying to subtrees.
*/
-extern struct radix_mask {
+struct radix_mask {
short rm_b; /* bit offset; -1-index(netmask) */
char rm_unused; /* cf. rn_bmask */
u_char rm_flags; /* cf. rn_flags */
@@ -90,7 +90,7 @@ extern struct radix_mask {
struct radix_node *rmu_leaf; /* for normal routes */
} rm_rmu;
int rm_refs; /* # of references to this struct */
-} *rn_mkfreelist;
+};
#define rm_mask rm_rmu.rmu_mask
#define rm_leaf rm_rmu.rmu_leaf /* extra field would make 32 bytes */
@@ -139,23 +139,8 @@ struct radix_node_head {
void rn_init(void);
int rn_inithead(struct radix_node_head **head, int off);
-int rn_refines(void *, void *);
int rn_walktree(struct radix_node_head *,
int (*)(struct radix_node *, struct walkarg *),
struct walkarg *);
-struct radix_node
- *rn_addmask(void *, int, int),
- *rn_addroute(void *, void *, struct radix_node_head *,
- struct radix_node [2]),
- *rn_delete(void *, void *, struct radix_node_head *),
- *rn_insert(void *, struct radix_node_head *, int *,
- struct radix_node [2]),
- *rn_match(void *, struct radix_node_head *),
- *rn_newpair(void *, int, struct radix_node[2]),
- *rn_search(void *, struct radix_node *),
- *rn_search_m(void *, struct radix_node *, void *);
-
-struct radix_node *rn_lookup(void *, void *, struct radix_node_head *);
-
#endif /* __RADIX_H_ */
diff --git a/sbin/routed/rdisc.c b/sbin/routed/rdisc.c
index 8452650..be160a8 100644
--- a/sbin/routed/rdisc.c
+++ b/sbin/routed/rdisc.c
@@ -73,14 +73,14 @@ union ad_u {
int rdisc_sock = -1; /* router-discovery raw socket */
-struct interface *rdisc_sock_mcast; /* current multicast interface */
+static struct interface *rdisc_sock_mcast; /* current multicast interface */
struct timeval rdisc_timer;
int rdisc_ok; /* using solicited route */
#define MAX_ADS 16 /* at least one per interface */
-struct dr { /* accumulated advertisements */
+static struct dr { /* accumulated advertisements */
struct interface *dr_ifp;
naddr dr_gate; /* gateway */
time_t dr_ts; /* when received */
diff --git a/sbin/routed/table.c b/sbin/routed/table.c
index 33f8332..a1f80ff 100644
--- a/sbin/routed/table.c
+++ b/sbin/routed/table.c
@@ -48,6 +48,7 @@ static void masktrim(struct sockaddr_in *ap);
#else
static void masktrim(struct sockaddr_in_new *ap);
#endif
+static void rtbad(struct rt_entry *);
struct radix_node_head *rhead; /* root of the radix tree */
@@ -66,7 +67,7 @@ int stopint;
int total_routes;
/* zap any old routes through this gateway */
-naddr age_bad_gate;
+static naddr age_bad_gate;
/* It is desirable to "aggregate" routes, to combine differing routes of
@@ -93,7 +94,7 @@ naddr age_bad_gate;
* sorted first by address, with the smallest address first.
*/
-struct ag_info ag_slots[NUM_AG_SLOTS], *ag_avail, *ag_corsest, *ag_finest;
+static struct ag_info ag_slots[NUM_AG_SLOTS], *ag_avail, *ag_corsest, *ag_finest;
/* #define DEBUG_AG */
#ifdef DEBUG_AG
@@ -611,7 +612,7 @@ ag_check(naddr dst,
static const char *
rtm_type_name(u_char type)
{
- static const char *rtm_types[] = {
+ static const char * const rtm_types[] = {
"RTM_ADD",
"RTM_DELETE",
"RTM_CHANGE",
@@ -1886,7 +1887,7 @@ rts_delete(struct rt_entry *rt,
/* Get rid of a bad route, and try to switch to a replacement.
*/
-void
+static void
rtbad(struct rt_entry *rt)
{
struct rt_spare new;
diff --git a/sbin/routed/trace.c b/sbin/routed/trace.c
index 574b65c..6706648 100644
--- a/sbin/routed/trace.c
+++ b/sbin/routed/trace.c
@@ -58,7 +58,7 @@ FILE *ftrace; /* output trace file */
static const char *sigtrace_pat = "%s";
static char savetracename[PATH_MAX];
char inittracename[PATH_MAX];
-int file_trace; /* 1=tracing to file, not stdout */
+static int file_trace; /* 1=tracing to file, not stdout */
static void trace_dump(void);
static void tmsg(const char *, ...) PATTRIB(1,2);
OpenPOWER on IntegriCloud