Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
iproute2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
iproute2
Commits
d1f28cf1
Commit
d1f28cf1
authored
Feb 12, 2013
by
Stephen Hemminger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ip: make local functions static
parent
14645ec2
Changes
40
Hide whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
187 additions
and
202 deletions
+187
-202
bridge/monitor.c
bridge/monitor.c
+2
-2
genl/ctrl.c
genl/ctrl.c
+1
-1
ip/ipaddress.c
ip/ipaddress.c
+5
-5
ip/iplink.c
ip/iplink.c
+2
-2
ip/ipmaddr.c
ip/ipmaddr.c
+6
-5
ip/ipmonitor.c
ip/ipmonitor.c
+2
-2
ip/ipneigh.c
ip/ipneigh.c
+3
-3
ip/ipnetconf.c
ip/ipnetconf.c
+2
-2
ip/ipprefix.c
ip/ipprefix.c
+2
-0
ip/iproute.c
ip/iproute.c
+15
-11
ip/ipxfrm.c
ip/ipxfrm.c
+1
-0
ip/rtmon.c
ip/rtmon.c
+1
-1
ip/xfrm_monitor.c
ip/xfrm_monitor.c
+1
-1
ip/xfrm_policy.c
ip/xfrm_policy.c
+1
-1
ip/xfrm_state.c
ip/xfrm_state.c
+1
-1
misc/arpd.c
misc/arpd.c
+17
-17
misc/ifstat.c
misc/ifstat.c
+15
-13
misc/nstat.c
misc/nstat.c
+20
-20
misc/rtacct.c
misc/rtacct.c
+17
-18
misc/ss.c
misc/ss.c
+24
-23
tc/f_rsvp.c
tc/f_rsvp.c
+1
-1
tc/f_u32.c
tc/f_u32.c
+3
-3
tc/m_action.c
tc/m_action.c
+7
-7
tc/m_estimator.c
tc/m_estimator.c
+1
-1
tc/m_gact.c
tc/m_gact.c
+5
-4
tc/m_mirred.c
tc/m_mirred.c
+8
-6
tc/m_pedit.c
tc/m_pedit.c
+2
-3
tc/m_police.c
tc/m_police.c
+3
-3
tc/m_xt.c
tc/m_xt.c
+2
-2
tc/q_mqprio.c
tc/q_mqprio.c
+1
-1
tc/q_multiq.c
tc/q_multiq.c
+1
-1
tc/q_netem.c
tc/q_netem.c
+2
-2
tc/q_rr.c
tc/q_rr.c
+1
-1
tc/tc_class.c
tc/tc_class.c
+2
-2
tc/tc_core.c
tc/tc_core.c
+3
-3
tc/tc_filter.c
tc/tc_filter.c
+2
-2
tc/tc_monitor.c
tc/tc_monitor.c
+2
-1
tc/tc_qdisc.c
tc/tc_qdisc.c
+2
-2
tc/tc_util.c
tc/tc_util.c
+0
-29
tc/tc_util.h
tc/tc_util.h
+1
-0
No files found.
bridge/monitor.c
View file @
d1f28cf1
...
...
@@ -46,8 +46,8 @@ static int show_mark(FILE *fp, const struct nlmsghdr *n)
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
;
...
...
genl/ctrl.c
View file @
d1f28cf1
...
...
@@ -112,7 +112,7 @@ errout:
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\t
Capabilities (0x%x):
\n
"
,
fl
);
if
(
!
fl
)
{
...
...
ip/ipaddress.c
View file @
d1f28cf1
...
...
@@ -89,7 +89,7 @@ static void usage(void)
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 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
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 @@ int print_addrinfo_primary(const struct sockaddr_nl *who, struct nlmsghdr *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
);
...
...
ip/iplink.c
View file @
d1f28cf1
...
...
@@ -135,7 +135,7 @@ struct link_util *get_link_kind(const char *id)
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 @@ struct iplink_req {
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
;
...
...
ip/ipmaddr.c
View file @
d1f28cf1
...
...
@@ -28,6 +28,7 @@
#include "rt_names.h"
#include "utils.h"
#include "ip_common.h"
static
struct
{
char
*
dev
;
...
...
@@ -70,7 +71,7 @@ struct ma_info
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 @@ void maddr_ins(struct ma_info **lst, struct ma_info *m)
*
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 @@ void read_dev_mcast(struct ma_info **result_p)
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_igmp(struct ma_info **result_p)
}
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 @@ static int multiaddr_list(int argc, char **argv)
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
;
...
...
ip/ipmonitor.c
View file @
d1f28cf1
...
...
@@ -37,8 +37,8 @@ static void usage(void)
}
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
;
...
...
ip/ipneigh.c
View file @
d1f28cf1
...
...
@@ -52,7 +52,7 @@ static void usage(void)
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 @@ int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
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
;
...
...
ip/ipnetconf.c
View file @
d1f28cf1
...
...
@@ -119,12 +119,12 @@ int print_netconf(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
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
;
...
...
ip/ipprefix.c
View file @
d1f28cf1
...
...
@@ -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
...
...
ip/iproute.c
View file @
d1f28cf1
...
...
@@ -124,7 +124,7 @@ static int flush_update(void)
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 @@ int filter_nlmsg(struct nlmsghdr *n, struct rtattr **tb, int host_len)
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 print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
}
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 @@ int parse_one_nh(struct rtmsg *r, struct rtattr *rta, struct rtnexthop *rtnh, in
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 @@ int parse_nexthops(struct nlmsghdr *n, struct rtmsg *r, int argc, char **argv)
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 int iproute_flush_cache(void)
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 @@ static int iproute_list_flush_or_save(int argc, char **argv, int action)
}
int
iproute_get
(
int
argc
,
char
**
argv
)
static
int
iproute_get
(
int
argc
,
char
**
argv
)
{
struct
{
struct
nlmsghdr
n
;
...
...
@@ -1528,7 +1531,8 @@ int iproute_get(int argc, char **argv)
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 @@ static int route_dump_check_magic(void)
return
0
;
}
int
iproute_restore
(
void
)
static
int
iproute_restore
(
void
)
{
if
(
route_dump_check_magic
())
exit
(
-
1
);
...
...
@@ -1584,7 +1588,7 @@ static int iproute_showdump(void)
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
;
...
...
ip/ipxfrm.c
View file @
d1f28cf1
...
...
@@ -39,6 +39,7 @@
#include "utils.h"
#include "xfrm.h"
#include "ip_common.h"
#define STRBUF_SIZE (128)
#define STRBUF_CAT(buf, str) \
...
...
ip/rtmon.c
View file @
d1f28cf1
...
...
@@ -56,7 +56,7 @@ static int dump_msg(const struct sockaddr_nl *who, struct nlmsghdr *n,
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
"
);
...
...
ip/xfrm_monitor.c
View file @
d1f28cf1
...
...
@@ -206,7 +206,7 @@ static int xfrm_report_print(const struct sockaddr_nl *who,
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
);
...
...
ip/xfrm_policy.c
View file @
d1f28cf1
...
...
@@ -896,7 +896,7 @@ static int xfrm_policy_list_or_deleteall(int argc, char **argv, int deleteall)
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
);
...
...
ip/xfrm_state.c
View file @
d1f28cf1
...
...
@@ -1053,7 +1053,7 @@ static int xfrm_state_list_or_deleteall(int argc, char **argv, int deleteall)
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
);
...
...
misc/arpd.c
View file @
d1f28cf1
...
...
@@ -92,7 +92,7 @@ int broadcast_rate = 1000;
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 @@ void usage(void)
exit
(
1
);
}
int
handle_if
(
int
ifindex
)
static
int
handle_if
(
int
ifindex
)
{
int
i
;
...
...
@@ -115,7 +115,7 @@ int handle_if(int ifindex)
int
sysctl_adjusted
;
void
do_sysctl_adjustments
(
void
)
static
void
do_sysctl_adjustments
(
void
)
{
int
i
;
...
...
@@ -148,7 +148,7 @@ void do_sysctl_adjustments(void)
sysctl_adjusted
=
1
;
}
void
undo_sysctl_adjustments
(
void
)
static
void
undo_sysctl_adjustments
(
void
)
{
int
i
;
...
...
@@ -178,7 +178,7 @@ void undo_sysctl_adjustments(void)
}
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 @@ int send_probe(int ifindex, __u32 addr)
/* 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 @@ int queue_active_probe(int ifindex, __u32 addr)
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 @@ int respond_to_kernel(int ifindex, __u32 addr, char *lla, int llalen)
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 @@ void prepare_neg_entry(__u8 *ndata, __u32 stamp)
}
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 @@ int do_one_request(struct nlmsghdr *n)
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 @@ void get_kern_msg(void)
}
/* 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 @@ void get_arp_pkt(void)
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 @@ void catch_signal(int sig, void (*handler)(int))
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 @@ void sig_stats(int signo)
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
,
...
...
misc/ifstat.c
View file @
d1f28cf1
...
...
@@ -115,7 +115,7 @@ static int get_nlmsg(const struct sockaddr_nl *who,
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_info(void)
}
}
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 load_raw_table(FILE *fp)
}
}
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 giga = 1000000000ull;
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 @@ void format_rate(FILE *fp, unsigned long long *vals, double *rates, int i)
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 @@ void format_pair(FILE *fp, unsigned long long *vals, int i, int k)
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_head(FILE *fp)
}
}
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 print_one_if(FILE *fp, struct ifstat_ent *n, unsigned long long *vals)
}
void
dump_kern_db
(
FILE
*
fp
)
static
void
dump_kern_db
(
FILE
*
fp
)
{
struct
ifstat_ent
*
n
;
...
...
@@ -388,7 +390,7 @@ void dump_kern_db(FILE *fp)
}
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 @@ void dump_incr_db(FILE *fp)
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 @@ void update_db(int interval)
#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 @@ void server_loop(int fd)
}
}
int
verify_forging
(
int
fd
)
static
int
verify_forging
(
int
fd
)
{
struct
ucred
cred
;
socklen_t
olen
=
sizeof
(
cred
);
...
...
misc/nstat.c
View file @
d1f28cf1
...
...
@@ -55,17 +55,17 @@ static int generic_proc_open(const char *env, char *name)
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
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 @@ int useless_number(char *id)
return
0
;
}
int
match
(
char
*
id
)
static
int
match
(
const
char
*
id
)
{
int
i
;
...
...
@@ -111,7 +111,7 @@ int match(char *id)
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_good_table(FILE *fp)
}
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_ugly_table(FILE *fp)
}
}
void
load_snmp
(
void
)
static
void
load_snmp
(
void
)
{
FILE
*
fp
=
fdopen
(
net_snmp_open
(),
"r"
);
if
(
fp
)
{
...
...
@@ -237,7 +237,7 @@ void load_snmp(void)
}
}
void
load_snmp6
(
void
)
static
void
load_snmp6
(
void
)
{
FILE
*
fp
=
fdopen
(
net_snmp6_open
(),
"r"
);
if
(
fp
)
{
...
...
@@ -246,7 +246,7 @@ void load_snmp6(void)
}
}
void
load_netstat
(
void
)
static
void
load_netstat
(
void
)
{
FILE
*
fp
=
fdopen
(
net_netstat_open
(),
"r"
);
if
(
fp
)
{
...
...
@@ -255,7 +255,7 @@ void load_netstat(void)
}
}
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_kern_db(FILE *fp, int to_hist)
}
}
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 @@ void dump_incr_db(FILE *fp)
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 @@ void update_db(int interval)
#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 @@ void server_loop(int fd)
}
}
int
verify_forging
(
int
fd
)
static
int
verify_forging
(
int
fd
)
{
struct
ucred
cred
;
socklen_t
olen
=
sizeof
(
cred
);
...
...
misc/rtacct.c
View file @
d1f28cf1
...
...
@@ -55,12 +55,12 @@ static int generic_proc_open(const char *env, const char *name)
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 @@ struct rtacct_data
char
signature
[
128
];
};
struct
rtacct_data
kern_db_static
;
st
atic
st
ruct
rtacct_data
kern_db_static
;
struct
rtacct_data
*
kern_db
=
&
kern_db_static
;
struct
rtacct_data
*
hist_db
;
st
atic
st
ruct
rtacct_data
*
kern_db
=
&
kern_db_static
;
st
atic
st
ruct
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 @@ void nread(int fd, char *buf, int tot)
}
}
__u32
*
read_kern_table
(
__u32
*
tbl
)
static
__u32
*
read_kern_table
(
__u32
*
tbl
)
{
static
__u32
*
tbl_ptr
;
int
fd
;
...
...
@@ -130,7 +129,7 @@ __u32 *read_kern_table(__u32 *tbl)
return
tbl
;
}
void
format_rate
(
FILE
*
fp
,
double
rate
)
static
void
format_rate
(
FILE
*
fp
,
double
rate
)
{
char
temp
[
64
];
...
...
@@ -144,7 +143,7 @@ void format_rate(FILE *fp, double rate)
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 @@ void format_count(FILE *fp, unsigned long long val)
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_abs_db(FILE *fp)
}
void
dump_incr_db
(
FILE
*
fp
)
static
void
dump_incr_db
(
FILE
*
fp
)
{
int
k
,
realm
;
char
b1
[
16
];
...
...
@@ -293,13 +292,13 @@ void dump_incr_db(FILE *fp)
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 update_db(int interval)
}
}
void
send_db
(
int
fd
)
static
void
send_db
(
int
fd
)
{
int
tot
=
0
;
...
...
@@ -351,7 +350,7 @@ void send_db(int fd)
#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 @@ void pad_kern_table(struct rtacct_data *dat, __u32 *ival)
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 @@ void server_loop(int fd)
}
}
int
verify_forging
(
int
fd
)
static
int
verify_forging
(
int
fd
)
{
struct
ucred
cred
;
socklen_t
olen
=
sizeof
(
cred
);
...
...
misc/ss.c
View file @
d1f28cf1
...
...
@@ -309,7 +309,7 @@ static void user_ent_hash_build(void)
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 @@ static const char *slabstat_ids[] =
"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 @@ static const char *tmr_name[] = {
"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 @@ const char *print_ms_timer(int timeout)
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
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 @@ static int is_ephemeral(int port)
}
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)
}
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 @@ const char *resolve_service(int port)
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
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 @@ int inet2_addr_match(const inet_prefix *a, const inet_prefix *p, int plen)
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 @@ int unix_match(const inet_prefix *a, const inet_prefix *p)
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 @@ outerr:
}
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 dgram_show_line(char *line, const struct filter *f, int family)
}
int
udp_show
(
struct
filter
*
f
)
static
int
udp_show
(
struct
filter
*
f
)
{
FILE
*
fp
=
NULL
;
...
...
@@ -2010,7 +2011,7 @@ outerr:
}
while
(
0
);
}
int
raw_show
(
struct
filter
*
f
)
static
int
raw_show
(
struct
filter
*
f
)
{
FILE
*
fp
=
NULL
;
...
...
@@ -2063,7 +2064,7 @@ int unix_state_map[] = { SS_CLOSE, SS_SYN_SENT,
#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_free(struct unixstat *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
;
...
...
@@ -2283,7 +2284,7 @@ close_it:
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 unix_show(struct filter *f)
}
int
packet_show
(
struct
filter
*
f
)
static
int
packet_show
(
struct
filter
*
f
)
{
FILE
*
fp
;
char
buf
[
256
];
...
...
@@ -2445,7 +2446,7 @@ int packet_show(struct filter *f)
return
0
;
}
int
netlink_show
(
struct
filter
*
f
)
static
int
netlink_show
(
struct
filter
*
f
)
{
FILE
*
fp
;
char
buf
[
256
];
...
...
@@ -2534,7 +2535,7 @@ struct snmpstat
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 @@ static void get_sockstat_line(char *line, struct sockstat *s)
&
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 @@ int get_sockstat(struct sockstat *s)
return
0
;
}
int
print_summary
(
void
)
static
int
print_summary
(
void
)
{
struct
sockstat
s
;
struct
snmpstat
sn
;
...
...
@@ -2743,7 +2744,7 @@ static void usage(void)
}
int
scan_state
(
const
char
*
state
)
static
int
scan_state
(
const
char
*
state
)
{
int
i
;
if
(
strcasecmp
(
state
,
"close"
)
==
0
||
...
...
tc/f_rsvp.c
View file @
d1f28cf1
...
...
@@ -37,7 +37,7 @@ static void explain(void)
fprintf
(
stderr
,
"
\n
NOTE: 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
;
...
...
tc/f_u32.c
View file @
d1f28cf1
...
...
@@ -45,7 +45,7 @@ static void explain(void)
fprintf
(
stderr
,
"
\n
NOTE: 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 @@ int get_u32_handle(__u32 *handle, const char *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
);
...
...
@@ -194,7 +194,7 @@ static int pack_key8(struct tc_u32_sel *sel, __u32 key, __u32 mask, int off, int
}
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
;
...
...
tc/m_action.c
View file @
d1f28cf1
...
...
@@ -35,7 +35,7 @@ int gact_ld = 0 ; //fuckin backward compatibility
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 @@ static int parse_noaopt(struct action_util *au, int *argc_p, char ***argv_p, int
return
-
1
;
}
struct
action_util
*
get_action_kind
(
char
*
str
)
st
atic
st
ruct
action_util
*
get_action_kind
(
char
*
str
)
{
static
void
*
aBODY
;
void
*
dlh
;
...
...
@@ -138,7 +138,7 @@ noexist:
return
a
;
}
int
static
int
new_cmd
(
char
**
argv
)
{
if
((
matches
(
*
argv
,
"change"
)
==
0
)
||
...
...
@@ -241,7 +241,7 @@ bad_val:
return
-
1
;
}
int
static
int
tc_print_one_action
(
FILE
*
f
,
struct
rtattr
*
arg
)
{
...
...
@@ -355,7 +355,7 @@ int print_action(const struct sockaddr_nl *who,
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 @@ bad_val:
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 @@ int tc_action_modify(int cmd, unsigned flags, int *argc_p, char ***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
];
...
...
tc/m_estimator.c
View file @
d1f28cf1
...
...
@@ -22,6 +22,7 @@
#include "utils.h"
#include "tc_util.h"
#include "tc_common.h"
static
void
est_help
(
void
);
...
...
@@ -31,7 +32,6 @@ 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
)
...
...
tc/m_gact.c
View file @
d1f28cf1
...
...
@@ -68,7 +68,7 @@ usage(void)
exit
(
-
1
);
}
int
static
int
get_act
(
char
***
argv_p
)
{
char
**
argv
=
*
argv_p
;
...
...
@@ -89,8 +89,9 @@ get_act(char ***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
;
...
...
@@ -202,7 +203,7 @@ parse_gact(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struc
return
0
;
}
int
static
int
print_gact
(
struct
action_util
*
au
,
FILE
*
f
,
struct
rtattr
*
arg
)
{
SPRINT_BUF
(
b1
);
...
...
tc/m_mirred.c
View file @
d1f28cf1
...
...
@@ -45,7 +45,7 @@ usage(void)
exit
(
-
1
);
}
char
*
mirred_n2a
(
int
action
)
static
const
char
*
mirred_n2a
(
int
action
)
{
switch
(
action
)
{
case
TCA_EGRESS_REDIR
:
...
...
@@ -61,8 +61,9 @@ char *mirred_n2a(int action)
}
}
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 @@ parse_egress(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, str
}
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 @@ parse_mirred(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, str
}
int
static
int
print_mirred
(
struct
action_util
*
au
,
FILE
*
f
,
struct
rtattr
*
arg
)
{
struct
tc_mirred
*
p
;
...
...
tc/m_pedit.c
View file @
d1f28cf1
...
...
@@ -73,8 +73,7 @@ pedit_parse_nopopt (int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct
}
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 @@ done:
return
res
;
}
int
static
int
parse_munge
(
int
*
argc_p
,
char
***
argv_p
,
struct
tc_pedit_sel
*
sel
)
{
struct
tc_pedit_key
tkey
;
...
...
tc/m_police.c
View file @
d1f28cf1
...
...
@@ -50,7 +50,7 @@ static void explain1(char *arg)
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 @@ char *police_action_n2a(int action, char *buf, int len)
}
}
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 police_action_a2n(char *arg, int *result)
}
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
,
'/'
);
...
...
tc/m_xt.c
View file @
d1f28cf1
...
...
@@ -76,7 +76,7 @@ static struct xtables_globals tcipt_globals = {
/*
* 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 @@ 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"
);
...
...
tc/q_mqprio.c
View file @
d1f28cf1
...
...
@@ -104,7 +104,7 @@ static int mqprio_parse_opt(struct qdisc_util *qu, int argc,
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
;
...
...
tc/q_multiq.c
View file @
d1f28cf1
...
...
@@ -61,7 +61,7 @@ static int multiq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
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
;
...
...
tc/q_netem.c
View file @
d1f28cf1
...
...
@@ -87,12 +87,12 @@ static int get_percent(__u32 *percent, const char *str)
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
;
...
...
tc/q_rr.c
View file @
d1f28cf1
...
...
@@ -88,7 +88,7 @@ static int rr_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlm
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
;
...
...
tc/tc_class.c
View file @
d1f28cf1
...
...
@@ -40,7 +40,7 @@ static void usage(void)
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 print_class(const struct sockaddr_nl *who,
}
int
tc_class_list
(
int
argc
,
char
**
argv
)
static
int
tc_class_list
(
int
argc
,
char
**
argv
)
{
struct
tcmsg
t
;
char
d
[
16
];
...
...
tc/tc_core.c
View file @
d1f28cf1
...
...
@@ -76,7 +76,7 @@ unsigned tc_calc_xmitsize(unsigned rate, unsigned ticks)
* (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 @@ unsigned tc_align_to_atm(unsigned size)
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 @@ again:
return
0
;
}
int
tc_core_init
()
int
tc_core_init
(
void
)
{
FILE
*
fp
;
__u32
clock_res
;
...
...
tc/tc_filter.c
View file @
d1f28cf1
...
...
@@ -45,7 +45,7 @@ static void usage(void)
}
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 print_filter(const struct sockaddr_nl *who,
}
int
tc_filter_list
(
int
argc
,
char
**
argv
)
static
int
tc_filter_list
(
int
argc
,
char
**
argv
)
{
struct
tcmsg
t
;
char
d
[
16
];
...
...
tc/tc_monitor.c
View file @
d1f28cf1
...
...
@@ -35,7 +35,8 @@ static void usage(void)
}
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
;
...
...
tc/tc_qdisc.c
View file @
d1f28cf1
...
...
@@ -44,7 +44,7 @@ static int usage(void)
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 print_qdisc(const struct sockaddr_nl *who,
}
int
tc_qdisc_list
(
int
argc
,
char
**
argv
)
static
int
tc_qdisc_list
(
int
argc
,
char
**
argv
)
{
struct
tcmsg
t
;
char
d
[
16
];
...
...
tc/tc_util.c
View file @
d1f28cf1
...
...
@@ -167,35 +167,6 @@ int get_rate(unsigned *rate, const char *str)
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
;
...
...
tc/tc_util.h
View file @
d1f28cf1
...
...
@@ -97,5 +97,6 @@ extern int tc_print_action(FILE *f, const struct rtattr *tb);
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment