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;
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) {
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))
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);
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);
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;
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;
#include "rt_names.h"
#include "utils.h"
+#include "ip_common.h"
static struct {
char *dev;
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;
*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");
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];
}
-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");
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;
}
-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;
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;
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;
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;
#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
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;
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;
}
-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;
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;
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;
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;
}
-int iproute_get(int argc, char **argv)
+static int iproute_get(int argc, char **argv)
{
struct {
struct nlmsghdr n;
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;
return 0;
}
-int iproute_restore(void)
+static int iproute_restore(void)
{
if (route_dump_check_magic())
exit(-1);
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;
#include "utils.h"
#include "xfrm.h"
+#include "ip_common.h"
#define STRBUF_SIZE (128)
#define STRBUF_CAT(buf, str) \
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");
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);
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);
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);
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 ]"
exit(1);
}
-int handle_if(int ifindex)
+static int handle_if(int ifindex)
{
int i;
int sysctl_adjusted;
-void do_sysctl_adjustments(void)
+static void do_sysctl_adjustments(void)
{
int i;
sysctl_adjusted = 1;
}
-void undo_sysctl_adjustments(void)
+static void undo_sysctl_adjustments(void)
{
int i;
}
-int send_probe(int ifindex, __u32 addr)
+static int send_probe(int ifindex, __u32 addr)
{
struct ifreq ifr;
struct sockaddr_in dst;
/* 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;
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;
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;
}
-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;
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;
}
/* 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;
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;
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;
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,
return 0;
}
-void load_info(void)
+static void load_info(void)
{
struct ifstat_ent *db, *n;
struct rtnl_handle rth;
}
}
-void load_raw_table(FILE *fp)
+static void load_raw_table(FILE *fp)
{
char buf[4096];
struct ifstat_ent *db = NULL;
}
}
-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;
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)
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)
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");
}
}
-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);
}
-void dump_kern_db(FILE *fp)
+static void dump_kern_db(FILE *fp)
{
struct ifstat_ent *n;
}
-void dump_incr_db(FILE *fp)
+static void dump_incr_db(FILE *fp)
{
struct ifstat_ent *n, *h;
h = hist_db;
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;
#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;
}
}
-int verify_forging(int fd)
+static int verify_forging(int fd)
{
struct ucred cred;
socklen_t olen = sizeof(cred);
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");
}
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++)
return 0;
}
-int match(char *id)
+static int match(const char *id)
{
int i;
return 0;
}
-void load_good_table(FILE *fp)
+static void load_good_table(FILE *fp)
{
char buf[4096];
struct nstat_ent *db = NULL;
}
-void load_ugly_table(FILE *fp)
+static void load_ugly_table(FILE *fp)
{
char buf[4096];
struct nstat_ent *db = NULL;
}
}
-void load_snmp(void)
+static void load_snmp(void)
{
FILE *fp = fdopen(net_snmp_open(), "r");
if (fp) {
}
}
-void load_snmp6(void)
+static void load_snmp6(void)
{
FILE *fp = fdopen(net_snmp6_open(), "r");
if (fp) {
}
}
-void load_netstat(void)
+static void load_netstat(void)
{
FILE *fp = fdopen(net_netstat_open(), "r");
if (fp) {
}
}
-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;
}
}
-void dump_incr_db(FILE *fp)
+static void dump_incr_db(FILE *fp)
{
struct nstat_ent *n, *h;
h = hist_db;
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;
#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;
}
}
-int verify_forging(int fd)
+static int verify_forging(int fd)
{
struct ucred cred;
socklen_t olen = sizeof(cred);
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
{
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;
}
}
-
-__u32 *read_kern_table(__u32 *tbl)
+static __u32 *read_kern_table(__u32 *tbl)
{
static __u32 *tbl_ptr;
int fd;
return tbl;
}
-void format_rate(FILE *fp, double rate)
+static void format_rate(FILE *fp, double rate)
{
char temp[64];
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));
fprintf(fp, " %10llu", val);
}
-void dump_abs_db(FILE *fp)
+static void dump_abs_db(FILE *fp)
{
int realm;
char b1[16];
}
-void dump_incr_db(FILE *fp)
+static void dump_incr_db(FILE *fp)
{
int k, realm;
char b1[16];
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;
}
}
-void send_db(int fd)
+static void send_db(int fd)
{
int tot = 0;
#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));
dat->val[i] = ival[i];
}
-void server_loop(int fd)
+static void server_loop(int fd)
{
struct timeval snaptime = { 0 };
struct pollfd p;
}
}
-int verify_forging(int fd)
+static int verify_forging(int fd)
{
struct ucred cred;
socklen_t olen = sizeof(cred);
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;
"skbuff_head_cache",
};
-int get_slabstat(struct slabstat *s)
+static int get_slabstat(struct slabstat *s)
{
char buf[256];
FILE *fp;
"unknown"
};
-const char *print_ms_timer(int timeout)
+static const char *print_ms_timer(int timeout)
{
static char buf[64];
int secs, msecs, minutes;
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);
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");
}
-const char *__resolve_service(int port)
+static const char *__resolve_service(int port)
{
struct scache *c;
}
-const char *resolve_service(int port)
+static const char *resolve_service(int port)
{
static char buf[128];
static struct scache cache[256];
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;
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;
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));
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:
}
-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;
}
-int udp_show(struct filter *f)
+static int udp_show(struct filter *f)
{
FILE *fp = NULL;
} while (0);
}
-int raw_show(struct filter *f)
+static int raw_show(struct filter *f)
{
FILE *fp = NULL;
#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;
}
}
-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;
return 0;
}
-int unix_show(struct filter *f)
+static int unix_show(struct filter *f)
{
FILE *fp;
char buf[256];
}
-int packet_show(struct filter *f)
+static int packet_show(struct filter *f)
{
FILE *fp;
char buf[256];
return 0;
}
-int netlink_show(struct filter *f)
+static int netlink_show(struct filter *f)
{
FILE *fp;
char buf[256];
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;
&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;
return 0;
}
-int print_summary(void)
+static int print_summary(void)
{
struct sockstat s;
struct snmpstat sn;
}
-int scan_state(const char *state)
+static int scan_state(const char *state)
{
int i;
if (strcasecmp(state, "close") == 0 ||
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;
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, ':');
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);
}
-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;
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
return -1;
}
-struct action_util *get_action_kind(char *str)
+static struct action_util *get_action_kind(char *str)
{
static void *aBODY;
void *dlh;
return a;
}
-int
+static int
new_cmd(char **argv)
{
if ((matches(*argv, "change") == 0) ||
return -1;
}
-int
+static int
tc_print_one_action(FILE * f, struct rtattr *arg)
{
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;
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;
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];
#include "utils.h"
#include "tc_util.h"
+#include "tc_common.h"
static void est_help(void);
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)
exit(-1);
}
-int
+static int
get_act(char ***argv_p)
{
char **argv = *argv_p;
}
}
-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;
return 0;
}
-int
+static int
print_gact(struct action_util *au,FILE * f, struct rtattr *arg)
{
SPRINT_BUF(b1);
exit(-1);
}
-char *mirred_n2a(int action)
+static const char *mirred_n2a(int action)
{
switch (action) {
case TCA_EGRESS_REDIR:
}
}
-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;
}
-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;
}
-int
+static int
print_mirred(struct action_util *au,FILE * f, struct rtattr *arg)
{
struct tc_mirred *p;
}
-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;
return res;
}
-int
+static int
parse_munge(int *argc_p, char ***argv_p,struct tc_pedit_sel *sel)
{
struct tc_pedit_key tkey;
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:
}
}
-int police_action_a2n(char *arg, int *result)
+static int police_action_a2n(const char *arg, int *result)
{
int res;
}
-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, '/');
/*
* we may need to check for version mismatch
*/
-int
+static int
build_st(struct xtables_target *target, struct xt_entry_target *t)
{
}
-inline void set_lib_dir(void)
+static void set_lib_dir(void)
{
lib_dir = getenv("XTABLES_LIBDIR");
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;
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;
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;
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;
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;
}
-int tc_class_list(int argc, char **argv)
+static int tc_class_list(int argc, char **argv)
{
struct tcmsg t;
char d[16];
* (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;
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;
return 0;
}
-int tc_core_init()
+int tc_core_init(void)
{
FILE *fp;
__u32 clock_res;
}
-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;
}
-int tc_filter_list(int argc, char **argv)
+static int tc_filter_list(int argc, char **argv)
{
struct tcmsg t;
char d[16];
}
-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;
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;
}
-int tc_qdisc_list(int argc, char **argv)
+static int tc_qdisc_list(int argc, char **argv)
{
struct tcmsg t;
char d[16];
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;
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