ip: make local functions static
diff --git a/bridge/monitor.c b/bridge/monitor.c
index 29bb931..e96fcaf 100644
--- a/bridge/monitor.c
+++ b/bridge/monitor.c
@@ -46,8 +46,8 @@
return 0;
}
-int accept_msg(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+static int accept_msg(const struct sockaddr_nl *who,
+ struct nlmsghdr *n, void *arg)
{
FILE *fp = arg;
diff --git a/genl/ctrl.c b/genl/ctrl.c
index 6d97c26..7c42578 100644
--- a/genl/ctrl.c
+++ b/genl/ctrl.c
@@ -112,7 +112,7 @@
return ret;
}
-void print_ctrl_cmd_flags(FILE *fp, __u32 fl)
+static void print_ctrl_cmd_flags(FILE *fp, __u32 fl)
{
fprintf(fp, "\n\t\tCapabilities (0x%x):\n ", fl);
if (!fl) {
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 0bd8a76..cff503f 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -89,7 +89,7 @@
exit(-1);
}
-void print_link_flags(FILE *fp, unsigned flags, unsigned mdown)
+static void print_link_flags(FILE *fp, unsigned flags, unsigned mdown)
{
fprintf(fp, "<");
if (flags & IFF_UP && !(flags & IFF_RUNNING))
@@ -699,8 +699,8 @@
return 0;
}
-int print_addrinfo_primary(const struct sockaddr_nl *who, struct nlmsghdr *n,
- void *arg)
+static int print_addrinfo_primary(const struct sockaddr_nl *who,
+ struct nlmsghdr *n, void *arg)
{
struct ifaddrmsg *ifa = NLMSG_DATA(n);
@@ -710,8 +710,8 @@
return print_addrinfo(who, n, arg);
}
-int print_addrinfo_secondary(const struct sockaddr_nl *who, struct nlmsghdr *n,
- void *arg)
+static int print_addrinfo_secondary(const struct sockaddr_nl *who,
+ struct nlmsghdr *n, void *arg)
{
struct ifaddrmsg *ifa = NLMSG_DATA(n);
diff --git a/ip/iplink.c b/ip/iplink.c
index c24f0ce..ad33611 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -135,7 +135,7 @@
return l;
}
-int get_link_mode(const char *mode)
+static int get_link_mode(const char *mode)
{
if (strcasecmp(mode, "default") == 0)
return IF_LINK_MODE_DEFAULT;
@@ -194,7 +194,7 @@
char buf[1024];
};
-int iplink_parse_vf(int vf, int *argcp, char ***argvp,
+static int iplink_parse_vf(int vf, int *argcp, char ***argvp,
struct iplink_req *req)
{
int len, argc = *argcp;
diff --git a/ip/ipmaddr.c b/ip/ipmaddr.c
index 3ae9478..6e19465 100644
--- a/ip/ipmaddr.c
+++ b/ip/ipmaddr.c
@@ -28,6 +28,7 @@
#include "rt_names.h"
#include "utils.h"
+#include "ip_common.h"
static struct {
char *dev;
@@ -70,7 +71,7 @@
inet_prefix addr;
};
-void maddr_ins(struct ma_info **lst, struct ma_info *m)
+static void maddr_ins(struct ma_info **lst, struct ma_info *m)
{
struct ma_info *mp;
@@ -82,7 +83,7 @@
*lst = m;
}
-void read_dev_mcast(struct ma_info **result_p)
+static void read_dev_mcast(struct ma_info **result_p)
{
char buf[256];
FILE *fp = fopen("/proc/net/dev_mcast", "r");
@@ -119,7 +120,7 @@
fclose(fp);
}
-void read_igmp(struct ma_info **result_p)
+static void read_igmp(struct ma_info **result_p)
{
struct ma_info m;
char buf[256];
@@ -158,7 +159,7 @@
}
-void read_igmp6(struct ma_info **result_p)
+static void read_igmp6(struct ma_info **result_p)
{
char buf[256];
FILE *fp = fopen("/proc/net/igmp6", "r");
@@ -275,7 +276,7 @@
return 0;
}
-int multiaddr_modify(int cmd, int argc, char **argv)
+static int multiaddr_modify(int cmd, int argc, char **argv)
{
struct ifreq ifr;
int fd;
diff --git a/ip/ipmonitor.c b/ip/ipmonitor.c
index a9ff1e8..86c473e 100644
--- a/ip/ipmonitor.c
+++ b/ip/ipmonitor.c
@@ -37,8 +37,8 @@
}
-int accept_msg(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+static int accept_msg(const struct sockaddr_nl *who,
+ struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
diff --git a/ip/ipneigh.c b/ip/ipneigh.c
index 1b7600b..d76e035 100644
--- a/ip/ipneigh.c
+++ b/ip/ipneigh.c
@@ -52,7 +52,7 @@
exit(-1);
}
-int nud_state_a2n(unsigned *state, char *arg)
+static int nud_state_a2n(unsigned *state, const char *arg)
{
if (matches(arg, "permanent") == 0)
*state = NUD_PERMANENT;
@@ -313,13 +313,13 @@
return 0;
}
-void ipneigh_reset_filter()
+void ipneigh_reset_filter(void)
{
memset(&filter, 0, sizeof(filter));
filter.state = ~0;
}
-int do_show_or_flush(int argc, char **argv, int flush)
+static int do_show_or_flush(int argc, char **argv, int flush)
{
char *filter_dev = NULL;
int state_given = 0;
diff --git a/ip/ipnetconf.c b/ip/ipnetconf.c
index 66d667b..8ceadfe 100644
--- a/ip/ipnetconf.c
+++ b/ip/ipnetconf.c
@@ -119,12 +119,12 @@
return 0;
}
-void ipnetconf_reset_filter(void)
+static void ipnetconf_reset_filter(void)
{
memset(&filter, 0, sizeof(filter));
}
-int do_show(int argc, char **argv)
+static int do_show(int argc, char **argv)
{
struct {
struct nlmsghdr n;
diff --git a/ip/ipprefix.c b/ip/ipprefix.c
index cf68f89..9725077 100644
--- a/ip/ipprefix.c
+++ b/ip/ipprefix.c
@@ -28,7 +28,9 @@
#include <string.h>
#include <sys/socket.h>
#include <netinet/icmp6.h>
+
#include "utils.h"
+#include "ip_common.h"
/* prefix flags; see kernel's net/ipv6/addrconf.c and include/net/if_inet6.h */
#define IF_PREFIX_ONLINK 0x01
diff --git a/ip/iproute.c b/ip/iproute.c
index 309cc87..5dc4437 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -124,7 +124,7 @@
return 0;
}
-int filter_nlmsg(struct nlmsghdr *n, struct rtattr **tb, int host_len)
+static int filter_nlmsg(struct nlmsghdr *n, struct rtattr **tb, int host_len)
{
struct rtmsg *r = NLMSG_DATA(n);
inet_prefix dst;
@@ -263,7 +263,7 @@
return 1;
}
-int calc_host_len(struct rtmsg *r)
+static int calc_host_len(const struct rtmsg *r)
{
if (r->rtm_family == AF_INET6)
return 128;
@@ -625,7 +625,9 @@
}
-int parse_one_nh(struct rtmsg *r, struct rtattr *rta, struct rtnexthop *rtnh, int *argcp, char ***argvp)
+static int parse_one_nh(struct rtmsg *r, struct rtattr *rta,
+ struct rtnexthop *rtnh,
+ int *argcp, char ***argvp)
{
int argc = *argcp;
char **argv = *argvp;
@@ -668,7 +670,8 @@
return 0;
}
-int parse_nexthops(struct nlmsghdr *n, struct rtmsg *r, int argc, char **argv)
+static int parse_nexthops(struct nlmsghdr *n, struct rtmsg *r,
+ int argc, char **argv)
{
char buf[1024];
struct rtattr *rta = (void*)buf;
@@ -699,8 +702,7 @@
return 0;
}
-
-int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
+static int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
{
struct {
struct nlmsghdr n;
@@ -1070,7 +1072,8 @@
static __u32 route_dump_magic = 0x45311224;
-int save_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
+static int save_route(const struct sockaddr_nl *who, struct nlmsghdr *n,
+ void *arg)
{
int ret;
int len = n->nlmsg_len;
@@ -1363,7 +1366,7 @@
}
-int iproute_get(int argc, char **argv)
+static int iproute_get(int argc, char **argv)
{
struct {
struct nlmsghdr n;
@@ -1528,7 +1531,8 @@
exit(0);
}
-int restore_handler(const struct sockaddr_nl *nl, struct nlmsghdr *n, void *arg)
+static int restore_handler(const struct sockaddr_nl *nl, struct nlmsghdr *n,
+ void *arg)
{
int ret;
@@ -1562,7 +1566,7 @@
return 0;
}
-int iproute_restore(void)
+static int iproute_restore(void)
{
if (route_dump_check_magic())
exit(-1);
@@ -1584,7 +1588,7 @@
exit(rtnl_from_file(stdin, &show_handler, NULL));
}
-void iproute_reset_filter()
+void iproute_reset_filter(void)
{
memset(&filter, 0, sizeof(filter));
filter.mdst.bitlen = -1;
diff --git a/ip/ipxfrm.c b/ip/ipxfrm.c
index 5a0f215..db51918 100644
--- a/ip/ipxfrm.c
+++ b/ip/ipxfrm.c
@@ -39,6 +39,7 @@
#include "utils.h"
#include "xfrm.h"
+#include "ip_common.h"
#define STRBUF_SIZE (128)
#define STRBUF_CAT(buf, str) \
diff --git a/ip/rtmon.c b/ip/rtmon.c
index c1416a0..9227eac 100644
--- a/ip/rtmon.c
+++ b/ip/rtmon.c
@@ -56,7 +56,7 @@
return 0;
}
-void usage(void)
+static void usage(void)
{
fprintf(stderr, "Usage: rtmon file FILE [ all | LISTofOBJECTS]\n");
fprintf(stderr, "LISTofOBJECTS := [ link ] [ address ] [ route ]\n");
diff --git a/ip/xfrm_monitor.c b/ip/xfrm_monitor.c
index ea17987..bfc48f1 100644
--- a/ip/xfrm_monitor.c
+++ b/ip/xfrm_monitor.c
@@ -206,7 +206,7 @@
return 0;
}
-void xfrm_ae_flags_print(__u32 flags, void *arg)
+static void xfrm_ae_flags_print(__u32 flags, void *arg)
{
FILE *fp = (FILE*)arg;
fprintf(fp, " (0x%x) ", flags);
diff --git a/ip/xfrm_policy.c b/ip/xfrm_policy.c
index 8e3aec5..bf263e0 100644
--- a/ip/xfrm_policy.c
+++ b/ip/xfrm_policy.c
@@ -896,7 +896,7 @@
exit(0);
}
-int print_spdinfo( struct nlmsghdr *n, void *arg)
+static int print_spdinfo( struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
__u32 *f = NLMSG_DATA(n);
diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c
index 0d98e78..35957bd 100644
--- a/ip/xfrm_state.c
+++ b/ip/xfrm_state.c
@@ -1053,7 +1053,7 @@
exit(0);
}
-int print_sadinfo(struct nlmsghdr *n, void *arg)
+static int print_sadinfo(struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
__u32 *f = NLMSG_DATA(n);
diff --git a/misc/arpd.c b/misc/arpd.c
index dd1de80..ec9d570 100644
--- a/misc/arpd.c
+++ b/misc/arpd.c
@@ -92,7 +92,7 @@
int broadcast_burst = 3000;
int poll_timeout = 30000;
-void usage(void)
+static void usage(void)
{
fprintf(stderr,
"Usage: arpd [ -lkh? ] [ -a N ] [ -b dbase ] [ -B number ]"
@@ -100,7 +100,7 @@
exit(1);
}
-int handle_if(int ifindex)
+static int handle_if(int ifindex)
{
int i;
@@ -115,7 +115,7 @@
int sysctl_adjusted;
-void do_sysctl_adjustments(void)
+static void do_sysctl_adjustments(void)
{
int i;
@@ -148,7 +148,7 @@
sysctl_adjusted = 1;
}
-void undo_sysctl_adjustments(void)
+static void undo_sysctl_adjustments(void)
{
int i;
@@ -178,7 +178,7 @@
}
-int send_probe(int ifindex, __u32 addr)
+static int send_probe(int ifindex, __u32 addr)
{
struct ifreq ifr;
struct sockaddr_in dst;
@@ -238,7 +238,7 @@
/* Be very tough on sending probes: 1 per second with burst of 3. */
-int queue_active_probe(int ifindex, __u32 addr)
+static int queue_active_probe(int ifindex, __u32 addr)
{
static struct timeval prev;
static int buckets;
@@ -262,7 +262,7 @@
return -1;
}
-int respond_to_kernel(int ifindex, __u32 addr, char *lla, int llalen)
+static int respond_to_kernel(int ifindex, __u32 addr, char *lla, int llalen)
{
struct {
struct nlmsghdr n;
@@ -286,7 +286,7 @@
return rtnl_send(&rth, &req, req.n.nlmsg_len) <= 0;
}
-void prepare_neg_entry(__u8 *ndata, __u32 stamp)
+static void prepare_neg_entry(__u8 *ndata, __u32 stamp)
{
ndata[0] = 0xFF;
ndata[1] = 0;
@@ -297,7 +297,7 @@
}
-int do_one_request(struct nlmsghdr *n)
+static int do_one_request(struct nlmsghdr *n)
{
struct ndmsg *ndm = NLMSG_DATA(n);
int len = n->nlmsg_len;
@@ -426,12 +426,12 @@
return 0;
}
-void load_initial_table(void)
+static void load_initial_table(void)
{
rtnl_wilddump_request(&rth, AF_INET, RTM_GETNEIGH);
}
-void get_kern_msg(void)
+static void get_kern_msg(void)
{
int status;
struct nlmsghdr *h;
@@ -477,7 +477,7 @@
}
/* Receive gratuitous ARP messages and store them, that's all. */
-void get_arp_pkt(void)
+static void get_arp_pkt(void)
{
unsigned char buf[1024];
struct sockaddr_ll sll;
@@ -532,7 +532,7 @@
dbase->put(dbase, &dbkey, &dbdat, 0);
}
-void catch_signal(int sig, void (*handler)(int))
+static void catch_signal(int sig, void (*handler)(int))
{
struct sigaction sa;
@@ -548,21 +548,21 @@
sigjmp_buf env;
volatile int in_poll;
-void sig_exit(int signo)
+static void sig_exit(int signo)
{
do_exit = 1;
if (in_poll)
siglongjmp(env, 1);
}
-void sig_sync(int signo)
+static void sig_sync(int signo)
{
do_sync = 1;
if (in_poll)
siglongjmp(env, 1);
}
-void sig_stats(int signo)
+static void sig_stats(int signo)
{
do_sync = 1;
do_stats = 1;
@@ -570,7 +570,7 @@
siglongjmp(env, 1);
}
-void send_stats(void)
+static void send_stats(void)
{
syslog(LOG_INFO, "arp_rcv: n%lu c%lu app_rcv: tot %lu hits %lu bad %lu neg %lu sup %lu",
stats.arp_new, stats.arp_change,
diff --git a/misc/ifstat.c b/misc/ifstat.c
index e7fbaa8..6d0ad8c 100644
--- a/misc/ifstat.c
+++ b/misc/ifstat.c
@@ -115,7 +115,7 @@
return 0;
}
-void load_info(void)
+static void load_info(void)
{
struct ifstat_ent *db, *n;
struct rtnl_handle rth;
@@ -146,7 +146,7 @@
}
}
-void load_raw_table(FILE *fp)
+static void load_raw_table(FILE *fp)
{
char buf[4096];
struct ifstat_ent *db = NULL;
@@ -209,7 +209,7 @@
}
}
-void dump_raw_db(FILE *fp, int to_hist)
+static void dump_raw_db(FILE *fp, int to_hist)
{
struct ifstat_ent *n, *h;
h = hist_db;
@@ -244,7 +244,8 @@
static const unsigned long long mega = 1000000;
static const unsigned long long kilo = 1000;
-void format_rate(FILE *fp, unsigned long long *vals, double *rates, int i)
+static void format_rate(FILE *fp, unsigned long long *vals,
+ double *rates, int i)
{
char temp[64];
if (vals[i] > giga)
@@ -264,7 +265,7 @@
fprintf(fp, "%-6u ", (unsigned)rates[i]);
}
-void format_pair(FILE *fp, unsigned long long *vals, int i, int k)
+static void format_pair(FILE *fp, unsigned long long *vals, int i, int k)
{
char temp[64];
if (vals[i] > giga)
@@ -284,7 +285,7 @@
fprintf(fp, "%-6u ", (unsigned)vals[k]);
}
-void print_head(FILE *fp)
+static void print_head(FILE *fp)
{
fprintf(fp, "#%s\n", info_source);
fprintf(fp, "%-15s ", "Interface");
@@ -327,7 +328,8 @@
}
}
-void print_one_if(FILE *fp, struct ifstat_ent *n, unsigned long long *vals)
+static void print_one_if(FILE *fp, struct ifstat_ent *n,
+ unsigned long long *vals)
{
int i;
fprintf(fp, "%-15s ", n->name);
@@ -374,7 +376,7 @@
}
-void dump_kern_db(FILE *fp)
+static void dump_kern_db(FILE *fp)
{
struct ifstat_ent *n;
@@ -388,7 +390,7 @@
}
-void dump_incr_db(FILE *fp)
+static void dump_incr_db(FILE *fp)
{
struct ifstat_ent *n, *h;
h = hist_db;
@@ -419,11 +421,11 @@
static int children;
-void sigchild(int signo)
+static void sigchild(int signo)
{
}
-void update_db(int interval)
+static void update_db(int interval)
{
struct ifstat_ent *n, *h;
@@ -482,7 +484,7 @@
#define T_DIFF(a,b) (((a).tv_sec-(b).tv_sec)*1000 + ((a).tv_usec-(b).tv_usec)/1000)
-void server_loop(int fd)
+static void server_loop(int fd)
{
struct timeval snaptime = { 0 };
struct pollfd p;
@@ -534,7 +536,7 @@
}
}
-int verify_forging(int fd)
+static int verify_forging(int fd)
{
struct ucred cred;
socklen_t olen = sizeof(cred);
diff --git a/misc/nstat.c b/misc/nstat.c
index 2f06ffd..b685978 100644
--- a/misc/nstat.c
+++ b/misc/nstat.c
@@ -55,17 +55,17 @@
return open(p, O_RDONLY);
}
-int net_netstat_open(void)
+static int net_netstat_open(void)
{
return generic_proc_open("PROC_NET_NETSTAT", "net/netstat");
}
-int net_snmp_open(void)
+static int net_snmp_open(void)
{
return generic_proc_open("PROC_NET_SNMP", "net/snmp");
}
-int net_snmp6_open(void)
+static int net_snmp6_open(void)
{
return generic_proc_open("PROC_NET_SNMP6", "net/snmp6");
}
@@ -82,13 +82,13 @@
struct nstat_ent *kern_db;
struct nstat_ent *hist_db;
-char *useless_numbers[] = {
-"IpForwarding", "IpDefaultTTL",
-"TcpRtoAlgorithm", "TcpRtoMin", "TcpRtoMax",
-"TcpMaxConn", "TcpCurrEstab"
+static const char *useless_numbers[] = {
+ "IpForwarding", "IpDefaultTTL",
+ "TcpRtoAlgorithm", "TcpRtoMin", "TcpRtoMax",
+ "TcpMaxConn", "TcpCurrEstab"
};
-int useless_number(char *id)
+static int useless_number(const char *id)
{
int i;
for (i=0; i<sizeof(useless_numbers)/sizeof(*useless_numbers); i++)
@@ -97,7 +97,7 @@
return 0;
}
-int match(char *id)
+static int match(const char *id)
{
int i;
@@ -111,7 +111,7 @@
return 0;
}
-void load_good_table(FILE *fp)
+static void load_good_table(FILE *fp)
{
char buf[4096];
struct nstat_ent *db = NULL;
@@ -157,7 +157,7 @@
}
-void load_ugly_table(FILE *fp)
+static void load_ugly_table(FILE *fp)
{
char buf[4096];
struct nstat_ent *db = NULL;
@@ -228,7 +228,7 @@
}
}
-void load_snmp(void)
+static void load_snmp(void)
{
FILE *fp = fdopen(net_snmp_open(), "r");
if (fp) {
@@ -237,7 +237,7 @@
}
}
-void load_snmp6(void)
+static void load_snmp6(void)
{
FILE *fp = fdopen(net_snmp6_open(), "r");
if (fp) {
@@ -246,7 +246,7 @@
}
}
-void load_netstat(void)
+static void load_netstat(void)
{
FILE *fp = fdopen(net_netstat_open(), "r");
if (fp) {
@@ -255,7 +255,7 @@
}
}
-void dump_kern_db(FILE *fp, int to_hist)
+static void dump_kern_db(FILE *fp, int to_hist)
{
struct nstat_ent *n, *h;
h = hist_db;
@@ -280,7 +280,7 @@
}
}
-void dump_incr_db(FILE *fp)
+static void dump_incr_db(FILE *fp)
{
struct nstat_ent *n, *h;
h = hist_db;
@@ -311,11 +311,11 @@
static int children;
-void sigchild(int signo)
+static void sigchild(int signo)
{
}
-void update_db(int interval)
+static void update_db(int interval)
{
struct nstat_ent *n, *h;
@@ -367,7 +367,7 @@
#define T_DIFF(a,b) (((a).tv_sec-(b).tv_sec)*1000 + ((a).tv_usec-(b).tv_usec)/1000)
-void server_loop(int fd)
+static void server_loop(int fd)
{
struct timeval snaptime = { 0 };
struct pollfd p;
@@ -419,7 +419,7 @@
}
}
-int verify_forging(int fd)
+static int verify_forging(int fd)
{
struct ucred cred;
socklen_t olen = sizeof(cred);
diff --git a/misc/rtacct.c b/misc/rtacct.c
index 49168bd..bb8c90f 100644
--- a/misc/rtacct.c
+++ b/misc/rtacct.c
@@ -55,12 +55,12 @@
return open(p, O_RDONLY);
}
-int net_rtacct_open(void)
+static int net_rtacct_open(void)
{
return generic_proc_open("PROC_NET_RTACCT", "net/rt_acct");
}
-__u32 rmap[256/4];
+static __u32 rmap[256/4];
struct rtacct_data
{
@@ -71,12 +71,12 @@
char signature[128];
};
-struct rtacct_data kern_db_static;
+static struct rtacct_data kern_db_static;
-struct rtacct_data *kern_db = &kern_db_static;
-struct rtacct_data *hist_db;
+static struct rtacct_data *kern_db = &kern_db_static;
+static struct rtacct_data *hist_db;
-void nread(int fd, char *buf, int tot)
+static void nread(int fd, char *buf, int tot)
{
int count = 0;
@@ -93,8 +93,7 @@
}
}
-
-__u32 *read_kern_table(__u32 *tbl)
+static __u32 *read_kern_table(__u32 *tbl)
{
static __u32 *tbl_ptr;
int fd;
@@ -130,7 +129,7 @@
return tbl;
}
-void format_rate(FILE *fp, double rate)
+static void format_rate(FILE *fp, double rate)
{
char temp[64];
@@ -144,7 +143,7 @@
fprintf(fp, " %-10u", (unsigned)rate);
}
-void format_count(FILE *fp, unsigned long long val)
+static void format_count(FILE *fp, unsigned long long val)
{
if (val > 1024*1024*1024)
fprintf(fp, " %10lluM", val/(1024*1024));
@@ -154,7 +153,7 @@
fprintf(fp, " %10llu", val);
}
-void dump_abs_db(FILE *fp)
+static void dump_abs_db(FILE *fp)
{
int realm;
char b1[16];
@@ -216,7 +215,7 @@
}
-void dump_incr_db(FILE *fp)
+static void dump_incr_db(FILE *fp)
{
int k, realm;
char b1[16];
@@ -293,13 +292,13 @@
static int children;
-void sigchild(int signo)
+static void sigchild(int signo)
{
}
/* Server side only: read kernel data, update tables, calculate rates. */
-void update_db(int interval)
+static void update_db(int interval)
{
int i;
__u32 *ival;
@@ -331,7 +330,7 @@
}
}
-void send_db(int fd)
+static void send_db(int fd)
{
int tot = 0;
@@ -351,7 +350,7 @@
#define T_DIFF(a,b) (((a).tv_sec-(b).tv_sec)*1000 + ((a).tv_usec-(b).tv_usec)/1000)
-void pad_kern_table(struct rtacct_data *dat, __u32 *ival)
+static void pad_kern_table(struct rtacct_data *dat, __u32 *ival)
{
int i;
memset(dat->rate, 0, sizeof(dat->rate));
@@ -361,7 +360,7 @@
dat->val[i] = ival[i];
}
-void server_loop(int fd)
+static void server_loop(int fd)
{
struct timeval snaptime = { 0 };
struct pollfd p;
@@ -410,7 +409,7 @@
}
}
-int verify_forging(int fd)
+static int verify_forging(int fd)
{
struct ucred cred;
socklen_t olen = sizeof(cred);
diff --git a/misc/ss.c b/misc/ss.c
index b8cd60d..ff7c194 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -309,7 +309,7 @@
closedir(dir);
}
-int find_users(unsigned ino, char *buf, int buflen)
+static int find_users(unsigned ino, char *buf, int buflen)
{
struct user_ent *p;
int cnt = 0;
@@ -365,7 +365,7 @@
"skbuff_head_cache",
};
-int get_slabstat(struct slabstat *s)
+static int get_slabstat(struct slabstat *s)
{
char buf[256];
FILE *fp;
@@ -455,7 +455,7 @@
"unknown"
};
-const char *print_ms_timer(int timeout)
+static const char *print_ms_timer(int timeout)
{
static char buf[64];
int secs, msecs, minutes;
@@ -482,7 +482,7 @@
return buf;
}
-const char *print_hz_timer(int timeout)
+static const char *print_hz_timer(int timeout)
{
int hz = get_user_hz();
return print_ms_timer(((timeout*1000) + hz-1)/hz);
@@ -498,7 +498,7 @@
struct scache *rlist;
-void init_service_resolver(void)
+static void init_service_resolver(void)
{
char buf[128];
FILE *fp = popen("/usr/sbin/rpcinfo -p 2>/dev/null", "r");
@@ -555,7 +555,7 @@
}
-const char *__resolve_service(int port)
+static const char *__resolve_service(int port)
{
struct scache *c;
@@ -580,7 +580,7 @@
}
-const char *resolve_service(int port)
+static const char *resolve_service(int port)
{
static char buf[128];
static struct scache cache[256];
@@ -634,7 +634,7 @@
return buf;
}
-void formatted_print(const inet_prefix *a, int port)
+static void formatted_print(const inet_prefix *a, int port)
{
char buf[1024];
const char *ap = buf;
@@ -667,7 +667,8 @@
struct aafilter *next;
};
-int inet2_addr_match(const inet_prefix *a, const inet_prefix *p, int plen)
+static int inet2_addr_match(const inet_prefix *a, const inet_prefix *p,
+ int plen)
{
if (!inet_addr_match(a, p, plen))
return 0;
@@ -686,7 +687,7 @@
return 1;
}
-int unix_match(const inet_prefix *a, const inet_prefix *p)
+static int unix_match(const inet_prefix *a, const inet_prefix *p)
{
char *addr, *pattern;
memcpy(&addr, a->data, sizeof(addr));
@@ -698,7 +699,7 @@
return !fnmatch(pattern, addr, 0);
}
-int run_ssfilter(struct ssfilter *f, struct tcpstat *s)
+static int run_ssfilter(struct ssfilter *f, struct tcpstat *s)
{
switch (f->type) {
case SSF_S_AUTO:
@@ -1882,7 +1883,7 @@
}
-int dgram_show_line(char *line, const struct filter *f, int family)
+static int dgram_show_line(char *line, const struct filter *f, int family)
{
struct tcpstat s;
char *loc, *rem, *data;
@@ -1974,7 +1975,7 @@
}
-int udp_show(struct filter *f)
+static int udp_show(struct filter *f)
{
FILE *fp = NULL;
@@ -2010,7 +2011,7 @@
} while (0);
}
-int raw_show(struct filter *f)
+static int raw_show(struct filter *f)
{
FILE *fp = NULL;
@@ -2063,7 +2064,7 @@
#define MAX_UNIX_REMEMBER (1024*1024/sizeof(struct unixstat))
-void unix_list_free(struct unixstat *list)
+static void unix_list_free(struct unixstat *list)
{
while (list) {
struct unixstat *s = list;
@@ -2074,7 +2075,7 @@
}
}
-void unix_list_print(struct unixstat *list, struct filter *f)
+static void unix_list_print(struct unixstat *list, struct filter *f)
{
struct unixstat *s;
char *peer;
@@ -2283,7 +2284,7 @@
return 0;
}
-int unix_show(struct filter *f)
+static int unix_show(struct filter *f)
{
FILE *fp;
char buf[256];
@@ -2368,7 +2369,7 @@
}
-int packet_show(struct filter *f)
+static int packet_show(struct filter *f)
{
FILE *fp;
char buf[256];
@@ -2445,7 +2446,7 @@
return 0;
}
-int netlink_show(struct filter *f)
+static int netlink_show(struct filter *f)
{
FILE *fp;
char buf[256];
@@ -2534,7 +2535,7 @@
int tcp_estab;
};
-int get_snmp_int(char *proto, char *key, int *result)
+static int get_snmp_int(char *proto, char *key, int *result)
{
char buf[1024];
FILE *fp;
@@ -2629,7 +2630,7 @@
&s->tcp_orphans, &s->tcp_tws, &s->tcp_total, &s->tcp_mem);
}
-int get_sockstat(struct sockstat *s)
+static int get_sockstat(struct sockstat *s)
{
char buf[256];
FILE *fp;
@@ -2651,7 +2652,7 @@
return 0;
}
-int print_summary(void)
+static int print_summary(void)
{
struct sockstat s;
struct snmpstat sn;
@@ -2743,7 +2744,7 @@
}
-int scan_state(const char *state)
+static int scan_state(const char *state)
{
int i;
if (strcasecmp(state, "close") == 0 ||
diff --git a/tc/f_rsvp.c b/tc/f_rsvp.c
index 8eaf85d..44d3bdf 100644
--- a/tc/f_rsvp.c
+++ b/tc/f_rsvp.c
@@ -37,7 +37,7 @@
fprintf(stderr, "\nNOTE: CLASSID is parsed as hexadecimal input.\n");
}
-int get_addr_and_pi(int *argc_p, char ***argv_p, inet_prefix * addr,
+static int get_addr_and_pi(int *argc_p, char ***argv_p, inet_prefix * addr,
struct tc_rsvp_pinfo *pinfo, int dir, int family)
{
int argc = *argc_p;
diff --git a/tc/f_u32.c b/tc/f_u32.c
index 66c3247..f2a862d 100644
--- a/tc/f_u32.c
+++ b/tc/f_u32.c
@@ -45,7 +45,7 @@
fprintf(stderr, "\nNOTE: CLASSID is parsed at hexadecimal input.\n");
}
-int get_u32_handle(__u32 *handle, const char *str)
+static int get_u32_handle(__u32 *handle, const char *str)
{
__u32 htid=0, hash=0, nodeid=0;
char *tmp = strchr(str, ':');
@@ -80,7 +80,7 @@
return 0;
}
-char * sprint_u32_handle(__u32 handle, char *buf)
+static char * sprint_u32_handle(__u32 handle, char *buf)
{
int bsize = SPRINT_BSIZE-1;
__u32 htid = TC_U32_HTID(handle);
@@ -194,7 +194,7 @@
}
-int parse_at(int *argc_p, char ***argv_p, int *off, int *offmask)
+static int parse_at(int *argc_p, char ***argv_p, int *off, int *offmask)
{
int argc = *argc_p;
char **argv = *argv_p;
diff --git a/tc/m_action.c b/tc/m_action.c
index 1fe2431..4acabef 100644
--- a/tc/m_action.c
+++ b/tc/m_action.c
@@ -35,7 +35,7 @@
int batch_c = 0;
int tab_flush = 0;
-void act_usage(void)
+static void act_usage(void)
{
/*XXX: In the near future add a action->print_help to improve
* usability
@@ -83,7 +83,7 @@
return -1;
}
-struct action_util *get_action_kind(char *str)
+static struct action_util *get_action_kind(char *str)
{
static void *aBODY;
void *dlh;
@@ -138,7 +138,7 @@
return a;
}
-int
+static int
new_cmd(char **argv)
{
if ((matches(*argv, "change") == 0) ||
@@ -241,7 +241,7 @@
return -1;
}
-int
+static int
tc_print_one_action(FILE * f, struct rtattr *arg)
{
@@ -355,7 +355,7 @@
return 0;
}
-int tc_action_gd(int cmd, unsigned flags, int *argc_p, char ***argv_p)
+static int tc_action_gd(int cmd, unsigned flags, int *argc_p, char ***argv_p)
{
char k[16];
struct action_util *a = NULL;
@@ -467,7 +467,7 @@
return ret;
}
-int tc_action_modify(int cmd, unsigned flags, int *argc_p, char ***argv_p)
+static int tc_action_modify(int cmd, unsigned flags, int *argc_p, char ***argv_p)
{
int argc = *argc_p;
char **argv = *argv_p;
@@ -507,7 +507,7 @@
return ret;
}
-int tc_act_list_or_flush(int argc, char **argv, int event)
+static int tc_act_list_or_flush(int argc, char **argv, int event)
{
int ret = 0, prio = 0, msg_size = 0;
char k[16];
diff --git a/tc/m_estimator.c b/tc/m_estimator.c
index a9e5dbc..3dc8624 100644
--- a/tc/m_estimator.c
+++ b/tc/m_estimator.c
@@ -22,6 +22,7 @@
#include "utils.h"
#include "tc_util.h"
+#include "tc_common.h"
static void est_help(void);
@@ -31,7 +32,6 @@
fprintf(stderr, " INTERVAL is interval between measurements\n");
fprintf(stderr, " TIME-CONST is averaging time constant\n");
fprintf(stderr, "Example: ... est 1sec 8sec\n");
- return;
}
int parse_estimator(int *p_argc, char ***p_argv, struct tc_estimator *est)
diff --git a/tc/m_gact.c b/tc/m_gact.c
index 9f07851..94bd5e7 100644
--- a/tc/m_gact.c
+++ b/tc/m_gact.c
@@ -68,7 +68,7 @@
exit(-1);
}
-int
+static int
get_act(char ***argv_p)
{
char **argv = *argv_p;
@@ -89,8 +89,9 @@
}
}
-int
-parse_gact(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n)
+static int
+parse_gact(struct action_util *a, int *argc_p, char ***argv_p,
+ int tca_id, struct nlmsghdr *n)
{
int argc = *argc_p;
char **argv = *argv_p;
@@ -202,7 +203,7 @@
return 0;
}
-int
+static int
print_gact(struct action_util *au,FILE * f, struct rtattr *arg)
{
SPRINT_BUF(b1);
diff --git a/tc/m_mirred.c b/tc/m_mirred.c
index 0d771bc..1ef9f2b 100644
--- a/tc/m_mirred.c
+++ b/tc/m_mirred.c
@@ -45,7 +45,7 @@
exit(-1);
}
-char *mirred_n2a(int action)
+static const char *mirred_n2a(int action)
{
switch (action) {
case TCA_EGRESS_REDIR:
@@ -61,8 +61,9 @@
}
}
-int
-parse_egress(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n)
+static int
+parse_egress(struct action_util *a, int *argc_p, char ***argv_p,
+ int tca_id, struct nlmsghdr *n)
{
int argc = *argc_p;
@@ -205,8 +206,9 @@
}
-int
-parse_mirred(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n)
+static int
+parse_mirred(struct action_util *a, int *argc_p, char ***argv_p,
+ int tca_id, struct nlmsghdr *n)
{
int argc = *argc_p;
@@ -245,7 +247,7 @@
}
-int
+static int
print_mirred(struct action_util *au,FILE * f, struct rtattr *arg)
{
struct tc_mirred *p;
diff --git a/tc/m_pedit.c b/tc/m_pedit.c
index 7499846..452d96f 100644
--- a/tc/m_pedit.c
+++ b/tc/m_pedit.c
@@ -73,8 +73,7 @@
}
-struct m_pedit_util
-*get_pedit_kind(char *str)
+static struct m_pedit_util *get_pedit_kind(const char *str)
{
static void *pBODY;
void *dlh;
@@ -411,7 +410,7 @@
return res;
}
-int
+static int
parse_munge(int *argc_p, char ***argv_p,struct tc_pedit_sel *sel)
{
struct tc_pedit_key tkey;
diff --git a/tc/m_police.c b/tc/m_police.c
index c3869b6..53cbefc 100644
--- a/tc/m_police.c
+++ b/tc/m_police.c
@@ -50,7 +50,7 @@
fprintf(stderr, "Illegal \"%s\"\n", arg);
}
-char *police_action_n2a(int action, char *buf, int len)
+static const char *police_action_n2a(int action, char *buf, int len)
{
switch (action) {
case -1:
@@ -72,7 +72,7 @@
}
}
-int police_action_a2n(char *arg, int *result)
+static int police_action_a2n(const char *arg, int *result)
{
int res;
@@ -100,7 +100,7 @@
}
-int get_police_result(int *action, int *result, char *arg)
+static int get_police_result(int *action, int *result, char *arg)
{
char *p = strchr(arg, '/');
diff --git a/tc/m_xt.c b/tc/m_xt.c
index 21dca00..3edf520 100644
--- a/tc/m_xt.c
+++ b/tc/m_xt.c
@@ -76,7 +76,7 @@
/*
* we may need to check for version mismatch
*/
-int
+static int
build_st(struct xtables_target *target, struct xt_entry_target *t)
{
@@ -98,7 +98,7 @@
}
-inline void set_lib_dir(void)
+static void set_lib_dir(void)
{
lib_dir = getenv("XTABLES_LIBDIR");
diff --git a/tc/q_mqprio.c b/tc/q_mqprio.c
index b2d8c12..fa1022b 100644
--- a/tc/q_mqprio.c
+++ b/tc/q_mqprio.c
@@ -104,7 +104,7 @@
return 0;
}
-int mqprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+static int mqprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
{
int i;
struct tc_mqprio_qopt *qopt;
diff --git a/tc/q_multiq.c b/tc/q_multiq.c
index 7ff9e74..546ae01 100644
--- a/tc/q_multiq.c
+++ b/tc/q_multiq.c
@@ -61,7 +61,7 @@
return 0;
}
-int multiq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+static int multiq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
{
struct tc_multiq_qopt *qopt;
diff --git a/tc/q_netem.c b/tc/q_netem.c
index 2583072..9dd8712 100644
--- a/tc/q_netem.c
+++ b/tc/q_netem.c
@@ -87,12 +87,12 @@
return 0;
}
-void print_percent(char *buf, int len, __u32 per)
+static void print_percent(char *buf, int len, __u32 per)
{
snprintf(buf, len, "%g%%", 100. * (double) per / max_percent_value);
}
-char * sprint_percent(__u32 per, char *buf)
+static char * sprint_percent(__u32 per, char *buf)
{
print_percent(buf, SPRINT_BSIZE-1, per);
return buf;
diff --git a/tc/q_rr.c b/tc/q_rr.c
index 79072ad..e8a9165 100644
--- a/tc/q_rr.c
+++ b/tc/q_rr.c
@@ -88,7 +88,7 @@
return 0;
}
-int rr_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+static int rr_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
{
int i;
struct tc_prio_qopt *qopt;
diff --git a/tc/tc_class.c b/tc/tc_class.c
index 95bf615..6c0850d 100644
--- a/tc/tc_class.c
+++ b/tc/tc_class.c
@@ -40,7 +40,7 @@
return;
}
-int tc_class_modify(int cmd, unsigned flags, int argc, char **argv)
+static int tc_class_modify(int cmd, unsigned flags, int argc, char **argv)
{
struct {
struct nlmsghdr n;
@@ -232,7 +232,7 @@
}
-int tc_class_list(int argc, char **argv)
+static int tc_class_list(int argc, char **argv)
{
struct tcmsg t;
char d[16];
diff --git a/tc/tc_core.c b/tc/tc_core.c
index 9a0ff39..85b072e 100644
--- a/tc/tc_core.c
+++ b/tc/tc_core.c
@@ -76,7 +76,7 @@
* (as the table will always be aligned for 48 bytes).
* --Hawk, d.7/11-2004. <hawk@diku.dk>
*/
-unsigned tc_align_to_atm(unsigned size)
+static unsigned tc_align_to_atm(unsigned size)
{
int linksize, cells;
cells = size / ATM_CELL_PAYLOAD;
@@ -87,7 +87,7 @@
return linksize;
}
-unsigned tc_adjust_size(unsigned sz, unsigned mpu, enum link_layer linklayer)
+static unsigned tc_adjust_size(unsigned sz, unsigned mpu, enum link_layer linklayer)
{
if (sz < mpu)
sz = mpu;
@@ -181,7 +181,7 @@
return 0;
}
-int tc_core_init()
+int tc_core_init(void)
{
FILE *fp;
__u32 clock_res;
diff --git a/tc/tc_filter.c b/tc/tc_filter.c
index c9e09d8..c3f2d5f 100644
--- a/tc/tc_filter.c
+++ b/tc/tc_filter.c
@@ -45,7 +45,7 @@
}
-int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv)
+static int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv)
{
struct {
struct nlmsghdr n;
@@ -260,7 +260,7 @@
}
-int tc_filter_list(int argc, char **argv)
+static int tc_filter_list(int argc, char **argv)
{
struct tcmsg t;
char d[16];
diff --git a/tc/tc_monitor.c b/tc/tc_monitor.c
index bf58744..0efe034 100644
--- a/tc/tc_monitor.c
+++ b/tc/tc_monitor.c
@@ -35,7 +35,8 @@
}
-int accept_tcmsg(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
+static int accept_tcmsg(const struct sockaddr_nl *who,
+ struct nlmsghdr *n, void *arg)
{
FILE *fp = (FILE*)arg;
diff --git a/tc/tc_qdisc.c b/tc/tc_qdisc.c
index c8d7335..f3bf5b5 100644
--- a/tc/tc_qdisc.c
+++ b/tc/tc_qdisc.c
@@ -44,7 +44,7 @@
return -1;
}
-int tc_qdisc_modify(int cmd, unsigned flags, int argc, char **argv)
+static int tc_qdisc_modify(int cmd, unsigned flags, int argc, char **argv)
{
struct qdisc_util *q = NULL;
struct tc_estimator est;
@@ -277,7 +277,7 @@
}
-int tc_qdisc_list(int argc, char **argv)
+static int tc_qdisc_list(int argc, char **argv)
{
struct tcmsg t;
char d[16];
diff --git a/tc/tc_util.c b/tc/tc_util.c
index ccf8fa4..8e62a01 100644
--- a/tc/tc_util.c
+++ b/tc/tc_util.c
@@ -167,35 +167,6 @@
return -1;
}
-int get_rate_and_cell(unsigned *rate, int *cell_log, char *str)
-{
- char * slash = strchr(str, '/');
-
- if (slash)
- *slash = 0;
-
- if (get_rate(rate, str))
- return -1;
-
- if (slash) {
- int cell;
- int i;
-
- if (get_integer(&cell, slash+1, 0))
- return -1;
- *slash = '/';
-
- for (i=0; i<32; i++) {
- if ((1<<i) == cell) {
- *cell_log = i;
- return 0;
- }
- }
- return -1;
- }
- return 0;
-}
-
void print_rate(char *buf, int len, __u32 rate)
{
double tmp = (double)rate*8;
diff --git a/tc/tc_util.h b/tc/tc_util.h
index 6b3ed1e..4f54436 100644
--- a/tc/tc_util.h
+++ b/tc/tc_util.h
@@ -97,5 +97,6 @@
extern int tc_print_ipt(FILE *f, const struct rtattr *tb);
extern int parse_action(int *, char ***, int, struct nlmsghdr *);
extern void print_tm(FILE *f, const struct tcf_t *tm);
+extern int prio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt);
#endif